:root {
  --ink: #142126;
  --ink-soft: #293b3d;
  --paper: #f3f0e7;
  --paper-deep: #e5dfd2;
  --jade: #47745d;
  --jade-light: #9abca6;
  --gold: #c4a56a;
  --red: #a45143;
  --danger: #b75f51;
  --line: rgba(20, 33, 38, .14);
  --sidebar: 248px;
  --display: "STSong", "Songti SC", "Noto Serif CJK SC", serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  --radius: 4px;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; background: var(--paper); color: var(--ink); font: 14px/1.7 var(--body); }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; }
[hidden] { display: none !important; }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 200; padding: 8px 12px; background: var(--paper); color: var(--ink); }
.skip-link:focus { top: 12px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; z-index: 20; display: flex; flex-direction: column; padding: 24px 20px 22px; overflow: auto; background: var(--ink); color: var(--paper); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--paper); font: 20px var(--display); text-decoration: none; letter-spacing: .08em; }
.brand small { display: block; margin-top: 2px; color: rgba(243, 240, 231, .48); font: 9px var(--body); letter-spacing: .42em; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 42px; border: 1px solid var(--gold); color: var(--gold); font-size: 20px; transform: rotate(-2deg); }
.side-caption { margin: 16px 0 25px; color: rgba(243, 240, 231, .42); font: 10px var(--display); text-align: center; letter-spacing: .18em; }
.navigation { display: grid; gap: 4px; }
.nav-button { position: relative; width: 100%; min-height: 54px; display: grid; grid-template-columns: 32px 1fr; align-items: center; gap: 10px; padding: 8px 10px; background: transparent; border: 1px solid transparent; color: rgba(243, 240, 231, .68); text-align: left; }
.nav-button:hover { background: rgba(255, 255, 255, .05); color: var(--paper); }
.nav-button.active { border-color: rgba(196, 165, 106, .28); background: rgba(255, 255, 255, .07); color: var(--paper); }
.nav-button.active::before { position: absolute; left: -21px; top: 12px; bottom: 12px; width: 2px; content: ""; background: var(--gold); }
.nav-glyph { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid rgba(154, 188, 166, .25); color: var(--jade-light); font: 13px var(--display); }
.nav-button strong, .nav-button small { display: block; }
.nav-button strong { font: 13px var(--display); }
.nav-button small { color: rgba(243, 240, 231, .34); font-size: 8px; }

.realm-route { margin-top: 30px; padding-top: 17px; border-top: 1px solid rgba(243, 240, 231, .12); }
.side-heading { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; color: rgba(243, 240, 231, .46); font-size: 9px; }
.realm-route ol { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.realm-route li { display: grid; grid-template-columns: 20px 1fr; align-items: center; gap: 8px; min-height: 28px; color: rgba(243, 240, 231, .35); }
.realm-route li span { width: 17px; height: 17px; display: grid; place-items: center; border: 1px solid rgba(243, 240, 231, .15); border-radius: 50%; font-size: 7px; }
.realm-route li strong { font: 11px var(--display); }
.realm-route li.current { color: var(--gold); }
.realm-route li.current span { border-color: var(--gold); }
.realm-route li.completed { color: var(--jade-light); }
.realm-route li.completed span { background: var(--jade); border-color: var(--jade); color: var(--paper); }
.side-bottom { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 7px; margin-top: auto; padding-top: 18px; color: rgba(243, 240, 231, .5); font-size: 9px; }
.side-bottom small, .side-bottom button { grid-column: 2; }
.side-bottom small { color: rgba(243, 240, 231, .28); }

.main-shell { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 15; min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 10px clamp(18px, 4vw, 52px); border-bottom: 1px solid var(--line); background: rgba(243, 240, 231, .92); backdrop-filter: blur(14px); }
.breadcrumb { display: flex; align-items: center; gap: 9px; color: rgba(20, 33, 38, .46); font-size: 10px; }
.breadcrumb i { color: rgba(20, 33, 38, .2); font-style: normal; }
.breadcrumb strong { color: var(--jade); font: 15px var(--display); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.save-status { display: inline-flex; align-items: center; gap: 6px; color: rgba(20, 33, 38, .52); font-size: 9px; }
.status-dot { width: 6px; height: 6px; display: inline-block; flex: 0 0 6px; border-radius: 50%; background: var(--jade-light); box-shadow: 0 0 0 3px rgba(154, 188, 166, .08); }
.status-dot.unsaved { background: var(--gold); }
.herb-badge, .ore-badge, .stone-badge { padding: 5px 9px; border: 1px solid rgba(71, 116, 93, .2); background: rgba(71, 116, 93, .06); color: var(--jade); font: 11px var(--display); }
.stone-badge { border-color: rgba(196, 165, 106, .35); background: rgba(196, 165, 106, .1); color: #876b36; }
.quiet-button { min-height: 34px; padding: 5px 11px; background: transparent; border: 1px solid var(--line); color: var(--ink-soft); font-size: 10px; }
.quiet-button:hover { background: rgba(20, 33, 38, .05); }

#workspace { max-width: 1120px; margin: 0 auto; padding: 32px clamp(18px, 5vw, 70px) 42px; }
.cultivation-hero { position: relative; height: 320px; overflow: hidden; background: var(--ink-soft); color: var(--paper); }
.cultivation-hero > img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.65) contrast(1.03); }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10, 22, 24, .9), rgba(10, 22, 24, .35) 65%, rgba(10, 22, 24, .1)); }
.hero-copy { position: absolute; left: clamp(25px, 6vw, 65px); top: 50%; transform: translateY(-50%); }
.hero-copy > span { color: var(--gold); font: 10px var(--display); letter-spacing: .35em; }
.hero-copy h1 { margin: 9px 0 3px; font-size: clamp(42px, 7vw, 74px); line-height: 1.05; text-shadow: 0 2px 15px rgba(0, 0, 0, .22); }
.hero-copy p { color: rgba(243, 240, 231, .62); font-size: 12px; }
.hero-copy p b { color: var(--paper); font: 24px var(--display); }
.realm-progress { position: absolute; left: clamp(25px, 6vw, 65px); right: clamp(25px, 6vw, 65px); bottom: 38px; height: 4px; background: rgba(243, 240, 231, .17); }
.realm-progress span { display: block; width: 0; height: 100%; background: var(--gold); transition: width 500ms ease; }
.journey-line { position: absolute; inset: auto 0 0; height: 3px; background: rgba(255, 255, 255, .06); }
.journey-line span { display: block; width: 0; height: 100%; background: var(--jade-light); transition: width 500ms ease; }
.activity-state { position: absolute; right: 20px; top: 18px; max-width: 48%; padding: 5px 9px; background: rgba(10, 22, 24, .58); border: 1px solid rgba(243, 240, 231, .2); color: rgba(243, 240, 231, .8); font-size: 9px; }
.activity-state span { display: block; white-space: nowrap; }

.view-heading { display: flex; justify-content: space-between; align-items: end; margin: 36px 0 18px; }
.eyebrow { display: block; color: var(--jade); font-size: 9px; letter-spacing: .16em; }
.view-heading h2 { margin: 3px 0 0; font-size: 30px; }
.view-content { animation: content-reveal 220ms ease-out both; }
.activity-card { min-height: 128px; display: grid; align-content: center; padding: 22px 26px; border-left: 3px solid var(--jade); background: rgba(71, 116, 93, .07); }
.activity-card strong { display: block; margin: 3px 0; font: 24px var(--display); }
.activity-card p { margin: 3px 0 0; color: rgba(20, 33, 38, .58); font-size: 11px; }
.activity-card.active { grid-template-columns: 1fr auto; align-items: center; background: var(--ink-soft); border-left-color: var(--gold); color: var(--paper); }
.activity-card.active .eyebrow, .activity-card.active p { color: rgba(243, 240, 231, .55); }
.countdown { grid-column: 2; grid-row: 1 / span 3; padding-left: 25px; color: var(--gold); font: clamp(32px, 6vw, 54px) var(--display); letter-spacing: .06em; }
.activity-countdown { grid-column: 2; grid-row: 1 / span 3; padding-left: 25px; color: var(--gold); font: clamp(32px, 6vw, 54px) var(--display); letter-spacing: .06em; }
.activity-card.complete { border-left-color: var(--gold); background: rgba(196, 165, 106, .1); }
.resource-grid, .recipe-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 14px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.resource-stock, .recipe-card { display: grid; align-content: start; gap: 5px; min-height: 150px; padding: 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .16); }
.resource-stock > span, .recipe-card h3 { font: 16px var(--display); }
.resource-stock strong { color: var(--jade); font: 30px var(--display); }
.resource-stock small, .recipe-card small { color: rgba(20, 33, 38, .56); font-size: 10px; }
.resource-stock.locked, .recipe-card.locked { opacity: .48; }
.recipe-card h3 { margin: 0; }
.recipe-card p { margin: 0; min-height: 32px; color: rgba(20, 33, 38, .62); font-size: 11px; }
.recipe-card .action-button, .resource-stock .action-button { align-self: end; min-height: 82px; margin: 5px -16px -16px; border-top: 1px solid var(--line); }
.artifact-panel { display: grid; gap: 4px; margin-top: 24px; padding: 18px 20px; border-left: 2px solid var(--gold); background: rgba(196, 165, 106, .1); }
.artifact-panel strong { font: 23px var(--display); color: var(--ink-soft); }
.artifact-panel p { margin: 0; color: rgba(20, 33, 38, .62); font-size: 11px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-heading h2, .section-heading h3 { margin: 0; }
.action-heading { margin: 30px 0 12px; }
.action-heading h3 { font-size: 20px; }
.muted, .help-note { color: rgba(20, 33, 38, .52); }
.action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.action-grid.single { grid-template-columns: 1fr; }
.action-button { position: relative; min-height: 120px; display: grid; grid-template-columns: 42px 1fr auto; align-items: start; gap: 13px; padding: 20px; background: rgba(255, 255, 255, .2); border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--ink); text-align: left; transition: background 180ms ease, transform 180ms ease; }
.action-button:hover:not(:disabled) { z-index: 1; background: rgba(71, 116, 93, .12); transform: translateY(-2px); }
.action-button:disabled, .primary-button:disabled, .secondary-button:disabled, .quiet-button:disabled { cursor: not-allowed; opacity: .42; }
.action-glyph { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(71, 116, 93, .35); background: rgba(71, 116, 93, .06); color: var(--jade); font: 16px var(--display); }
.action-copy { display: grid; gap: 2px; }
.action-copy strong { font: 17px var(--display); }
.action-copy > span { color: rgba(20, 33, 38, .64); font-size: 11px; }
.action-copy small { margin-top: 6px; color: var(--red); font-size: 10px; }
.action-arrow { color: rgba(20, 33, 38, .3); }
.help-note { margin: 18px 0 0; padding-top: 13px; border-top: 1px solid var(--line); font-size: 10px; }
.garden-stock { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 30px; padding: 22px 25px; border: 1px solid var(--line); background: rgba(255, 255, 255, .16); }
.garden-stock strong { display: block; color: var(--jade); font: 38px var(--display); }
.garden-stock strong small { font-size: 12px; }
.garden-stock p { max-width: 520px; margin: 0; color: rgba(20, 33, 38, .62); font: 14px var(--display); }
.bottle-panel { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 24px; margin-top: 24px; padding: 20px 24px; border: 1px solid rgba(71, 116, 93, .22); background: rgba(71, 116, 93, .07); }
.bottle-art { position: relative; display: grid; place-items: center; min-height: 130px; }
.bottle-art img { position: relative; z-index: 1; filter: drop-shadow(0 10px 14px rgba(20, 33, 38, .2)); }
.bottle-ring { position: absolute; width: 92px; height: 92px; border: 1px solid rgba(196, 165, 106, .45); border-radius: 50%; box-shadow: 0 0 0 12px rgba(196, 165, 106, .08); }
.bottle-panel strong { display: block; margin-top: 5px; color: var(--jade); font: 42px var(--display); line-height: 1; }
.bottle-panel strong small { color: rgba(20, 33, 38, .48); font: 12px var(--body); }
.bottle-panel p { margin: 9px 0 0; color: rgba(20, 33, 38, .58); font-size: 11px; }
.herb-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 14px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.herb-stock { display: grid; gap: 4px; min-height: 110px; padding: 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .16); }
.herb-stock span { font: 12px var(--display); }
.herb-stock strong { color: var(--jade); font: 26px var(--display); }
.herb-stock small { color: rgba(20, 33, 38, .52); font-size: 9px; }
.herb-stock.locked { opacity: .48; }
.small-action { align-self: end; min-height: 30px; margin-top: 6px; padding: 4px 7px; border: 1px solid rgba(196, 165, 106, .4); background: rgba(196, 165, 106, .08); color: #765d2e; font-size: 9px; }
.small-action:hover { background: rgba(196, 165, 106, .16); }

.recent-section { margin-top: 43px; padding-top: 24px; border-top: 1px solid var(--line); }
.recent-log, .journal-list { margin-top: 14px; }
.log-row { display: grid; grid-template-columns: 145px 1fr; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.log-time { color: var(--jade); font: 11px var(--display); }
.log-row p { margin: 0; color: #415052; font-size: 12px; }
.log-row.breakthrough .log-time { color: var(--gold); }
.log-row.gain .log-time { color: #628d75; }
.journal-intro { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.journal-intro h3 { margin: 4px 0 0; font-size: 18px; }
.empty-state { max-width: 520px; margin: 32px auto; text-align: center; }
.empty-state > span { width: 62px; height: 62px; display: grid; place-items: center; margin: 0 auto 15px; border: 1px solid rgba(71, 116, 93, .3); border-radius: 50%; color: var(--jade); font: 23px var(--display); }
.empty-state h3 { margin-bottom: 5px; font-size: 21px; }
.empty-state p { color: rgba(20, 33, 38, .58); }
.page-footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); color: rgba(20, 33, 38, .4); font-size: 9px; letter-spacing: .08em; }

.primary-button, .secondary-button, .file-button { min-height: 41px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 15px; text-decoration: none; }
.primary-button { background: var(--jade); border: 1px solid var(--jade); color: var(--paper); }
.primary-button:hover:not(:disabled) { background: #315e49; }
.secondary-button, .file-button { background: transparent; border: 1px solid rgba(20, 33, 38, .25); color: var(--ink-soft); }
.secondary-button:hover:not(:disabled), .file-button:hover { background: rgba(20, 33, 38, .05); }
.text-button { padding: 0; background: transparent; border: 0; color: var(--jade-light); font-size: 9px; text-align: left; }
.main-shell .text-button, dialog .text-button { color: var(--jade); }
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }

dialog { width: min(620px, calc(100vw - 32px)); max-height: min(84vh, 780px); padding: 25px 27px 28px; overflow: auto; background: var(--paper); border: 1px solid #cfc7b8; border-radius: var(--radius); box-shadow: 0 30px 100px rgba(5, 12, 14, .42); color: var(--ink); }
dialog::backdrop { background: rgba(8, 17, 19, .72); backdrop-filter: blur(4px); }
dialog[open] { animation: dialog-arrive 180ms ease-out both; }
.modal-heading { display: flex; align-items: center; justify-content: space-between; }
dialog h2 { margin: 8px 0 18px; font-size: 28px; }
dialog p, .instructions { color: rgba(20, 33, 38, .7); font-size: 12px; }
.instructions { padding-left: 20px; }
.icon-button { width: 34px; height: 34px; background: transparent; border: 1px solid var(--line); color: var(--ink-soft); font-size: 22px; line-height: 1; }
.save-summary { display: grid; margin: 18px 0; padding: 15px 17px; background: rgba(71, 116, 93, .08); border-left: 2px solid var(--jade); }
.save-summary span { color: rgba(20, 33, 38, .52); font-size: 10px; }
.save-summary strong { font: 17px var(--display); }
.save-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.storage-warning { padding: 10px 12px; border-left: 2px solid var(--danger); background: rgba(183, 95, 81, .1); }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; padding-top: 13px; border-top: 1px solid var(--line); }
.danger-zone p { margin: 0; font-size: 10px; }
.danger-text { color: var(--danger) !important; }
.realm-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px 20px; margin: 18px 0; padding: 0; list-style: none; }
.realm-list li { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); color: rgba(20, 33, 38, .52); }
.realm-list li > span { font-size: 9px; }
.realm-list li strong { font: 13px var(--display); }
.realm-list li small { color: var(--red); font-size: 8px; }
.realm-list li.current { color: var(--jade); }
.realm-list li.completed { color: rgba(71, 116, 93, .64); }
.toast { position: fixed; right: 23px; bottom: 23px; z-index: 80; max-width: min(390px, calc(100vw - 32px)); padding: 12px 16px; background: var(--ink-soft); border: 1px solid rgba(154, 188, 166, .35); border-radius: var(--radius); box-shadow: 0 18px 50px rgba(9, 18, 20, .18); color: var(--paper); font-size: 11px; animation: toast-arrive 180ms ease-out both; }
.noscript { position: fixed; inset: auto 0 0; z-index: 100; padding: 12px; background: var(--red); color: white; text-align: center; }

@keyframes content-reveal { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@keyframes dialog-arrive { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes toast-arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 860px) {
  .app-shell { display: block; }
  .sidebar { position: sticky; width: 100%; height: auto; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px 20px; padding: 10px 16px; overflow: visible; }
  .brand { font-size: 16px; }
  .brand-mark { width: 33px; height: 33px; flex-basis: 33px; font-size: 16px; }
  .brand small, .side-caption, .realm-route, .side-bottom { display: none; }
  .navigation { display: flex; justify-content: flex-end; gap: 2px; }
  .nav-button { width: auto; min-height: 38px; grid-template-columns: 22px auto; padding: 5px 8px; }
  .nav-button.active::before, .nav-button small { display: none; }
  .nav-glyph { width: 21px; height: 21px; font-size: 10px; }
  .topbar { top: 55px; }
}

@media (max-width: 620px) {
  body { font-size: 13px; }
  .sidebar { position: static; display: block; padding: 11px 12px 8px; }
  .brand { justify-content: center; margin-bottom: 8px; }
  .navigation { justify-content: stretch; overflow-x: auto; }
  .nav-button { flex: 1 0 auto; justify-content: center; text-align: center; }
  .topbar { position: static; min-height: 48px; padding: 8px 13px; }
  .breadcrumb > span, .breadcrumb i, .save-status { display: none; }
  .topbar-actions { margin-left: auto; }
  .stone-badge, .herb-badge, .ore-badge { padding: 4px 7px; font-size: 10px; }
  #workspace { padding: 16px 14px 34px; }
  .cultivation-hero { height: 250px; }
  .hero-copy { left: 24px; }
  .hero-copy h1 { font-size: 42px; }
  .realm-progress { left: 24px; right: 24px; bottom: 32px; }
  .activity-state { left: 20px; right: auto; top: 17px; max-width: calc(100% - 40px); }
  .view-heading { margin-top: 27px; }
  .view-heading h2 { font-size: 26px; }
  .activity-card { padding: 19px; }
  .activity-card.active { grid-template-columns: 1fr; }
  .countdown, .activity-countdown { grid-column: 1; grid-row: auto; padding: 8px 0 0; font-size: 42px; }
  .action-grid, .save-actions, .realm-list { grid-template-columns: 1fr; }
  .garden-stock { grid-template-columns: 1fr; gap: 6px; }
  .bottle-panel { grid-template-columns: 90px 1fr; gap: 16px; padding: 16px; }
  .herb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .resource-grid, .recipe-grid { grid-template-columns: 1fr; }
  .log-row { grid-template-columns: 105px 1fr; gap: 12px; }
  .journal-intro { align-items: start; flex-direction: column; }
  .page-footer { display: grid; }
  dialog { padding: 21px 19px 23px; }
  .toast { right: 16px; bottom: 16px; }
}

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

.longevity-panel { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; padding: 13px 16px; border-left: 2px solid var(--red); background: rgba(183, 95, 81, .08); }
.longevity-panel strong { font: 18px var(--display); color: var(--red); }
.longevity-panel p { margin: 0; color: var(--ink-soft); font-size: 11px; }
@media (max-width: 620px) { .longevity-panel { display: grid; gap: 5px; } }
