
:root{--paper:#f8f5ed;--card:#fffdf8;--ink:#384b43;--muted:#879087;--green:#54755e;--sage:#e9eddf;--pink:#f4d8c9;--line:#e9e6dc;--wood:#e4c5a0;--danger:#bf715f;--safe-top:max(58px,env(safe-area-inset-top,0px));--safe-bottom:max(18px,env(safe-area-inset-bottom,0px))}
*{box-sizing:border-box}html{min-height:100%;background:#eceee4}body{margin:0;color:var(--ink);font-family:'Noto Sans SC','Microsoft YaHei',system-ui,sans-serif;font-size:14px;-webkit-tap-highlight-color:transparent;background:radial-gradient(ellipse at 20% 30%,#f4e9d7 0,transparent 55%),radial-gradient(ellipse at 85% 70%,#dfe8d9 0,transparent 50%);min-height:100vh}button{font:inherit;cursor:pointer;border:0;color:inherit;touch-action:manipulation}button:disabled{cursor:default;opacity:.45}button:focus-visible{outline:3px solid #b87959;outline-offset:3px}button:not(:disabled):active{transform:scale(.97)}svg{display:block;flex-shrink:0}h1,h2,h3,p{margin:0}.app{width:min(100%,460px);margin:auto;min-height:100dvh;background:var(--paper);position:relative;padding:var(--safe-top) 22px calc(114px + var(--safe-bottom));box-shadow:0 0 90px #50604413;overflow:clip}.desktop-note{display:none}.topbar{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:24px}.brand{display:flex;align-items:center;gap:9px;font-weight:800;font-size:17px;letter-spacing:1px}.brand-mark{background:#e9ecd9;color:var(--green);padding:9px;border-radius:13px}.top-actions{display:flex;gap:8px}.icon-button{background:transparent;border:1px solid #e4e4d8;border-radius:50%;width:37px;height:37px;display:grid;place-items:center;color:#788678}.eyebrow{font-size:10px;letter-spacing:2.5px;color:#929884;font-weight:700}.hero-heading{position:relative;margin:0 0 23px}.hero-heading h1{font-size:30px;font-weight:800;letter-spacing:1px;line-height:1.55;margin:5px 0}.hero-heading p{color:#889083;font-size:12px;letter-spacing:1px}.hero-spark{position:absolute;right:15px;top:12px;color:#dbb366;transform:rotate(12deg)}.mode-switch{display:flex;gap:5px;background:#ebece2;border-radius:16px;padding:5px;margin-bottom:19px}.mode-switch button{width:50%;padding:11px 3px;background:transparent;border-radius:12px;font-size:13px;font-weight:700;color:#8b9386}.mode-switch button.active{background:#fffdf7;color:var(--green);box-shadow:0 2px 6px #4b624010}.mode-switch small{font-size:9px;letter-spacing:1px;margin-left:5px;font-weight:500}.store-card{border-radius:22px;background:#e5ebdb;position:relative;overflow:hidden;padding:20px 20px 16px;border:1px solid #dce3d1}.store-top{display:flex;justify-content:space-between;align-items:center}.store-top .chapter{font-size:10px;letter-spacing:1px;color:#798b6d}.text-button{background:none;padding:5px 0;font-size:11px;color:#6f8166;border-bottom:1px solid #a9b89d}.store-card h2{font-size:22px;letter-spacing:1px;margin:7px 0 4px;font-weight:800}.store-subtitle{font-size:11px;color:#84917a}.mini-shop{margin:17px 12px 12px;position:relative}.mini-awning{height:21px;border-radius:8px 8px 2px 2px;background:repeating-linear-gradient(90deg,#92a57d 0 25px,#fbf3df 25px 50px);border-bottom:5px solid #77926950}.mini-window{background:#f4efd9;border:7px solid #d0b58a;border-top:0;border-radius:0 0 7px 7px;display:flex;justify-content:center;align-items:flex-end;height:82px;position:relative;box-shadow:0 6px 0 #a3ae8e30}.mini-window svg{width:53px;height:66px;margin:0 1px}.mini-sign{position:absolute;right:-14px;top:39px;background:#fffbef;transform:rotate(7deg);font-size:9px;padding:7px;border-radius:5px;box-shadow:0 3px 0 #87987e20;letter-spacing:1px;color:#9c7f61}.store-foot{display:flex;justify-content:space-between;align-items:center;margin-top:17px;gap:10px}.goal-caption{font-size:11px;color:#6c7f64}.effect-pill{display:inline-flex;align-items:center;gap:4px;border-radius:7px;padding:5px 7px;font-size:10px;background:#fffdf19c;color:#6d815c;white-space:nowrap}.effect-pill.negative{background:#f2dfd1;color:#a07255}.effects{display:flex;gap:5px;flex-wrap:wrap}.section-line{display:flex;align-items:center;justify-content:space-between;margin:23px 0 12px}.section-line h3{font-size:14px;font-weight:700}.section-line span{font-size:10px;color:#92998c;letter-spacing:1px}.characters{display:grid;grid-template-columns:repeat(4,1fr);gap:10px 8px}.char-button{border:1px solid #e9e7de;background:#fffdf6;border-radius:15px;padding:6px 0 7px;position:relative;min-width:0}.char-button.selected{border:1.5px solid #7d9672;background:#edf0e3;box-shadow:0 2px 0 #a8b89945}.char-button svg{width:57px;height:57px;margin:auto}.char-button .char-name{font-size:10px;margin-top:1px;display:block}.selected-dot{position:absolute;top:6px;right:6px;width:6px;height:6px;background:#69885c;border-radius:50%}.character-detail{background:#fffdf7;border:1px solid var(--line);border-radius:17px;margin-top:12px;padding:14px}.detail-header{display:flex;align-items:center;gap:8px;margin-bottom:10px}.detail-header strong{font-size:13px}.role-tag{font-size:9px;color:#9c8a70;background:#f3ede0;padding:3px 6px;border-radius:5px}.ability-row{display:grid;grid-template-columns:31px 1fr;gap:6px;align-items:start;font-size:10px;line-height:1.8;color:#7e897c}.ability-row+.ability-row{margin-top:7px}.ability-tag{background:#eaf0e3;color:#7a916e;border-radius:4px;text-align:center;font-size:9px}.ability-tag.active-tag{background:#f8e6d9;color:#b28c68}.bottom-dock{position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:min(100%,460px);padding:15px 22px var(--safe-bottom);background:linear-gradient(transparent,var(--paper) 19%);z-index:15}.primary{background:var(--green);color:#fffdf2;display:flex;align-items:center;justify-content:center;gap:10px;min-height:52px;width:100%;border-radius:15px;box-shadow:0 4px 0 #3c5f4d1f;font-weight:700;letter-spacing:1px}.primary small{font-size:11px;opacity:.7;font-weight:400;letter-spacing:0}.dock-note{text-align:center;color:#a1a596;font-size:9px;margin-bottom:9px;letter-spacing:1px}.sub-actions{display:flex;justify-content:center;gap:23px;margin-top:18px}.sub-actions button{background:none;font-size:10px;color:#8d9689;padding:5px}.versus-card{background:#e9e5dc;border-color:#e0dbce}.vs-players{display:flex;align-items:center;justify-content:space-evenly;margin:15px 0 10px}.vs-player{background:#fff9eaa8;border:1px solid transparent;border-radius:16px;width:108px;padding:9px 0}.vs-player.chosen{border-color:#92a484;background:#fffaf0}.vs-player svg{margin:auto;width:65px;height:65px}.vs-player span{display:block;font-size:11px;margin-top:3px}.vs-mark{font-family:Georgia,serif;font-style:italic;color:#b0a28e;font-size:24px}.play-type{display:flex;justify-content:center;gap:7px;margin-top:13px}.play-type button{border-radius:7px;padding:6px 13px;background:#ffffff80;font-size:10px;color:#8d8c7d}.play-type button.active{background:#738967;color:#fff9e9}.pvp-rule{text-align:center;font-size:11px;color:#8d8c7d;margin:12px 0 0}.game.app{padding:var(--safe-top) 17px calc(24px + var(--safe-bottom))}.game .topbar{margin-bottom:16px}.game-title{font-size:13px;font-weight:700}.game-kicker{display:block;font-size:9px;color:#919b88;letter-spacing:1px;margin-top:3px}.tiny-button{border:1px solid #e2e5d8;background:#f8f8f0;border-radius:9px;padding:8px 11px;font-size:10px}.game-summary{display:flex;align-items:center;gap:10px;background:#fffdf5;border:1px solid var(--line);padding:12px;border-radius:18px}.player-avatar{background:#edf0e4;width:57px;height:57px;border-radius:14px;display:grid;place-items:center}.player-avatar svg{width:53px;height:53px}.player-info{flex:1}.player-info strong{font-size:12px}.player-info p{font-size:9px;color:#909986;margin-top:5px}.timer{text-align:right;min-width:75px}.timer strong{font-variant-numeric:tabular-nums;font-size:27px;font-weight:600;letter-spacing:1px;line-height:1}.timer span{display:block;font-size:9px;color:#9a9f8f;margin-top:5px}.timer.urgent{color:#c56f58}.timer-bar{height:3px;background:#e6e9dc;border-radius:9px;margin:10px 3px 14px;overflow:hidden}.timer-bar div{height:100%;background:#a9ba91;transition:width .15s linear}.goal-row{display:flex;gap:8px;margin-bottom:11px}.goal-chip{display:flex;align-items:center;gap:7px;background:#e9eddf;border-radius:12px;padding:8px 10px;flex:1;min-width:0}.goal-chip svg{width:29px;height:29px}.goal-chip .goal-number{font-size:14px;font-weight:700}.goal-chip .goal-label{font-size:9px;color:#8b987f;margin-top:2px}.goal-chip.done{background:#dce8cf}.goal-chip.done .goal-number{color:#6d8d52}.game-effects{margin:0 2px 12px}.game-effects button{font-size:9px}.opponent-bar{display:flex;align-items:center;justify-content:space-between;background:#ede8df;border-radius:10px;padding:7px 10px;margin:10px 0;font-size:10px;color:#928874}.opponent-bar span{display:flex;align-items:center;gap:5px}.opponent-bar svg{width:25px;height:25px}.shop-board{border-radius:15px;background:#eee4d1;padding:0 12px 12px;box-shadow:0 4px 0 #d9d6c652;border:1px solid #e3d8c3;overflow:hidden;position:relative}.awning{height:24px;margin:0 -12px;background:repeating-linear-gradient(90deg,#99ad85 0 28px,#faf1d8 28px 56px);border-bottom:5px solid #f8efd7;border-radius:0 0 8px 8px;box-shadow:0 3px 3px #9d8d6b15}.board-label{display:flex;justify-content:space-between;align-items:center;margin:11px 0 7px;color:#a18f71;font-size:8px;letter-spacing:1.3px}.shelves{display:grid;grid-template-columns:1fr 1fr;gap:11px 13px}.shelf{position:relative;background:#f8f0df;border-radius:8px 8px 4px 4px;border-bottom:8px solid #dab88d;box-shadow:0 3px 0 #c6a58255;padding:5px 3px 0}.shelf-slots{display:grid;grid-template-columns:repeat(3,1fr);gap:1px}.slot{height:64px;min-width:0;background:transparent;position:relative;border-radius:8px;display:flex;align-items:center;justify-content:center;padding:0;margin:0 0 2px}.slot svg{width:100%;height:auto;max-height:64px;filter:drop-shadow(0 3px 2px #8d765018);pointer-events:none}.slot.empty:after{content:'';display:block;width:28px;height:34px;border:1.4px dashed #dbd0b8;border-radius:7px;background:#f2ead8a0}.slot.selected{background:#f9dfbe;box-shadow:inset 0 0 0 2px #c49a65;animation:gentle 1s ease-in-out infinite alternate}.slot.hinted{background:#dfebc5;box-shadow:inset 0 0 0 1.5px #9caf78}.slot.locked{background:#d2e4e280;box-shadow:inset 0 0 0 1px #abc7c880}.ice{position:absolute;right:1px;top:0;background:#e0f0efcc;border-radius:6px;color:#8db6bb;pointer-events:none}.ice svg{width:17px;height:17px;filter:none}.shelf-id{font-size:7px;position:absolute;bottom:-7px;color:#fff9e5;right:5px;letter-spacing:1px}.cover{position:absolute;inset:1px 0 -1px;z-index:2;border-radius:7px 7px 0 0;background:repeating-linear-gradient(90deg,#cdbba0 0 16px,#dac8ad 16px 32px);display:flex;align-items:center;justify-content:center;flex-direction:column;gap:7px;font-size:10px;color:#fffdf3;text-shadow:0 1px 2px #796a5155}.cover small{font-size:8px;background:#a1917844;padding:3px 6px;border-radius:6px}.board-help{text-align:center;font-size:10px;color:#9c9e8c;margin:12px 0;min-height:15px}.board-help.active{color:#a77d4f}.game-skill{width:100%;border:1px solid #dfe5d4;border-radius:14px;background:#e9eedd;display:flex;align-items:center;gap:10px;padding:10px 12px;text-align:left}.game-skill svg{width:36px;height:36px}.skill-label{flex:1}.skill-label strong{font-size:12px;display:block}.skill-label span{display:block;font-size:9px;color:#899779;margin-top:4px}.energy-dots{display:flex;gap:4px}.energy-dots i{width:7px;height:7px;border-radius:50%;background:#ccd5be}.energy-dots i.full{background:#8fa773}.items{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-top:9px}.item-button{background:#fffdf6;border:1px solid #e5e4d7;border-radius:13px;padding:9px 4px;display:flex;align-items:center;justify-content:center;gap:7px;position:relative}.item-button svg{width:22px;height:22px;color:#aa9471}.item-button span{font-size:10px}.item-button b{font-size:8px;background:#eae9de;color:#8a927e;border-radius:5px;padding:2px 4px}.item-button.armed{background:#f8e4c7;border-color:#cba477}.game-footer{display:flex;justify-content:space-between;align-items:center;margin-top:13px;font-size:9px;color:#a4a697}.game-footer button{background:none;color:#9b9f8a;font-size:10px;padding:5px}.game-footer .end-turn{background:#ede9de;color:#918267;border-radius:7px;padding:7px 11px}.toast{position:fixed;top:calc(var(--safe-top) + 8px);left:50%;transform:translate(-50%,-12px);width:max-content;max-width:calc(100% - 48px);z-index:100;background:#384b43ed;color:#fffbed;border-radius:12px;padding:11px 17px;font-size:12px;opacity:0;pointer-events:none;transition:.2s}.toast.show{transform:translate(-50%,0);opacity:1}.modal-overlay{position:fixed;inset:0;z-index:50;background:#394c4359;backdrop-filter:blur(5px);padding:calc(var(--safe-top) + 8px) 18px calc(var(--safe-bottom) + 8px);display:flex;align-items:center;justify-content:center}.modal{max-width:420px;width:100%;max-height:100%;overflow:auto;background:var(--paper);border:1px solid #ffffffe6;border-radius:24px;padding:24px;box-shadow:0 15px 90px #263c4320}.modal-top{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}.modal h2{font-size:20px;letter-spacing:1px}.modal h3{font-size:13px;margin:18px 0 7px}.modal p{font-size:11px;line-height:1.9;color:#84917e}.modal .close{background:#eaece1;border-radius:50%;height:30px;width:30px;display:grid;place-items:center}.modal .primary{margin-top:20px}.modal .secondary{width:100%;background:none;color:#88917f;padding:13px;font-size:11px}.rules-step{display:flex;align-items:flex-start;gap:11px;margin:15px 0}.rules-step b{background:#e8eddb;color:#7f946a;border-radius:9px;width:27px;height:27px;display:grid;place-items:center;flex-shrink:0;font-size:11px}.rules-step strong{font-size:12px}.rules-step p{font-size:10px;margin-top:4px}.rule-demo{display:flex;justify-content:center;gap:6px;background:#ebe5d5;border-bottom:7px solid #d3b28a;border-radius:10px;margin:14px 0;padding:8px}.rule-demo svg{width:58px;height:58px}.level-list{display:grid;gap:8px}.level-option{display:flex;align-items:center;text-align:left;background:#fffdf5;border:1px solid #e8e7da;border-radius:12px;gap:11px;padding:13px}.level-option.selected{border-color:#8ea77e;background:#e9eedf}.level-option .num{font-size:16px;color:#b3b79f;font-weight:700}.level-option strong{font-size:12px;display:block}.level-option small{font-size:9px;color:#969e8b;display:block;margin-top:4px}.level-option .stars{margin-left:auto;font-size:10px;color:#c5a46b}.modal-character{display:flex;align-items:center;gap:13px;margin-bottom:12px}.modal-character svg{width:75px;height:75px}.modal-character h3{margin:0 0 5px}.ready-screen{text-align:center}.ready-screen .avatar-big svg{width:120px;height:120px;margin:12px auto}.ready-screen h2{font-size:24px;margin:7px 0}.ready-screen .ready-label{font-size:10px;letter-spacing:2px;color:#96a083}.ready-goals{display:flex;gap:10px;justify-content:center;margin:18px 0}.ready-goals div{background:#eeeddf;border-radius:13px;padding:13px 15px;font-size:11px}.ready-goals strong{display:block;font-size:20px;color:#6d865b;margin-bottom:3px}.result-stars{font-size:30px;letter-spacing:8px;color:#c9ad6f;margin:10px 0 20px}.result-stats{display:flex;justify-content:space-evenly;margin:20px 0}.result-stats strong{display:block;font-size:22px;color:#748769}.result-stats span{font-size:10px;color:#99a18e}.all-character-list{display:grid;gap:12px}.roster-card{background:#fffdf6;border:1px solid var(--line);border-radius:15px;padding:13px}.roster-head{display:flex;gap:9px;align-items:center;margin-bottom:7px}.roster-head svg{width:53px;height:53px}.roster-head strong{font-size:13px}.roster-head p{font-size:10px}.roster-card .ability-row{font-size:10px}.source-note{margin-top:20px!important;font-size:9px!important}.source-note a{color:#8b9b75}.stats-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:20px 0}.stat-tile{background:#e9eddf;border-radius:14px;text-align:center;padding:20px 10px}.stat-tile strong{font-size:28px;display:block;color:#74886b}.stat-tile span{font-size:10px;color:#99a28e}.empty-record{border:1px dashed #dcded0;border-radius:13px;text-align:center;padding:18px!important}.motion-win .shop-board{animation:success .5s}.step-pips{display:inline-flex;gap:4px;margin-left:5px}.step-pips i{height:5px;width:15px;background:#d0d6bf;border-radius:4px}.step-pips i.full{background:#839b6c}.status-tags{display:flex;gap:5px;flex-wrap:wrap;font-size:8px;color:#8d997a;margin-top:5px}.status-tags span{background:#edf0e0;padding:2px 4px;border-radius:4px}.pause-board{visibility:hidden}.modal-open{overflow:hidden}
@keyframes gentle{to{box-shadow:inset 0 0 0 2px #d4aa78,0 0 12px #eecb8555}}@keyframes success{50%{box-shadow:0 0 25px #adc87c99}}

@media(max-width:374px){.app{padding-left:16px;padding-right:16px}.game.app{padding-left:12px;padding-right:12px}.slot{height:56px}.shelves{gap:10px}.hero-heading h1{font-size:27px}.char-button svg{width:51px;height:51px}.game-summary{padding:9px}.timer strong{font-size:24px}.items{gap:5px}.modal{padding:19px}}
@media(prefers-reduced-motion:reduce){*{animation:none!important;scroll-behavior:auto!important;transition:none!important}}


@media(max-width:374px){.hero-heading h1{font-size:24px;letter-spacing:.5px}.hero-spark{display:none}}
.guest-outline{display:grid!important;place-items:center;width:65px;height:65px;margin:auto!important;border:1.5px dashed #bfc5ae;border-radius:50%;color:#a9b19a;font-size:27px!important;font-family:Georgia,serif}.pending-player{opacity:.8}.room-divider{text-align:center;margin:22px 0 17px;color:#a3a68f;font-size:10px}.room-input-label{font-size:11px;color:#8d997d;display:block;margin-bottom:8px}.room-input{width:100%;min-height:52px;border:1px solid #dbe0d0;background:#fffdf5;border-radius:12px;padding:12px 16px;font:600 20px system-ui;letter-spacing:7px;text-transform:uppercase;text-align:center;color:var(--green);outline-color:#a7b596}.room-input::placeholder{font-size:14px;letter-spacing:2px;color:#b5b9aa}.room-join{background:#e2e9d5;color:#617853;box-shadow:none}.room-card{text-align:center}.room-code{font-family:ui-monospace,monospace;font-size:35px;letter-spacing:7px;font-weight:700;color:#5c7554;margin:15px 0}.room-card .vs-player{width:115px}.ready-badge{display:inline-block;margin-top:9px;padding:3px 8px;background:#ebe7d9;border-radius:6px;font-size:9px;color:#a0947b}.ready-badge.is-ready{background:#dce9c9;color:#6e8b57}.connection-status{font-size:10px;color:#91a17e;text-align:center;margin:0 0 10px;min-height:15px}.room-card .connection-status{margin:17px 0 0}.connection-status.reconnecting{color:#bb8760}.room-rules{font-size:10px;color:#9ca58c;line-height:1.9;text-align:center;margin:19px 0}.room-leave{display:block;margin:10px auto 0;background:none;font-size:10px;color:#939d85;padding:3px 8px}.room-wait{text-align:center;padding:35px 12px}.room-wait h1{font-size:24px}.room-wait p{font-size:12px;line-height:1.9;color:#94a087;margin:20px 0}.room-wait .secondary{margin-top:18px;background:transparent;color:#97a087;font-size:12px}.room-card+.section-line{margin-top:20px}.room-card .chapter{font-size:10px;color:#91a17e;letter-spacing:1px}

/* Two visible shelf layers. Rear goods are previews, never draggable targets. */
.rear-label{display:flex;justify-content:space-between;font-size:7px;color:#a29173;padding:0 3px;line-height:12px}.rear-slots{display:grid;grid-template-columns:repeat(3,1fr);height:25px;border-radius:4px;background:#e8dfcb;border-bottom:1px solid #d9c8a8;margin:0 3px;pointer-events:none}.rear-slots span{display:flex;align-items:center;justify-content:center}.rear-slots svg{width:25px;height:25px;opacity:.68}.rear-slots i{width:12px;height:2px;border-radius:2px;background:#d8cdb7}.slot{height:52px;touch-action:none;user-select:none;-webkit-user-select:none}.slot svg{max-height:52px}.slot.empty:after{height:28px;width:24px}.slot.drag-source{opacity:.28}.slot.drop-target{background:#d7e7c4;box-shadow:inset 0 0 0 2px #7b9b65}.drag-ghost{position:fixed;width:62px;height:62px;transform:translate(-50%,-50%);pointer-events:none;z-index:80;filter:drop-shadow(0 9px 7px #5e523355)}.chapter-tabs{display:flex;gap:5px;margin-bottom:12px}.chapter-tabs button{flex:1;background:#e9eadf;border-radius:8px;padding:9px 1px;font-size:10px}.chapter-tabs button.active{background:var(--green);color:#fffdf1}.chapter-heading{margin-bottom:13px!important;font-weight:600;color:var(--green)!important}.level-option{padding:11px 9px;gap:8px}.level-option .stars{flex-shrink:0;font-size:9px}.store-foot{flex-wrap:wrap}.board-label{letter-spacing:.3px;font-size:9px}.game .topbar{margin-bottom:12px}.game-summary{padding:9px}.board-help{margin:10px 0}.game-skill{padding:8px 10px}.shelves{gap:10px 12px}.shelf{padding-top:3px}
@media(max-width:374px){.slot{height:46px}.slot svg{max-height:46px}.shelves{gap:9px 8px}.rear-label{font-size:6px}.game.app{padding-left:11px;padding-right:11px}}

/* Single mobile layout at every viewport size. */
html,body{background:var(--paper)}.app{box-shadow:none;padding-top:var(--safe-top);padding-bottom:calc(90px + var(--safe-bottom))}.topbar{margin-bottom:14px}.mode-switch{margin-bottom:12px}.store-card{padding:15px}.store-card h2{font-size:20px;margin:10px 0}.level-facts{display:flex;justify-content:space-between;gap:7px;font-size:10px;color:#75856c;margin:14px 0 9px}.level-facts b{display:block;font-size:15px;color:var(--ink);margin-top:4px}.stock-note{font-size:10px;color:#7f8c75;margin:10px 0;line-height:1.8}.section-line{margin:17px 0 10px}.play-type{margin:0 0 14px;gap:6px}.play-type button{flex:1;padding:10px}.versus-card h2{font-size:18px}.pvp-rule{text-align:left;font-size:11px;line-height:1.8;margin:6px 0}.bottom-dock{padding-top:10px}.secondary{background:transparent;display:block;width:100%;padding:13px;font-size:12px;color:#6f8063}.match-panel{text-align:center;padding:28px 6px}.match-panel h1{font-size:24px}.match-panel p{font-size:12px;line-height:1.9;color:#7d8b73;margin:18px 0}.match-panel .vs-player{padding:12px}.match-avatar{margin:28px auto 10px;display:grid;place-items:center}.match-elapsed{font-variant-numeric:tabular-nums;font-size:28px;margin:20px 0}.match-pulse{display:flex;justify-content:center;gap:8px;margin:26px 0}.match-pulse i{width:8px;height:8px;border-radius:50%;background:var(--green);animation:matchpulse 1.3s ease-in-out infinite}.match-pulse i:nth-child(2){animation-delay:.2s}.match-pulse i:nth-child(3){animation-delay:.4s}.match-pulse.stopped i{animation:none;opacity:.3}.matching .bottom-dock{background:var(--paper)}@keyframes matchpulse{50%{opacity:.25;transform:scale(.7)}}

/* The play screen uses the available phone viewport, with no document scrolling. */
html:has(.app.game),body:has(.app.game){height:100%;min-height:0;overflow:hidden;overscroll-behavior:none}
.game.app{height:100vh;height:100dvh;min-height:0;max-height:100dvh;padding:var(--safe-top) 14px var(--safe-bottom);display:flex;flex-direction:column;gap:6px;overflow:hidden}
.game-hud,.game-controls,.game .board-help{flex:none;min-width:0}
.game-hud{display:flex;flex-direction:column;gap:5px}
.game .topbar{margin:0;min-height:32px;gap:8px}
.game .top-actions{gap:5px}
.game .tiny-button{min-height:32px;padding:6px 9px}
.game .game-rules{width:32px;padding:0;display:grid;place-items:center}
.game .game-summary{padding:6px 9px;gap:8px;border-radius:14px;min-height:52px}
.game .player-avatar{width:38px;height:38px;border-radius:10px}
.game .player-avatar svg{width:36px;height:36px}
.game .player-info{min-width:0}
.game .player-info strong{font-size:12px}
.game .player-info p{margin-top:3px;white-space:nowrap}
.game .status-tags{margin-top:0;gap:3px}
.game .status-tags:has(span:not(:empty)){margin-top:2px}
.game .status-tags span:empty{display:none}
.game .timer strong{font-size:26px}
.game .timer span{margin-top:3px;font-size:8px}
.game .timer-bar{height:2px;margin:0 3px}
.game .goal-row{margin:0;gap:6px}
.game .goal-chip{padding:5px 8px;gap:6px;border-radius:10px}
.game .goal-chip svg{width:24px;height:24px}
.game .goal-chip>div{display:flex;align-items:baseline;gap:6px;flex-wrap:wrap}
.game .goal-number{font-size:13px;line-height:18px}
.game .goal-label{font-size:9px;margin:0}
.game .opponent-bar{margin:0;padding:3px 8px;min-height:26px;font-size:9px}
.game .opponent-bar svg{width:20px;height:20px}
.game .game-effects{margin:0;gap:4px}
.game .game-effects .effect-pill{padding:4px 6px;font-size:9px;min-height:22px}
.game .connection-status{margin:0;min-height:12px;line-height:12px;font-size:9px}
.game .shop-board{flex:1 1 0;min-height:0;display:flex;flex-direction:column;padding:0 8px 7px;box-shadow:none}
.game .awning{flex:none;height:14px;margin:0 -8px;border-bottom-width:3px}
.game .board-label{flex:none;font-size:8px;line-height:14px;margin:4px 0;letter-spacing:0}
.game .shelves{flex:1 1 0;min-height:0;grid-template-rows:repeat(3,minmax(0,1fr));gap:7px 9px}
.game .shelf{min-height:0;display:flex;flex-direction:column;padding:2px 3px 0;border-bottom-width:5px;box-shadow:none}
.game .rear-label{flex:none;line-height:11px;font-size:7px}
.game .rear-slots{flex:none;height:21px}
.game .rear-slots svg{width:21px;height:21px}
.game .shelf-slots{flex:1 1 0;min-height:0;align-items:stretch}
.game .slot{height:100%;min-height:0;margin:0}
.game .slot svg{height:100%;width:100%;max-height:72px}
.game .slot.empty:after{max-height:65%;max-width:65%}
.game .shelf-id{bottom:-5px;font-size:6px;line-height:5px}
.game .cover{gap:2px;font-size:10px}
.game .cover svg{width:20px;height:20px}
.game .board-help{margin:0;font-size:9px;line-height:14px;min-height:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.game-controls{display:flex;flex-direction:column;gap:5px}
.action-row{display:flex;gap:7px;min-width:0}
.game .game-skill{flex:1 1 0;min-width:0;min-height:44px;padding:4px 8px;gap:6px;border-radius:11px}
.game .game-skill>svg{width:30px;height:30px}
.game .skill-label{min-width:0}
.game .skill-label strong{font-size:11px;white-space:nowrap}
.game .skill-label>span{font-size:8px;white-space:nowrap}
.game .energy-dots{gap:3px}
.game .energy-dots i{width:5px;height:5px}
.game .end-turn{flex:none;min-width:82px;min-height:44px;padding:7px 10px;background:var(--green);color:#fffdf2;border-radius:11px;font-size:12px;font-weight:700}
.game .items{margin:0;gap:6px}
.game .item-button{min-height:40px;padding:5px 4px;border-radius:10px;gap:5px}
.game .item-button svg{width:20px;height:20px}
body:has(.app.game) .toast{bottom:calc(var(--safe-bottom) + 106px);pointer-events:none}
@media(max-height:700px){
  .game.app{gap:4px;padding-left:11px;padding-right:11px}
  .game-hud{gap:3px}
  .game .topbar{min-height:28px}
  .game .game-title{font-size:12px}
  .game .game-kicker{display:inline;margin-left:6px;font-size:8px;letter-spacing:0}
  .game .tiny-button{min-height:28px;padding:4px 7px;font-size:9px}
  .game .game-rules{width:28px;padding:0}
  .game .game-summary{padding:4px 7px;min-height:40px;gap:6px}
  .game .player-avatar,.game .player-avatar svg{width:30px;height:30px}
  .game .player-info strong{font-size:11px}
  .game .player-info p{font-size:8px;margin-top:1px}
  .game .timer strong{font-size:23px}
  .game .timer span{display:none}
  .game .goal-chip{padding:3px 7px}
  .game .goal-chip svg{width:21px;height:21px}
  .game .goal-chip>div{gap:4px}
  .game .goal-number{font-size:12px}
  .game .goal-label{font-size:8px}
  .game .opponent-bar{min-height:22px;padding:1px 7px;font-size:8px}
  .game .game-effects .effect-pill{min-height:20px;padding:3px 5px;font-size:8px}
  .game .connection-status{font-size:8px;line-height:10px;min-height:10px}
  .game .awning{height:8px;border-bottom-width:2px}
  .game .board-label{margin:2px 0;line-height:12px;font-size:7px}
  .game .shop-board{padding-bottom:5px}
  .game .shelves{gap:5px 7px}
  .game .shelf{padding-top:1px;border-bottom-width:4px}
  .game .rear-label{line-height:9px;font-size:6px}
  .game .rear-slots{height:16px}
  .game .rear-slots svg{width:16px;height:16px}
  .game .board-help{line-height:11px;min-height:11px;font-size:8px}
  .game-controls{gap:4px}
  .game .game-skill,.game .end-turn{min-height:40px}
  .game .game-skill>svg{width:26px;height:26px}
  .game .end-turn{min-width:76px;font-size:11px}
  .game .item-button{min-height:36px;padding:3px 4px}
  .game .item-button svg{width:18px;height:18px}
  .game .cover small{font-size:7px}
}
@media(max-width:359px){
  .game .game-kicker{display:block;margin:2px 0 0}
  .game .skill-label>span{font-size:7px}
  .game .game-skill{gap:4px;padding-left:5px;padding-right:5px}
  .game .game-skill>svg{width:24px;height:24px}
  .game .goal-chip{gap:3px;padding-left:5px;padding-right:5px}
  .game .goal-label{font-size:7px}
}
@media(max-height:600px){
  .game-hud{gap:2px}
  .game .topbar>div:first-child{line-height:14px}
  .game .game-kicker{line-height:9px;margin-top:1px}
  .game .game-summary{min-height:36px;padding-top:3px;padding-bottom:3px}
  .game .player-avatar,.game .player-avatar svg{width:28px;height:28px}
  .game .player-info{font-size:11px;line-height:12px}
  .game .player-info p{line-height:10px}
  .game .timer-bar{display:none}
  .game .goal-chip{padding-top:2px;padding-bottom:2px}
  .game .goal-chip svg{width:20px;height:20px}
  .game .opponent-bar{min-height:20px;padding-top:0;padding-bottom:0}
  .game .game-effects .effect-pill{min-height:18px;padding-top:2px;padding-bottom:2px}
  .game .board-help{min-height:10px;line-height:10px}
  .ready-screen .avatar-big svg{width:64px;height:64px;margin:6px auto}
  .ready-screen h2{font-size:20px;margin:5px 0}
  .ready-goals{margin:10px 0}
  .ready-goals div{padding:8px 12px}
  .ready-goals strong{font-size:18px}
  .ready-screen .primary{margin-top:12px;min-height:42px}
  .ready-screen .secondary{padding:9px}
}
/* Transient messages must not stretch between the old top anchor and the controls. */
body:has(.app.game) .toast{top:auto}
@media(max-height:600px){
  .game .player-info{display:flex;flex-wrap:wrap;align-items:center;column-gap:5px}
  .game .player-info strong{flex-basis:100%}
  .game .status-tags,.game .status-tags:has(span:not(:empty)){margin:0}
  .game .rear-slots{height:14px}
  .game .rear-slots svg{width:14px;height:14px}
  .game .awning{height:6px}
}

/* Four rows of shelves: each rear sprite sits half behind the current product. */
.game .shelves{grid-template-rows:repeat(var(--shelf-rows,4),minmax(0,1fr));gap:6px 9px}
.game .shelf{padding:1px 3px 0;border-bottom-width:7px}
.game .shelf-slots{height:100%;min-height:0;gap:1px}
.stock-cell{position:relative;isolation:isolate;display:grid;grid-template-rows:minmax(0,1fr) minmax(0,2fr);min-width:0;min-height:0}
.rear-peek{position:relative;grid-row:1;overflow:hidden;pointer-events:none;min-height:0;z-index:0}
.rear-peek svg{display:block;width:100%;height:200%;max-height:none;opacity:.6;filter:saturate(.8);transform:translateX(3px)}
.game .stock-cell .slot{grid-row:2;height:100%;min-height:0;z-index:1;border-radius:6px}
.game .stock-cell .slot svg{height:100%;width:100%;max-height:none}
.game .shelf-id{left:5px;right:auto;bottom:-7px;line-height:7px;font-size:6px}
.shelf-depth{position:absolute;right:4px;bottom:-7px;color:#785f41;font-size:6px;line-height:7px;pointer-events:none}
.game .cover{z-index:3}
@media(max-height:700px){
  .game .shelves{gap:4px 7px}
  .game .shelf{border-bottom-width:6px}
  .game .shelf-id,.game .shelf-depth{bottom:-6px;line-height:6px;font-size:6px}
}
/* Raise the foreground into the preview's lower half; the rear remains non-interactive. */
.stock-cell{--goods-overlap:clamp(8px,1.4dvh,12px)}
.game .stock-cell .slot{height:calc(100% + var(--goods-overlap));transform:translateY(calc(-1 * var(--goods-overlap)))}
.game .stock-cell .slot svg{height:calc(100% - var(--goods-overlap));align-self:flex-start}

/* Text navigation stays below the phone's safe area and never uses arrows. */
.back-button{flex:none;min-width:44px;min-height:36px;padding:7px 9px;background:#e9eddf;border:1px solid #dce3d1;border-radius:10px;font-size:12px;font-weight:700}
.topbar:has(>.back-button) .brand{flex:1;font-size:15px}
.topbar:has(>.back-button) .brand-mark{display:none}
.game-heading{flex:1;min-width:0}
.game-heading .game-title{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.game .back-button{min-height:32px;font-size:11px;padding:5px 8px}
.game .top-actions{flex:none;gap:5px}
.modal{padding:18px}
.modal-top{position:static;margin:-1px 0 14px;padding:3px 0 9px;justify-content:flex-start;gap:12px}
.modal-top h2{font-size:17px;letter-spacing:0}
.modal .danger{color:#ad5544;font-weight:700}
.rank-card{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:12px;margin:12px 0 8px;background:#fff9ed;border:1px solid #ded7bd;border-radius:12px;text-align:left;color:#74653e}
.rank-card b{display:block;font-size:14px}
.rank-card small{display:block;margin-top:4px;font-size:10px;color:#8f8a74}
.rank-summary{text-align:center;background:#eeebdc;border-radius:14px;padding:14px}
.rank-summary>span{font-size:13px;font-weight:700;color:#857246}
.rank-summary>strong{display:block;font-size:32px;color:#5a6d4f;margin:5px 0}
.rank-summary strong small{font-size:11px;letter-spacing:1px;font-weight:500}
.rank-record{display:flex;justify-content:center;gap:24px;font-size:12px;margin:15px 0}
.rank-ladder{margin:16px 0;display:grid;gap:5px}
.rank-ladder>div{display:grid;grid-template-columns:1fr 1fr 1fr;gap:8px;padding:9px 12px;border:1px solid transparent;border-radius:8px;font-size:11px;background:#f0efe5;align-items:center}
.rank-ladder small{font-size:10px;text-align:right;color:#8b927c}
.rank-ladder .current{border-color:#93a17b;background:#e5edd9}
[data-ranking]>p+p{margin-top:10px}
.rank-result{display:grid;grid-template-columns:1fr auto;text-align:left;align-items:center;background:#e8eedc;border-radius:12px;padding:12px 15px;margin:15px 0}
.rank-result>b{font-size:14px}.rank-result>strong{font-size:24px;color:#658153}.rank-result>strong.negative{color:#b96a53}
.rank-result small{grid-column:1/-1;font-size:10px;color:#8b957c;margin-top:4px}
.match-panel .queue-rank{margin:8px 0;color:#857246;font-weight:700}
@media(max-height:700px){.game .back-button{min-height:28px;padding:4px 7px;font-size:10px}.game .topbar{gap:6px}.game-heading .game-kicker{display:block;margin:1px 0 0}.modal-top{margin-bottom:10px}.match-panel{padding-top:14px}.match-avatar{margin-top:16px}.match-panel p{margin:12px 0}.match-pulse{margin:16px 0}}
@media(max-width:359px){.game-heading .game-title{font-size:11px}.game .top-actions{gap:3px}}

/* Ranked progress uses real earned stars; ELO remains an internal matching value. */
.rank-stars{display:flex;flex-direction:column;align-items:center;gap:7px;margin:13px 0 8px;color:#8b836b;font-variant-numeric:tabular-nums}
.star-slots{display:grid;grid-template-columns:repeat(var(--star-cols,4),1fr);gap:3px 8px;font-size:30px;line-height:1.2}
.rank-stars .filled,.star-gold{color:#bd9144;text-shadow:0 1px 0 #fff7cd}
.rank-stars .empty{color:#b2b09d}
.rank-stars small{font-size:12px!important;color:#81775b!important;letter-spacing:1px}
.rank-stars.compact{display:inline-flex;flex-direction:row;gap:10px;margin:6px 0 0;vertical-align:middle}
.rank-stars.compact .star-slots{font-size:16px;gap:1px 3px}
.rank-stars.compact small{font-size:10px!important;letter-spacing:0;white-space:nowrap;margin:0}
.rank-summary>span:first-child{display:block;font-size:21px}
.rank-card b{font-size:16px}.rank-card>span{min-width:0}
.rank-card .rank-stars b{font-size:14px}
.rank-result>.rank-stars{grid-column:1/-1;justify-self:start}
.rank-result>strong{font-size:21px}.king-stars>b{font-size:26px}
.king-stars>.filled{font-size:32px}.king-stars.compact>.filled{font-size:18px}
.queue-rank .rank-stars{display:flex;justify-content:center}

.rank-trophy{object-fit:contain;display:block;flex:none;max-width:100%;height:auto;user-select:none;filter:drop-shadow(0 3px 2px #78643c10)}
.rank-summary>.rank-trophy{margin:-3px auto 3px}
.rank-summary{background:radial-gradient(ellipse at 50% 30%,#fffdf4,#eeebdc 80%);padding:10px 14px 14px}
.rank-summary .rank-stars{margin-top:8px}
.rank-ladder{gap:6px}
.rank-ladder>button{display:grid;grid-template-columns:42px 1fr auto;align-items:center;gap:8px;text-align:left;padding:5px 9px;background:#f0efe5;border:1px solid transparent;border-radius:11px;min-width:0}
.rank-ladder>button.current{background:#e5edd9;border-color:#93a17b}
.rank-ladder>button b{font-size:12px;display:block}
.rank-ladder>button small{display:block;font-size:9px;margin-top:4px;white-space:nowrap}
.rank-ladder .trophy-rank-name small{text-align:left;color:#96927f}
.rank-ladder>button>span:last-child{text-align:right}
.game .game-title:has(.rank-trophy){display:flex;align-items:center;gap:5px;line-height:21px}
.game .game-title>.rank-trophy{width:22px;height:24px}
.game .game-title>span{overflow:hidden;text-overflow:ellipsis}
.result-trophy .rank-trophy{margin:10px auto 8px}
.trophy-showcase{text-align:center;padding:8px 6px 15px;background:radial-gradient(ellipse at 50% 35%,#fff9df 0%,transparent 66%)}
.trophy-showcase>.rank-trophy{margin:0 auto 10px}
.trophy-showcase h2{font-size:22px;margin-bottom:12px}
.trophy-showcase p{max-width:290px;margin:0 auto;line-height:2}
.trophy-requirement{display:inline-block;font-size:11px;font-weight:700;color:#857247;background:#eee9d9;border:1px solid #e3dac0;border-radius:20px;padding:9px 14px;margin-top:20px}
.trophy-showcase[data-tier=diamond]{background:radial-gradient(ellipse at 50% 35%,#e2f5f6,transparent 66%)}
.trophy-showcase[data-tier=master]{background:radial-gradient(ellipse at 50% 35%,#eee3f4,transparent 66%)}
.trophy-showcase[data-tier=king]{background:radial-gradient(ellipse at 50% 35%,#fae8d6,transparent 66%)}
@media(max-height:600px){.game .game-title>.rank-trophy{width:18px;height:19px}.game .game-title:has(.rank-trophy){line-height:19px}.result-trophy>.rank-trophy{width:68px;margin:4px auto}.rank-summary>.rank-trophy{width:82px}.trophy-showcase>.rank-trophy{width:125px}}
.rank-summary{display:grid;grid-template-columns:82px minmax(0,1fr);column-gap:10px;align-items:center;padding:10px}
.rank-summary>.rank-trophy{grid-column:1;grid-row:1/4;width:82px;margin:0}
.rank-summary>span:not(.rank-stars){grid-column:2;font-size:20px}
.rank-summary>.rank-stars,.rank-summary>p{grid-column:2;margin:3px 0}
.rank-summary>.rank-stars{gap:3px}.rank-summary .star-slots{font-size:23px;gap:3px}
.rank-summary>p{font-size:10px;line-height:1.5}
.rank-ladder>button{grid-template-columns:36px 1fr auto;padding:3px 8px}
.rank-ladder>button>.rank-trophy{width:36px}

/* The safe area is space in the layout, never a painted layer over scrolled content. */
.app:not(.game)>.topbar{margin-bottom:12px}
.app:not(.game) .mode-switch{margin-bottom:12px}
.app:not(.game) .section-line{margin-top:16px}
.account-entry{border:1px solid #dce3d1;border-radius:10px;background:#edf0e3;padding:7px 9px;font-size:11px;max-width:90px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* Let the document scroll: the initial safe-area padding scrolls away with the page. */
.app:not(.game){overflow:visible}
