:root {
  --bg: #e9eef3;
  --bg-soft: #f4f7fa;
  --surface: #ffffff;
  --ink: #101827;
  --muted: #647185;
  --faint: #8d99aa;
  --line: #d9e1ea;
  --line-strong: #c6d2df;
  --brand: #176fd8;
  --brand-strong: #0f5bb7;
  --cyan: #17a8a1;
  --amber: #e8a025;
  --danger: #d95542;
  --warning-bg: #fff6e3;
  --shadow-sm: 0 1px 2px rgba(24, 38, 55, 0.06);
  --shadow-md: 0 14px 32px rgba(29, 48, 72, 0.12);
  --shadow-lg: 0 26px 70px rgba(18, 31, 49, 0.2);
  --radius: 8px;
  --radius-sm: 6px;
  --topbar-h: 76px;
  --topbar-inset: max(48px, calc((100vw - 1680px) / 2 + 28px));
  --side-fixed-inset: max(48px, calc((100vw - 1680px) / 2 + 28px));
  --sidebar-w: 272px;
  --rightbar-w: 280px;
  --shell-gap: 24px;
  --hero-height: 188px;
  --account-board-height: 368px;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 18px);
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  max-width: 100%;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0) 360px),
    var(--bg);
  font-size: 15px;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  left: 18px;
  top: 12px;
  z-index: 60;
  padding: 10px 14px;
  color: #fff;
  background: var(--brand);
  border-radius: var(--radius-sm);
  transform: translateY(-180%);
  transition: transform 180ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.page-texture {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.42;
  background-image:
    linear-gradient(rgba(16, 24, 39, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 24, 39, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.42), transparent 76%);
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 28px;
  height: var(--topbar-h);
  padding: 0 var(--topbar-inset);
  color: var(--ink);
  background: #fff;
  border-bottom: 1px solid rgba(198, 210, 223, 0.82);
  box-shadow: 0 10px 28px rgba(29, 48, 72, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  flex: 0 0 230px;
  min-width: 0;
  text-decoration: none;
}

.brand-logo {
  width: 176px;
  height: 58px;
  object-fit: contain;
  object-position: left center;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.brand-meta {
  padding-left: 14px;
  color: var(--muted);
  border-left: 1px solid var(--line);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.topnav {
  display: flex;
  justify-content: center;
  gap: 34px;
  flex: 1;
  min-width: 0;
}

.topnav a {
  position: relative;
  padding: 26px 0 24px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0;
}

.topnav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 17px;
  height: 2px;
  background: currentColor;
  opacity: 0;
  transform: scaleX(0.5);
  transition: opacity 180ms ease, transform 180ms ease;
}

.topnav a.active,
.topnav a:hover {
  color: var(--ink);
}

.topnav a.active::after,
.topnav a:hover::after {
  opacity: 1;
  transform: scaleX(1);
}

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

.ghost-button,
.primary-button {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius-sm);
  font-weight: 800;
  letter-spacing: 0;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, border-color 180ms ease;
}

.ghost-button {
  padding: 10px 20px;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(143, 157, 176, 0.62);
}

.primary-button {
  padding: 12px 24px;
  color: #fff;
  background: var(--brand);
  box-shadow: 0 10px 22px rgba(23, 111, 216, 0.26);
}

.primary-button.compact {
  padding: 10px 20px;
}

.primary-button.full {
  width: 100%;
}

.ghost-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.ghost-button:hover {
  border-color: rgba(23, 111, 216, 0.42);
  background: #f8fbff;
}

.primary-button:hover {
  background: var(--brand-strong);
  box-shadow: 0 14px 28px rgba(23, 111, 216, 0.28);
}

.ghost-button:active,
.primary-button:active {
  transform: translateY(1px);
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--rightbar-w);
  gap: var(--shell-gap);
  max-width: 1680px;
  margin: 0 auto;
  padding: calc(var(--topbar-h) + 24px) 28px 42px;
}

.sidebar,
.rightbar {
  position: fixed;
  top: calc(var(--topbar-h) + 24px);
  max-height: calc(100vh - var(--topbar-h) - 48px);
  overflow-y: auto;
  scrollbar-width: thin;
  z-index: 20;
}

.sidebar {
  left: var(--side-fixed-inset);
  width: var(--sidebar-w);
}

.rightbar {
  right: var(--side-fixed-inset);
  width: var(--rightbar-w);
}

.sidebar,
.status-panel,
.generator-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(198, 210, 223, 0.86);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.sidebar {
  padding: 18px 16px;
}

.side-section + .side-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.side-title {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.subject-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.subject-link span {
  font-size: 16px;
  font-weight: 900;
}

.subject-link small {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.subject-link.active {
  color: var(--brand-strong);
  background: #edf5ff;
  border-color: #c8dcf5;
}

.sub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.sub-grid button,
.side-section.muted .setting-button {
  min-height: 38px;
  padding: 7px 10px;
  color: #4d5b70;
  background: var(--bg-soft);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.sub-grid button:hover,
.sub-grid button.active,
.side-section.muted .setting-button:hover {
  color: var(--brand-strong);
  background: #f8fbff;
  border-color: #c9ddf5;
  transform: translateY(-1px);
}

.side-section.muted .setting-button {
  cursor: default;
}

.side-section.muted .setting-button:hover {
  transform: none;
}

.side-section.muted {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.side-section.muted .side-title {
  grid-column: 1 / -1;
  margin-bottom: 2px;
}

.side-section.muted .setting-button {
  display: flex;
  align-items: center;
  justify-content: center;
}

.workspace {
  grid-column: 2;
  min-width: 0;
}

#account-showcase,
#generator-title,
#guide-panel,
#template-center,
#template-select {
  scroll-margin-top: calc(var(--topbar-h) + 18px);
}

.hero-panel {
  position: relative;
  min-height: var(--hero-height);
  overflow: hidden;
  border-radius: var(--radius);
  background: #cfe4f6;
  box-shadow: var(--shadow-md);
}

.hero-panel img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(14, 30, 52, 0.8), rgba(15, 83, 151, 0.36) 54%, rgba(255, 255, 255, 0.06)),
    linear-gradient(180deg, rgba(13, 23, 38, 0.06), rgba(13, 23, 38, 0.24));
}

.hero-copy,
.hero-flow {
  position: relative;
  z-index: 1;
}

.hero-copy {
  max-width: 540px;
  padding: 20px 58px 54px;
  color: #fff;
}

.hero-copy p,
.section-head p,
.generator-title p,
.register-modal p {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.hero-copy p {
  color: #9ce6dc;
  margin-bottom: 5px;
}

.hero-copy h1 {
  max-width: 520px;
  margin: 0;
  font-size: clamp(26px, 2.6vw, 36px);
  line-height: 1.06;
  letter-spacing: 0;
  text-wrap: balance;
}

.hero-copy span {
  display: block;
  max-width: 460px;
  margin-top: 7px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 14px;
  line-height: 1.45;
}

.hero-flow {
  position: absolute;
  left: 58px;
  right: 58px;
  bottom: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  max-width: 500px;
  overflow: hidden;
  color: #fff;
  background: rgba(13, 28, 47, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
}

.hero-flow span {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 30px;
  font-weight: 900;
  font-size: 13px;
}

.hero-flow span + span {
  border-left: 1px solid rgba(255, 255, 255, 0.16);
}

.hero-flow strong {
  color: #9ce6dc;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 24px 0 14px;
}

.section-head h2,
.generator-title h2,
.register-modal h2 {
  margin: 0;
  font-size: 23px;
  letter-spacing: 0;
}

.section-head > span {
  color: var(--muted);
  font-size: 14px;
}

.account-board-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(132px, 1fr));
  gap: 12px;
}

.account-board {
  position: relative;
  min-height: var(--account-board-height);
  display: flex;
  flex-direction: column;
  padding: 14px;
  overflow: hidden;
  border: 1px solid rgba(207, 217, 228, 0.9);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, #fbfdff);
  box-shadow: var(--shadow-sm);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.account-board::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--brand);
}

.account-board.math::before {
  background: var(--brand);
}

.account-board.chinese::before {
  background: var(--amber);
}

.account-board.english::before {
  background: var(--cyan);
}

.account-board:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: 0 14px 28px rgba(29, 48, 72, 0.1);
}

.account-board span {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  height: 26px;
  padding: 0 9px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.account-board strong {
  display: block;
  margin-top: 12px;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.25;
  text-wrap: balance;
}

.account-board p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}

.account-preview {
  position: relative;
  height: 148px;
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid rgba(207, 217, 228, 0.86);
  border-radius: var(--radius);
  background: #f6f9fc;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.account-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 54%, rgba(16, 24, 39, 0.08));
}

.account-board-featured .account-preview {
  height: 220px;
  border-color: rgba(23, 111, 216, 0.22);
  background: #fff;
}

.real-account::after {
  display: none;
}

.real-account img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.preview-cover {
  height: 58px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: #fff;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: 0;
}

.preview-lines {
  display: grid;
  gap: 6px;
  padding: 12px 12px 0;
}

.preview-lines i {
  display: block;
  height: 7px;
  border-radius: 999px;
  background: rgba(100, 113, 133, 0.18);
}

.preview-lines i:nth-child(2) {
  width: 72%;
}

.preview-lines i:nth-child(3) {
  width: 48%;
}

.preview-pill {
  position: absolute;
  left: 12px;
  bottom: 9px;
  z-index: 1;
  padding: 5px 9px;
  color: #3f4d62;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(207, 217, 228, 0.84);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.preview-math .preview-cover {
  background: linear-gradient(135deg, #176fd8, #17a8a1);
}

.preview-chinese .preview-cover {
  background: linear-gradient(135deg, #e8a025, #d95542);
}

.preview-english .preview-cover {
  background: linear-gradient(135deg, #17a8a1, #176fd8);
}

.account-board.math span {
  background: var(--brand);
}

.account-board.chinese span {
  background: var(--amber);
}

.account-board.english span {
  background: var(--cyan);
}

.generator-panel {
  margin-top: 24px;
  padding: 24px;
}

.generator-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.generator-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.generator-summary span {
  padding: 7px 10px;
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 800;
}

.generator-form {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(190px, 0.9fr) minmax(300px, 1.45fr);
  gap: 14px;
  align-items: start;
  margin-top: 22px;
}

.generator-form label,
.register-modal label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.generator-form select,
.generator-form textarea,
.register-modal input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.generator-form select,
.register-modal input {
  height: 46px;
  padding: 0 12px;
}

.generator-form textarea {
  min-height: 88px;
  max-height: 150px;
  resize: vertical;
  padding: 12px;
  line-height: 1.6;
}

.question-field small {
  color: var(--faint);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}

.generator-form select:focus,
.generator-form textarea:focus,
.register-modal input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(23, 111, 216, 0.13);
}

.generator-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(180px, auto) minmax(260px, 1fr);
  align-items: center;
  gap: 14px;
}

.generator-actions .primary-button {
  justify-self: start;
  min-width: 188px;
}

.generator-output {
  min-height: 46px;
  display: flex;
  align-items: center;
  padding: 11px 14px;
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  line-height: 1.5;
}

.generator-output[data-state="loading"] {
  color: #7a5a12;
  background: var(--warning-bg);
  border-color: #efd493;
}

.generator-output[data-state="success"] {
  color: #1d6a3b;
  background: #edf8f0;
  border-color: #bfe4ca;
}

.generator-output[data-state="error"] {
  color: #9f3326;
  background: #fff0ee;
  border-color: #efc1b9;
}

.rightbar {
  display: grid;
  gap: 16px;
}

.status-panel {
  padding: 18px;
}

.panel-title {
  margin-bottom: 14px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.site-card {
  min-height: 122px;
  padding: 18px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(23, 111, 216, 0.96), rgba(23, 168, 161, 0.94)),
    #1674c9;
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.site-card span {
  font-size: 13px;
  opacity: 0.84;
  font-variant-numeric: tabular-nums;
}

.site-card strong {
  display: block;
  margin-top: 10px;
  font-size: 24px;
  line-height: 1.2;
}

.site-card p {
  margin: 8px 0 0;
  opacity: 0.88;
}

.status-panel.accent {
  border-color: #efd493;
  background: #fff9ed;
}

.register-flow {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.6;
}

.guide-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.guide-list span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  color: var(--brand-strong);
  background: #edf5ff;
  border: 1px solid #d6e6f9;
  border-radius: var(--radius-sm);
  font-weight: 900;
  font-size: 13px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 18, 32, 0.48);
}

.modal-backdrop[hidden] {
  display: none;
}

.register-modal {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(440px, 100%);
  padding: 28px;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: var(--bg-soft);
  font-size: 22px;
  line-height: 1;
  transition: color 160ms ease, background 160ms ease;
}

.modal-close:hover {
  color: var(--ink);
  background: #e9eff6;
}

.watermark-note {
  padding: 12px;
  color: #7a5a12;
  background: var(--warning-bg);
  border: 1px solid #efd493;
  border-radius: var(--radius-sm);
  line-height: 1.6;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 60;
  min-width: 260px;
  max-width: calc(100vw - 32px);
  padding: 13px 18px;
  color: #fff;
  background: #172033;
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(10, 18, 32, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.mobile-shell {
  display: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(23, 111, 216, 0.34);
  outline-offset: 2px;
}

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

  .sidebar,
  .rightbar {
    position: static;
    top: auto;
    left: auto;
    right: auto;
    width: auto;
    max-height: none;
    overflow-y: visible;
  }

  .workspace {
    grid-column: auto;
  }

  .rightbar {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, 1fr);
  }

  .account-board-grid {
    grid-template-columns: repeat(4, minmax(132px, 1fr));
  }

  .hero-flow {
    position: absolute;
    left: auto;
    right: 58px;
    width: auto;
  }
}

@media (max-width: 980px) {
  .topbar {
    position: static;
    height: auto;
    flex-wrap: wrap;
    gap: 14px 0;
    padding: 14px 16px 16px;
    width: 100%;
    overflow: hidden;
  }

  .brand {
    flex: 0 0 calc(100vw - 32px);
    width: calc(100vw - 32px);
    max-width: 100%;
    min-width: 0;
  }

  .top-actions {
    order: 2;
    flex: 0 0 calc(100vw - 32px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: calc(100vw - 32px);
    max-width: 100%;
    min-width: 0;
    gap: 10px;
  }

  .top-actions button {
    min-width: 0;
  }

  .topnav {
    order: 3;
    flex: 0 0 calc(100vw - 32px);
    justify-content: flex-start;
    gap: 20px;
    width: calc(100vw - 32px);
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 3px;
  }

  .topnav a {
    flex: 0 0 auto;
    padding: 8px 0;
  }

  .topnav a::after {
    bottom: 0;
  }

  .app-shell {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    padding: 16px;
  }

  .sidebar {
    position: static;
    width: 100%;
    min-width: 0;
  }

  .workspace,
  .rightbar,
  .hero-panel,
  .generator-panel,
  .status-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .rightbar {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    padding: 34px 24px 20px;
  }

  .hero-flow {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    grid-template-columns: 1fr 1fr;
    margin: 0 24px 20px;
  }

  .account-board-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .generator-title,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .generator-summary {
    justify-content: flex-start;
  }

  .generator-form {
    grid-template-columns: 1fr;
  }

  .generator-actions {
    grid-template-columns: 1fr;
  }

  .generator-actions .primary-button {
    justify-self: stretch;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 14px;
  }

  .brand,
  .top-actions,
  .topnav {
    width: clamp(280px, calc(100vw - 64px), 360px);
    max-width: clamp(280px, calc(100vw - 64px), 360px);
  }

  .brand,
  .top-actions,
  .topnav {
    flex-basis: clamp(280px, calc(100vw - 64px), 360px);
  }

  .app-shell {
    padding-right: 48px;
  }

  .brand-logo {
    width: 118px;
    height: 42px;
  }

  .subject-link small {
    display: none;
  }

  .brand-meta {
    padding-left: 10px;
    font-size: 12px;
  }

  .ghost-button,
  .primary-button {
    padding-left: 12px;
    padding-right: 12px;
  }

  .top-actions {
    gap: 8px;
    grid-template-columns: 1fr;
  }

  .top-actions .ghost-button,
  .top-actions .primary-button {
    padding-left: 8px;
    padding-right: 8px;
  }

  .sub-grid,
  .account-board-grid {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    min-height: auto;
  }

  .hero-copy h1 {
    font-size: 30px;
  }

  .hero-copy span {
    line-height: 1.65;
  }

  .hero-flow span {
    min-height: 40px;
  }

  .generator-panel {
    padding: 18px;
  }

  .guide-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  html {
    scroll-padding-top: 0;
  }

  body {
    background: #fff;
  }

  #main-content {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .topbar,
  .app-shell {
    display: none;
  }

  .page-texture {
    opacity: 0.22;
    background-size: 22px 22px;
  }

  .mobile-shell {
    display: flex;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    min-height: 100dvh;
    flex-direction: column;
    padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
    color: #0b1220;
    background:
      linear-gradient(180deg, #fff 0, #fff 62%, #f5f8fc 100%),
      #fff;
  }

  .mobile-header {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) 64px;
    align-items: center;
    gap: 10px;
    min-height: 56px;
  }

  .mobile-icon-button,
  .mobile-nav-button,
  .mobile-secondary-button,
  .mobile-send-button {
    border: 0;
    background: transparent;
  }

  .mobile-icon-button {
    justify-self: start;
    display: grid;
    align-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0 6px;
  }

  .mobile-icon-button span {
    display: block;
    height: 3px;
    border-radius: 999px;
    background: #111827;
  }

  .mobile-title {
    min-width: 0;
    text-align: center;
  }

  .mobile-title strong {
    display: block;
    font-size: 20px;
    line-height: 1.15;
    font-weight: 900;
  }

  .mobile-nav-button {
    justify-self: end;
    min-width: 58px;
    min-height: 34px;
    padding: 0 8px;
    color: var(--brand-strong);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
  }

  .mobile-nav-button:hover {
    background: #f1f6ff;
  }

  .mobile-panel {
    display: none;
    flex: 1;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
    min-height: 0;
  }

  .mobile-panel.is-active {
    display: flex;
    flex-direction: column;
  }

  .mobile-workspace {
    flex: 1;
    min-height: clamp(310px, 48dvh, 560px);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 42px 2px 20px;
  }

  .mobile-workspace p {
    margin: 0 0 8px;
    color: var(--brand);
    font-size: 13px;
    font-weight: 900;
  }

  .mobile-workspace h1 {
    max-width: 320px;
    margin: 0;
    font-size: 26px;
    line-height: 1.16;
    font-weight: 900;
    letter-spacing: 0;
  }

  .mobile-task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
  }

  .mobile-task-meta span {
    padding: 7px 10px;
    color: #3f4d62;
    background: #f1f6fb;
    border: 1px solid #dbe5ef;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
  }

  .mobile-console-visual {
    width: min(280px, 82vw);
    margin: clamp(42px, 8dvh, 76px) auto 0;
    color: var(--brand);
  }

  .mobile-console-visual svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
  }

  .visual-shadow {
    fill: rgba(23, 111, 216, 0.08);
  }

  .visual-screen {
    fill: #fff;
    stroke: #cfe0f4;
    stroke-width: 2;
  }

  .visual-panel {
    fill: #eef6ff;
    stroke: #cfe0f4;
    stroke-width: 2;
  }

  .visual-play {
    fill: #176fd8;
  }

  .visual-line,
  .visual-card,
  .visual-book,
  .visual-book-line {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .visual-line {
    stroke: #93a7bf;
    stroke-width: 6;
  }

  .visual-card {
    stroke: #17a8a1;
    stroke-width: 8;
  }

  .visual-book {
    fill: #fff8ea;
    stroke: #e8a025;
    stroke-width: 2;
  }

  .visual-book-line {
    stroke: #d8921d;
    stroke-width: 2;
  }

  .mobile-quick-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin: auto 0 12px;
    padding: 0;
  }

  .mobile-quick-actions button {
    min-width: 0;
    display: grid;
    justify-items: center;
    align-items: center;
    gap: 5px;
    min-height: 58px;
    padding: 7px 4px;
    color: #111827;
    background: #fff;
    border: 1px solid #e0e5ec;
    border-radius: 14px;
    box-shadow: 0 3px 10px rgba(20, 33, 48, 0.05);
    font-size: 12px;
    font-weight: 900;
    line-height: 1.2;
    overflow: hidden;
  }

  .mobile-action-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    color: var(--brand);
    background: #eef6ff;
    border: 1px solid #d6e8fb;
    border-radius: 12px;
  }

  .mobile-action-icon svg {
    display: block;
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
  }

  .mobile-quick-actions button:nth-child(2) .mobile-action-icon {
    color: #128982;
    background: #edfafa;
    border-color: #cdeceb;
  }

  .mobile-quick-actions button:nth-child(3) .mobile-action-icon {
    color: #bd7b12;
    background: #fff7e8;
    border-color: #f1deae;
  }

  .mobile-prompt-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 58px;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 74px;
    padding: 10px 12px 10px 18px;
    background: #fff;
    border: 1px solid rgba(214, 222, 232, 0.9);
    border-radius: 22px;
    box-shadow: 0 14px 36px rgba(17, 24, 39, 0.13);
  }

  .mobile-prompt-field {
    min-width: 0;
    display: grid;
    gap: 2px;
  }

  .mobile-prompt-field span {
    color: #8d99aa;
    font-size: 11px;
    font-weight: 800;
  }

  .mobile-prompt-field input {
    min-width: 0;
    width: 100%;
    height: 30px;
    padding: 0;
    border: 0;
    outline: none;
    color: #111827;
    background: transparent;
    font-size: 16px;
    font-weight: 800;
  }

  .mobile-prompt-field input::placeholder {
    color: #a0a9b5;
    font-weight: 700;
  }

  .mobile-send-button {
    min-height: 42px;
    color: #fff;
    background: var(--brand);
    border-radius: 14px;
    font-size: 14px;
    font-weight: 900;
  }

  .mobile-output {
    min-height: 40px;
    margin-top: 12px;
    padding: 10px 12px;
    color: #647185;
    background: #f5f8fc;
    border: 1px solid #e1e8f0;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.45;
  }

  .mobile-output:empty {
    display: none;
  }

  .mobile-output[data-state="error"] {
    color: #9f3326;
    background: #fff0ee;
    border-color: #efc1b9;
  }

  .mobile-output[data-state="loading"] {
    color: #7a5a12;
    background: #fff6e3;
    border-color: #efd493;
  }

  .mobile-output[data-state="success"] {
    color: #1d6a3b;
    background: #edf8f0;
    border-color: #bfe4ca;
  }

  .mobile-history-layer,
  .mobile-sheet-layer {
    position: fixed;
    inset: 0;
    z-index: 80;
  }

  .mobile-history-layer[hidden],
  .mobile-sheet-layer[hidden] {
    display: none;
  }

  .mobile-history-backdrop,
  .mobile-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.26);
    opacity: 0;
    transition: opacity 180ms ease;
  }

  .mobile-history-drawer {
    position: relative;
    z-index: 1;
    width: min(318px, 82vw);
    height: 100%;
    padding: max(22px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.98);
    border-right: 1px solid #dbe5ef;
    box-shadow: 18px 0 42px rgba(16, 24, 39, 0.16);
    transform: translateX(-104%);
    transition: transform 220ms ease;
  }

  .mobile-history-layer.is-open .mobile-history-backdrop,
  .mobile-sheet-layer.is-open .mobile-sheet-backdrop {
    opacity: 1;
  }

  .mobile-history-layer.is-open .mobile-history-drawer {
    transform: translateX(0);
  }

  .mobile-drawer-head,
  .mobile-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .mobile-drawer-head strong,
  .mobile-sheet-head strong {
    color: #0b1220;
    font-size: 20px;
    font-weight: 900;
  }

  .mobile-drawer-head button,
  .mobile-sheet-head button {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 12px;
    color: #647185;
    background: #f1f6fb;
    font-size: 22px;
    line-height: 1;
  }

  .mobile-history-list {
    display: grid;
    gap: 8px;
    margin-top: 18px;
  }

  .mobile-history-item {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    min-height: 54px;
    padding: 8px 6px;
    text-align: left;
    color: #0b1220;
    background: transparent;
    border: 0;
    border-radius: 12px;
  }

  .mobile-history-item:hover {
    background: #f4f8fd;
  }

  .mobile-history-item span {
    grid-row: 1 / span 2;
    width: 18px;
    height: 18px;
    border: 2px solid #bfdbfe;
    border-radius: 50%;
    background: #eff6ff;
  }

  .mobile-history-item strong {
    min-width: 0;
    overflow: hidden;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-history-item small {
    color: #647185;
    font-size: 12px;
  }

  .mobile-sheet-layer {
    display: grid;
    align-items: end;
  }

  .mobile-action-sheet {
    position: relative;
    z-index: 1;
    width: 100%;
    max-height: 78dvh;
    overflow-y: auto;
    padding: 18px 18px max(20px, env(safe-area-inset-bottom));
    background: #fff;
    border: 1px solid #dbe5ef;
    border-bottom: 0;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -18px 46px rgba(16, 24, 39, 0.16);
    transform: translateY(104%);
    transition: transform 220ms ease;
  }

  .mobile-sheet-layer.is-open .mobile-action-sheet {
    transform: translateY(0);
  }

  .mobile-sheet-panel {
    display: none;
    gap: 14px;
    margin-top: 16px;
  }

  .mobile-sheet-panel.is-active {
    display: grid;
  }

  .mobile-sheet-panel p {
    margin: 0;
    color: #647185;
    font-size: 13px;
    font-weight: 900;
  }

  .mobile-option-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

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

  .mobile-option-grid button {
    min-height: 50px;
    padding: 10px 8px;
    color: #0b1220;
    background: #f7fbff;
    border: 1px solid #dbe7f5;
    border-radius: 14px;
    font-weight: 900;
  }

  .mobile-option-grid button.is-selected {
    color: var(--brand-strong);
    background: #eef6ff;
    border-color: #9cc4f2;
    box-shadow: inset 0 0 0 1px rgba(23, 111, 216, 0.18);
  }

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

  .mobile-watermark-form label {
    display: grid;
    gap: 8px;
    color: #647185;
    font-size: 13px;
    font-weight: 900;
  }

  .mobile-watermark-form input {
    height: 48px;
    width: 100%;
    padding: 0 12px;
    color: #0b1220;
    background: #fff;
    border: 1px solid #dbe5ef;
    border-radius: 12px;
    outline: none;
  }

  .mobile-watermark-form input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(23, 111, 216, 0.12);
  }

  .mobile-home-panel {
    gap: 12px;
    padding-top: 18px;
    padding-bottom: 10px;
  }

  .mobile-home-hero {
    position: relative;
    overflow: hidden;
    padding: 18px;
    border: 1px solid #d7e3f2;
    border-radius: 20px;
    background:
      linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 251, 255, 0.96) 54%, rgba(238, 246, 255, 0.96) 100%),
      repeating-linear-gradient(90deg, rgba(23, 111, 216, 0.04) 0 1px, transparent 1px 52px);
    box-shadow: 0 18px 42px rgba(32, 61, 93, 0.1);
  }

  .mobile-home-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 18px;
  }

  .mobile-home-brand img {
    display: block;
    width: 136px;
    height: 46px;
    object-fit: contain;
    object-position: left center;
  }

  .mobile-home-brand span {
    flex: 0 0 auto;
    padding: 6px 8px;
    color: var(--brand-strong);
    background: #eef6ff;
    border: 1px solid #d6e7fb;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 900;
  }

  .mobile-home-hero h1 {
    max-width: 320px;
    margin: 0;
    color: #071426;
    font-size: 26px;
    line-height: 1.15;
    font-weight: 900;
    letter-spacing: 0;
    text-wrap: balance;
  }

  .mobile-home-hero p {
    max-width: 31em;
    margin: 10px 0 0;
    color: #526277;
    font-size: 14px;
    line-height: 1.65;
  }

  .mobile-trust-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 16px 0;
    padding: 8px;
    border: 1px solid #dde8f5;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.78);
  }

  .mobile-trust-strip span {
    min-width: 0;
    padding: 10px 8px;
    background: #fff;
    border-radius: 11px;
    box-shadow: inset 0 0 0 1px rgba(215, 227, 242, 0.8);
  }

  .mobile-trust-strip strong {
    display: block;
    color: var(--brand-strong);
    font-size: 21px;
    line-height: 1;
    font-weight: 950;
    font-variant-numeric: tabular-nums;
  }

  .mobile-trust-strip small {
    display: block;
    margin-top: 4px;
    color: #5f6e82;
    font-size: 11px;
    line-height: 1.2;
    font-weight: 800;
    white-space: nowrap;
  }

  .mobile-home-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .mobile-home-actions .primary-button,
  .mobile-secondary-button {
    min-height: 46px;
    border-radius: 12px;
  }

  .mobile-secondary-button {
    color: var(--brand-strong);
    background: #eef6ff;
    border: 1px solid #cfe0f4;
    font-weight: 900;
  }

  .mobile-home-section {
    display: grid;
    gap: 12px;
    padding: 15px;
    border: 1px solid #dbe5ef;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 10px 26px rgba(28, 46, 70, 0.06);
  }

  .mobile-section-title {
    display: grid;
    gap: 4px;
  }

  .mobile-section-title span {
    color: var(--brand);
    font-size: 12px;
    line-height: 1.2;
    font-weight: 900;
  }

  .mobile-section-title strong {
    color: #101827;
    font-size: 18px;
    line-height: 1.25;
    font-weight: 900;
  }

  .mobile-subject-matrix {
    display: grid;
    gap: 9px;
  }

  .mobile-subject-matrix button {
    display: grid;
    grid-template-columns: 58px repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: center;
    padding: 10px;
    text-align: left;
    background: #f7faff;
    border: 1px solid #dbe5ef;
    border-radius: 14px;
    transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1), border-color 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .mobile-subject-matrix button:active {
    transform: scale(0.99);
  }

  .mobile-subject-icon {
    grid-row: 1 / span 2;
    display: grid;
    place-items: center;
    width: 58px;
    min-height: 58px;
    color: var(--brand-strong);
    background:
      linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(237, 247, 255, 0.9));
    border-radius: 12px;
    box-shadow:
      inset 0 0 0 1px rgba(207, 224, 244, 0.96),
      0 8px 16px rgba(31, 94, 162, 0.08);
  }

  .mobile-subject-icon svg {
    width: 34px;
    height: 34px;
    fill: rgba(255, 255, 255, 0.42);
    stroke: var(--brand-strong);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .mobile-subject-matrix button:nth-child(2) .mobile-subject-icon {
    color: #b66a00;
    background: linear-gradient(145deg, #fff9eb, #fff);
  }

  .mobile-subject-matrix button:nth-child(2) .mobile-subject-icon svg {
    stroke: #b66a00;
  }

  .mobile-subject-matrix button:nth-child(3) .mobile-subject-icon {
    color: #087f7a;
    background: linear-gradient(145deg, #ecfffb, #fff);
  }

  .mobile-subject-matrix button:nth-child(3) .mobile-subject-icon svg {
    stroke: #087f7a;
  }

  .mobile-subject-matrix span {
    min-width: 0;
    padding: 7px 8px;
    color: #3e4e63;
    background: #fff;
    border-radius: 9px;
    font-size: 12px;
    line-height: 1.15;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
  }

  .mobile-mini-accounts {
    display: grid;
    gap: 8px;
  }

  .mobile-mini-accounts article {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    column-gap: 10px;
    row-gap: 3px;
    align-items: center;
    padding: 11px;
    background: #f8fbff;
    border: 1px solid #dce7f4;
    border-radius: 13px;
  }

  .mobile-mini-accounts em {
    grid-row: 1 / span 2;
  }

  .mobile-account-icon {
    display: grid;
    place-items: center;
    width: 58px;
    min-height: 58px;
    color: var(--brand-strong);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(237, 247, 255, 0.9));
    border-radius: 12px;
    font-style: normal;
    box-shadow:
      inset 0 0 0 1px rgba(207, 224, 244, 0.96),
      0 8px 16px rgba(31, 94, 162, 0.08);
  }

  .mobile-account-icon svg {
    width: 34px;
    height: 34px;
    fill: none;
    stroke: var(--brand-strong);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .mobile-account-icon.chinese {
    color: #b66a00;
    background: linear-gradient(145deg, #fff9eb, #fff);
  }

  .mobile-account-icon.chinese svg {
    stroke: #b66a00;
  }

  .mobile-account-icon.english {
    color: #087f7a;
    background: linear-gradient(145deg, #ecfffb, #fff);
  }

  .mobile-account-icon.english svg {
    stroke: #087f7a;
  }

  .mobile-mini-accounts strong {
    min-width: 0;
    color: #101827;
    font-size: 15px;
    line-height: 1.2;
    font-weight: 900;
  }

  .mobile-mini-accounts span {
    min-width: 0;
    color: #637287;
    font-size: 12px;
    line-height: 1.35;
  }
}

@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;
  }
}
