: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: 12px; }
.section-heading.compact { margin-top: 24px; 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: 12px; align-items: center; justify-content: space-between; min-height: 64px; padding: 12px 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); }
.workspace-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; margin-bottom: 12px; }
.workspace-view-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.workspace-view-nav button[aria-current="page"], .workspace-view-nav button[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.workspace-filter-form { padding: 12px; margin: 12px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.workspace-filter-form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.commerce-facts.workspace-facts { display: grid; grid-template-columns: minmax(90px, .4fr) minmax(0, 1fr); gap: 6px 12px; margin: 8px 0; padding: 0; }
.commerce-facts.workspace-facts dt { font-size: 13px; color: var(--muted); }
.commerce-facts.workspace-facts dd { margin: 0; white-space: pre-wrap; font-size: 14px; min-width: 0; }
.workspace-facts .workspace-wide-fact { grid-column: 1 / -1; }
.workspace-game-details { margin: 8px 0; }
.workspace-game-detail-body { padding: 0 16px 12px; }
.workspace-game-detail-body .definition-description { margin-top: 0; overflow-wrap: anywhere; }
.workspace-data-section { margin: 12px 0; }
.workspace-record { padding: 12px; margin: 8px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.workspace-object { margin: 8px 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.definition-list > .workspace-record, .definition-list > .workspace-data-section, .definition-list > .workspace-settings-list, .definition-list > .workspace-game-details { margin-block: 0; }
.workspace-object legend { padding: 0 6px; font-size: 14px; font-weight: 600; }
.workspace-edit-toggle { display: flex; align-items: center; gap: 8px; margin: 8px 0; color: var(--muted); font-size: 13px; }
.workspace-edit-toggle input { width: 18px; min-height: 18px; }
.workspace-button-editor { display: grid; gap: 8px; margin: 8px 0; }
.workspace-button-row { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.workspace-button-cells, .workspace-button-cell { display: grid; gap: 8px; min-width: 0; }
.workspace-button-cell { padding: 8px 0; }
.workspace-button-cell + .workspace-button-cell { border-top: 1px solid var(--line); }
.workspace-dialog { max-height: min(90dvh, 900px); overflow-y: auto; }
.workspace-action-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.workspace-action-name { min-width: 0; flex: 1; font-size: 15px; font-weight: 500; }
.workspace-action-row .button { flex: none; }
.workspace-dialog-group { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 16px; }
.workspace-array { display: grid; gap: 8px; margin: 8px 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.workspace-multichoice { display: grid; gap: 8px; border: 0; padding: 8px 0; }
.workspace-multichoice label { display: flex; align-items: center; gap: 8px; }
.workspace-multichoice input { width: 18px; min-height: 18px; }
.workspace-settings-list { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 0 12px; margin: 12px 0; }
.workspace-setting-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; padding: 12px 0; }
.workspace-setting-row + .workspace-setting-row { border-top: 1px solid var(--line); }
.workspace-setting-row h3 { font-size: 14px; font-weight: 500; }
.workspace-setting-value { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.workspace-setting-row .field-help { grid-column: 1 / -1; }
.workspace-rule-editor, .workspace-rule-condition, .workspace-rule-action, .workspace-rule-schedule, .workspace-rule-reply { display: grid; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.workspace-rule-editor fieldset, .workspace-rule-child { min-width: 0; }
.workspace-rule-child { padding-left: 12px; border-left: 2px solid var(--line); }
.workspace-rule-actions { display: grid; gap: 12px; }
.workspace-coordinates { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; min-width: 0; }
.workspace-consent-checkbox { width: 18px; min-height: 18px; accent-color: var(--accent); }
@media (max-width: 520px) {
  .workspace-controls { grid-template-columns: minmax(0, 1fr); }
  .commerce-facts.workspace-facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .commerce-facts.workspace-facts dd { margin-bottom: 8px; }
  .workspace-filter-form, .workspace-record, .workspace-object { padding: 12px; }
}
.chevron { color: var(--muted); font-size: 26px; font-weight: 300; }
.footnote { color: var(--muted); font-size: 12px; text-align: center; margin-top: 16px; }
.section-description { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.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); }
.button.danger { background: #b63737; border-color: #b63737; color: #fff; }
.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: 12px 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: 8px; }
.list-count { font-size: 13px; color: var(--muted); }
.definition-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; 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: 8px; font-size: 14px; white-space: pre-wrap; }
.definition-meta { color: var(--muted); font-size: 12px; margin-top: 8px; }
.definition-card > .button { margin-top: 12px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 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: 20px; 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: 12px; font-size: 13px; }
fieldset { min-width: 0; padding: 0; margin: 0; border: 0; }
.form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.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: 16px; }
.editor-actions > button { flex: 1; }
.prize-picker { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); margin: 16px 0; }
.picker-card { border-top: 1px solid var(--line); padding: 12px 0; }
.picker-card .button { margin-top: 12px; }
.preview-section { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.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: 16px 8px 0; }
.member-tabs { display: grid; grid-template-columns: repeat(4, 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: 8px 12px; padding: 12px 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; }
.safety-group-field { margin-bottom: 16px; }
.safety-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.safety-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 12px 16px; cursor: pointer; font-size: 16px; font-weight: 600; list-style: none; }
.safety-summary::-webkit-details-marker { display: none; }
.safety-summary::after { content: "−"; font-size: 20px; font-weight: 400; color: var(--muted); }
.safety-section:not([open]) .safety-summary::after { content: "+"; }
.safety-section-label { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 400; text-align: right; }
.safety-section-description { margin: 0 16px 12px; color: var(--muted); font-size: 13px; }
.safety-rows { margin: 0; padding: 0 16px; }
.safety-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(100px, 1fr); gap: 6px 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.safety-row dt { font-size: 14px; }
.safety-row dd { min-width: 0; margin: 0; font-size: 14px; }
.safety-value { display: block; white-space: pre-wrap; overflow-wrap: anywhere; }
.safety-on { color: var(--accent); font-weight: 600; }
.safety-off, .safety-unknown { color: var(--muted); }
.safety-row-description { margin-top: 4px; color: var(--muted); font-size: 12px; }
.safety-summary:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.commerce-numeric-warning { margin-top: 12px; color: var(--muted); font-size: 12px; }
.trade-dialog > h3 { margin-bottom: 8px; }
.trade-confirm-section { border-top: 1px solid var(--line); padding-top: 8px; }
.trade-server-warning, .trade-operation-status { margin-top: 16px; font-size: 14px; white-space: pre-wrap; }
.trade-operation-status { color: var(--muted); }
.trade-result { padding-top: 8px; }
.trade-result > .button { width: 100%; margin-top: 24px; }
.trade-actions > .button { flex: 1 1 180px; }
.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 16px; }
.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: 4px; }
.drawer-nav button { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; padding: 8px 12px; line-height: 1.4; 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; line-height: 1; }
.nav-group-label { padding: 12px 12px 0; font-size: 12px; color: var(--muted); }
.drawer-note { padding: 16px 12px 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, .safety-summary: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: 16px; } .definition-card { padding: 12px; } }
@media (max-width: 420px) { .safety-summary { padding-inline: 16px; } .safety-rows { padding-inline: 16px; } .safety-section-description { margin-inline: 16px; } .safety-row { column-gap: 12px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; } }
