
*{box-sizing:border-box; user-select:none; -webkit-user-select:none}
.skip-link{position:fixed;top:6px;left:6px;z-index:10000;transform:translateY(-150%);padding:9px 12px;color:#111;background:#f5d7a9;border:2px solid #111}
.skip-link:focus{transform:none}
.keyboard-box{max-width:460px;height:auto;max-height:86vh}
.metrics-box{max-width:520px;height:auto;max-height:86vh}
.metrics-box .modal-head{flex:none}
.metrics-box .modal-body{display:flex;flex-direction:column;gap:12px;overflow:auto}
.metrics-box .modal-body>*{flex:none;min-width:0}
.metrics-box p{margin:0;line-height:1.5}
.metrics-note{font-size:.85rem;color:var(--ui-muted)}
#pwa-settings{margin:10px 0;padding:10px 0;border-block:1px solid var(--ui-line)}
#pwa-settings button{display:block;min-height:44px;width:100%;margin-top:8px;white-space:normal}
#pwa-install{border:1px solid var(--ui-brass);border-radius:3px;background:var(--ui-control)}
#pwa-install:hover{background:var(--ui-hover)}
.modal-box.app-settings-box{height:auto;max-width:480px;max-height:86dvh}
.app-settings-box .modal-head{flex:none}
.app-settings-box .modal-body{overflow:auto;font: .9rem/1.5 system-ui,sans-serif}
.app-settings-box p{margin:0 0 10px}
body > header:has(#pwa-notice:not([hidden])){flex-wrap:wrap;--menu-clearance:210px}
#pwa-notice{display:flex;align-items:center;gap:12px;flex:0 0 100%;min-width:0;padding:9px 0 2px;border-top:1px solid var(--ui-line);font:.8rem/1.45 system-ui,sans-serif}
#pwa-notice p{flex:1;min-width:0;margin:0;color:var(--ui-text)}
.pwa-notice-actions{display:flex;gap:6px;flex:none}
header #pwa-notice button{min-height:44px;padding:7px 12px;font:600 .8rem/1.2 system-ui,sans-serif;border:1px solid var(--ui-brass);border-radius:3px;white-space:normal}
header #pwa-notice-update{background:var(--ui-control);color:var(--ui-paper)}
header #pwa-notice-later{border-color:transparent;color:var(--ui-muted)}
#pwa-menu-badge{margin-left:auto;padding:3px 5px;border:1px solid var(--ui-brass);border-radius:3px;color:var(--ui-paper);font:.65rem/1.2 system-ui,sans-serif}
@media(max-width:600px){#pwa-notice{align-items:flex-start;flex-wrap:wrap;gap:5px}#pwa-notice p{flex:0 0 100%}.pwa-notice-actions{margin-left:auto}}
@media(max-width:360px){body > header{gap:6px}.stats.live{max-width:124px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}}
.app-popover{max-height:calc(100dvh - 80px);overflow-y:auto;overscroll-behavior:contain}
.utility-actions{max-height:calc(100dvh - var(--menu-clearance,90px));overflow-y:auto;overscroll-behavior:contain}
.metrics-actions{display:flex;flex-wrap:wrap;gap:8px}
.metrics-actions button{flex:1 1 145px}
.metrics-box .metrics-actions button{min-width:0;min-height:44px;height:auto;white-space:normal;overflow-wrap:anywhere}
@media(max-width:440px){.metrics-box .metrics-actions{flex-direction:column}.metrics-box .metrics-actions button{flex:none;width:100%}}
.metrics-box a{color:var(--ui-paper);text-decoration:underline}
#metrics-state{min-height:1.5em}
#metrics-choice{position:absolute;bottom:8px;left:8px;right:8px;z-index:9;max-width:520px;margin:auto;padding:12px;border:1px solid var(--ui-line);background:var(--ui-chrome);color:var(--ui-text);border-radius:3px;font:14px/1.5 system-ui}
#metrics-choice p{margin:0 0 8px}
#metrics-choice button{min-height:40px;font:inherit}
#metrics-choice .metrics-actions button{flex:1 1 0}
#metrics-choice .metrics-actions #metrics-details{flex:0 0 100%;min-height:28px;background:transparent;border:0;text-decoration:underline}
#metrics-choice :focus-visible,.metrics-box :focus-visible{outline:3px solid var(--ui-paper);outline-offset:3px}
body:has(.modal.open) #metrics-choice,#canvas-container:has(#journey-goal:not([hidden])) #metrics-choice,#canvas-container:has(#onboarding-note:not([hidden])) #metrics-choice{display:none}
[hidden]{display:none!important}
.keyboard-box .modal-body{display:grid;gap:10px}
.keyboard-box label{font-weight:600}
.keyboard-box select{width:100%;padding:10px;background:#192b3c;color:#f1f3f2;border:1px solid #718594;border-radius:4px;font:inherit}
.keyboard-actions{display:flex;flex-wrap:wrap;gap:8px}
.keyboard-box :focus-visible,#btn-keyboard:focus-visible{outline:3px solid #f0c889;outline-offset:2px}
#keyboard-status{min-height:1.5em;margin:0}
#keyboard-overview{max-height:130px;overflow:auto;margin:0;padding-left:22px;line-height:1.5}
@media(max-width:850px){.footer-secondary #btn-keyboard{grid-column:1/-1}}
@media(max-width:850px){.footer-secondary #btn-motion{grid-column:1/-1}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}
@media(max-height:500px){html body{display:flex;flex-direction:column;height:auto;min-height:100dvh;overflow-y:auto}body > header,body > footer{flex:none}#canvas-container{flex:none;height:180px;min-height:180px;width:100%}body > footer{overflow:visible}}
#journey-goal{position:absolute;bottom:14px;left:16px;z-index:5;width:min(320px,calc(100% - 32px));padding:13px 16px 10px;border:1px solid #bd9d71;border-radius:5px 8px 6px 9px;background:#ead7b6;box-shadow:0 10px 24px rgba(0,0,0,.28);color:#34291f;font:0.94rem/1.42 Georgia,serif;pointer-events:auto;transform:rotate(-1deg)}
#journey-goal .hint-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:6px;padding-bottom:4px;border-bottom:1px solid rgba(82,60,38,.35)}
#journey-goal .note-label{font-size:.9rem;font-weight:700}
#journey-hint-text{display:block}
#journey-hint-status,#journey-hint-help-text{margin:7px 0 0;font-size:.78rem;line-height:1.35}
#journey-hint-status{color:#704120}
#journey-hint-status[data-kind="solved"]{color:#235a39;font-weight:700}
#journey-hint-help-text{padding:6px 0 0;border-top:1px dashed rgba(82,60,38,.3)}
#journey-goal .hint-actions{display:flex;flex-wrap:wrap;justify-content:space-between;gap:4px 12px;margin-top:8px}
#journey-goal .hint-actions button{min-height:44px;padding:6px 0;background:transparent;border:0;color:#624326;font:0.78rem/1.35 system-ui,sans-serif;text-decoration:underline;text-underline-offset:2px;white-space:normal;text-align:left}
#journey-goal .hint-actions button:hover{background:transparent;color:#2d2119}
#journey-goal .hint-actions button[hidden]{display:none}
#journey-goal[hidden],#journey-panel[hidden],#journey-hint-links[hidden]{display:none}
#journey-goal{max-height:calc(100% - 28px);overflow:auto;overscroll-behavior:contain;transform:none}
#journey-hint-title{min-width:0;overflow-wrap:anywhere}
#journey-hint-links{display:flex;flex-wrap:wrap;gap:4px 10px;margin-top:8px}
#journey-hint-links button{min-height:44px;padding:6px 8px;border-color:rgba(82,60,38,.45);background:transparent;color:#624326;font:.8rem/1.4 system-ui,sans-serif;white-space:normal}
#journey-hint-links a{display:inline-flex;align-items:center;min-height:44px;color:#624326;font:.8rem/1.4 system-ui,sans-serif;text-underline-offset:3px}
#journey-goal[data-mode="curiosity"] #journey-hint-text{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
body.ui-hidden #journey-goal{display:none}
#journey-panel{margin-bottom:14px;font-size:.8rem;line-height:1.5}
#journey-panel summary{cursor:pointer;padding:8px 0;color:var(--ui-paper)}
#journey-panel p{color:var(--ui-muted)}
#journey-panel .journey-badges{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
#journey-panel section{min-width:0;padding:12px;border:1px solid var(--ui-line);border-radius:6px;background:var(--ui-control)}
#journey-panel .journey-badge-head{display:grid;grid-template-columns:40px minmax(0,1fr) auto;align-items:center;gap:10px;color:var(--ui-text)}
#journey-panel .journey-badge-icon{width:36px;height:36px;color:var(--ui-paper);fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;overflow:visible}
#journey-panel [data-state=new] .journey-badge-icon{color:var(--ui-muted)}
#journey-panel .journey-badge-count{white-space:nowrap;color:var(--ui-paper);font-variant-numeric:tabular-nums}
#journey-panel progress{display:block;appearance:none;width:100%;height:3px;margin:10px 0;border:0;border-radius:2px;overflow:hidden;background:var(--ui-hover);color:var(--ui-brass);accent-color:var(--ui-brass)}
#journey-panel progress::-webkit-progress-bar{background:var(--ui-hover)}
#journey-panel progress::-webkit-progress-value{background:var(--ui-brass)}
#journey-panel progress::-moz-progress-bar{background:var(--ui-brass)}
#journey-panel section p{font-size:.72rem;line-height:1.4;margin:5px 0 8px}
#journey-panel section li{font-size:.72rem;overflow-wrap:anywhere}
#journey-panel small{display:block;font-size:.72rem;color:var(--ui-muted)}
#journey-panel .journey-badge-state{margin-top:6px}
#journey-panel .earned{border-color:var(--ui-brass)}
#journey-panel .earned .journey-badge-state{color:var(--ui-paper)}
#journey-panel .journey-expedition-start{display:block;min-height:44px;width:100%;margin-top:10px;padding:8px;font:.8rem/1.35 system-ui,sans-serif;white-space:normal}
#journey-panel .journey-pack.active{border-color:var(--ui-brass)}
@media(max-width:440px){#journey-panel .journey-badges{grid-template-columns:1fr}}
#journey-panel strong{display:block}
#journey-panel ul{list-style:none;margin:8px 0;padding:0;color:var(--ui-muted)}
body{margin:0; background:#050712; color:#e2e8f0; font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif; overflow:hidden; display:flex; flex-direction:column; height:100vh; height:100dvh}
#bg{position:fixed; inset:0; z-index:0; pointer-events:none; overflow:hidden; background:#050712}
#bg-canvas{position:absolute; inset:0; width:100%; height:100%; opacity:.9; filter:blur(46px)}
#canvas-container{flex:1; position:relative; width:100%; z-index:1; overflow:hidden; background:transparent}
#main-canvas{display:block; width:100%; height:100%; cursor:grab; position:relative; z-index:2; touch-action:none}
#main-canvas:active{cursor:grabbing}
#main-canvas.delete-mode,#main-canvas.delete-mode:active{cursor:url("delete-cursor.svg") 16 16,crosshair}
#toast-completion{margin-top:7px;padding-top:7px;border-top:1px solid var(--ui-line);color:var(--ui-text);font-size:.8rem;line-height:1.4;overflow-wrap:anywhere}
#onboarding-spotlight{position:absolute;z-index:3;left:50%;top:50%;width:210px;height:170px;transform:translate(-50%,-50%);border:2px dashed rgba(255,221,169,.75);border-radius:50%;box-shadow:0 0 0 8px rgba(255,221,169,.045);pointer-events:none}
#onboarding-note{position:absolute;z-index:6;left:50%;top:calc(50% - 245px);width:min(320px,calc(100% - 28px));transform:translateX(-50%) rotate(-1.4deg);padding:15px 42px 12px 17px;border:1px solid rgba(255,219,164,.58);border-radius:13px 17px 12px 19px;background:rgba(31,37,53,.97);box-shadow:3px 7px 0 rgba(0,0,0,.13),0 14px 38px rgba(0,0,0,.27);color:#f7e7ca;font-family:inherit;font-size:1rem;line-height:1.5}
#onboarding-note[data-step=book]{top:18px;left:auto;right:18px;transform:rotate(1.2deg)}
#onboarding-note[data-step=pick]{top:auto;bottom:20px}
#onboarding-arrow{position:fixed;inset:0;width:100%;height:100%;z-index:12;pointer-events:none;overflow:visible;fill:none;stroke:#ffe0a2;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round;filter:drop-shadow(0 1px 3px rgba(0,0,0,.5))}
#onboarding-arrow[hidden]{display:none}
#onboarding-message{display:block}
#onboarding-note button{font-family:inherit;font-size:.875rem;padding:7px 12px;margin-top:9px;color:#f7e7ca;background:rgba(255,223,173,.09);border-color:rgba(255,223,173,.35)}
#onboarding-note #onboarding-close{position:absolute;right:8px;top:5px;margin:0;padding:0;width:26px;height:26px;border:0;background:transparent;font:1.3rem system-ui,sans-serif;color:#f7e7ca}
#onboarding-note[hidden],#onboarding-spotlight[hidden]{display:none}
.onboarding-target{position:relative;z-index:11;outline:2px solid #ffdfa5;outline-offset:3px;box-shadow:0 0 20px rgba(255,217,157,.35)!important}
body.ui-hidden #onboarding-note,body.ui-hidden #onboarding-spotlight,body.ui-hidden #onboarding-arrow{display:none}
@media(max-width:700px){#onboarding-note{top:10px}#onboarding-note[data-step=book]{top:10px;right:10px}#onboarding-note[data-step=pick]{bottom:12px}#onboarding-spotlight{width:175px;height:140px}}
.info-block #btn-tour{margin-bottom:11px;border-color:rgba(255,223,173,.32);color:#f7e7ca}
#toast{position:absolute; top:18px; left:50%; transform:translateX(-50%) translateY(-130px); background:rgba(15,23,42,0.94); backdrop-filter:blur(24px); border:1px solid rgba(125,211,252,0.35); color:#fff; padding:11px 20px; border-radius:18px; text-align:center; transition:transform 0.6s cubic-bezier(0.16,1,0.3,1), opacity 0.35s; pointer-events:none; opacity:0; box-shadow:0 12px 40px rgba(0,0,0,0.55); z-index:20; min-width:170px; max-width:86%}
#toast.show{transform:translateX(-50%) translateY(0); opacity:1}
.startup-error{position:fixed;inset:0;z-index:100;background:#050712;color:#e2e8f0;place-items:center;padding:24px;text-align:center}.startup-error-visible{overflow:hidden}.startup-error[hidden]{display:none}.startup-error:not([hidden]){display:grid}.startup-error>div{max-width:440px;padding:28px;border:1px solid rgba(125,211,252,.3);border-radius:22px;background:rgba(15,23,42,.96);box-shadow:0 18px 60px rgba(0,0,0,.45)}.startup-error h1{margin:0 0 12px;font-size:1.35rem}.startup-error p{margin:8px 0;color:#cbd5e1;line-height:1.45}.startup-error button{margin-top:14px}
#btn-pick.limit-reached,#btn-rand.limit-reached{position:relative;border-color:rgba(125,211,252,.72);box-shadow:0 0 0 1px rgba(125,211,252,.12),0 0 18px rgba(56,189,248,.12)}
#toast .title{font-size:0.58rem; text-transform:uppercase; letter-spacing:0.12em; color:#7dd3fc; margin-bottom:2px; font-weight:600}
#toast .name{font-size:1.05rem; font-weight:600} #toast .formula{font-size:0.78rem; color:#94a3b8}
header{position:relative; z-index:10; padding:10px 14px; background:rgba(12,18,35,0.82); backdrop-filter:blur(20px); border-bottom:1px solid rgba(255,255,255,0.07); display:flex; justify-content:space-between; align-items:center; gap:8px; flex-wrap:wrap}
.brand{position:relative}
#app-name-btn{background:transparent;border:1px solid var(--ui-line);border-radius:4px;padding:5px 7px;margin:0;cursor:pointer;color:inherit;font:inherit;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:3px;min-height:44px}
h1{margin:0; font-size:1rem; font-weight:800; letter-spacing:0.02em; color:#e2e8f0}
h1 .dot{color:#7dd3fc; font-weight:800}
.brand-caption{display:flex;align-items:center;gap:6px;color:var(--ui-text);font:600 .65rem/1.1 system-ui,sans-serif;white-space:nowrap}
.brand-caption svg{width:16px;height:16px;flex:none}
#app-name-btn[aria-expanded=true] .brand-caption svg{transform:rotate(180deg)}
.app-popover{position:absolute; top:calc(100% + 10px); left:0; width:270px; max-width:82vw; background:rgba(15,23,42,0.98); border:1px solid rgba(255,255,255,0.12); border-radius:14px; padding:14px 15px; box-shadow:0 16px 40px rgba(0,0,0,0.55); z-index:30; opacity:0; transform:translateY(-6px); pointer-events:none; transition:opacity 0.18s, transform 0.18s}
.app-popover.open{opacity:1; transform:translateY(0); pointer-events:auto}
.app-popover p{margin:0 0 8px; font-size:0.78rem; line-height:1.45; color:rgba(226,232,240,0.88)}
.app-popover .author{font-size:0.68rem; color:#7dd3fc}
.app-popover .support-link{display:inline-flex; align-items:center; gap:5px; margin-top:10px; padding:7px 10px; border-radius:100px; color:#fff7ed; background:rgba(251,146,60,.16); border:1px solid rgba(251,146,60,.35); text-decoration:none; font-size:.72rem; font-weight:650}
.app-popover .support-link:hover{background:rgba(251,146,60,.27)}
.app-popover .legal-link{display:block;width:max-content;margin-top:10px;color:rgba(226,232,240,.45);font-size:.64rem;text-decoration:none}.app-popover .legal-link:hover{color:#7dd3fc}
.header-right,.game-actions,.utility-actions{display:flex;align-items:center;gap:6px}
.header-right{justify-content:flex-end}
.utility-actions{padding-left:10px;border-left:1px solid rgba(255,255,255,.12)}
.utility-mobile-only,.utility-label,#btn-more{display:none}
.stats{font-size:0.7rem; background:rgba(255,255,255,0.07); border:1px solid rgba(255,255,255,0.1); padding:5px 9px; color:#94a3b8; white-space:nowrap}
.stats.live{color:#7dd3fc;height:33px;border-color:rgba(125,211,252,0.35); background:rgba(125,211,252,0.12)}
.stats.live:hover{color:#e0f7ff;background:rgba(125,211,252,.2)}
#btn-book{display:inline-flex;align-items:center;white-space:nowrap;gap:2px}
.count{font-size:0.68rem; color:rgba(255,255,255,0.45); background:rgba(0,0,0,0.32); padding:4px 8px; border-radius:100px; white-space:nowrap}
.iconbtn{opacity:0.72}
.iconbtn:hover{opacity:1}
.homebtn{display:grid;place-items:center;width:32px;height:32px;padding:0;text-decoration:none;color:rgba(226,232,240,.72);border:1px solid rgba(255,255,255,.1);border-radius:50%;background:rgba(255,255,255,.055);font-size:.94rem;transition:all .18s ease}.homebtn:hover{color:#fff;background:rgba(255,255,255,.14)}
@media(max-width:850px){
  header{flex-wrap:nowrap;padding:8px 10px}
  .brand{flex:none}
  .header-right{margin-left:auto;gap:5px;min-width:0}
  .game-actions{gap:5px}
  .game-actions .count,.game-actions #btn-info,.game-actions #btn-hud{display:none}
  #btn-more{display:grid;place-items:center;width:36px;height:36px;padding:0;font-size:1.4rem;line-height:1}
  .utility-actions{position:absolute;top:calc(100% + 8px);right:10px;z-index:30;display:flex;flex-direction:column;align-items:stretch;width:min(260px,calc(100vw - 20px));padding:8px;border:1px solid rgba(255,255,255,.16);border-radius:14px;background:rgba(15,23,42,.98);box-shadow:0 16px 40px rgba(0,0,0,.5);opacity:0;visibility:hidden;pointer-events:none;transform:translateY(-6px);transition:opacity .18s,transform .18s,visibility .18s}
  .utility-actions.open{opacity:1;visibility:visible;pointer-events:auto;transform:translateY(0)}
  .utility-actions .utility-mobile-only,.utility-actions .utility-label{display:flex}
  .utility-actions :is(button,a){display:flex;align-items:center;justify-content:flex-start;gap:8px;width:100%;min-height:40px;height:auto;padding:8px 10px;border:0;border-radius:9px;background:transparent;color:#e2e8f0;font-size:.82rem;text-decoration:none;opacity:1}
  .utility-actions :is(button,a):hover{background:rgba(255,255,255,.1);transform:none}
  .utility-actions .utility-icon,.utility-actions svg{width:24px;flex:none;text-align:center}
  .utility-actions #btn-home{margin-top:4px;border-top:1px solid rgba(255,255,255,.12);border-radius:0}
}
@media(max-width:360px){header{padding-inline:7px}.game-actions #live-count{padding:5px 6px;font-size:.72rem}.game-actions #btn-book{padding:7px 6px}}
#btn-hud{display:flex;align-items:center}#btn-show-ui{display:none;position:fixed;z-index:60;right:14px;top:14px;padding:8px 11px;background:rgba(12,18,35,.8);backdrop-filter:blur(16px);border-color:rgba(255,255,255,.17)}header,footer{transition:opacity .25s ease,transform .25s ease}body.ui-hidden header,body.ui-hidden footer{opacity:0;transform:translateY(-12px);pointer-events:none}body.ui-hidden footer{transform:translateY(12px)}body.ui-hidden #btn-show-ui{display:block}
footer{position:relative; z-index:10; padding:8px 10px 10px; background:rgba(12,18,35,0.84); backdrop-filter:blur(20px); border-top:1px solid rgba(255,255,255,0.07); display:flex; gap:6px; justify-content:center; align-items:center; flex-wrap:wrap}
button{background:rgba(255,255,255,0.07); color:#e2e8f0; border:1px solid rgba(255,255,255,0.1); padding:9px 14px; border-radius:100px; font-size:0.82rem; font-weight:500; cursor:pointer; transition:all 0.18s ease}
button:hover{background:rgba(255,255,255,0.12)} button:active{transform:scale(0.95)}
button.danger-active{background:rgba(248,113,113,0.22); border-color:rgba(248,113,113,0.55); color:#fca5a5}
button.icon{padding:8px 11px; font-size:0.95rem; line-height:1;height:33px;}
.zoombar{display:flex; gap:4px; align-items:center; background:rgba(0,0,0,0.28); padding:3px 6px; border-radius:100px; border:1px solid rgba(255,255,255,0.08)}
.zoombar button{padding:6px 9px; font-size:0.8rem}
.tempbar{display:flex; gap:6px; align-items:center; background:rgba(0,0,0,0.28); padding:4px 8px 4px 10px; border-radius:100px; border:1px solid rgba(255,255,255,0.08)}
.tempbar input{width:88px; accent-color:#7dd3fc}
.phase-label{font-size:0.72rem; color:rgba(255,255,255,0.4); text-transform:uppercase; letter-spacing:0.04em; min-width:52px; text-align:center}
.modal{position:fixed; inset:0; z-index:50; display:none; align-items:center; justify-content:center; background:rgba(0,0,0,0.62); backdrop-filter:blur(14px); padding:14px; touch-action:pan-y}
.modal.open{display:flex}
.modal-box{width:100%; max-width:560px; height:86vh; max-height:86vh; display:flex; flex-direction:column; background:rgba(15,23,42,0.98); border:1px solid rgba(255,255,255,0.12); border-radius:20px; box-shadow:0 20px 60px rgba(0,0,0,0.7); overflow:hidden}
.modal-head{display:flex; justify-content:space-between; align-items:center; padding:16px 16px 12px; border-bottom:1px solid rgba(255,255,255,0.08); flex-shrink:0}
.modal-head h2{margin:0; font-size:1rem; font-weight:600}
.modal-body{flex:1; min-height:0; overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; padding:12px 16px 16px; touch-action:pan-y}
.close{width:40px; height:40px; padding:0; line-height:1; border-radius:50%; display:grid; place-items:center; font-size:1.1rem; flex-shrink:0; background:rgba(255,255,255,0.06)}
.close:hover{background:rgba(255,255,255,0.16)}
.picker-legend{margin:0 0 12px;color:#aebed0;font-size:.78rem;line-height:1.4}
.periodic{display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:7px}
.elem{aspect-ratio:1; min-width:0; border-radius:11px; border:1px solid rgba(255,255,255,0.16); background:rgba(255,255,255,0.065); display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; padding:5px 4px 13px; cursor:pointer; transition:background .15s,border-color .15s,transform .15s; position:relative; overflow:hidden}
.elem::before{content:'';position:absolute;inset:0 0 auto;height:2px;background:var(--element-accent);opacity:.75}
.elem:hover{transform:translateY(-1px);background:rgba(255,255,255,.11);border-color:var(--element-accent)}
.elem.inert{opacity:.68}
.elem .sym{font-weight:750;font-size:1.16rem;line-height:1.1}
.elem .element-name{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.76rem;line-height:1.1;color:#e1e8f1}
.elem .num{position:absolute;bottom:3px;left:6px;font-size:.57rem;color:#b3c1d1}
.elem .val{position:absolute;bottom:3px;right:4px;font-size:.52rem;background:rgba(0,0,0,.55);padding:1px 4px;border-radius:100px;color:#e2e8f0}
@media(max-width:480px){.periodic{grid-template-columns:repeat(4,minmax(0,1fr))}}
.book-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.book-item{display:flex;flex-direction:column;min-width:0;padding:11px 12px;border-radius:12px;background:rgba(255,255,255,0.05);border:1px solid rgba(255,255,255,0.08);gap:6px;cursor:pointer;transition:background .18s}
.book-item:hover{background:rgba(255,255,255,0.08)}
.book-item:not(.locked){grid-column:1/-1}
.book-item.locked{flex-direction:row;align-items:center;min-height:40px;padding:8px 10px;gap:8px;opacity:.7;cursor:default;font-size:.76rem}
.book-item.locked .locked-mark{display:grid;place-items:center;flex:none;width:20px;height:20px;border:1px solid rgba(255,255,255,.22);border-radius:50%;color:#bed0dc;font-weight:700}
.book-item .top{display:flex; justify-content:space-between; align-items:center; gap:8px}
.book-item .left{display:flex; flex-direction:column; min-width:0}
.book-item .fname{font-weight:600; font-size:0.88rem}
.book-item .fform{font-size:.85rem;color:var(--ui-muted);line-height:1.5}
.book-status{display:flex;flex-direction:column;align-items:flex-end;gap:5px;flex:none;max-width:45%}
.book-item .book-status .right{white-space:normal;text-align:right}
.book-new{font-size:.75rem;font-weight:700;color:var(--ui-paper);border:1px solid var(--ui-brass);border-radius:3px;padding:3px 7px}
.book-sort-row{display:flex;align-items:center;gap:8px;margin:8px 0 12px;font-size:.85rem;color:var(--ui-muted)}
.book-sort-row select{min-width:0;max-width:100%;flex:1;min-height:44px;padding:6px;background:var(--ui-control);color:var(--ui-text);border:1px solid var(--ui-line);border-radius:3px;font:inherit}
.book-item:not(.expanded) .fform{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.book-item.expanded .book-preview{display:none}
.book-item .right{font-size:0.68rem; color:#7dd3fc; background:rgba(125,211,252,0.12); padding:4px 8px; border-radius:100px; border:1px solid rgba(125,211,252,0.22); white-space:nowrap; flex-shrink:0}
.book-item .book-expand-hint{display:flex;align-items:center;gap:4px;margin-top:6px;color:#a9bdcf;font-size:.66rem;letter-spacing:.01em;opacity:.82}
.book-item .book-expand-icon{font-size:.9rem;line-height:.7;transition:transform .18s ease}
.book-item.expanded .book-expand-icon{transform:rotate(180deg)}
.book-item:focus-visible{outline:2px solid #74d8ff;outline-offset:2px}
.book-item .extra{display:none; margin-top:6px; padding-top:8px; border-top:1px dashed rgba(255,255,255,0.12); gap:6px; flex-direction:column}
.book-item.expanded .extra{display:flex}
.book-item .extra[hidden]{display:none}
.book-toggle{display:block;width:100%;padding:0;border:0;background:transparent;color:inherit;text-align:left;font:inherit;white-space:normal;min-width:0}
.book-toggle:hover,.book-toggle:active{background:transparent;color:var(--ui-paper)}
.book-item:not(.locked){cursor:default}
.practice-question,.practice-challenges{color:var(--ui-text);font:0.85rem/1.55 system-ui,sans-serif}
.practice-question{padding-top:8px;border-top:1px solid var(--ui-line)}
.practice-question h4,.practice-challenges h4{margin:8px 0;font-size:inherit}
.practice-question p,.practice-challenges p{margin:8px 0}
.practice-question summary,.practice-challenges>summary{cursor:pointer;min-height:32px;padding:4px 0;color:var(--ui-paper)}
.practice-question summary:hover,.practice-challenges>summary:hover{color:var(--ui-text)}
.practice-question a{color:var(--ui-muted);text-underline-offset:3px}
.practice-question a:hover{color:var(--ui-paper)}
.practice-question summary:focus-visible,.practice-challenges>summary:focus-visible{outline:2px solid var(--ui-paper);outline-offset:3px}
.practice-challenges{margin:12px 0;padding:8px 12px;border:1px solid var(--ui-line)}
.practice-challenges>section{margin-top:14px;padding:12px;border:1px solid var(--ui-line);border-radius:3px;background:var(--ui-control)}
.practice-task>h4{margin-top:0;color:var(--ui-paper)}
.practice-task>details{margin-top:10px;padding-top:8px;border-top:1px solid var(--ui-line)}
.practice-task>details>summary{cursor:pointer;min-height:44px;display:list-item;padding:10px 0;color:var(--ui-paper)}
.practice-task>details a{color:var(--ui-muted);text-underline-offset:3px}
.practice-task summary:focus-visible{outline:2px solid var(--ui-paper);outline-offset:3px}
.book-item[hidden],#book-search-clear[hidden]{display:none}
.book-search-label,#book-search-status{font:.85rem/1.5 system-ui,sans-serif;color:var(--ui-muted)}
.book-search-label{display:block;margin:14px 0 6px}
#discovery-save-warning{margin:0 0 14px;padding:12px;border:1px solid var(--ui-brass);border-radius:3px;background:var(--ui-control);color:var(--ui-paper);font:.85rem/1.5 system-ui,sans-serif}
#discovery-save-warning p{margin:0 0 10px}
#discovery-save-retry{min-height:44px;white-space:normal}
.book-search-row{display:flex;gap:8px;align-items:center}
#book-search{min-width:0;flex:1;width:100%;min-height:40px;padding:8px 10px;border:1px solid var(--ui-line);border-radius:3px;background:var(--ui-control);color:var(--ui-text);font:inherit}
#book-search-clear{min-height:40px;flex:none}
#book-search-status{min-height:1.5em;margin:5px 0 10px}
.book-item .fact{font-size:.9rem;line-height:1.55;color:var(--ui-text);background:var(--ui-control);padding:10px;border-radius:3px;border-left:2px solid var(--ui-brass)}
.book-item .school-note{display:grid;gap:6px;margin-top:3px;padding:10px;border:1px solid var(--ui-line);border-radius:3px;color:var(--ui-text);background:var(--ui-control);font-size:.9rem;line-height:1.55}
.book-item .school-note b{color:#aee8ff;font-size:.73rem}
.info-block{margin-bottom:14px}
.info-block h3{margin:0 0 6px; font-size:0.8rem; color:#7dd3fc; text-transform:uppercase; letter-spacing:0.06em}
.info-block p, .info-block li{font-size:0.85rem; line-height:1.55; color:rgba(226,232,240,0.88); margin:0 0 4px}
.info-block ul{margin:0; padding-left:18px}
.info-contact{margin:20px 0 0;font:0.85rem/1.55 system-ui,sans-serif;color:var(--ui-muted)}
.info-contact a{color:inherit;text-decoration:underline;text-underline-offset:3px;cursor:pointer}
.info-contact a:hover,.info-contact a:active{color:var(--ui-paper)}
#journey-hint-dismiss{width:44px;height:44px;min-width:44px;padding:0;background:transparent;border:0;color:#624326;font:1.25rem/1 system-ui,sans-serif}
#journey-hint-dismiss:hover{background:transparent;color:#2d2119}
@media(max-width:700px){#journey-goal{left:10px;bottom:10px;width:min(300px,calc(100% - 20px));font-size:.88rem}}
.lang-list{display:flex; flex-direction:column; gap:8px}
.lang-item{display:flex; align-items:center; justify-content:space-between; padding:12px 14px; border-radius:12px; background:rgba(255,255,255,0.05); border:1px solid rgba(255,255,255,0.08); cursor:pointer}
.lang-item.active{border-color:rgba(125,211,252,0.4); background:rgba(125,211,252,0.1)}
.lang-item.disabled{opacity:0.4; cursor:default}
.lang-item .tag{font-size:0.65rem; color:#94a3b8}
.coffee-box{text-align:center; padding:6px 4px}
.coffee-box .cup{font-size:2.4rem; margin-bottom:8px}
.coffee-box p{font-size:0.86rem; line-height:1.55; color:rgba(226,232,240,0.88); margin:0 0 16px}
.coffee-box a.button-link{display:inline-block; text-decoration:none; background:rgba(125,211,252,0.18); border:1px solid rgba(125,211,252,0.35); color:#7dd3fc; padding:11px 20px; border-radius:100px; font-weight:600; font-size:0.88rem}
.privacy-footer-link {
  position: fixed;
  bottom: 8px;
  right: 12px;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 12px;
  color: #b6c0c8;
  text-decoration: none;
  z-index: 9999;
  transition: color 0.2s ease;
}
.privacy-footer-link:hover {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: underline;
}
@media (max-width:700px){.privacy-footer-link{display:none}}

h1{color:#f3eadc;font-family:Georgia,serif;letter-spacing:-.055em;font-size:1.45rem;line-height:1}
h1 .dot{color:#69c9e8}
@media(max-width:850px){h1{font-size:1.14rem}}
.app-popover,.utility-actions.open{background:#152638;border-color:#5d6170}
.app-popover .author{color:#a7ddec}
.app-popover .legal-link:hover{color:#a7ddec}
.stats{background:#1d3038;border-color:#3e5658;color:#c4d4d0}
.stats.live{background:#24483f;border-color:#6da88e;color:#e8fff3}
.stats.live:hover{background:#30574b;color:#fff}
.count{background:#1b2b32;color:#bdcbc8}
.homebtn{border-radius:4px;background:#21353d;border-color:#3d5557;color:#dbece4}
.homebtn:hover{background:#305047}
button:hover{background:#2d4449}
button:focus-visible,a:focus-visible{outline:2px solid #b9efd7;outline-offset:3px}
#btn-book{border-color:#5d9caf;background:#214257;color:#f2fbff}
#btn-book.discover-pulse{animation:book-discovery .9s cubic-bezier(.16,1,.3,1) both}
@keyframes book-discovery{0%{transform:scale(1)}35%{transform:scale(1.2);background:#4a8069;border-color:#e7fff1}100%{transform:scale(1)}}
.zoombar,.tempbar{background:#152638;border-color:#435a67;border-radius:4px;min-height:37px}
#btn-hints{height:37px;min-width:84px;padding:0 9px;border-color:#9d8564;background:#302f31;color:#f0d6ad;font:700 .76rem Georgia,serif}
#btn-hints[aria-expanded="false"]{border-color:#435a67;background:#152638;color:#c8d4d8}
#btn-hints:hover{opacity:1;background:#3b4247}
.tempbar input{accent-color:#8bcce5}
.phase-label{color:#b1c7c1}
#toast{background:#162839;border-color:#b59972;border-radius:8px;color:#f4f1e9}
#toast .title{color:#e2c49c}
#toast .formula{color:#c5d6e0}
#btn-pick{background:#214257;border-color:#5d9caf}
#btn-rand{background:#172b3d;border-color:#435a67}
#btn-show-ui{background:#1a2c34;border-color:#45605e}
.modal{background:rgba(9,20,23,.7)}
.modal-box{background:#152638;border-color:#68606a;box-shadow:0 22px 55px rgba(0,0,0,.42)}
.modal-head{border-bottom-color:#635967}
.modal-head h2{color:#f3eadc;font-family:Georgia,serif}
.close{background:#263c43;color:#e8f0e9}
.close:hover{background:#365158}
.elem{background:#20343c;border-color:#46605f;border-radius:11px}
.elem:hover{background:#2b4849}
.elem .element-name{color:#f0f5ef}
.elem .num{color:#bdd0ca}
.elem .val{background:#12252a;color:#ecf7f0}
.picker-legend{color:#c2d4cd}
.info-block h3{color:#a8e9ce}
.lang-item{background:#20343c;border-color:#46605f}
.lang-item.active{background:#285243;border-color:#95c8a7}
.lang-item .tag{color:#c2d4cd}
.coffee-box a.button-link{background:#a8e9ce;border-color:#a8e9ce;color:#153d34}

#modal-book .modal-box{background:#122339;border-color:#68606a;box-shadow:0 20px 60px rgba(0,0,0,.7)}
#modal-book .close{background:rgba(255,255,255,.06);color:#e2e8f0}
@media(max-width:850px){.utility-actions{background:#1a2c34;border-color:#45605e}.utility-actions :is(button,a):hover{background:#2b4849}}

:root{--ui-chrome:#0b1929;--ui-control:#152839;--ui-hover:#213b50;--ui-line:#786143;--ui-text:#f1e9dc;--ui-muted:#c0c8c8;--ui-cyan:#4dc0ea;--ui-brass:#bf9663;--ui-paper:#e9d5b7}
body > header,body > footer{background-color:var(--ui-chrome);background-image:radial-gradient(circle at 2px 2px,rgba(218,186,139,.045) .6px,transparent .9px),linear-gradient(145deg,#0a1725,#101f30);background-size:23px 19px,auto;border-color:#a47d4d;backdrop-filter:none}
body > header{min-height:78px;padding:12px 28px;box-shadow:0 2px 0 rgba(0,0,0,.25)}
body > footer{gap:16px;padding:15px 22px calc(15px + env(safe-area-inset-bottom,0px));box-shadow:0 -2px 0 rgba(0,0,0,.22)}
header button,footer button{font-family:Georgia,serif;font-size:1rem;font-weight:400;line-height:1.2;color:var(--ui-text);background:transparent;border-color:transparent;border-radius:7px}
header button:hover,footer button:hover{background:rgba(181,148,104,.1);border-color:var(--ui-brass)}
button:focus-visible,a:focus-visible,input:focus-visible{outline:2px solid #efd09b;outline-offset:3px}
header h1{color:#f4e9d6;font-family:system-ui,-apple-system,"Segoe UI",sans-serif;font-size:2.45rem;font-weight:800;letter-spacing:-.065em;line-height:1}
header h1 .dot{color:#27bbee}
#app-name-btn{min-height:44px;align-items:flex-start;gap:3px}
.header-right,.game-actions{gap:10px}
.game-actions #btn-info,.game-actions #btn-hud{display:none}
.utility-actions{position:absolute;top:calc(100% + 1px);right:24px;z-index:30;display:flex;flex-direction:column;align-items:stretch;width:min(280px,calc(100vw - 20px));padding:9px;border:1px solid var(--ui-brass);border-radius:5px;background:#112437;box-shadow:0 18px 40px rgba(0,0,0,.5);opacity:0;visibility:hidden;pointer-events:none;transform:translateY(-6px);transition:opacity .18s,transform .18s,visibility .18s}
.utility-actions.open{opacity:1;visibility:visible;pointer-events:auto;transform:translateY(0)}
header .utility-actions :is(button,a){display:flex;align-items:center;justify-content:flex-start;gap:11px;width:100%;min-height:44px;height:auto;padding:8px 12px;color:var(--ui-text);background:transparent;border:0;border-radius:3px;font:600 .9rem system-ui,-apple-system,"Segoe UI",sans-serif;text-decoration:none;opacity:1}
.utility-actions .utility-mobile-only,.utility-actions .utility-label{display:flex}
.utility-actions .utility-icon,.utility-actions svg{width:21px;height:21px;flex:none;text-align:center}
.utility-actions #btn-home{margin-top:5px;padding-top:11px;border-top:1px solid rgba(191,150,99,.42);border-radius:0}
header .utility-actions #btn-lang{width:100%;letter-spacing:normal}
.count{font-size:.78rem;font-variant-numeric:tabular-nums;color:var(--ui-muted);background:transparent;border:0;padding:0 7px}
.stats.live{height:44px;padding:0 12px;font:600 .78rem system-ui,-apple-system,"Segoe UI",sans-serif;font-variant-numeric:tabular-nums;color:#d9e8e8;background:transparent;border:0;border-bottom:1px solid #678496;border-radius:0}
.stats.live:hover{color:#fff;background:rgba(38,89,110,.2)}
#btn-book{height:48px;padding:0 14px;border:0;background:transparent;color:#f4e9d7;gap:10px}
#btn-book:hover{background:rgba(181,148,104,.1);border-color:transparent}
#total-count{margin-left:0;font:1.05rem Georgia,serif;font-variant-numeric:tabular-nums}
.ui-symbol{width:23px;height:23px;flex:none}
header button.icon,.homebtn{display:grid;place-items:center;width:44px;height:44px;padding:0;border-radius:3px}
#btn-book.icon{display:inline-flex;width:auto}
header .iconbtn{opacity:1}
.header-right > #btn-share{display:inline-flex;align-items:center;gap:12px;width:auto;height:48px;margin-left:6px;padding:0 22px;border-left:1px solid var(--ui-brass);border-right:1px solid var(--ui-brass);border-radius:0;color:#f1e5d1}
.header-right > #btn-share .utility-label{display:inline;font:1.08rem Georgia,serif}
.header-right > #btn-more{display:grid;place-items:center;width:52px;height:48px;padding:0;font:2rem/1 Georgia,serif;color:#f0e3cd}
.utility-actions .iconbtn,.utility-actions .homebtn,#btn-info,#btn-hud{color:var(--ui-muted);background:transparent;border-color:transparent}
.utility-actions .iconbtn:hover,.utility-actions .homebtn:hover,#btn-info:hover,#btn-hud:hover{color:#fff;background:#31414b;border-color:#536a70}
.homebtn{text-decoration:none}
.utility-icon{width:19px;height:19px;flex:none}
#btn-lang{width:43px;font-size:.8rem;letter-spacing:.04em}
.app-popover,.utility-actions.open{background:#112437;border:1px solid #9e7b50;border-radius:5px;box-shadow:0 18px 40px rgba(0,0,0,.45)}
.app-popover{border-top:3px solid var(--ui-brass);padding:17px}
.app-popover p{color:#e4e9e5;font-size:.88rem;line-height:1.55}
.app-popover .author{color:var(--ui-cyan)}
.app-popover .support-link{border-radius:3px;color:#f5e2c1;background:#3d3935;border-color:#9f835e}
.app-popover .legal-link{color:var(--ui-muted);font-size:.75rem}
.app-popover .legal-link:hover{color:#fff}
.footer-tools,.footer-actions{display:flex;align-items:center;justify-content:center;gap:12px}
.footer-tools{padding-right:18px;border-right:1px solid var(--ui-brass)}
.zoombar,.tempbar{position:relative;display:flex;align-items:center;min-height:48px;padding:0;background:transparent;border:0;border-radius:0}
.zoombar{gap:13px;padding-right:18px;border-right:1px solid var(--ui-brass)}
.zoombar button{width:44px;height:44px;padding:0;border:1px solid var(--ui-brass);border-radius:50%;font:1.55rem/1 Georgia,serif;background:transparent;color:#f3e4c8}
.zoombar button:hover{background:rgba(191,150,99,.17);border-color:#e2bc83}
#zoom-label{min-width:53px;text-align:center;font:1.02rem Georgia,serif;font-variant-numeric:tabular-nums;color:var(--ui-text)}
.tempbar{gap:13px;padding-inline:2px}
.temp-icon{width:25px;height:25px;flex:none;color:#86d4f1}
.temp-hot{color:#e98f66}
.tempbar input{width:175px;appearance:none;height:7px;border-radius:9px;background:linear-gradient(90deg,#17b8eb,#5c9acb 52%,#ef5645);cursor:pointer}
.tempbar input::-webkit-slider-thumb{appearance:none;width:22px;height:22px;border-radius:50%;border:3px solid #fff1de;background:#e5f5fa;box-shadow:0 0 0 1px #288abc}
.tempbar input::-moz-range-thumb{width:16px;height:16px;border-radius:50%;border:3px solid #fff1de;background:#e5f5fa}
.phase-label{display:none}
.footer-actions > button{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:50px;padding:10px 9px;white-space:nowrap}
.action-symbol{width:22px;height:22px;flex:none}
.action-add{display:grid;place-items:center;width:24px;height:24px;border-radius:50%;background:var(--ui-paper);color:#142238;font:700 1.15rem/1 system-ui,sans-serif}
.action-plus{font:1.45rem/1 Georgia,serif}
#btn-pick{color:var(--ui-text);background:transparent;border:1px solid #a88358;border-radius:9px;box-shadow:none}
#btn-pick:hover{color:#fff2dc;background:rgba(191,150,99,.15);border-color:#d9ad78}
#btn-rand{background:transparent;border:1px solid #806b52;border-radius:9px}
#btn-hints{min-width:0;height:50px;padding:0 12px;font:1rem Georgia,serif;color:#ead4b7;background:transparent;border:0;border-radius:0}
#btn-hints[aria-expanded="false"]{color:#dfc9a9;background:transparent;border:0}
#btn-hints:hover{background:rgba(191,150,99,.12);border:0}
#btn-shake,#btn-delete,#btn-reset{position:relative;background:transparent;border:0;border-radius:0}
#btn-shake::before,#btn-delete::before,#btn-reset::before{content:"";position:absolute;left:-9px;top:7px;bottom:7px;width:1px;background:var(--ui-brass);opacity:.7}
#btn-shake{color:#f0e8dc}
#btn-delete{color:#c0bcbb}
#btn-delete:hover{color:#f5e4dd;background:rgba(191,150,99,.12);border:0}
body > footer .footer-secondary #btn-delete.danger-active{color:#fff2e9;background:rgba(150,66,59,.3);border:1px solid #dc9b8e}
#btn-reset{color:#e7ded2}
#btn-reset:hover{color:#fff;background:rgba(191,150,99,.12);border:0}
header button:disabled,footer button:disabled{opacity:.45;cursor:not-allowed}
#btn-show-ui{background:#1e303a;border-color:#6a7473}
.modal-box{background:#1b2d39;border-color:#777766;border-radius:6px;box-shadow:0 22px 55px rgba(0,0,0,.48)}
.modal-head{background:#22323c;border-bottom-color:#756d5e;padding:17px 20px}
.modal-head h2{color:#f0e1c9;font-family:Georgia,serif;font-size:1.25rem;line-height:1.25}
.modal-body{padding:16px 20px 20px}
.close{border-radius:3px;background:#2d434d;color:#e8f0f2}
.close:hover{background:#3c5660}
#modal-book .modal-box{background:#122339;border-color:#777766}
#modal-book .modal-head{background:#1d2d40}
.picker-legend{color:#c4d1ca;font-size:.82rem}
.periodic{gap:6px}
.elem{border-radius:3px;background:#263b45;border-color:#5b7170;gap:2px}
.elem::before{height:2px;opacity:.9}
.elem:hover{background:#35515a;border-color:var(--element-accent)}
.elem .sym{font-size:1.26rem;color:#fff5e6}
.elem .element-name{font-size:.77rem;color:#e1eeec}
.elem .num{top:5px;bottom:auto;left:7px;font-size:.62rem;color:#d0ddda}
.elem .val{font-size:.58rem;background:#172b35;color:#f0f1e6}
.lang-item{border-radius:3px;background:#263b45;border-color:#5b7170}
.lang-item.active{background:#38514b;border-color:#a8bb9e}
.coffee-box a.button-link{border-radius:3px;background:var(--ui-paper);border-color:#f1dfc2;color:#192834}
@media(min-width:851px) and (max-width:1350px){
  body > footer{gap:9px;padding-inline:12px}
  .footer-tools,.footer-actions{gap:7px}
  .footer-tools{padding-right:9px}
  .zoombar{gap:7px;padding-right:9px}
  .zoombar button{width:38px;height:38px}
  #zoom-label{min-width:46px;font-size:.94rem}
  .tempbar{gap:7px}
  .tempbar input{width:126px}
  .temp-icon{width:21px;height:21px}
  .footer-actions > button{gap:6px;padding-inline:7px;font-size:.9rem}
  .footer-actions .action-symbol{width:19px;height:19px}
  #btn-hints{font-size:.9rem}
}
@media(max-width:850px){
  body > header{min-height:58px;padding:7px 10px}
  header h1{font-size:1.4rem}
  .header-right,.game-actions{gap:5px}
  .stats.live{height:40px;padding-inline:7px;font-size:.7rem}
  #btn-book{height:40px;padding-inline:7px}
  #btn-book .ui-symbol{width:20px;height:20px}
  .header-right > #btn-share{display:none}
  .header-right > #btn-more{display:grid;place-items:center;width:40px;height:40px;margin:0;padding:0;border:0;font-size:1.6rem}
  .utility-actions{top:calc(100% + 5px);right:10px;background:#112437;border-color:#9e7b50}
  header .utility-actions :is(button,a){display:flex;width:100%;height:auto;color:var(--ui-text);font-size:.9rem}
  header .utility-actions #btn-lang{width:100%;letter-spacing:normal}
  .utility-actions :is(button,a):hover{background:var(--ui-hover)}
  body > footer{display:flex;flex-direction:column;gap:6px;padding:8px 8px calc(9px + env(safe-area-inset-bottom,0px))}
  .footer-tools{max-width:100%;border:0;padding:0}
  .zoombar{gap:7px;padding-right:10px}
  .zoombar button{width:36px;height:36px;font-size:1.25rem}
  #zoom-label{min-width:42px;font-size:.87rem}
  .tempbar{gap:6px;padding-inline:7px}
  .tempbar input{width:clamp(58px,20vw,90px)}
  .temp-icon{width:18px;height:18px}
  .footer-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));width:min(390px,100%);gap:5px}
  .footer-actions > button{min-width:0;min-height:42px;padding:6px 4px;white-space:normal;font:600 .76rem/1.15 system-ui,-apple-system,"Segoe UI",sans-serif;border:1px solid #735d41;border-radius:5px}
  .footer-actions .action-symbol{width:16px;height:16px}
  .action-add{width:18px;height:18px;font-size:.9rem}
  .action-plus{font-size:1.1rem}
  #btn-hints{width:100%;min-width:0;height:42px;font-size:.76rem;border:1px solid #735d41}
  #btn-hints[aria-expanded="false"]{border:1px solid #735d41}
  #btn-shake::before,#btn-delete::before,#btn-reset::before{display:none}
}
@media(max-width:360px){
  body > header{padding-inline:7px}
  header h1{font-size:1.2rem}
  .stats.live{padding-inline:5px;font-size:.65rem}
  #btn-book{padding-inline:6px}
  .header-right > #btn-more{width:36px;height:36px}
  .footer-tools{max-width:100%;gap:5px}
  .tempbar{gap:4px;padding-inline:5px}
  .tempbar input{width:58px}
  .zoombar button{width:31px}
  #zoom-label{min-width:36px;font-size:.76rem}
  .phase-label{min-width:45px;font-size:.67rem}
}
@media(prefers-reduced-motion:reduce){header,footer,header button,footer button,.app-popover,.utility-actions{transition:none}}

.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.book-progress{position:relative;display:block;flex:none;width:22px;height:22px;border-radius:50%;background:conic-gradient(var(--ui-cyan) var(--book-progress,0%),#31475a 0)}
.book-progress::after{content:"";position:absolute;inset:5px;border-radius:50%;background:var(--ui-chrome)}
.book-progress{box-shadow:inset 0 0 0 1px #5a7a8c}
body > header{min-height:60px;padding:7px 20px}
header h1{font-size:1.85rem}
#app-name-btn{min-height:44px}
.header-right,.game-actions{gap:6px}
.stats.live{height:38px;font-size:.72rem}
#btn-book{height:40px;padding:0 9px;gap:8px}
#btn-book .ui-symbol{width:21px;height:21px}
.header-right > #btn-share{height:38px;padding:0 14px;gap:8px}
.header-right > #btn-share .utility-label{font-size:.95rem}
.header-right > #btn-more{width:40px;height:38px;font-size:1.6rem}
.utility-actions{right:18px}
body > footer{gap:12px;padding:9px 15px calc(9px + env(safe-area-inset-bottom,0px))}
.footer-actions,.footer-extras,.footer-secondary{display:flex;align-items:center;justify-content:center;gap:7px}
.footer-tools{gap:9px;padding-right:10px}
.footer-actions > button,.footer-secondary > button{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:40px;padding:6px 8px;font:.87rem Georgia,serif;white-space:nowrap}
.footer-actions .action-symbol,.footer-secondary .action-symbol{width:18px;height:18px;flex:none}
.footer-actions #btn-hints{height:40px;padding:0 9px;font-size:.87rem}
.footer-secondary > button:not(:first-child){border-left:1px solid var(--ui-brass);border-radius:0}
#btn-shake::before,#btn-delete::before,#btn-reset::before{display:none}
.action-add{display:grid;place-items:center;width:20px;height:20px;line-height:1}
.action-plus{display:grid;place-items:center;line-height:1}
.zoombar{gap:8px;padding-right:10px}
.zoombar button{width:35px;height:35px;font-size:1.2rem}
#zoom-label{min-width:42px;font-size:.9rem}
.tempbar{gap:8px}
.tempbar input{width:120px}
.temp-icon{width:19px;height:19px}
#btn-tools-more{display:none}
@media(min-width:1000px){
  html body{display:grid;grid-template-columns:186px minmax(0,1fr);grid-template-rows:auto minmax(0,1fr)}
  body > header{grid-column:1/-1;grid-row:1}
  #canvas-container{grid-column:2;grid-row:2;min-width:0;min-height:0}
  body > footer{grid-column:1;grid-row:2;display:flex;flex-direction:column;justify-content:flex-start;align-items:stretch;gap:15px;min-width:0;min-height:0;padding:16px 13px 32px;border-top:0;border-right:1px solid #a47d4d;overflow-y:auto}
  .footer-actions,.footer-extras,.footer-tools,.footer-secondary{display:flex;flex-direction:column;align-items:stretch;width:100%;gap:6px}
  .footer-actions > button,.footer-secondary > button,.footer-actions #btn-hints{justify-content:flex-start;width:100%;height:39px;min-height:39px;padding:6px 9px;font-size:.88rem;border-radius:4px}
  .footer-actions #btn-hints,.footer-actions #btn-shake,.footer-secondary > button{border:1px solid transparent}
  .footer-actions #btn-hints:hover,.footer-actions #btn-shake:hover,.footer-secondary > button:hover{border-color:#786143}
  .footer-actions #btn-pick,.footer-actions #btn-rand{border:1px solid #856c4d}
  .footer-actions #btn-hints{border:0}
  .footer-secondary{margin-top:4px;padding-top:10px;border-top:1px solid rgba(191,150,99,.42)}
  .footer-secondary > button:not(:first-child){border:0;border-radius:4px}
  .footer-tools{padding:12px 0 0;border:0;border-top:1px solid rgba(191,150,99,.42)}
  .zoombar{justify-content:space-between;padding:0;border:0}
  .tempbar{justify-content:space-between;padding:0}
  .tempbar input{width:93px}
  .privacy-footer-link{left:18px;right:auto}
}
@media(max-width:850px){
  body > header{min-height:56px;padding:6px 9px}
  #app-name-btn{padding:4px 3px;gap:2px}
  .brand-caption{gap:3px}
  header h1{font-size:1.35rem}
  .header-right > #btn-more{width:36px;height:36px}
  .stats.live{height:35px;font-size:.68rem}
  #btn-book{height:36px;padding:0 5px;gap:6px}
  #btn-book .ui-symbol{width:19px;height:19px}
  .book-progress{width:18px;height:18px}
  .book-progress::after{inset:4px}
  body > footer{display:flex;flex-direction:column;gap:4px;padding:7px 8px calc(7px + env(safe-area-inset-bottom,0px))}
  .footer-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:min(340px,100%);gap:4px}
  .footer-actions > button,.footer-actions #btn-hints{justify-content:center;width:100%;min-width:0;height:38px;min-height:38px;padding:5px 7px;font:600 .75rem/1.12 system-ui,-apple-system,"Segoe UI",sans-serif;white-space:normal;border:1px solid #735d41;border-radius:4px}
  #btn-tools-more{display:flex;align-items:center;justify-content:center;gap:6px;width:100%;min-height:28px;padding:2px 0;color:var(--ui-muted);font:600 .72rem system-ui,-apple-system,"Segoe UI",sans-serif}
  .tools-chevron{font-size:1.1rem;line-height:1;transition:transform .18s}
  footer.tools-open .tools-chevron{transform:rotate(180deg)}
  .footer-extras{display:none;width:min(340px,100%);flex-direction:column;gap:6px}
  footer.tools-open .footer-extras{display:flex}
  .footer-tools{display:flex;width:100%;justify-content:center;padding:8px 0 0;border:0;border-top:1px solid rgba(191,150,99,.42)}
  .footer-secondary{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;gap:4px}
  .footer-secondary > button{min-width:0;min-height:36px;padding:5px;gap:5px;font:600 .72rem system-ui,-apple-system,"Segoe UI",sans-serif;border:1px solid #735d41;border-radius:4px}
  .footer-secondary > button:not(:first-child){border:1px solid #735d41;border-radius:4px}
  .zoombar{gap:6px;padding-right:12px}
  .tempbar{gap:6px;padding:0}
  .tempbar input{width:clamp(70px,22vw,105px)}
}
@media(max-width:360px){header h1{font-size:1.15rem}.stats.live{font-size:.62rem}.header-right > #btn-more{width:32px}.book-progress{width:17px;height:17px}.footer-actions > button,.footer-actions #btn-hints{font-size:.71rem}}

body > header,body > footer{background-image:repeating-linear-gradient(110deg,transparent 0 23px,rgba(205,177,139,.017) 24px,transparent 25px),linear-gradient(145deg,#0a1725,#101f30)}
#bg-canvas{filter:blur(34px)}
body > header{z-index:30;box-shadow:inset 0 -3px 0 rgba(191,150,99,.13)}
body > footer{box-shadow:inset -3px 0 0 rgba(191,150,99,.08)}
.panel-heading{display:none;color:#bfa17c;font:italic .9rem Georgia,serif;letter-spacing:.11em;text-align:center}
header .utility-actions #btn-lang{display:flex;flex-direction:row;align-items:center;gap:11px;padding:8px 12px;text-align:left}
header .utility-actions #lang-code{display:grid;place-items:center;width:21px;height:21px;flex:none;font:700 .7rem system-ui,sans-serif}
body > footer .footer-actions > button,body > footer .footer-secondary > button,body > footer #btn-hints,body > footer #btn-hints[aria-expanded="false"]{color:var(--ui-text);background:rgba(255,255,255,.018);border:1px solid rgba(191,150,99,.36);border-radius:2px;box-shadow:none}
body > footer .footer-actions > button:hover,body > footer .footer-secondary > button:hover,body > footer #btn-hints:hover{color:#fff5e8;background:rgba(191,150,99,.1);border-color:#bf9663}
body > footer #btn-pick,body > footer #btn-rand{background:rgba(191,150,99,.09);border-color:#bc9567}
body > footer #btn-pick:hover,body > footer #btn-rand:hover{background:rgba(191,150,99,.19);border-color:#e2b57f}
body > footer .footer-actions > button svg,body > footer .footer-secondary > button svg,header .utility-actions svg,header .ui-symbol{display:block;align-self:center;flex:none}
body > footer .zoombar button{width:29px;height:29px;font:1.1rem/1 Georgia,serif}
@media(min-width:1000px){
  body > footer{box-shadow:inset -3px 0 0 rgba(191,150,99,.09)}
  .panel-heading{display:block;margin:1px 3px 2px;padding-bottom:11px;border-bottom:1px solid rgba(191,150,99,.45)}
  .footer-actions,.footer-extras,.footer-tools,.footer-secondary{gap:7px}
  body > footer .footer-actions > button,body > footer .footer-secondary > button,body > footer #btn-hints{justify-content:flex-start;min-height:37px;height:37px;padding:5px 9px;font-size:.84rem}
  .zoombar button{width:29px;height:29px}
  .privacy-footer-link{left:15px;right:auto}
}
@media(max-width:850px){
  .panel-heading{display:none}
  body > footer{box-shadow:inset 0 3px 0 rgba(191,150,99,.09)}
  body > footer .footer-actions > button,body > footer .footer-secondary > button,body > footer #btn-hints,body > footer #btn-hints[aria-expanded="false"]{min-height:38px;height:38px;font:600 .75rem/1.12 system-ui,-apple-system,"Segoe UI",sans-serif}
  body > footer .zoombar button{width:29px;height:29px}
}
body > footer .footer-actions #btn-pick,body > footer .footer-actions #btn-rand,body > footer .footer-actions #btn-hints,body > footer .footer-actions #btn-hints[aria-expanded="false"],body > footer .footer-actions #btn-shake,body > footer .footer-secondary #btn-delete,body > footer .footer-secondary #btn-reset{display:flex;align-items:center;gap:6px;min-height:37px;height:37px;color:var(--ui-text);background:rgba(255,255,255,.018);border:1px solid rgba(191,150,99,.36);border-radius:2px;box-shadow:none}
body > footer .footer-actions #btn-pick,body > footer .footer-actions #btn-rand{background:rgba(191,150,99,.09);border-color:#bc9567}
body > footer .footer-actions #btn-pick:hover,body > footer .footer-actions #btn-rand:hover,body > footer .footer-actions #btn-hints:hover,body > footer .footer-actions #btn-shake:hover,body > footer .footer-secondary #btn-delete:hover,body > footer .footer-secondary #btn-reset:hover{color:#fff5e8;background:rgba(191,150,99,.14);border-color:#d6ac77}
@media(max-width:850px){body > footer .footer-actions #btn-pick,body > footer .footer-actions #btn-rand,body > footer .footer-actions #btn-hints,body > footer .footer-actions #btn-hints[aria-expanded="false"],body > footer .footer-actions #btn-shake,body > footer .footer-secondary #btn-delete,body > footer .footer-secondary #btn-reset{justify-content:center;min-height:38px;height:38px;font:600 .75rem/1.12 system-ui,-apple-system,"Segoe UI",sans-serif}}
.panel-support-link{display:none}
@media(min-width:1000px){.panel-support-link{display:block;align-self:flex-start;margin-top:auto;margin-left:2px;color:#b6c0c8;font:12px system-ui,-apple-system,sans-serif;text-decoration:none}.panel-support-link:hover,.panel-support-link:focus-visible{color:#f5f7f8;text-decoration:underline}}
body:has(.modal.open) .privacy-footer-link{display:none}
.workbench-mark{width:17px;height:17px;flex:none}
@media(min-width:1000px){.panel-heading{display:flex;align-items:center;justify-content:center;gap:8px}}
@media(max-width:850px){
  #btn-tools-more{width:min(180px,55vw);height:28px;min-height:28px;gap:6px;padding:0 9px;border-radius:2px;line-height:1}
  .tools-chevron{display:block;width:14px;height:14px;flex:none}
  .footer-tools{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;gap:0}
  .zoombar,.tempbar{width:100%;min-width:0;justify-content:center;gap:6px}
  .zoombar{padding:0 8px 0 0}
  .tempbar{padding:0 0 0 8px}
  .tempbar input{width:min(78px,21vw)}
  .tempbar input::-webkit-slider-thumb{width:16px;height:16px;border-width:2px}
  .tempbar input::-moz-range-thumb{width:12px;height:12px;border-width:2px}
}
.element-tile{position:relative;min-width:0}
.element-tile .elem{width:100%;height:100%}
.element-info-button{position:absolute;top:3px;right:3px;z-index:1;width:24px;height:24px;min-width:24px;padding:0;border:1px solid rgba(230,214,186,.55);border-radius:3px;background:#1b303b;color:#f1dfc2;font:700 .7rem Georgia,serif}
.element-info-button:hover,.element-info-button:focus-visible{background:#344d58;border-color:#f1dfc2}
.element-fact{margin:0 0 12px;padding:10px 12px;border:1px solid rgba(191,150,99,.45);background:rgba(191,150,99,.07);color:#f0e4d1;font-size:.78rem;line-height:1.45}
.element-fact[hidden],.book-tabs[hidden],#knowledge-content[hidden],#book-molecules[hidden]{display:none}
.element-fact p{margin:5px 0}
.element-fact a,.knowledge-card a{color:#b9dfef;font-size:.72rem;text-underline-offset:3px}
.book-tabs{display:flex;gap:6px;margin:0 0 14px;border-bottom:1px solid rgba(191,150,99,.38)}
.book-tabs button{flex:1;min-width:0;min-height:44px;border:0;border-radius:0;background:transparent;color:#c4d1d8;font:700 .84rem Georgia,serif;padding:9px 6px;white-space:normal;overflow-wrap:anywhere}
.discovery-curiosity{margin:0 0 12px;padding:12px;border-left:3px solid var(--ui-brass);background:var(--ui-control);font:.9rem/1.5 system-ui,sans-serif;color:var(--ui-text)}
.discovery-curiosity h4{margin:0 0 6px;color:var(--ui-paper);font-size:1rem}
.discovery-curiosity p{margin:0 0 8px}
.discovery-curiosity a{color:var(--ui-paper);text-decoration:underline;text-underline-offset:3px}
.book-tabs button[aria-selected="true"]{color:#f5e1bd;box-shadow:inset 0 -2px #c59962}
#knowledge-content h3{font:700 .93rem Georgia,serif;color:#f0ddbd;margin:18px 0 8px}
.knowledge-intro{color:#b9cbd3;font-size:.8rem;margin:0 0 10px}
.knowledge-card{border:1px solid rgba(191,150,99,.25);background:rgba(255,255,255,.025);margin-bottom:7px;padding:8px 12px;color:#e4eaf0}
.knowledge-card summary{display:flex;justify-content:space-between;align-items:baseline;gap:8px;cursor:pointer;font-size:.82rem}
.knowledge-card summary small{color:#b9cbd3;white-space:nowrap;font-size:.66rem}
.knowledge-card p{font-size:.79rem;line-height:1.5;margin:9px 0;color:#d1dce2}
body > footer .footer-actions #btn-hints.hint-ready,body > footer .footer-actions #btn-hints.hint-ready[aria-expanded="false"]{border-color:#d4ad78;box-shadow:0 0 0 1px rgba(212,173,120,.28),0 0 13px rgba(212,173,120,.18)}
@media(prefers-reduced-motion:reduce){body > footer .footer-actions #btn-hints.hint-ready{transition:none}}
#keyboard-pad{padding:9px 11px;border:1px solid #bfa77e;border-radius:4px;background:#172a38;cursor:default}
#keyboard-shortcuts{margin:0;color:#f0e2c8;font-size:.82rem;line-height:1.4}
#keyboard-add{justify-self:start}
#modal-keyboard{justify-content:flex-end;align-items:center;background:rgba(3,10,16,.35);backdrop-filter:none}
#modal-keyboard .keyboard-box{width:min(360px,calc(100vw - 24px));max-width:none;max-height:calc(100dvh - 24px);margin:12px}
@media(max-width:650px){#modal-keyboard{align-items:flex-end;justify-content:center}#modal-keyboard .keyboard-box{width:100%;max-height:70dvh;margin:0 8px 8px}#keyboard-overview{max-height:60px}}
body.high-contrast{color:#fff;background:#050b11}
body.high-contrast #bg{background:#050b11!important}
body.high-contrast #bg-canvas{opacity:.12}
body.high-contrast header,body.high-contrast footer,body.high-contrast .utility-actions,body.high-contrast .modal-box,body.high-contrast .book-item,body.high-contrast .knowledge-card,body.high-contrast .elem,body.high-contrast #keyboard-pad{background:#081520!important;color:#fff!important;border-color:#aebdca!important}
body.high-contrast button,body.high-contrast a,body.high-contrast select,body.high-contrast input,body.high-contrast .book-item p,body.high-contrast .knowledge-card p,body.high-contrast .knowledge-intro,body.high-contrast .picker-legend{color:#fff!important}
body.high-contrast button,body.high-contrast select,body.high-contrast input{border-color:#aebdca!important}
body.high-contrast button.primary,body.high-contrast .footer-actions #btn-pick{border-color:#f1cf89!important;box-shadow:inset 0 0 0 1px #f1cf89!important}
body.high-contrast #journey-goal,body.high-contrast #onboarding-note,body.high-contrast #toast{background:#081520!important;color:#fff!important;border-color:#aebdca!important}
body.high-contrast #journey-goal *,body.high-contrast #onboarding-note *,body.high-contrast #toast *{color:#fff!important}
body.high-contrast :focus-visible{outline:3px solid #ffdf8e!important;outline-offset:3px!important}
header .utility-actions > :is(button,a):is(:hover,:focus-visible){background:#315064!important;color:#fff!important}
body.high-contrast header .utility-actions > :is(button,a):is(:hover,:focus-visible){background:#31566d!important}
header .utility-actions.open{visibility:visible!important;transition:none!important}
@media(max-width:360px){.header-right > #btn-more{min-width:24px;flex:none}}
