:root{--font-ui: "Segoe UI", "Hiragino Maru Gothic ProN", "Yu Gothic UI", system-ui, -apple-system, sans-serif;--glass-bg: rgba(255, 255, 255, .88);--glass-dark: rgba(15, 23, 42, .82);--border-light: rgba(255, 255, 255, .72);--shadow-soft: 0 10px 28px rgba(15, 23, 42, .18);--text-main: #0f172a;--text-muted: #475569;--accent-teal: #0d9488}#canvas-container canvas{touch-action:none}.touch-stick{position:absolute;width:116px;height:116px;margin:-58px 0 0 -58px;border:2px solid rgba(255,255,255,.85);border-radius:50%;background:#0f172a42;pointer-events:none;opacity:0;transition:opacity .12s ease;z-index:5}.touch-stick.is-active{opacity:1}.touch-stick-knob{position:absolute;left:32px;top:32px;width:48px;height:48px;border-radius:50%;background:#ffffffeb;border:3px solid #14b8a6;box-shadow:0 3px 12px #0f172a40}.touch-control-hint{display:none}*{box-sizing:border-box;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}html,body,#app{margin:0;padding:0;width:100%;height:100%;overflow:hidden;font-family:var(--font-ui);background:#8ee3f5}#canvas-container{position:absolute;inset:0}#hud-root{position:absolute;inset:0;pointer-events:none;z-index:10}button{font-family:inherit;cursor:pointer}.hud-top-bar{position:absolute;top:14px;left:14px;right:14px;display:flex;justify-content:space-between;align-items:flex-start;gap:12px}.hud-left-stack{display:flex;flex-wrap:wrap;align-items:center;gap:10px;max-width:68%}.brand-pill,.pip-banner,.hud-btn,.sensor-panel,.proximity-pill,.controls-chip{pointer-events:auto;backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px)}.brand-pill{display:flex;align-items:center;gap:8px;background:var(--glass-bg);border:2px solid var(--border-light);border-radius:999px;padding:7px 14px;box-shadow:var(--shadow-soft)}.brand-icon{font-size:1.35rem}.brand-text{display:flex;flex-direction:column;line-height:1.1;color:var(--text-main)}.brand-text strong{font-size:.96rem}.brand-text small{font-size:.7rem;color:var(--accent-teal);font-weight:700}.pip-banner{display:flex;align-items:center;gap:9px;background:#f0fdfaeb;border:2px solid #5eead4;border-radius:16px;padding:8px 14px;box-shadow:var(--shadow-soft);max-width:480px}.pip-avatar{font-size:1.35rem;flex-shrink:0}.pip-en{font-size:.85rem;color:var(--text-main);line-height:1.25}.pip-ja{font-size:.75rem;color:#0f766e;font-weight:600;margin-top:2px}.hud-top-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}.hud-btn{background:var(--glass-bg);border:2px solid var(--border-light);border-radius:999px;padding:8px 14px;font-size:.85rem;font-weight:700;color:var(--text-main);box-shadow:var(--shadow-soft);transition:transform .12s ease,background .15s ease}.hud-btn:hover{transform:translateY(-1px);background:#fff}.hud-btn:active{transform:translateY(1px)}.icon-btn{padding:8px 11px;font-size:.95rem}.lang-btn{background:linear-gradient(135deg,#0ea5e9,#14b8a6);color:#fff;border-color:#ffffffd9}.lang-btn:hover{background:linear-gradient(135deg,#0284c7,#0d9488)}.lang-btn.is-ja{background:linear-gradient(135deg,#f59e0b,#f97316)}.sensor-panel{position:absolute;top:86px;left:14px;width:214px;background:var(--glass-bg);border:2px solid var(--border-light);border-radius:18px;padding:10px;display:flex;flex-direction:column;gap:6px;box-shadow:var(--shadow-soft)}.panel-heading{font-size:.72rem;text-transform:uppercase;letter-spacing:.05em;font-weight:800;color:var(--text-muted);padding:2px 4px}.panel-gap{margin-top:4px}.sensor-chip,.nav-chip{display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;border-radius:12px;border:1.5px solid #cbd5e1;background:#f8fafc;padding:7px 10px;font-size:.78rem;color:var(--text-main);transition:all .14s ease}.sensor-chip.on{border-color:#14b8a6;background:#f0fdfa}.sensor-chip.off{border-color:#fda4af;background:#fff1f2}.sensor-chip small{font-size:.68rem;color:var(--text-muted)}.nav-chip{flex-direction:row;align-items:center;justify-content:space-between;font-weight:700}.nav-chip:hover,.sensor-chip:hover{transform:translate(2px)}.dot{width:10px;height:10px;border-radius:50%;background:#94a3b8}.dot.lit{background:#10b981;box-shadow:0 0 8px #10b981}.controls-chip{position:absolute;bottom:14px;left:14px;background:var(--glass-dark);color:#f8fafc;border-radius:12px;padding:7px 12px;font-size:.74rem;display:flex;flex-direction:column;gap:2px}.ja-sub{font-size:.69rem;color:#fde68a;font-weight:600}.proximity-pill{position:absolute;bottom:16px;left:50%;transform:translate(-50%);background:var(--glass-dark);color:#fff;border:1.5px solid rgba(255,255,255,.25);border-radius:999px;padding:9px 18px;font-size:.84rem;display:flex;flex-direction:column;align-items:center;text-align:center;box-shadow:var(--shadow-soft);transition:opacity .2s ease,transform .2s ease}.proximity-pill.is-hidden{opacity:0;pointer-events:none;transform:translate(-50%,16px)}.rule-pedestal-tray{position:absolute;bottom:14px;left:50%;transform:translate(-50%);width:min(860px,calc(100vw - 24px));background:#fffffff0;backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);border:2.5px solid #ffffff;border-radius:22px;padding:12px 16px 14px;box-shadow:0 18px 42px #0f172a47;pointer-events:auto;transition:transform .26s cubic-bezier(.22,1,.36,1),opacity .2s ease}.rule-pedestal-tray.is-hidden{opacity:0;pointer-events:none;transform:translate(-50%,120%)}.rule-pedestal-tray.is-open{opacity:1;transform:translate(-50%)}.tray-header{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:10px}.tray-title-wrap{display:flex;align-items:center;gap:9px}.tray-badge{font-size:1.5rem}.tray-title{margin:0;font-size:1rem;color:var(--text-main)}.tray-hint{margin:2px 0 0;font-size:.78rem;color:var(--text-muted);font-weight:600}.tray-actions{display:flex;align-items:center;gap:8px}.status-pill{padding:5px 11px;border-radius:999px;font-size:.74rem;font-weight:800;background:#e2e8f0;color:#475569}.status-pill.is-active{background:#d1fae5;color:#065f46;box-shadow:0 0 12px #10b98159}.small-btn{padding:6px 11px;font-size:.76rem}.rule-slots-row{display:flex;flex-wrap:wrap;gap:6px;padding:7px 8px;background:#f1f5f9;border-radius:14px;border:1.5px solid #cbd5e1;margin-bottom:10px}.rule-slot{position:relative;min-width:72px;height:48px;border-radius:9px;padding:4px 10px;display:flex;flex-direction:column;align-items:center;justify-content:center;transition:transform .12s ease}.rule-slot.empty{border:2px dashed #94a3b8;background:#ffffffb3;color:#64748b;font-weight:700;font-size:.8rem}.rule-slot.filled{border:1px solid rgba(148,163,184,.36);background:linear-gradient(135deg,#fffffff0,#ffffffd1),var(--crystal-color, #0ea5e9);color:#17384b;box-shadow:inset 0 2px 0 var(--crystal-color),0 1px 3px #0f172a14;padding-right:19px}.rule-slot.filled:hover{transform:translateY(-2px)}.slot-word{font-size:.76rem;font-weight:800;letter-spacing:.03em}.slot-ja{font-size:.65rem;color:#365267;font-weight:600}.slot-remove{position:absolute;top:4px;right:6px;font-size:.82rem;font-weight:900;opacity:.82}.crystal-bank{display:grid;grid-template-columns:repeat(9,minmax(0,1fr));gap:6px}.crystal-card{min-width:48px;min-height:56px;border:1px solid rgba(148,163,184,.36);border-radius:10px;background:linear-gradient(135deg,#fffffff0,#fffc),var(--crystal-color, #6366f1);color:#17384b;padding:4px 6px 5px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;box-shadow:inset 0 2px 0 var(--crystal-color),0 1px 3px #0f172a14;transition:transform .12s ease,filter .12s ease}.crystal-card:hover{transform:translateY(-1px);filter:brightness(1.02)}.crystal-card:active{transform:scale(.98)}.crystal-card:focus-visible,.rule-slot:focus-visible{outline:2px solid #0284c7;outline-offset:2px}.crystal-card-top{display:flex;align-items:center;justify-content:space-between;width:100%;height:12px;flex-shrink:0}.crystal-gem{font-size:.5rem;line-height:1;color:var(--crystal-color)}.crystal-en{font-size:.76rem;font-weight:800;letter-spacing:.015em;line-height:1.15;text-align:center;max-width:100%}.crystal-cat{font-size:.56rem;font-weight:700;opacity:.82}.crystal-ja{font-size:.65rem;font-weight:600;line-height:1.15;text-align:center;color:#365267}.crystal-kana{font-size:.56rem;opacity:.88}@media(max-width:820px){.sensor-panel,.controls-chip{display:none}.hud-left-stack{max-width:100%}.crystal-bank{grid-template-columns:repeat(5,minmax(0,1fr))!important}}.sensor-panel{max-height:calc(100vh - 150px);overflow-y:auto}.hud-btn:disabled,.label-btn:disabled{opacity:.45;cursor:not-allowed;transform:none}.ja-inline{font-size:.82em;font-weight:600;opacity:.85}.ja-hint{color:#b45309}.objective-list{list-style:none;margin:0;padding:0 2px;display:flex;flex-direction:column;gap:5px}.objective{display:flex;gap:7px;align-items:flex-start;font-size:.76rem;color:var(--text-main);line-height:1.25}.objective-text{display:flex;flex-direction:column}.objective .ja-sub{color:#b45309}.objective .check{flex-shrink:0;width:18px;height:18px;border-radius:50%;display:grid;place-items:center;font-size:.7rem;background:#e2e8f0;color:#64748b}.objective.done{color:#047857}.objective.done .check{background:#10b981;color:#fff}.sensor-chip.static{cursor:default;flex-direction:row;flex-wrap:wrap;gap:4px}.sensor-chip.static:hover{transform:none}.nav-chip.is-on{border-color:#14b8a6;background:#f0fdfa}.pulse{animation:hud-pulse 1.4s ease-in-out infinite}@keyframes hud-pulse{0%,to{box-shadow:0 0 #facc158c}50%{box-shadow:0 0 0 6px #facc1500}}.rot{font-style:normal;font-size:.7rem;color:var(--text-muted)}.logic-board{font-size:.74rem;line-height:1.6;color:var(--text-main);background:#f8fafc;border:1.5px solid #cbd5e1;border-radius:12px;padding:7px 9px}.bool{display:inline-block;font-size:.62rem;font-weight:800;border-radius:6px;padding:0 5px;margin:0 2px}.bool.t{background:#d1fae5;color:#065f46}.bool.f{background:#fee2e2;color:#991b1b}.warn{color:#be185d;font-weight:800}.gate-line{margin-top:3px;color:#9a3412}.gate-line.open{color:#047857}.label-tag{font-size:.62rem;font-weight:800;border-radius:6px;padding:1px 6px;color:#fff}.label-tag.safe{background:#059669}.label-tag.danger{background:#dc2626}.label-tag.none{background:#94a3b8}.go-pip{width:100%;margin-top:4px;background:linear-gradient(135deg,#10b981,#14b8a6);color:#fff}.context-card,.rule-pedestal-tray{animation:tray-in .28s cubic-bezier(.22,1,.36,1)}@keyframes tray-in{0%{opacity:0;transform:translate(-50%,30px)}to{opacity:1;transform:translate(-50%)}}.context-card{position:absolute;bottom:14px;left:50%;transform:translate(-50%);width:min(460px,calc(100vw - 24px));background:#fffffff2;border:2.5px solid #ffffff;border-radius:20px;padding:12px 16px 14px;box-shadow:0 18px 42px #0f172a47;pointer-events:auto;display:flex;flex-direction:column;gap:8px;align-items:stretch}.context-title{font-weight:800;font-size:.95rem;color:var(--text-main)}.context-hint{margin:0;font-size:.8rem;color:var(--text-muted);display:flex;flex-direction:column;gap:2px}.context-hint .ja-sub{color:#b45309}.scanner-name{font-weight:700;font-size:.88rem}.traits{display:flex;flex-direction:column;gap:5px}.trait{display:grid;grid-template-columns:120px 1fr 80px;gap:8px;align-items:center;font-size:.76rem}.trait-bar{height:9px;border-radius:999px;background:#e2e8f0;overflow:hidden}.trait-bar i{display:block;height:100%;border-radius:999px;background:linear-gradient(90deg,#22d3ee,#a855f7)}.trait-word{font-weight:700;color:var(--text-muted)}.label-row{display:grid;grid-template-columns:1fr 1fr;gap:8px}.label-btn{min-width:48px;min-height:48px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;border:1.5px solid transparent;border-radius:10px;padding:6px 8px;font-size:.8rem;font-weight:800;color:#fff;transition:transform .12s ease}.label-btn.safe{background:#047857}.label-btn.danger{background:#be123c}.label-en{line-height:1.15}.label-ja{font-size:.65rem;font-weight:600;line-height:1.15}.label-btn.chosen{border-color:#fde047;box-shadow:0 1px 5px #0f172a24}.label-btn:not(:disabled):hover{transform:translateY(-2px)}.crystal-bank{grid-template-columns:repeat(var(--bank-cols, 9),minmax(0,1fr))}.slot-placeholder{font-weight:700}.modal-backdrop{position:absolute;inset:0;background:#0f172a6b;display:grid;place-items:center;pointer-events:auto;padding:16px;z-index:20}.modal{width:min(860px,100%);max-height:calc(100vh - 32px);overflow-y:auto;background:#fffffff7;border-radius:24px;padding:18px 20px 20px;box-shadow:0 24px 60px #0f172a59;animation:modal-in .3s cubic-bezier(.22,1,.36,1);color:var(--text-main)}@keyframes modal-in{0%{opacity:0;transform:scale(.94)}to{opacity:1;transform:scale(1)}}.modal-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.modal h2{margin:0;font-size:1.25rem}.level-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-bottom:14px}.level-card{border:2px solid #e2e8f0;border-radius:18px;padding:14px;display:flex;flex-direction:column;gap:6px;background:linear-gradient(160deg,#f0fdfa,#fff)}.level-card.current{border-color:#14b8a6}.level-card.cleared{background:linear-gradient(160deg,#fef9c3,#fff)}.level-card.locked{background:#f1f5f9;color:#94a3b8}.level-card h3{margin:0;font-size:1rem}.ja-title{font-size:.8rem;font-weight:700;color:#b45309}.level-num{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;font-weight:900;background:#14b8a6;color:#fff}.level-card.cleared .level-num{background:#f59e0b}.level-card.locked .level-num{background:#cbd5e1}.level-focus{margin:0;font-size:.78rem;color:var(--text-muted);display:flex;flex-direction:column;gap:2px;flex:1}.level-meta{margin:0;font-size:.72rem;color:var(--text-muted);display:flex;flex-direction:column}.play-btn{background:linear-gradient(135deg,#0ea5e9,#14b8a6);color:#fff}.word-book{display:flex;flex-wrap:wrap;gap:6px;margin:6px 0 4px}.word-chip{background:var(--crystal-color, #6366f1);color:#fff;font-weight:800;font-size:.78rem;border-radius:10px;padding:4px 9px}.word-chip small{font-weight:600;opacity:.9}.muted{color:var(--text-muted);font-size:.8rem;display:flex;flex-direction:column}.cleared-banner{width:min(460px,100%);text-align:center;display:flex;flex-direction:column;align-items:center;gap:8px}.cleared-banner p{margin:0;display:flex;flex-direction:column;gap:2px}.cleared-stars{font-size:1.8rem;color:#f59e0b;letter-spacing:.2em}.modal-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:center;margin-top:6px}@media(max-width:1100px){.sensor-panel{top:128px;max-height:calc(100vh - 290px)}}@media(max-width:820px){.sensor-panel{display:flex;left:auto;right:max(10px,env(safe-area-inset-right));top:126px;bottom:auto;width:176px;max-height:26vh}#hud-root:has(.rule-pedestal-tray.is-open) .sensor-panel,#hud-root:has(.context-card) .sensor-panel{display:none}.level-grid{grid-template-columns:1fr}.trait{grid-template-columns:90px 1fr 60px}.hud-top-actions .hud-btn{padding:6px 9px;font-size:.75rem}}.rule-slot{min-width:48px;min-height:48px}@media(max-width:820px){.crystal-bank{grid-template-columns:repeat(auto-fit,minmax(48px,1fr))!important}}@media(any-pointer:coarse){.hud-btn,.sensor-chip,.nav-chip,.label-btn{min-width:48px;min-height:48px}.desktop-control-hint{display:none}.touch-control-hint{display:flex;flex-direction:column}.controls-chip{display:flex;left:max(12px,env(safe-area-inset-left));bottom:max(12px,env(safe-area-inset-bottom));max-width:220px;font-size:.68rem;pointer-events:none}.rule-pedestal-tray,.context-card{bottom:max(12px,env(safe-area-inset-bottom));max-height:48dvh;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y}.modal{max-height:calc(100dvh - 32px);touch-action:pan-y}}@media(any-pointer:coarse)and (max-width:820px){.hud-top-bar{top:max(8px,env(safe-area-inset-top));left:8px;right:8px;gap:6px}.hud-left-stack{flex:1;gap:5px}.pip-banner{padding:6px 8px}.pip-en{font-size:.74rem}.brand-pill{padding:6px 9px}.brand-text small{font-size:.62rem}.hud-top-actions{max-width:116px;gap:4px}.sensor-panel{left:auto;right:max(8px,env(safe-area-inset-right));top:126px;bottom:auto;width:176px;max-height:27dvh;touch-action:pan-y}}@media(prefers-reduced-motion:reduce){.touch-stick{transition:none}}@media(max-width:820px){.crystal-bank{grid-template-columns:repeat(auto-fit,minmax(84px,1fr))!important}}@media(any-pointer:coarse)and (max-width:900px){.hud-top-bar{flex-direction:column;align-items:stretch;gap:6px}.hud-left-stack{width:100%;max-width:100%}.hud-top-actions{order:-1;width:100%;max-width:none;flex-wrap:nowrap;justify-content:flex-start;overflow-x:auto;touch-action:pan-x;scrollbar-width:thin;padding-bottom:3px}.hud-top-actions .hud-btn{flex-shrink:0}.sensor-panel{top:210px;max-height:24dvh}}@media(any-pointer:coarse)and (max-height:500px){.hud-left-stack{flex-wrap:nowrap}.pip-banner{max-height:68px;overflow-y:auto;touch-action:pan-y}.sensor-panel{top:132px;max-height:max(48px,calc(100dvh - 270px))}.rule-pedestal-tray .tray-header{margin-bottom:6px}}.reset-btn{background:linear-gradient(135deg,#fef3c7,#fde68a);border-color:#fcd34d}.rule-slot.pulse-lit,.rule-slot.pulse-dark,.rule-slot.pulse-stop,.pulse-node.pulse-lit,.pulse-node.pulse-dark,.pulse-node.pulse-stop{animation:pulse-step .5s ease-out both;animation-delay:var(--pulse-delay, 0s)}.rule-slot.pulse-lit{--pulse-glow: rgba(52, 211, 153, .95)}.rule-slot.pulse-dark{--pulse-glow: rgba(148, 163, 184, .9)}.rule-slot.pulse-stop{--pulse-glow: rgba(239, 68, 68, .95);outline:3px solid #ef4444;outline-offset:2px;animation-name:pulse-stop}@keyframes pulse-step{0%{box-shadow:0 0 0 0 var(--pulse-glow, rgba(52, 211, 153, .9));transform:scale(1)}35%{box-shadow:0 0 0 7px var(--pulse-glow, rgba(52, 211, 153, .9));transform:scale(1.08)}to{box-shadow:0 4px 10px #0f172a2e;transform:scale(1)}}@keyframes pulse-stop{0%,40%{transform:translate(0);box-shadow:0 0 #ef4444e6}55%{transform:translate(-4px);box-shadow:0 0 0 7px #ef444480}70%{transform:translate(4px)}to{transform:translate(0);box-shadow:0 0 0 3px #ef444459}}.pulse-node{align-self:center;font-size:.72rem;font-weight:800;border-radius:999px;padding:5px 10px;background:#e2e8f0;color:#475569;white-space:nowrap}.pulse-node.pulse-lit{background:#d1fae5;color:#065f46}.pulse-node.pulse-stop{background:#fee2e2;color:#991b1b}.pulse-node.target{margin-left:auto}.level-section{margin:4px 0 6px;font-size:.8rem}.level-grid.tutorial-grid{grid-template-columns:repeat(4,minmax(0,1fr))}@media(max-width:820px){.level-grid.tutorial-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(prefers-reduced-motion:reduce){.rule-slot.pulse-lit,.rule-slot.pulse-dark,.rule-slot.pulse-stop,.pulse-node{animation:none}}.rule-slot[data-drag],.crystal-card[data-drag]{cursor:grab;touch-action:none}.is-dragging,.is-dragging *{cursor:grabbing!important}.drag-ghost{position:fixed;z-index:100;pointer-events:none;transform:translate(-50%,-50%) rotate(-4deg) scale(1.08);opacity:.92;box-shadow:0 14px 30px #0f172a59;margin:0}.drag-source{opacity:.35}.drop-hover{outline:3px dashed #facc15;outline-offset:2px;transform:scale(1.06)}.crystal-bank.drop-hover{transform:none;background:#fef08a59;border-radius:14px}.rule-slot.locked{cursor:default;opacity:.82;filter:saturate(.75);padding-right:22px}.slot-lock{position:absolute;top:3px;right:5px;font-size:.62rem;opacity:.85}.crystal-card{position:relative}.crystal-card.is-new{border-color:#d8b54c;box-shadow:inset 0 2px 0 var(--crystal-color),0 1px 5px #b48b1a24}.new-badge{display:inline-block;background:#fef3c7;color:#713f12;font-size:.53rem;font-weight:800;line-height:1;border-radius:999px;padding:2px 4px;white-space:nowrap}.lesson-bar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;margin-bottom:8px}.step-dots{display:inline-flex;gap:5px}.step-dots i{width:11px;height:11px;border-radius:50%;background:#cbd5e1}.step-dots i.now{background:#38bdf8;box-shadow:0 0 0 3px #38bdf84d}.step-dots i.done{background:#10b981}.step-label{font-size:.74rem;font-weight:800;color:var(--text-muted)}.meaning-card{display:inline-flex;flex-direction:column;font-size:.8rem;font-weight:700;color:#713f12;background:#fef9c3;border:1.5px solid #fde047;border-radius:10px;padding:4px 10px}.meaning-card .ja-sub{color:#92400e}.drag-hint{margin:8px 0 0;font-size:.7rem;color:var(--text-muted);display:flex;flex-direction:column}@media(prefers-reduced-motion:reduce){.crystal-card.is-new{animation:none}}.crystal-bank>.crystal-card{width:100%;max-width:104px;justify-self:center}
