:root {
  color-scheme: light dark;
  --accent: #2485c7;
  --accent-soft: #eaf4fb;
  --canvas: #f4f7fa;
  --surface: #ffffff;
  --ink: #192b3a;
  --muted: #687b8b;
  --line: #e1e8ee;
  --focus: #2485c7;
  --radius: 12px;
  --shadow: 0 2px 8px #192b3a04;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "PingFang SC", "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  font-synthesis: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #18222c;
    --surface: #202e3a;
    --ink: #e9f0f5;
    --muted: #a0b0be;
    --line: #344553;
    --accent: #67b4e8;
    --accent-soft: #213b50;
    --focus: #8dcef8;
  }
}

:root[data-theme="dark"] {
  --canvas: #18222c;
  --surface: #202e3a;
  --ink: #e9f0f5;
  --muted: #a0b0be;
  --line: #344553;
  --accent: #67b4e8;
  --accent-soft: #213b50;
  --focus: #8dcef8;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--canvas); color: var(--ink); line-height: 1.6; overflow-wrap: anywhere; }
body:has(dialog[open]) { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled, select:disabled { cursor: not-allowed; }
button, select, input, textarea { transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease; }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
button:disabled { opacity: .55; }
h1, h2, h3, p { margin: 0; text-wrap: pretty; }
h1 { font-size: 28px; font-weight: 650; line-height: 1.3; letter-spacing: -.5px; }
h2 { font-size: 24px; font-weight: 650; line-height: 1.4; letter-spacing: -.3px; }
h3 { font-size: 18px; font-weight: 600; }
.app-shell { max-width: 720px; min-height: 100dvh; margin: auto; padding: 0 24px calc(32px + var(--safe-bottom)); }
.app-header { padding: 24px 0 20px; }
.header-line { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.header-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.menu-trigger { display: grid; place-items: center; width: 44px; height: 44px; padding: 10px; flex: none; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
.hamburger { display: flex; flex-direction: column; gap: 4px; width: 20px; }
.hamburger span { height: 2px; width: 100%; border-radius: 1px; background: currentColor; }
.eyebrow { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.status-pill { flex: none; border: 1px solid var(--line); border-radius: 99px; padding: 3px 12px; color: var(--muted); background: var(--surface); font-size: 13px; }
.context-bar { margin-top: 20px; display: flex; gap: 16px; }
.scope-field { display: flex; flex: 1; flex-direction: column; gap: 4px; min-width: 0; color: var(--muted); font-size: 13px; }
select { width: 100%; min-height: 48px; padding: 10px 12px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); text-overflow: ellipsis; }
select:disabled { color: var(--muted); opacity: 1; }
.login-notice { padding: 16px; display: flex; align-items: flex-start; gap: 12px; background: var(--accent-soft); border-radius: var(--radius); margin-bottom: 24px; }
.notice-mark { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border: 1.5px solid var(--accent); border-radius: 50%; color: var(--accent); font-size: 14px; font-weight: 600; margin-top: 2px; }
.login-notice h2 { font-size: 15px; line-height: 1.6; letter-spacing: 0; }
.login-notice p { font-size: 13px; color: var(--muted); margin-top: 3px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-heading.compact { margin-top: 32px; margin-bottom: 12px; }
.quiet-label { color: var(--muted); font-size: 13px; }
.balance-panel { padding: 20px 20px 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.balance-label { font-size: 14px; color: var(--muted); }
.balance-value { margin-top: 4px; font-size: 40px; line-height: 1.25; font-weight: 600; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.balance-help { font-size: 13px; color: var(--muted); margin-top: 8px; }
.balance-footer { margin-top: 16px; border-top: 1px solid var(--line); padding: 10px 0; font-size: 12px; color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.metric { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.metric p { font-size: 13px; color: var(--muted); }
.metric strong { display: block; margin-top: 4px; font-size: 26px; font-weight: 600; line-height: 1.4; font-variant-numeric: tabular-nums; }
.metric span { font-size: 12px; color: var(--muted); }
.tool-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tool-row { display: flex; width: 100%; gap: 16px; align-items: center; justify-content: space-between; min-height: 80px; padding: 16px; text-align: left; color: var(--ink); border: 0; background: transparent; }
.tool-row + .tool-row { border-top: 1px solid var(--line); }
.tool-row strong { display: block; font-size: 16px; font-weight: 600; }
.tool-row small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.tool-row:active { background: var(--accent-soft); }
.chevron { color: var(--muted); font-size: 26px; font-weight: 300; }
.footnote { color: var(--muted); font-size: 12px; text-align: center; margin-top: 24px; }
.section-description { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.empty-state { text-align: center; padding: 40px 24px; }
.empty-symbol { display: grid; place-items: center; margin: 0 auto 20px; width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: 24px; }
.empty-state p { font-size: 14px; color: var(--muted); margin-top: 8px; }
.button { min-height: 48px; padding: 10px 24px; border: 1px solid var(--line); border-radius: var(--radius); font-weight: 600; background: var(--surface); color: var(--ink); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.text-button { min-height: 44px; border: 0; padding: 6px 8px; background: transparent; border-radius: 8px; color: var(--accent); font-size: 13px; font-weight: 600; }
.small-button { min-height: 44px; padding: 8px 16px; font-size: 14px; }
.feedback { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 14px; margin-bottom: 20px; }
.feedback .button { margin-top: 12px; }
.inline-note { padding: 12px 16px; margin-bottom: 16px; border-radius: var(--radius); background: var(--accent-soft); color: var(--muted); font-size: 13px; }
.scope-note { margin-top: 20px; color: var(--muted); font-size: 12px; }
.search-form { display: flex; align-items: stretch; gap: 8px; margin: 16px 0; }
.search-form input { min-width: 0; flex: 1; }
input:not([type="checkbox"]), textarea { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); padding: 10px 12px; }
textarea { resize: vertical; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:disabled, textarea:disabled { opacity: 1; color: var(--muted); }
.definition-list { display: flex; flex-direction: column; gap: 12px; }
.list-count { font-size: 13px; color: var(--muted); }
.definition-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; background: var(--surface); }
.definition-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.definition-heading h3 { min-width: 0; }
.definition-description { margin-top: 12px; font-size: 14px; white-space: pre-wrap; }
.definition-meta { color: var(--muted); font-size: 12px; margin-top: 8px; }
.definition-card > .button { margin-top: 16px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 0; }
.pagination > span { color: var(--muted); font-size: 13px; }
.editor-dialog { width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); margin: auto; padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); overscroll-behavior: contain; }
.editor-dialog::backdrop { background: #192b3a88; }
.editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.editor-heading h2 { font-size: 22px; }
.editor-dialog .section-description { margin-bottom: 20px; font-size: 13px; }
fieldset { min-width: 0; padding: 0; margin: 0; border: 0; }
.form-field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.field-label { font-size: 14px; font-weight: 600; }
.field-help { display: block; font-size: 12px; color: var(--muted); }
.switch-field { display: grid; grid-template-columns: 1fr 44px; align-items: center; gap: 16px; min-height: 48px; }
.switch-field input { accent-color: var(--accent); width: 24px; height: 24px; margin: 0; justify-self: center; }
.field-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.selection-label { font-size: 13px; color: var(--muted); }
.editor-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.editor-actions > button { flex: 1; }
.prize-picker { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); margin: 24px 0; }
.picker-card { border-top: 1px solid var(--line); padding: 16px 0; }
.picker-card .button { margin-top: 12px; }
.preview-section { margin-top: 32px; border-top: 1px solid var(--line); padding-top: 24px; }
.preview-section h3 { margin-bottom: 8px; }
.preview-change { padding: 16px 0; border-bottom: 1px solid var(--line); }
.preview-change > strong { font-size: 14px; }
.preview-before, .preview-after { display: grid; grid-template-columns: 52px 1fr; gap: 8px; margin-top: 8px; font-size: 14px; white-space: pre-wrap; }
.preview-before { color: var(--muted); }
.change-label { color: var(--muted); font-size: 12px; }
.preview-warnings { padding-left: 20px; margin: 20px 0 0; color: var(--muted); font-size: 13px; }
.preview-warnings li + li { margin-top: 8px; }
.drawer-logout { margin: 24px 8px 0; }
.member-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.member-tabs button { min-height: 44px; padding: 8px 4px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 14px; }
.member-tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.commerce-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; padding: 16px 0 0; margin: 0; }
.commerce-facts div { min-width: 0; }
.commerce-facts dt { color: var(--muted); font-size: 12px; }
.commerce-facts dd { margin: 2px 0 0; font-size: 15px; font-variant-numeric: tabular-nums; }
.commerce-status { color: var(--muted); font-size: 13px; }
.commerce-numeric-warning { margin-top: 12px; color: var(--muted); font-size: 12px; }
.empty-state .button { margin-top: 24px; }
.menu-drawer { width: min(320px, calc(100vw - 48px)); max-width: none; height: 100dvh; max-height: none; margin: 0; padding: max(24px, env(safe-area-inset-top, 0px)) 16px calc(24px + var(--safe-bottom)); border: 0; border-right: 1px solid var(--line); background: var(--surface); color: var(--ink); overflow-y: auto; overscroll-behavior: contain; }
.menu-drawer::backdrop { background: #192b3a66; }
.drawer-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 8px 24px; }
.drawer-heading h2 { font-size: 26px; }
.close-button { display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 30px; line-height: 1; }
.drawer-nav { display: flex; flex-direction: column; gap: 8px; }
.drawer-nav button { width: 100%; min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; padding: 12px 16px; border: 0; border-radius: var(--radius); background: transparent; color: var(--ink); }
.drawer-nav button[aria-current="page"] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.drawer-nav button small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.nav-arrow { font-size: 24px; font-weight: 300; }
.nav-group-label { padding: 20px 16px 0; font-size: 12px; color: var(--muted); }
.drawer-note { padding: 24px 16px 0; font-size: 12px; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (hover: hover) { .tool-row:hover, .drawer-nav button:not(:disabled):hover, .menu-trigger:hover, .close-button:hover { background: var(--accent-soft); } }
@media (max-width: 380px) { .app-shell { padding-inline: 16px; } .app-header { padding-top: 24px; } .balance-panel { padding-inline: 20px; } }
@media (max-width: 420px) { .editor-dialog { padding: 20px 16px; } .definition-card { padding: 16px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; } }
