:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #18202f;
  --muted: #687385;
  --line: #dce2ea;
  --soft: #f8fafc;
  --blue: #2457a6;
  --blue-soft: #eef4ff;
  --teal: #147f79;
  --teal-soft: #edf9f7;
  --orange: #a66a16;
  --orange-soft: #fff6e7;
  --red: #c83b3b;
  --green: #128254;
  --amber: #9a6400;
  --shadow: 0 10px 24px rgba(24, 32, 47, 0.06);
}

/* ========================================================================== */
/* Moonlit Avalon — IFELF 2026 visual system                                  */
/* ========================================================================== */

:root {
  color-scheme: dark;
  --bg: #050a14;
  --panel: #0b1422;
  --ink: #eef0ed;
  --muted: #9b94bd;
  --line: #34445b;
  --soft: #101b2b;
  --blue: #78e6ba;
  --teal: #78e6ba;
  --orange: #d4b66f;
  --green: #78e6ba;
  --amber: #d4b66f;
  --red: #ef8fa5;
  --shadow: none;
  --avalon-ink: #050a14;
  --avalon-navy: #091426;
  --avalon-lapis: #14284c;
  --avalon-pearl: #eef0ed;
  --avalon-mist: #a49acb;
  --avalon-mint: #78e6ba;
  --avalon-gold: #d4b66f;
  --avalon-line: #35465e;
  --display-font: "STSong", "Songti SC", "SimSun", Georgia, serif;
  --ui-font: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}

html {
  background: var(--avalon-ink);
  scrollbar-color: #536681 #070d18;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--avalon-pearl);
  background:
    radial-gradient(circle at 78% -12%, rgba(89, 119, 153, 0.18), transparent 38%),
    linear-gradient(135deg, #08101c 0%, #050a14 58%, #090f1a 100%);
  font-family: var(--ui-font);
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--avalon-mint);
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: clamp(310px, 24.8vw, 382px) minmax(0, 1fr);
  background: var(--avalon-ink);
}

.platform-sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  align-content: start;
  color: var(--avalon-pearl);
  background:
    radial-gradient(circle at 27% 14%, rgba(60, 101, 137, 0.16), transparent 24%),
    linear-gradient(155deg, #050d19 0%, #030812 66%, #080d17 100%);
  border-right: 1px solid rgba(212, 182, 111, 0.6);
  box-shadow: 16px 0 46px rgba(0, 0, 0, 0.36);
}

.platform-sidebar::before,
.platform-sidebar::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
}

.platform-sidebar::before {
  inset: 0;
  opacity: 0.23;
  background:
    radial-gradient(ellipse at 5% 27%, transparent 0 30%, rgba(142, 183, 174, 0.2) 31% 32%, transparent 33%),
    repeating-linear-gradient(124deg, transparent 0 38px, rgba(151, 177, 184, 0.1) 39px 40px, transparent 41px 78px);
  mask-image: linear-gradient(to bottom, #000 2%, transparent 61%);
}

.platform-sidebar::after {
  width: 430px;
  height: 250px;
  left: -120px;
  bottom: 84px;
  opacity: 0.22;
  border: 1px solid rgba(120, 230, 186, 0.36);
  border-radius: 50%;
  transform: rotate(-14deg);
  box-shadow:
    52px -38px 0 -50px rgba(212, 182, 111, 0.8),
    100px -62px 0 -96px rgba(120, 230, 186, 0.9);
}

.sidebar-brand {
  padding: 46px 44px 38px;
  display: grid;
  gap: 7px;
}

.sidebar-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  width: fit-content;
  color: var(--avalon-pearl);
  font-family: var(--display-font);
  font-size: clamp(34px, 3vw, 47px);
  font-weight: 700;
  letter-spacing: 0.22em;
  line-height: 1;
  text-shadow: 0 0 24px rgba(177, 224, 213, 0.1);
}

.sidebar-wordmark::after {
  content: "";
  width: 13px;
  height: 13px;
  margin-left: -10px;
  background: linear-gradient(135deg, var(--avalon-mint) 0 48%, var(--avalon-gold) 49% 100%);
  clip-path: polygon(0 46%, 100% 0, 53% 100%);
  filter: drop-shadow(0 0 8px rgba(120, 230, 186, 0.35));
}

.sidebar-subtitle {
  color: rgba(238, 240, 237, 0.68);
  font-family: var(--display-font);
  font-size: 14px;
  letter-spacing: 0.52em;
}

.sidebar-overview {
  width: calc(100% - 88px);
  margin: 0 44px 28px;
  padding: 0 0 24px;
  border: 0;
  border-bottom: 1px solid rgba(83, 103, 130, 0.62);
  color: var(--avalon-pearl);
  background: transparent;
  text-align: left;
  font-family: var(--display-font);
  font-size: 22px;
  letter-spacing: 0.16em;
  cursor: pointer;
  transition: color 180ms ease, padding-left 180ms ease;
}

.sidebar-overview:hover {
  padding-left: 6px;
  color: var(--avalon-mint);
}

.side-nav {
  display: grid;
  align-content: start;
  gap: 0;
}

.side-nav button {
  position: relative;
  width: 100%;
  min-height: 118px;
  display: grid;
  grid-template-columns: 64px 52px minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  padding: 18px 34px 18px 44px;
  border: 0;
  border-radius: 0;
  color: rgba(238, 240, 237, 0.82);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}

.side-nav button::after {
  content: "";
  position: absolute;
  inset: 20px 0 20px auto;
  width: 3px;
  background: transparent;
  transition: background 180ms ease, box-shadow 180ms ease;
}

.side-nav button:hover:not(:disabled) {
  color: var(--avalon-mint);
  background: rgba(255, 255, 255, 0.035);
}

.side-nav button.active {
  color: #07101d;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.98) 0%, rgba(238, 240, 237, 0.96) 76%, rgba(205, 221, 219, 0.9) 100%);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.23);
}

.side-nav button.active::after {
  background: var(--avalon-mint);
  box-shadow: 0 0 18px rgba(120, 230, 186, 0.8);
}

.side-nav button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.nav-index {
  font-family: Georgia, var(--display-font);
  font-size: 52px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.05em;
}

.nav-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.45;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.nav-copy strong {
  font-family: var(--display-font);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: 0.16em;
  white-space: nowrap;
}

.nav-copy small {
  overflow: hidden;
  color: currentColor;
  font-family: Georgia, serif;
  font-size: 11px;
  letter-spacing: 0.28em;
  opacity: 0.58;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer {
  margin: 16px 44px 0;
  padding: 24px 0 0;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  border-top: 1px solid rgba(83, 103, 130, 0.62);
}

.sidebar-user {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.sidebar-user strong {
  overflow: hidden;
  font-size: 14px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user small {
  color: rgba(238, 240, 237, 0.45);
  font-size: 10px;
  letter-spacing: 0.18em;
}

.sidebar-utilities {
  display: flex;
  gap: 14px;
}

.sidebar-utilities button {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  color: rgba(238, 240, 237, 0.62);
  background: transparent;
  cursor: pointer;
  transition: color 160ms ease, transform 160ms ease;
}

.sidebar-utilities button:hover:not(:disabled) {
  color: var(--avalon-mint);
  transform: translateY(-2px);
}

.sidebar-utilities button:disabled {
  opacity: 0.33;
}

.sidebar-utilities svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-frame {
  position: relative;
  min-width: 0;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 4%, rgba(115, 145, 170, 0.14), transparent 32%),
    linear-gradient(145deg, #0b1421 0%, #080f1b 46%, #040914 100%);
}

.app-header,
.app-status-bar {
  position: relative;
  z-index: 20;
}

.app-shell[data-active-view="home"] .app-header,
.app-shell[data-active-view="home"] .app-status-bar {
  display: none;
}

.app-header {
  margin: 22px 30px 0;
  padding: 18px 22px;
  border: 1px solid rgba(83, 103, 130, 0.58);
  border-radius: 4px;
  background: rgba(7, 14, 25, 0.84);
  box-shadow: none;
  backdrop-filter: blur(18px);
}

.app-header h1,
.workspace-head h2,
.workspace-head h3 {
  color: var(--avalon-pearl);
  font-family: var(--display-font);
}

.eyebrow {
  color: var(--avalon-mint);
  letter-spacing: 0.24em;
}

.muted,
.small,
.app-status-bar {
  color: var(--avalon-mist);
}

.app-status-bar {
  margin: 0 30px;
  background: rgba(4, 9, 18, 0.88);
  border-color: rgba(83, 103, 130, 0.48);
}

.app-frame > main {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.app-shell:not([data-active-view="home"]) .app-frame > main {
  padding: 24px 30px 54px;
}

.platform-home {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  padding: 0 52px 34px;
  color: var(--avalon-pearl);
  isolation: isolate;
}

.platform-home::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 0;
  background:
    linear-gradient(116deg, rgba(21, 38, 58, 0.26), transparent 35%),
    radial-gradient(circle at 85% 7%, rgba(122, 151, 173, 0.13), transparent 29%),
    linear-gradient(145deg, #101a28 0%, #0b1320 44%, #070d17 100%);
}

.platform-home::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34%;
  opacity: 0.46;
  background:
    repeating-linear-gradient(176deg, transparent 0 14px, rgba(145, 181, 186, 0.1) 15px 16px, transparent 17px 31px),
    linear-gradient(to bottom, transparent, rgba(4, 15, 25, 0.75));
  mask-image: linear-gradient(to bottom, transparent, #000 32%);
}

.platform-hero {
  position: relative;
  min-height: 302px;
  display: grid;
  grid-template-columns: minmax(470px, 0.95fr) minmax(370px, 1.05fr);
  align-items: center;
  gap: 18px;
  margin: 0;
  padding: 49px 10px 25px 32px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.hero-copy {
  position: relative;
  z-index: 4;
  align-self: center;
  display: grid;
  justify-items: start;
  gap: 0;
}

.platform-hero h2 {
  margin: 0;
  color: var(--avalon-pearl);
  font-family: var(--display-font);
  font-size: clamp(49px, 4.35vw, 69px);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: 0.08em;
  text-shadow: 0 10px 34px rgba(0, 0, 0, 0.28);
}

.platform-hero p {
  max-width: 640px;
  margin: 20px 0 0;
  color: var(--avalon-mist);
  font-family: var(--display-font);
  font-size: clamp(17px, 1.52vw, 23px);
  line-height: 1.65;
  letter-spacing: 0.08em;
}

.start-create-link {
  position: relative;
  margin: 34px 0 0;
  padding: 0 32px 8px 0;
  border: 0;
  border-bottom: 1px solid rgba(120, 230, 186, 0.78);
  border-radius: 0;
  color: var(--avalon-mint);
  background: transparent;
  box-shadow: none;
  font-family: var(--display-font);
  font-size: 20px;
  letter-spacing: 0.2em;
  cursor: pointer;
  transition: color 180ms ease, padding-right 180ms ease, text-shadow 180ms ease;
}

.start-create-link::after {
  content: "›";
  position: absolute;
  right: 4px;
  top: -3px;
  font-family: Georgia, serif;
  font-size: 27px;
  line-height: 1;
}

.start-create-link:hover {
  padding-right: 42px;
  color: #b4f8d9;
  background: transparent;
  box-shadow: none;
  text-shadow: 0 0 16px rgba(120, 230, 186, 0.42);
}

.avalon-hero-art {
  position: relative;
  align-self: stretch;
  min-height: 260px;
  pointer-events: none;
}

.avalon-hero-art svg {
  position: absolute;
  width: min(760px, 62vw);
  height: auto;
  right: -76px;
  top: -92px;
  overflow: visible;
  filter: drop-shadow(0 18px 38px rgba(0, 0, 0, 0.34));
}

.moon-orbit {
  fill: none;
  stroke: rgba(238, 240, 237, 0.83);
  stroke-width: 3.2;
}

.moon-orbit-soft {
  fill: none;
  stroke: rgba(120, 230, 186, 0.28);
  stroke-width: 1;
}

.moon-cut {
  fill: #0b1421;
}

.moon-dot {
  fill: var(--avalon-gold);
  filter: drop-shadow(0 0 6px rgba(212, 182, 111, 0.58));
}

.flower-stem,
.flower-bell,
.flower-vein {
  fill: none;
  stroke: rgba(207, 221, 218, 0.77);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flower-stem { stroke-width: 1.65; }
.flower-bell { stroke-width: 1.3; fill: rgba(125, 174, 172, 0.08); }
.flower-vein { stroke-width: 0.75; opacity: 0.72; }
.flower-glow { fill: rgba(120, 230, 186, 0.78); }

.avalon-tools {
  position: relative;
  z-index: 3;
}

.avalon-section-title {
  position: relative;
  margin: 0 0 20px;
  padding-left: 33px;
  color: var(--avalon-pearl);
  font-family: var(--display-font);
  font-size: 29px;
  font-weight: 500;
  letter-spacing: 0.2em;
}

.avalon-section-title::before {
  content: "✦";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--avalon-gold);
  font-family: Georgia, serif;
  font-size: 23px;
  text-shadow: 0 0 16px rgba(212, 182, 111, 0.35);
}

.avalon-tool-list {
  overflow: hidden;
  border-top: 1px solid var(--avalon-line);
  border-bottom: 1px solid var(--avalon-line);
}

.avalon-tool-row {
  position: relative;
  min-height: 128px;
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr) auto;
  align-items: center;
  gap: 26px;
  padding: 19px 30px 19px 23px;
  border-bottom: 1px solid rgba(53, 70, 94, 0.9);
  background: transparent;
  transition: background 180ms ease;
}

.avalon-tool-row:last-child {
  border-bottom: 0;
}

.avalon-tool-row::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: transparent;
  box-shadow: none;
  transition: background 180ms ease, box-shadow 180ms ease;
}

.avalon-tool-row.is-current,
.avalon-tool-row:hover {
  background:
    linear-gradient(90deg, rgba(27, 51, 91, 0.98) 0%, rgba(17, 36, 67, 0.94) 70%, rgba(13, 27, 48, 0.8) 100%);
}

.avalon-tool-row.is-current::before,
.avalon-tool-row:hover::before {
  background: var(--avalon-mint);
  box-shadow: 0 0 20px rgba(120, 230, 186, 0.58);
}

.tool-emblem {
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  justify-self: center;
  color: var(--avalon-gold);
  border: 1px solid rgba(212, 182, 111, 0.72);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 182, 111, 0.08), transparent 70%);
  box-shadow: inset 0 0 0 5px rgba(212, 182, 111, 0.025);
}

.tool-emblem svg {
  width: 57%;
  height: 57%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-emblem svg .fill-gold {
  fill: currentColor;
  stroke: none;
}

.tool-copy {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.tool-copy h3 {
  margin: 0;
  color: var(--avalon-pearl);
  font-family: var(--display-font);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: 0.13em;
}

.tool-copy p {
  margin: 0;
  color: rgba(238, 240, 237, 0.64);
  font-size: 15px;
  letter-spacing: 0.09em;
}

.tool-copy span {
  color: var(--avalon-mist);
  font-family: var(--display-font);
  font-size: 14px;
  letter-spacing: 0.08em;
}

.tool-text-action {
  position: relative;
  min-width: 142px;
  padding: 10px 26px 10px 0;
  border: 0;
  border-radius: 0;
  color: var(--avalon-mint);
  background: transparent;
  box-shadow: none;
  font-family: var(--display-font);
  font-size: 20px;
  letter-spacing: 0.13em;
  text-align: right;
  cursor: pointer;
  transition: color 170ms ease, transform 170ms ease, text-shadow 170ms ease;
}

.tool-text-action::after {
  content: "›";
  position: absolute;
  right: 2px;
  top: 6px;
  font-family: Georgia, serif;
  font-size: 27px;
}

.tool-text-action:hover {
  color: #b4f8d9;
  background: transparent;
  box-shadow: none;
  transform: translateX(6px);
  text-shadow: 0 0 14px rgba(120, 230, 186, 0.35);
}

.avalon-home-bottom {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 22px;
  border-top: 1px solid rgba(53, 70, 94, 0.88);
}

.avalon-bottom-block {
  min-width: 0;
  padding: 24px 30px 14px 18px;
}

.avalon-bottom-block + .avalon-bottom-block {
  padding-left: 44px;
  border-left: 1px solid rgba(53, 70, 94, 0.88);
}

.avalon-bottom-label {
  margin: 0 0 18px;
  color: rgba(238, 240, 237, 0.7);
  font-family: var(--display-font);
  font-size: 15px;
  letter-spacing: 0.18em;
}

.avalon-bottom-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px;
}

.avalon-bottom-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.avalon-bottom-copy strong {
  overflow: hidden;
  color: var(--avalon-pearl);
  font-family: var(--display-font);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avalon-bottom-copy span {
  color: var(--avalon-mist);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.avalon-bottom-link {
  padding: 5px 25px 4px 0;
  border: 0;
  border-radius: 0;
  color: var(--avalon-mint);
  background: transparent;
  box-shadow: none;
  font-family: var(--display-font);
  font-size: 16px;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: color 170ms ease, transform 170ms ease;
}

.avalon-bottom-link:hover {
  color: #b4f8d9;
  background: transparent;
  box-shadow: none;
  transform: translateX(4px);
}

/* Keep the existing editors functional while bringing them into the same world. */
.panel,
.workspace-head,
.design-target-panel,
.design-editor-shell,
.design-preview-section,
.design-doc-cover,
.design-entry-card,
.learning-topic-card,
.learning-step-card,
.learning-note,
.learning-summary,
.model-result-card,
.model-stat-card,
.tool-card,
.queue-card,
.status-card {
  color: var(--avalon-pearl);
  background: rgba(10, 20, 35, 0.9);
  border-color: rgba(65, 86, 113, 0.82);
  box-shadow: none;
}

.panel h2,
.panel h3,
.panel h4,
.design-entry-card h3,
.learning-topic-card h3,
.learning-step-card h3 {
  color: var(--avalon-pearl);
}

input,
textarea,
select {
  color: var(--avalon-pearl);
  background: #08121f;
  border-color: rgba(72, 94, 122, 0.9);
}

input::placeholder,
textarea::placeholder {
  color: rgba(164, 154, 203, 0.56);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--avalon-mint);
  box-shadow: 0 0 0 3px rgba(120, 230, 186, 0.1);
}

button.primary,
a.primary,
.link-button.primary {
  color: #07111c;
  background: var(--avalon-mint);
  border-color: var(--avalon-mint);
}

button.secondary,
a.secondary,
.link-button,
.ghost-button {
  color: var(--avalon-pearl);
  background: rgba(18, 34, 56, 0.9);
  border-color: rgba(73, 95, 123, 0.9);
  box-shadow: none;
}

button.primary:hover,
a.primary:hover,
.link-button.primary:hover {
  background: #9cf1cf;
  border-color: #9cf1cf;
}

button.secondary:hover,
a.secondary:hover,
.link-button:hover,
.ghost-button:hover {
  color: var(--avalon-mint);
  background: #14243a;
  border-color: rgba(120, 230, 186, 0.48);
}

.table-wrap,
table,
th,
td {
  border-color: rgba(65, 86, 113, 0.72);
}

th {
  color: var(--avalon-mist);
  background: rgba(10, 22, 38, 0.96);
}

td,
code,
pre {
  color: var(--avalon-pearl);
}

pre,
code {
  background: #050c17;
}

.login-screen {
  min-height: 100vh;
  background:
    radial-gradient(circle at 72% 14%, rgba(120, 230, 186, 0.1), transparent 22%),
    radial-gradient(circle at 20% 80%, rgba(164, 154, 203, 0.12), transparent 30%),
    linear-gradient(145deg, #0b1727, #030811 65%);
}

.login-screen::before {
  opacity: 0.18;
  background: repeating-linear-gradient(128deg, transparent 0 44px, rgba(212, 182, 111, 0.13) 45px 46px, transparent 47px 88px);
}

.login-panel {
  color: var(--avalon-pearl);
  background: rgba(6, 14, 26, 0.86);
  border: 1px solid rgba(212, 182, 111, 0.45);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(24px);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 292px minmax(0, 1fr);
  }

  .sidebar-brand {
    padding-inline: 34px;
  }

  .sidebar-overview {
    width: calc(100% - 68px);
    margin-inline: 34px;
  }

  .side-nav button {
    grid-template-columns: 54px 42px minmax(0, 1fr);
    gap: 14px;
    min-height: 108px;
    padding-inline: 32px 24px;
  }

  .nav-index { font-size: 45px; }
  .nav-icon { width: 39px; height: 39px; }
  .nav-copy strong { font-size: 21px; }
  .sidebar-footer { margin-inline: 34px; }

  .platform-home {
    padding-inline: 38px;
  }

  .platform-hero {
    grid-template-columns: minmax(410px, 1fr) minmax(280px, 0.8fr);
    padding-left: 18px;
  }

  .avalon-tool-row {
    grid-template-columns: 104px minmax(0, 1fr) auto;
    gap: 18px;
  }

  .tool-emblem {
    width: 76px;
    height: 76px;
  }
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .platform-sidebar {
    position: relative;
    height: auto;
    min-height: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    border-right: 0;
    border-bottom: 1px solid rgba(212, 182, 111, 0.56);
  }

  .sidebar-brand {
    padding: 23px 26px 17px;
  }

  .sidebar-wordmark {
    font-size: 29px;
  }

  .sidebar-subtitle {
    font-size: 10px;
  }

  .sidebar-overview {
    align-self: center;
    justify-self: end;
    width: auto;
    margin: 0 26px 0 0;
    padding: 8px 0;
    border-bottom: 0;
    font-size: 16px;
  }

  .side-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid rgba(53, 70, 94, 0.66);
  }

  .side-nav button {
    min-height: 82px;
    grid-template-columns: 31px minmax(0, 1fr);
    gap: 10px;
    padding: 12px 14px;
    border-right: 1px solid rgba(53, 70, 94, 0.45);
  }

  .side-nav button:last-child {
    border-right: 0;
  }

  .nav-index { font-size: 26px; }
  .nav-icon { display: none; }
  .nav-copy strong { font-size: 15px; letter-spacing: 0.08em; }
  .nav-copy small { font-size: 8px; }
  .sidebar-footer { display: none; }

  .platform-home {
    min-height: auto;
  }
}

@media (max-width: 680px) {
  .sidebar-brand {
    padding-left: 18px;
  }

  .sidebar-overview {
    margin-right: 18px;
  }

  .side-nav {
    overflow-x: auto;
    grid-template-columns: repeat(4, minmax(132px, 1fr));
    scrollbar-width: none;
  }

  .side-nav::-webkit-scrollbar { display: none; }

  .platform-home {
    padding: 0 20px 28px;
  }

  .platform-hero {
    min-height: 292px;
    display: block;
    padding: 48px 4px 30px;
    isolation: isolate;
  }

  .platform-hero h2 {
    max-width: 290px;
    font-size: 45px;
  }

  .platform-hero p {
    max-width: 320px;
    font-size: 16px;
  }

  .start-create-link {
    margin-top: 27px;
    font-size: 17px;
  }

  .avalon-hero-art {
    position: absolute;
    z-index: -1;
    inset: 0 -70px 0 auto;
    width: 76%;
    opacity: 0.48;
  }

  .avalon-hero-art svg {
    width: 520px;
    right: -135px;
    top: -55px;
  }

  .avalon-section-title {
    font-size: 23px;
  }

  .avalon-tool-row {
    min-height: 0;
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 15px;
    padding: 22px 8px 20px 12px;
  }

  .tool-emblem {
    width: 62px;
    height: 62px;
  }

  .tool-copy h3 {
    font-size: 21px;
  }

  .tool-copy p {
    font-size: 13px;
    line-height: 1.55;
  }

  .tool-text-action {
    grid-column: 2;
    justify-self: start;
    min-width: 0;
    padding: 3px 25px 3px 0;
    font-size: 16px;
  }

  .tool-text-action::after {
    top: -1px;
    font-size: 22px;
  }

  .avalon-home-bottom {
    grid-template-columns: 1fr;
  }

  .avalon-bottom-block {
    padding: 22px 10px;
  }

  .avalon-bottom-block + .avalon-bottom-block {
    padding-left: 10px;
    border-top: 1px solid rgba(53, 70, 94, 0.88);
    border-left: 0;
  }

  .avalon-bottom-content {
    align-items: center;
  }

  .app-header {
    margin: 14px 14px 0;
  }

  .app-status-bar {
    margin-inline: 14px;
  }

  .app-shell:not([data-active-view="home"]) .app-frame > main {
    padding: 18px 14px 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
}

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, #f8fafc 0%, #eef4ff 100%);
}

.login-panel {
  width: min(440px, 100%);
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 4px;
}

.login-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.login-panel input {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.login-message {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.app-shell {
  min-height: 100vh;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: 0;
}

h2 {
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand p,
.muted,
.section-title span,
small {
  color: var(--muted);
}

.brand p {
  margin-top: 4px;
  font-size: 13px;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark img {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 8px;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.tool-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.tool-nav button {
  height: 34px;
  padding: 0 11px;
}

.tool-nav button.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}

.user-chip {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.controls label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.controls input[type="number"],
.controls input[type="text"] {
  width: 112px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 9px;
  background: #fff;
  color: var(--ink);
}

.controls .wide-control input {
  width: 220px;
}

.check {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.check input {
  width: 15px;
  height: 15px;
}

button,
.link-button {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 13px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  font-weight: 700;
}

button.secondary {
  border-color: #b9c5d3;
  background: var(--soft);
  color: var(--blue);
  font-weight: 700;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

main {
  max-width: 1480px;
  margin: 0 auto;
  padding: 18px 24px 32px;
}

.app-status-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 14px;
}

.status {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  box-shadow: var(--shadow);
}

.runtime-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-pill {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.status-pill.online,
.status-pill.ready {
  color: var(--green);
  background: #edf8f3;
}

.status-pill.offline,
.status-pill.warn {
  color: var(--amber);
  background: #fff8e8;
}

.status-pill.error {
  color: var(--red);
  background: #fff1f1;
}

.status.loading {
  color: var(--blue);
  background: var(--blue-soft);
}

.status.success {
  color: var(--green);
  background: #edf8f3;
}

.status.error {
  color: var(--red);
  background: #fff1f1;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.tool-center {
  margin-bottom: 14px;
}

.tool-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.tool-card {
  min-height: 94px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.tool-card strong,
.tool-card p,
.tool-card span {
  display: block;
}

.tool-card p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.tool-card span {
  margin-top: 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.tool-card.disabled {
  opacity: 0.68;
}

.active-job-box {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: var(--soft);
}

.active-job-box > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.active-job-box strong,
.active-job-box span,
.active-job-box small {
  display: block;
}

.active-job-box span,
.active-job-box small {
  color: var(--muted);
  font-size: 12px;
}

.active-job-box.succeeded {
  background: #edf8f3;
}

.active-job-box.failed {
  background: #fff1f1;
}

.job-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9eef5;
}

.job-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.job-history {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.job-chip {
  height: auto;
  min-height: 42px;
  display: grid;
  gap: 3px;
  justify-items: start;
  border-radius: 8px;
  padding: 7px 10px;
}

.job-chip span {
  color: var(--muted);
  font-size: 11px;
}

.job-chip.succeeded {
  border-color: rgba(18, 130, 84, 0.34);
  background: #edf8f3;
}

.job-chip.failed {
  border-color: rgba(200, 59, 59, 0.36);
  background: #fff1f1;
}

.job-chip.running,
.job-chip.queued {
  border-color: rgba(36, 87, 166, 0.34);
  background: var(--blue-soft);
}

.model-workbench {
  padding-bottom: 18px;
}

.compact-title {
  margin-top: 14px;
}

.section-subtitle {
  min-height: 26px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.model-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.flow-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.flow-step > span {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
}

.flow-step strong,
.flow-step b,
.flow-step small {
  display: block;
}

.flow-step b {
  margin-top: 5px;
  font-size: 22px;
  line-height: 1.15;
  color: var(--ink);
}

.flow-step small {
  margin-top: 6px;
  line-height: 1.35;
}

.model-insight-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 14px;
}

.weight-map,
.theme-map,
.stock-explain-box {
  display: grid;
  gap: 10px;
}

.weight-row,
.theme-summary,
.theme-row,
.stock-detail-panel,
.stock-score-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 11px 12px;
}

.weight-head,
.theme-row div,
.theme-summary {
  display: grid;
  gap: 5px;
}

.weight-head,
.theme-row div {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.weight-head span,
.theme-row span,
.theme-summary span {
  color: var(--blue);
  font-weight: 700;
}

.weight-track,
.factor-break-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9eef5;
}

.weight-track i,
.factor-break-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.weight-row p,
.theme-summary p,
.theme-row p,
.stock-detail-panel p,
.discipline {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.weight-row small,
.theme-row small,
.theme-summary small {
  display: block;
  margin-top: 5px;
  line-height: 1.45;
}

.stock-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.stock-tabs button {
  height: 46px;
  min-width: 116px;
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
  border-radius: 8px;
  padding: 6px 10px;
}

.stock-tabs button strong,
.stock-tabs button span {
  display: block;
  line-height: 1.1;
}

.stock-tabs button span {
  color: var(--muted);
  font-size: 12px;
}

.stock-tabs button.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.stock-explain-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.1fr) minmax(0, 1.05fr);
  gap: 10px;
}

.stock-score-panel {
  display: grid;
  gap: 10px;
  align-content: start;
  background: #ffffff;
}

.stock-score-panel.strong {
  border-color: rgba(200, 59, 59, 0.42);
}

.stock-score-panel.watch {
  border-color: rgba(154, 100, 0, 0.36);
}

.stock-score-panel.weak {
  border-color: rgba(18, 130, 84, 0.32);
}

.stock-score-panel span,
.stock-detail-panel h3,
.metric-tile span,
.plan-grid span,
.intraday-strip span {
  color: var(--muted);
  font-size: 12px;
}

.stock-score-panel strong {
  display: block;
  margin-top: 5px;
  font-size: 26px;
  line-height: 1.15;
}

.stock-score-panel em {
  margin-left: 6px;
  font-size: 14px;
  font-style: normal;
}

.factor-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.factor-chips span {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 12px;
}

.positive-chip {
  background: #fff1f1;
  color: var(--red);
}

.negative-chip {
  background: #edf8f3;
  color: var(--green);
}

.stock-detail-panel h3 {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0;
}

.wide-detail {
  grid-column: 1 / -1;
}

.factor-break-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 74px;
  align-items: center;
  gap: 8px;
  min-height: 31px;
}

.factor-break-label {
  display: grid;
  gap: 2px;
}

.factor-break-label strong,
.factor-break-label span {
  font-size: 12px;
  line-height: 1.1;
}

.factor-break-label span {
  color: var(--muted);
}

.factor-break-track.plus i {
  background: var(--red);
}

.factor-break-track.minus i {
  background: var(--green);
}

.metric-tile-grid,
.plan-grid,
.intraday-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric-tile,
.plan-grid div,
.intraday-strip div {
  min-height: 58px;
  border: 1px solid #e8edf3;
  border-radius: 7px;
  padding: 9px;
  background: #fff;
}

.metric-tile strong,
.plan-grid strong,
.intraday-strip strong {
  display: block;
  margin-top: 5px;
  font-size: 15px;
  line-height: 1.25;
}

.intraday-strip small {
  margin-top: 3px;
}

.branch-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.branch-row {
  min-height: 98px;
  border: 1px solid #e8edf3;
  border-radius: 7px;
  padding: 9px;
  background: #fff;
}

.branch-row strong,
.branch-row p,
.branch-row small {
  display: block;
}

.branch-row p {
  margin-top: 5px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
}

.branch-row small {
  margin-top: 5px;
  line-height: 1.45;
}

.metric-card,
.mini-card,
.panel,
.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 100px;
  padding: 14px;
}

.metric-card span,
.mini-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.metric-card small,
.mini-card small {
  display: block;
  margin-top: 8px;
  line-height: 1.35;
}

.panel {
  padding: 15px;
  margin-bottom: 14px;
}

.hidden {
  display: none !important;
}

.image-panel {
  background: #fff;
}

.report-image-preview {
  display: block;
  width: 100%;
  max-width: 980px;
  max-height: 720px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.section-title {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.wide-table {
  min-width: 1180px;
}

th,
td {
  border-bottom: 1px solid #e8edf3;
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

th {
  color: var(--muted);
  font-weight: 700;
  background: var(--soft);
}

td:first-child,
th:first-child {
  width: 118px;
}

.wide-table td:first-child,
.wide-table th:first-child {
  width: 150px;
}

.wide-table th:nth-child(6),
.wide-table td:nth-child(6) {
  width: 310px;
}

.gto-table {
  min-width: 1460px;
}

.gto-table th:nth-child(2),
.gto-table td:nth-child(2) {
  width: 330px;
}

.gto-table th:nth-child(6),
.gto-table td:nth-child(6) {
  width: 330px;
}

.holdings-table {
  min-width: 1440px;
}

.allocation-table {
  min-width: 1260px;
}

.holdings-table th:nth-child(2),
.holdings-table td:nth-child(2) {
  width: 210px;
}

.holdings-table th:nth-child(4),
.holdings-table td:nth-child(4),
.holdings-table th:nth-child(5),
.holdings-table td:nth-child(5),
.holdings-table th:nth-child(6),
.holdings-table td:nth-child(6) {
  width: 260px;
}

.positive {
  color: var(--red);
  font-weight: 700;
}

.negative {
  color: var(--green);
  font-weight: 700;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 126px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #eef2f6;
}

.segmented button {
  height: 34px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.segmented button.active {
  background: #fff;
  color: var(--blue);
  font-weight: 700;
}

#allocationMeta {
  min-height: 26px;
  font-size: 13px;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.mini-card {
  min-height: 84px;
  padding: 12px;
}

.mini-card strong {
  display: block;
  margin-top: 7px;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
}

.news-list,
.factor-grid,
.backtest-box {
  display: grid;
  gap: 10px;
}

.news-item,
.factor-card,
.backtest-card,
.empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 11px 12px;
}

.news-item a,
.news-item strong {
  display: block;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  line-height: 1.45;
}

.news-item p,
.factor-card p,
.backtest-card p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 7px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 6px;
  padding: 2px 7px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
}

.tag.score {
  background: #fff4db;
  color: var(--amber);
}

.tag.danger {
  margin-left: 4px;
  background: #fff1f1;
  color: var(--red);
}

.factor-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  margin-bottom: 12px;
}

.style-card {
  grid-column: 1 / -1;
}

.factor-card div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.factor-card div span {
  color: var(--blue);
  font-weight: 700;
}

.notice {
  padding: 13px 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.site-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 52px;
  padding: 16px 24px 22px;
  background: #eef2f6;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--blue);
  text-decoration: underline;
}

@media (max-width: 1180px) {
  .summary-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .model-flow {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .model-insight-layout,
  .stock-explain-grid {
    grid-template-columns: 1fr;
  }

  .branch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-header {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }

  .app-status-bar {
    grid-template-columns: 1fr;
  }

  .runtime-status {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .controls {
    justify-content: flex-start;
  }

  .tool-nav {
    margin-left: 0;
    flex-wrap: wrap;
  }

  .summary-grid,
  .mini-grid,
  .model-flow,
  .metric-tile-grid,
  .plan-grid,
  .intraday-strip,
  .branch-grid {
    grid-template-columns: 1fr;
  }

  .factor-break-row {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .factor-break-row small {
    grid-column: 2;
  }

  main {
    padding: 14px;
  }
}

@media (max-width: 560px) {
  .controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .controls label,
  .controls input[type="number"],
  .controls input[type="text"],
  .controls button,
  .link-button,
  .user-chip {
    width: 100%;
  }

  .primary,
  .secondary,
  .link-button,
  .user-chip {
    grid-column: span 2;
  }

  .runtime-status {
    grid-template-columns: 1fr;
  }
}

/* Platform shell */
body {
  background: #eef2f6;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.platform-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 20px;
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  background: #ffffff;
}

.sidebar-brand {
  min-height: 54px;
  padding: 6px 8px;
}

.sidebar-brand strong,
.sidebar-brand span {
  display: block;
}

.sidebar-brand strong {
  font-size: 17px;
  line-height: 1.2;
}

.sidebar-brand span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.side-nav {
  display: grid;
  align-content: start;
  gap: 6px;
}

.side-nav button {
  width: 100%;
  height: 42px;
  justify-content: flex-start;
  gap: 10px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.side-nav button.active {
  border-color: #cbd8eb;
  background: var(--blue-soft);
  color: var(--blue);
}

.side-nav button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #f0f3f7;
}

.side-nav button.active .nav-icon {
  background: #ffffff;
}

.sidebar-footer {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--soft);
}

.sidebar-footer span {
  color: var(--muted);
  font-size: 12px;
}

.sidebar-footer strong {
  font-size: 13px;
}

.app-frame {
  min-width: 0;
}

.app-header {
  min-height: 72px;
  padding: 14px 24px;
}

.app-header .brand {
  min-width: 210px;
}

.app-header .brand h1 {
  font-size: 20px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.tool-nav {
  flex: 1;
  justify-content: center;
  margin-left: 0;
}

.tool-nav button.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

main {
  max-width: 1560px;
  padding: 18px 24px 36px;
}

.platform-home,
.quant-workspace {
  display: grid;
  gap: 14px;
}

.quant-workspace > *,
.platform-home > * {
  min-width: 0;
}

.platform-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 16px;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(36, 87, 166, 0.08), rgba(18, 130, 84, 0.05)),
    #ffffff;
  box-shadow: var(--shadow);
}

.hero-copy {
  display: grid;
  align-content: center;
  gap: 14px;
  max-width: 720px;
}

.hero-copy h2 {
  font-size: 30px;
  line-height: 1.2;
}

.hero-copy p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-console {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-content: center;
}

.hero-console div {
  min-height: 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid #dce5ef;
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.82);
}

.hero-console span,
.ops-item span,
.tool-card-head span {
  color: var(--muted);
  font-size: 12px;
}

.hero-console strong {
  color: var(--ink);
  font-size: 15px;
}

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
  gap: 14px;
  align-items: start;
}

.ops-rail {
  display: grid;
  gap: 14px;
}

.ops-list {
  display: grid;
  gap: 8px;
}

.ops-item {
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--soft);
}

.ops-item strong {
  font-size: 12px;
}

.ops-item.ready strong {
  color: var(--green);
}

.ops-item.watch strong {
  color: var(--amber);
}

.tool-cards {
  display: grid;
  gap: 14px;
}

.tool-category {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.tool-category-head {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tool-category-head h3,
.tool-category-head p {
  margin: 0;
}

.tool-category-head h3 {
  font-size: 16px;
  line-height: 1.3;
}

.tool-category-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.tool-category-head > span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 0 8px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.tool-category-investment {
  border-left: 4px solid var(--blue);
}

.tool-category-game {
  border-left: 4px solid var(--teal);
}

.tool-category-learning {
  border-left: 4px solid #6b7b2d;
}

.tool-category-resource {
  border-left: 4px solid var(--orange);
}

.tool-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
}

.tool-card {
  position: relative;
  min-height: 214px;
  display: grid;
  grid-template-rows: auto auto minmax(48px, 1fr) auto auto;
  gap: 10px;
  padding: 16px;
  background: #ffffff;
  cursor: pointer;
}

.tool-card.investment,
.tool-card.live {
  border-color: rgba(36, 87, 166, 0.28);
}

.tool-card.game {
  border-color: rgba(20, 127, 121, 0.28);
  background: linear-gradient(180deg, #ffffff 0%, var(--teal-soft) 100%);
}

.tool-card.resource {
  border-color: rgba(166, 106, 22, 0.28);
  background: linear-gradient(180deg, #ffffff 0%, var(--orange-soft) 100%);
}

.tool-card.program {
  border-color: rgba(62, 92, 142, 0.28);
  background: linear-gradient(180deg, #ffffff 0%, #edf4fb 100%);
}

.tool-card.art {
  border-color: rgba(139, 92, 43, 0.28);
  background: linear-gradient(180deg, #ffffff 0%, #f8f1e8 100%);
}

.tool-card.active,
.tool-card:hover {
  border-color: var(--blue);
  box-shadow: 0 12px 28px rgba(36, 87, 166, 0.12);
}

.tool-card.game:hover {
  border-color: var(--teal);
  box-shadow: 0 12px 28px rgba(20, 127, 121, 0.12);
}

.tool-card.resource:hover {
  border-color: var(--orange);
  box-shadow: 0 12px 28px rgba(166, 106, 22, 0.12);
}

.tool-card.program:hover {
  border-color: #3e5c8e;
  box-shadow: 0 12px 28px rgba(62, 92, 142, 0.12);
}

.tool-card.art:hover {
  border-color: #8b5c2b;
  box-shadow: 0 12px 28px rgba(139, 92, 43, 0.12);
}

.tool-card.disabled {
  cursor: not-allowed;
  opacity: 0.78;
}

.tool-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tool-card-head span,
.tool-card-head b {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin: 0;
  border-radius: 6px;
  padding: 0 8px;
  background: var(--soft);
}

.tool-card-head b {
  color: var(--green);
  font-size: 12px;
}

.tool-card.pending .tool-card-head b {
  color: var(--amber);
}

.tool-card.game .tool-card-head b {
  color: var(--teal);
}

.tool-card.resource .tool-card-head b {
  color: var(--orange);
}

.tool-card.program .tool-card-head b {
  color: #3e5c8e;
}

.tool-card.art .tool-card-head b {
  color: #8b5c2b;
}

.tool-card > strong {
  font-size: 20px;
  line-height: 1.25;
}

.tool-card p {
  min-height: 44px;
  font-size: 13px;
}

.tool-capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tool-capabilities span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  margin: 0;
  border: 1px solid #e1e7ef;
  border-radius: 6px;
  padding: 0 7px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tool-card-action {
  width: max-content;
  margin-top: 2px;
}

.home-job-panel {
  margin-bottom: 0;
}

.platform-flow {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 10px;
}

.platform-flow article {
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.platform-flow span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.platform-flow strong,
.platform-flow p {
  display: block;
}

.platform-flow strong {
  margin-top: 8px;
  font-size: 14px;
}

.platform-flow p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.workspace-head {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(220px, 0.55fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.workspace-title {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.workspace-title h2 {
  font-size: 22px;
}

.workspace-title p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.icon-button {
  width: 38px;
  min-width: 38px;
  padding: 0;
  font-size: 24px;
}

.workspace-head .controls {
  width: 100%;
  justify-content: flex-end;
  min-width: 0;
}

.workspace-head .controls label {
  background: transparent;
}

.workspace-head .controls input[type="number"],
.workspace-head .controls input[type="text"] {
  background: var(--soft);
}

.game-workspace,
.design-study-workspace,
.program-workspace,
.art-workspace {
  display: block;
}

.design-study-panel {
  margin-top: 14px;
  padding: 14px;
}

.design-study-frame {
  display: block;
  width: 100%;
  height: min(820px, calc(100vh - 150px));
  min-height: 640px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2f5;
}

.design-actions {
  align-content: start;
}

.design-study-actions {
  align-content: start;
  justify-content: flex-end;
}

.learning-actions {
  align-content: start;
  justify-content: flex-end;
}

.learning-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
  align-items: stretch;
}

.art-learning-layout {
  grid-template-columns: minmax(0, 1fr);
}

.learning-board {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 260px;
}

.learning-board-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.learning-board-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.learning-board-head h3 {
  margin: 4px 0 7px;
  font-size: 20px;
  line-height: 1.25;
}

.learning-board-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.learning-board-head strong {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 6px;
  padding: 0 9px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.code-board {
  border-color: rgba(62, 92, 142, 0.22);
}

.art-board {
  border-color: rgba(139, 92, 43, 0.22);
}

.learning-topic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.learning-topic-grid span {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  background: var(--soft);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.design-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 0.42fr);
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}

.design-side {
  display: grid;
  gap: 14px;
}

.design-form {
  display: grid;
  gap: 12px;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.design-form label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.design-form label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.design-form input,
.design-form select,
.design-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  outline: none;
}

.design-form input,
.design-form select {
  height: 38px;
}

.design-form textarea {
  min-height: 84px;
  line-height: 1.55;
  resize: vertical;
}

.design-form input:focus,
.design-form select:focus,
.design-form textarea:focus,
#designMarkdownOutput:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(20, 127, 121, 0.12);
}

.design-preset-summary,
.design-rule-list,
.suggestion-group,
.module-checklist label {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.design-preset-summary {
  display: grid;
  gap: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.design-preset-summary strong {
  color: var(--teal);
  font-size: 16px;
}

.design-preset-summary p,
.design-rule-list p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.suggestion-groups {
  display: grid;
  gap: 10px;
}

.suggestion-group {
  padding: 12px;
}

.suggestion-group h3 {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.35;
}

.suggestion-chip-list {
  display: grid;
  gap: 7px;
}

.suggestion-chip-list button {
  height: auto;
  min-height: 34px;
  justify-content: flex-start;
  white-space: normal;
  text-align: left;
  line-height: 1.45;
  color: var(--teal);
  background: #fff;
}

.module-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.module-checklist label {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  color: var(--ink);
  font-size: 13px;
}

.module-checklist input {
  width: 15px;
  height: 15px;
}

.dynamic-design-form {
  gap: 14px;
}

.design-target-panel,
.design-progress-panel,
.design-active-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
}

.design-target-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.42fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.design-target-panel h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.design-target-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.design-target-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.design-target-options button {
  height: auto;
  min-height: 66px;
  display: grid;
  justify-items: start;
  align-content: center;
  gap: 4px;
  padding: 10px;
  border-color: var(--line);
  background: #fff;
  text-align: left;
}

.design-target-options button.active {
  border-color: var(--teal);
  background: #eaf7f5;
  color: var(--teal);
}

.design-target-options span {
  color: var(--muted);
  font-size: 12px;
}

.design-flow-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.design-flow-steps article {
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  display: grid;
  gap: 4px;
}

.design-flow-steps article.active {
  border-color: rgba(20, 127, 121, 0.35);
  background: #f2fbfa;
}

.design-flow-steps span,
.design-entry-card header span,
.design-recommend-card span {
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
}

.design-flow-steps strong {
  font-size: 13px;
  line-height: 1.3;
}

.design-flow-steps small,
.design-entry-card small,
.design-recommend-card small,
.design-library-group small,
.design-gap-list small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.design-entry-list {
  display: grid;
  gap: 10px;
}

.design-entry-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.design-entry-card header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.design-entry-card h3 {
  margin: 3px 0 4px;
  font-size: 16px;
}

.design-entry-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.entry-actions {
  display: flex;
  gap: 6px;
  align-items: start;
}

.entry-actions button {
  height: 32px;
  padding-inline: 10px;
}

.entry-body {
  display: grid;
  gap: 9px;
  padding: 12px;
}

.design-entry-card.collapsed .entry-body {
  display: none;
}

.design-pattern-list {
  display: grid;
  gap: 7px;
}

.design-pattern-list button,
.design-library-group button,
.design-recommend-card,
.design-gap-list button {
  height: auto;
  min-height: 34px;
  justify-content: flex-start;
  white-space: normal;
  text-align: left;
  line-height: 1.45;
  background: #fff;
}

.design-pattern-list button {
  color: var(--teal);
}

.design-next-list,
.design-entry-library,
.design-gap-list {
  display: grid;
  gap: 9px;
}

.design-recommend-card {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(20, 127, 121, 0.28);
  background: #f4fbfa;
  color: var(--ink);
}

.design-library-group {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 10px;
}

.design-library-group h3 {
  margin: 0;
  font-size: 13px;
}

.design-library-group > div {
  display: grid;
  gap: 7px;
}

.design-library-group button {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border-color: var(--line);
}

.design-gap-list button {
  display: grid;
  gap: 4px;
  border-color: rgba(198, 111, 30, 0.35);
  background: #fff8ed;
  color: #8a4a0f;
}

.design-gap-list button.missing {
  border-color: rgba(20, 127, 121, 0.25);
  background: #f4fbfa;
  color: var(--teal);
}

.design-gap-clear {
  border: 1px solid rgba(18, 130, 84, 0.24);
  border-radius: 8px;
  background: #eefaf3;
  color: #128254;
  padding: 12px;
  font-size: 13px;
}

.design-preview-entry {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.design-preview-entry:first-child {
  border-top: 0;
  padding-top: 0;
}

.design-preview-entry h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.design-rule-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.design-output-panel {
  margin-top: 14px;
}

.design-output-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.58fr);
  gap: 14px;
  align-items: start;
}

.design-doc-preview,
.markdown-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.design-doc-preview {
  overflow: hidden;
}

.design-doc-cover {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.38fr);
  gap: 16px;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(20, 127, 121, 0.12), transparent 44%),
    linear-gradient(180deg, #ffffff 0%, var(--teal-soft) 100%);
  border-bottom: 1px solid var(--line);
}

.design-doc-cover span {
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
}

.design-doc-cover h1 {
  margin-top: 8px;
  font-size: clamp(26px, 4vw, 44px);
  line-height: 1.12;
}

.design-doc-cover p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.6;
}

.design-doc-cover dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.design-doc-cover dl div {
  border: 1px solid rgba(20, 127, 121, 0.18);
  border-radius: 8px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.7);
}

.design-doc-cover dt,
.design-doc-cover dd {
  margin: 0;
}

.design-doc-cover dt {
  color: var(--muted);
  font-size: 12px;
}

.design-doc-cover dd {
  margin-top: 4px;
  font-weight: 700;
}

.design-preview-section {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.design-preview-section:last-child {
  border-bottom: 0;
}

.design-preview-section.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.design-preview-section h2 {
  margin-bottom: 9px;
  color: var(--teal);
  font-size: 15px;
}

.design-preview-section ul {
  margin: 0;
  padding-left: 18px;
}

.design-preview-section li {
  margin: 6px 0;
  line-height: 1.55;
}

.design-loop-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.design-loop-steps article {
  min-height: 92px;
  border: 1px solid rgba(20, 127, 121, 0.22);
  border-radius: 8px;
  padding: 10px;
  background: var(--teal-soft);
}

.design-loop-steps span {
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
}

.design-loop-steps strong {
  display: block;
  margin-top: 9px;
  line-height: 1.45;
}

.module-grid-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.module-grid-preview span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(20, 127, 121, 0.24);
  border-radius: 6px;
  padding: 0 10px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
}

.markdown-panel {
  display: grid;
  gap: 8px;
  padding: 14px;
  position: sticky;
  top: 92px;
}

#designMarkdownOutput {
  width: 100%;
  min-height: 640px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #0f1724;
  color: #dbeafe;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  resize: vertical;
}

@media (max-width: 1500px) {
  .workspace-head {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .workspace-head .controls {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 1320px) {
  .platform-flow {
    grid-template-columns: repeat(4, minmax(140px, 1fr));
  }
}

@media (max-width: 1080px) {
  .platform-hero,
  .home-layout {
    grid-template-columns: 1fr;
  }

  .tool-nav {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .design-layout,
  .design-output-layout,
  .learning-layout {
    grid-template-columns: 1fr;
  }

  .design-target-panel {
    grid-template-columns: 1fr;
  }

  .markdown-panel {
    position: static;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .platform-sidebar {
    position: static;
    height: auto;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto;
    align-items: center;
    padding: 10px 14px;
  }

  .side-nav {
    display: flex;
    overflow-x: auto;
  }

  .side-nav button {
    width: auto;
    flex: 0 0 auto;
  }

  .sidebar-footer {
    display: none;
  }
}

@media (max-width: 760px) {
  .platform-sidebar {
    display: grid;
    gap: 10px;
  }

  .app-header {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    justify-content: space-between;
  }

  .platform-hero {
    padding: 18px;
  }

  .hero-copy h2 {
    font-size: 24px;
  }

  .platform-flow {
    grid-template-columns: 1fr;
  }

  .workspace-head {
    grid-template-columns: 1fr;
  }

  .design-study-panel {
    padding: 10px;
  }

  .design-study-frame {
    height: 760px;
    min-height: 620px;
  }

  .workspace-head .controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .workspace-head .controls label,
  .workspace-head .controls input[type="number"],
  .workspace-head .controls input[type="text"],
  .workspace-head .controls button,
  .workspace-head .controls .link-button {
    width: 100%;
  }

  .workspace-head .controls .wide-control,
  .workspace-head .controls .primary,
  .workspace-head .controls .secondary,
  .workspace-head .controls .link-button {
    grid-column: span 2;
  }

  .form-grid.three,
  .design-doc-cover,
  .design-preview-section.two,
  .module-checklist,
  .design-target-options,
  .design-flow-steps,
  .learning-topic-grid {
    grid-template-columns: 1fr;
  }

  .design-entry-card header {
    grid-template-columns: 1fr;
  }

  .entry-actions {
    width: 100%;
  }

  .entry-actions button {
    flex: 1;
  }

  .design-preview-section,
  .design-doc-cover {
    padding: 16px;
  }
}
