@import url('../engine/sprite.css');
/* Bottle Flip Tycoon — game chrome. Shares the Click to Play palette. */
:root {
  --ink: #172638;
  --cream: #fffaf0;
  --coral: #f47d6d;
  --yellow: #ffcf47;
  --wood: #e6c49c;
  --wood-dark: #c99f74;
  --frame: #241b18;
  --frame-2: #372a24;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  color: var(--ink);
  background: var(--cream);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #ed6655; outline-offset: 3px; }
.skip-link { position: absolute; top: -100px; left: 16px; z-index: 50; background: var(--ink); color: white; padding: 12px; }
.skip-link:focus { top: 12px; }

/* ---------- portal chrome ---------- */
.portal-header { height: 82px; padding: 0 clamp(22px, 4.5vw, 80px); display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--cream); border-bottom: 1px solid #dcded5; }
.portal-brand { display: inline-flex; align-items: center; gap: 10px; font-size: 29px; font-weight: 800; letter-spacing: -.09em; line-height: 1; white-space: nowrap; }
.portal-mark { display: grid; place-items: center; width: 36px; height: 36px; flex: none; background: var(--coral); border: 2px solid var(--ink); border-radius: 50%; font-size: 25px; letter-spacing: 0; transition: transform .3s; }
.portal-brand:hover .portal-mark { transform: rotate(90deg); }
.portal-to, .portal-dot { color: #ee7567; }
.portal-back { font-size: 13px; font-weight: 700; border-bottom: 1px solid var(--ink); padding-bottom: 4px; }
.portal-back:hover { color: #c45449; }
.portal-workspace { max-width: 1400px; margin: auto; padding: 26px clamp(16px, 4vw, 60px) 60px; }
.workspace-heading { display: flex; justify-content: space-between; border-top: 2px solid var(--ink); padding-top: 14px; font-size: 10px; font-weight: 800; letter-spacing: .15em; margin-bottom: 14px; }
.portal-footer { background: var(--ink); color: var(--cream); padding: 42px clamp(22px, 6vw, 90px) 24px; margin-top: 40px; }
.portal-footer-top, .portal-footer-bottom { max-width: 1100px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.portal-footer .portal-brand { color: var(--cream); font-size: 27px; }
.portal-original { color: #cbd5d3; font-size: 12px; font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.portal-footer-bottom { margin-top: 44px; border-top: 1px solid #ffffff44; padding-top: 18px; color: #cbd5d3; font-size: 12px; }
.game-help { max-width: 900px; margin: 20px auto 0; font-size: 12px; line-height: 1.7; color: #5d666d; }

/* ---------- cabinet ---------- */
.game {
  display: grid; grid-template-columns: minmax(0, 1fr) 366px; grid-template-rows: 62px minmax(0, 1fr) 58px;
  grid-template-areas: 'hud panel' 'stage panel' 'bar panel';
  height: min(76vh, 700px); min-height: 540px; background: var(--frame); color: var(--cream);
  border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; box-shadow: 10px 12px 0 var(--ink);
}
.hud { grid-area: hud; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 16px; background: linear-gradient(180deg, #2e2320, var(--frame)); border-bottom: 2px solid #17110e; }
.hud-res { display: flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.hud-res .rate { font-size: 11px; font-weight: 700; color: #cbb69b; letter-spacing: 0; }

/* ---------- table ---------- */
.stage { grid-area: stage; position: relative; display: grid; grid-template-columns: 86px minmax(0, 1fr); gap: 10px; padding: 12px; background: radial-gradient(circle at 30% -10%, #4a3830, #2b211d 70%); }
.game[data-belt='0'] .stage { grid-template-columns: minmax(0, 1fr); }
.game[data-belt='0'] .belt { display: none; }
.belt { position: relative; border-radius: 10px; border: 3px solid #17110e; background: #221a16; overflow: hidden; }
.belt::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(180deg, #4a382e 0 12px, #2c221c 12px 24px); animation: beltrun 1.1s linear infinite; opacity: .85; }
@keyframes beltrun { to { background-position-y: 24px; } }
.belt-glyph { position: absolute; left: 50%; margin-left: -13px; font-size: 26px; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .4)); animation: beltRise 2.8s linear infinite; }
.belt-glyph:nth-child(2) { animation-delay: -0.7s; }
.belt-glyph:nth-child(3) { animation-delay: -1.4s; }
.belt-glyph:nth-child(4) { animation-delay: -2.1s; }
@keyframes beltRise { from { top: 104%; opacity: 0; } 12% { opacity: 1; } 88% { opacity: 1; } to { top: -14%; opacity: 0; } }
.belt-tag { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; font-size: 10px; font-weight: 800; color: #ffd9a8; text-shadow: 0 1px 2px #000; }
.table { position: relative; overflow: hidden; border-radius: 10px; border: 3px solid #7c5a3c; background: repeating-linear-gradient(180deg, #e9c9a2 0 46px, #e2c098 46px 48px); cursor: crosshair; }
.table::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 12px 24px rgba(120, 80, 40, .25); }
.world { position: absolute; inset: 0; }
.world > * { position: absolute; left: 0; bottom: 0; }
.game.idle .world { opacity: .06; }

/* ---------- bottles ---------- */
.bottle { width: 22px; height: 62px; transform-origin: 50% 50%; will-change: transform; }

/* ---------- hands, popups, idle note ---------- */
.hand { width: 34px; height: 34px; display: grid; place-items: center; font-size: 26px; transform-origin: 50% 50%; transition: opacity .2s; }
.hand[data-mode='rest'] { opacity: .3; }
.pop { font-size: 15px; font-weight: 800; white-space: nowrap; color: #4a3418; text-shadow: 0 1px 0 rgba(255, 255, 255, .75); pointer-events: none; }
.pop[data-kind='cap'] { color: #b83c14; font-size: 19px; }
.pop[data-kind='upright'] { color: #2c6b3d; }
.idle-note { position: absolute; inset: auto 0 50% 0; text-align: center; font-size: 14px; font-weight: 800; color: #402c18; letter-spacing: .04em; pointer-events: none; }

/* ---------- panel ---------- */
.panel { grid-area: panel; display: flex; flex-direction: column; min-height: 0; background: #1c1512; border-left: 2px solid #17110e; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 10px 10px 4px; }
.tabs button { padding: 10px 4px; font-size: 13px; font-weight: 800; color: #e5d8c4; background: #2b211c; border: 2px solid #453329; border-radius: 8px; }
.tabs button[aria-selected='true'] { background: var(--cream); color: var(--frame); border-color: var(--cream); }
.divider { height: 2px; margin: 6px 10px 0; background: linear-gradient(90deg, var(--coral), #6b4a33 60%, transparent); border-radius: 2px; }
.rows { flex: 1; min-height: 0; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin; }
.rows::-webkit-scrollbar { width: 8px; }
.rows::-webkit-scrollbar-thumb { background: #55402f; border-radius: 4px; }
.row { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 10px; text-align: left; padding: 9px 11px; border-radius: 9px; border: 2px solid #6a5748; background: #f4e8d5; color: #241b18; transition: transform .12s, box-shadow .12s, background .2s; }
.row:hover:not(.max) { transform: translate(-2px, -2px); box-shadow: 3px 3px 0 #17110e; }
.row.poor { background: #e7dac6; }
.row.max { background: #cfc2ad; border-color: #8d7c68; cursor: default; }
.row-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 8px; background: var(--cream); border: 2px solid #6a5748; font-size: 20px; line-height: 1; }
.row-name { display: block; font-size: 13.5px; font-weight: 800; }
.row-note { display: block; font-size: 11px; line-height: 1.35; color: #6b5645; margin-top: 2px; }
.row-side { text-align: right; }
.row-count { display: block; font-size: 11px; font-weight: 800; color: #6b5645; }
.row-cost { display: block; font-size: 13px; font-weight: 800; color: #b4451f; margin-top: 2px; white-space: nowrap; }
.row.rich .row-cost { color: #1d6b3a; }
.row.max .row-cost, .row.max .row-count { color: #6b5645; }

/* ---------- bottom bar ---------- */
.bar { grid-area: bar; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: var(--frame); border-top: 2px solid #17110e; }
.bar button { padding: 9px 14px; font-size: 12px; font-weight: 800; color: #f0e3cd; background: #35291f; border: 2px solid #55402f; border-radius: 8px; }
.bar button:hover { background: #45352a; }
.bar button[aria-pressed='true'] { background: var(--yellow); color: var(--frame); border-color: var(--yellow); }
.bar .spacer { flex: 1; }
.bar .stat { font-size: 11px; font-weight: 700; color: #c2ab8f; text-align: right; line-height: 1.4; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: var(--cream); padding: 13px 20px; border-radius: 10px; font-size: 13px; font-weight: 700; box-shadow: 5px 6px 0 rgba(0, 0, 0, .35); z-index: 60; animation: rise .3s both; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 12px); } }

@media (max-width: 980px) {
  .game { grid-template-columns: minmax(0, 1fr); grid-template-rows: 58px minmax(340px, 46vh) auto 54px; grid-template-areas: 'hud' 'stage' 'panel' 'bar'; height: auto; min-height: 0; }
  .panel { border-left: 0; border-top: 2px solid #17110e; max-height: 340px; }
  .portal-header { height: 66px; }
  .portal-brand { font-size: 23px; }
  .hud-res { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) { .belt::before { animation: none; } .row { transition: none; } }

/* Godot edition. The rules above remain available to legacy.html. */
.godot-page .portal-workspace { max-width: 1500px; }
.godot-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 14px; font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.godot-toolbar-actions { display: flex; align-items: center; gap: 16px; letter-spacing: 0; }
.godot-toolbar-actions button { border: 2px solid #30201b; border-radius: 9px; background: #ffd36e; color: #30201b; padding: 9px 15px; font-weight: 800; box-shadow: 3px 3px 0 #30201b; }
.godot-toolbar-actions button:hover { transform: translate(1px, 1px); box-shadow: 2px 2px 0 #30201b; }
.godot-toolbar-actions a { text-decoration: underline; text-underline-offset: 3px; }
.godot-page .godot-game { display: block; width: 100%; height: auto; min-height: 0; max-height: none; aspect-ratio: 16 / 9; padding: 0; background: #30201b; border: 5px solid #30201b; border-radius: 11px; overflow: hidden; box-shadow: 8px 9px 0 #30201b; }
.godot-page .godot-game iframe { display: block; width: 100%; height: 100%; border: 0; background: #30201b; }
.godot-page .godot-game:fullscreen { width: 100vw; height: 100dvh; max-height: none; aspect-ratio: auto; border: 0; border-radius: 0; box-shadow: none; }
.godot-page .game-help { max-width: none; color: #64564e; font-size: 13px; }
@media (max-width: 680px) {
  .godot-toolbar { align-items: flex-start; flex-direction: column; }
  .godot-toolbar-actions { flex-wrap: wrap; }
  .godot-page .godot-game { border-width: 3px; box-shadow: 4px 5px 0 #30201b; }
}

/* The tabletop is the play surface; controls are set into a warm cabinet. */
.game {
  --frame: #302522;
  --frame-2: #514039;
  grid-template-columns: minmax(0, 1fr) 390px;
  height: min(78vh, 740px);
  min-height: 560px;
  border: 4px solid #241c19;
  border-radius: 8px;
  box-shadow: 0 22px 42px #271d1b30, 8px 9px 0 #1c1716;
}
.game:fullscreen { width: 100vw; height: 100dvh; min-height: 0; border: 0; border-radius: 0; box-shadow: none; }
.hud, .bar { background: #342723; }
.hud { border-bottom: 3px solid #1f1715; }
.hud-res { color: #fff6e8; font-variant-numeric: tabular-nums; text-shadow: 0 2px #1d1513; }
.stage {
  background-color: #43352f;
  background-image: repeating-linear-gradient(45deg, #ffffff08 0 10px, transparent 10px 24px), repeating-linear-gradient(-45deg, #00000018 0 12px, transparent 12px 26px);
  padding: 14px;
  gap: 11px;
}
.table {
  border: 4px solid #241a16;
  border-radius: 9px;
  background-color: #edc89b;
  background-image: repeating-linear-gradient(0deg, #b8855624 0 2px, transparent 2px 62px), radial-gradient(circle at 28% 25%, #ffdea8 0, transparent 52%), linear-gradient(120deg, #e5b784, #efc997 60%, #e8ba84);
  box-shadow: inset 0 0 0 3px #f9d9af, inset 0 16px 30px #80512a25, 0 8px 0 #1e1514;
}
.table::after { box-shadow: inset 0 0 30px #8c56272b; }
.belt { border-radius: 7px; border-width: 4px; box-shadow: 0 7px 0 #1f1715; }
.bottle { filter: drop-shadow(2px 4px 1px #67462e6b); cursor: pointer; }
.bottle.ready:hover { filter: drop-shadow(0 0 7px #fff7bc) drop-shadow(2px 4px 1px #67462e6b); }
.hand { filter: drop-shadow(2px 3px 0 #583e2b77); }
.panel { background: #3b2d29; border-left: 4px solid #1e1715; }
.tabs { padding: 13px 12px 8px; gap: 5px; }
.tabs button { background: #584842; border: 2px solid #211a17; border-radius: 5px; box-shadow: inset 0 2px #ffffff14, 0 3px 0 #211a17; }
.tabs button[aria-selected='true'] { background: #e6d0ab; border-color: #211a17; color: #302521; }
.divider { margin: 5px 12px 0; background: #a37a57; }
.rows { gap: 9px; padding: 13px; }
.row { border: 2px solid #29211d; border-radius: 5px; background: #ddcfad; box-shadow: inset 0 2px #fff8df, 0 4px 0 #211a17; }
.row.poor { background: #b8aa91; }
.row.rich { background: #e8d8b6; }
.row.max { background: #a99d86; border-color: #29211d; }
.row-icon { border-color: #4d3e33; border-radius: 4px; background: #f5e8c9; }
.bar { border-top: 3px solid #1f1715; }
.bar button { border-radius: 5px; }

/* A compact web remains legible inside the cabinet's narrow inspector. */
.talent-graph { position: relative; flex: none; width: 100%; height: 325px; margin: 0 auto; border: 1px solid #896a58; border-radius: 6px; overflow: hidden; background: radial-gradient(circle at 50% 49%, #8d7056 0, #5c493e 46%, #302824 100%); box-shadow: inset 0 0 30px #1b1516a8; }
.talent-graph::before, .talent-graph::after { content: ''; position: absolute; inset: 10% 4%; border: 1px solid #d3ad7852; border-radius: 50%; pointer-events: none; }
.talent-graph::after { inset: 22% 17%; }
.web-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.web-lines line { stroke: #ceb89488; stroke-width: .65; stroke-dasharray: 1.1 1.2; transition: stroke .25s, opacity .25s; }
.web-lines line.lit { stroke: #f8d389; stroke-width: .9; stroke-dasharray: none; filter: drop-shadow(0 0 2px #ffe5a4); }
.web-node { position: absolute; z-index: 1; display: grid; place-items: center; width: 48px; height: 48px; padding: 0; transform: translate(-50%, -50%); border: 2px solid #ead2aa; border-radius: 50%; background: #322824; color: #fff2d8; box-shadow: 0 4px 0 #211a17, 0 0 0 4px #30282490; transition: transform .18s, background .18s, box-shadow .18s; }
.web-node:hover { transform: translate(-50%, -54%) scale(1.08); }
.web-node.active { background: #b87935; border-color: #ffe2a0; box-shadow: 0 4px 0 #211a17, 0 0 15px #ffcb72a8; }
.web-node.selected { outline: 3px solid #f9e5bb; outline-offset: 4px; }
.web-node.future { opacity: .34; filter: grayscale(1); }
.web-level { position: absolute; right: -6px; bottom: -7px; min-width: 17px; padding: 1px 3px; border-radius: 8px; background: #f0d49b; color: #37251b; font-size: 10px; font-weight: 900; }
.web-level:empty { display: none; }
.talent-detail { padding: 14px 15px 15px; background: #dfcdab; border: 2px solid #211a17; border-radius: 5px; box-shadow: inset 0 2px #fff5d7, 0 4px 0 #211a17; color: #302521; }
.talent-eyebrow { color: #846547; font-size: 10px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.talent-name { display: block; margin-top: 5px; font-size: 18px; }
.talent-note { min-height: 16px; margin: 4px 0 14px; color: #665343; font-size: 12px; line-height: 1.4; }
.talent-action { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.talent-progress { font-size: 13px; font-weight: 900; font-variant-numeric: tabular-nums; }
.talent-buy { padding: 8px 12px; border: 2px solid #2b211a; border-radius: 4px; background: #b77437; color: #fff7e3; font-size: 12px; font-weight: 900; box-shadow: 0 3px 0 #2b211a; }
.talent-buy:disabled { background: #a69a85; color: #e8dcc7; cursor: default; }

@media (max-width: 980px) {
  .game { grid-template-columns: minmax(0, 1fr); grid-template-rows: 58px minmax(340px, 46vh) auto 54px; height: auto; min-height: 0; }
  .panel { border-left: 0; border-top: 4px solid #1e1715; max-height: 630px; }
  .talent-graph { max-width: 420px; }
}
@media (max-width: 500px) {
  .stage { padding: 8px; gap: 6px; grid-template-columns: 54px minmax(0, 1fr); }
  .hud-res { font-size: 20px; }
  .hud-res .rate { display: none; }
  .bar .stat { display: none; }
  .talent-graph { height: 390px; }
  .web-node { width: 42px; height: 42px; }
}

/* Theme-specific sizing for sprites supplied by the shared atlas renderer. */
.hud-sprite { width: 32px; height: 32px; filter: drop-shadow(0 2px 1px #120c0b); }
.icon-sprite { width: 38px; height: 38px; filter: drop-shadow(1px 2px 0 #36292545); }
.mini-bottle { width: 38px; height: 38px; filter: drop-shadow(1px 2px 0 #36292545); }
.web-node .icon-sprite, .web-node .mini-bottle { width: 42px; height: 42px; }
.bottle-sprite { position: absolute; width: 78px; height: 78px; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.hand-sprite { position: absolute; width: 50px; height: 50px; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.belt-glyph { width: 70px; height: 70px; margin-left: -35px; transform: rotate(-17deg); }
.belt-glyph::before, .belt-glyph::after { content: none; }
.belt-pile { position: absolute; left: 50%; bottom: 12px; width: 80px; height: 80px; transform: translateX(-50%); pointer-events: none; }
.belt-tag { z-index: 1; }
.stage { background-image: linear-gradient(#332722c9, #332722c9), url('./assets/floor-tile.webp'); background-size: auto, 220px 220px; }
.table { background-image: linear-gradient(#efd0a9ba, #efd0a9ba), url('./assets/table-tile.webp'); background-size: auto, 240px 240px; }
.table-hint { position: absolute; left: 50%; bottom: 17px; z-index: 2; transform: translateX(-50%); padding: 7px 12px; border: 1px solid #795f45a6; border-radius: 4px; color: #5a4129; background: #f7dfbaae; font-size: 11px; font-weight: 800; letter-spacing: .04em; white-space: nowrap; pointer-events: none; }
.panel-heading { position: relative; display: grid; gap: 2px; padding: 16px 16px 13px; border-bottom: 3px solid #211a17; background: linear-gradient(135deg, #6c5243, #3d302b 70%); }
.panel-eyebrow { color: #e0be8e; font-size: 10px; font-weight: 900; letter-spacing: .17em; }
.panel-title { color: #fff0d7; font-size: 21px; font-weight: 900; letter-spacing: -.02em; line-height: 1.2; text-shadow: 0 2px #221a17; }
.panel-table-count { position: absolute; right: 16px; top: 24px; color: #f6dfb8; font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; }
.panel-meter { display: block; width: 100%; height: 5px; margin-top: 11px; overflow: hidden; border-radius: 8px; background: #211a17; }
.panel-meter-fill { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #84c4c0, #e5c56b); transition: width .25s; }
.panel .tabs { padding-top: 11px; }
.row { position: relative; overflow: hidden; min-height: 68px; }
.row::before { content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 5px; background: #9c8a6f; }
.row.rich::before { background: #59a863; }
.row.poor::before { background: #8a5d4c; }
.row-icon { box-shadow: inset 0 2px #fff9e8, 1px 2px #3b2a2545; }
.row-cost { display: inline-block; padding: 3px 6px; border: 1px solid #ac735d; border-radius: 3px; background: #f2d8c3; }
.row.rich .row-cost { border-color: #8db788; background: #d8e9d0; }
.row.max .row-cost { border-color: #8b8274; background: #bdb19a; }
.hud-res .rate:empty { display: none; }

/* The reward track is a reusable lane with theme-provided moving tokens. */
.stage { grid-template-columns: 102px minmax(0, 1fr); }
.belt { display: flex; flex-direction: column; background: #211e1c; border: 5px solid #171513; border-radius: 14px; }
.belt::before { content: none; }
.track-head { z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 68px; flex: none; border-bottom: 6px solid #141312; border-radius: 8px 8px 18px 18px; background: linear-gradient(#77776f, #454540); box-shadow: inset 0 6px #b3b3a6, 0 4px 0 #111; }
.track-count { padding: 5px 7px; border-radius: 5px; background: #85857b; color: #efe9d8; font-size: 19px; font-variant-numeric: tabular-nums; text-shadow: 0 2px #353530; }
.track-speed { color: #efeadc; font-size: 9px; font-weight: 900; letter-spacing: .02em; text-shadow: 0 1px #232321; white-space: nowrap; }
.track-lane { position: relative; flex: 1; min-height: 80px; margin: 0 7px; overflow: hidden; border: 5px solid #111; border-radius: 8px; background: repeating-linear-gradient(160deg, #9c9e9a 0 2px, transparent 2px 65px), #777d7b; box-shadow: inset 8px 0 #373b3a, inset -8px 0 #373b3a; }
.track-lane::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(28deg, transparent 0 42px, #3034325c 43px 45px, transparent 46px 86px); }
.track-token { position: absolute; z-index: 1; left: calc(50% + var(--token-offset) * .38); top: -48px; width: 42px; height: 42px; margin-left: -21px; filter: hue-rotate(calc(var(--token-index) * 32deg)) drop-shadow(1px 3px 1px #222a); animation: trackDrop 5.4s linear infinite; animation-delay: calc(var(--token-index) * -.46s); }
.track-foot { height: 66px; flex: none; border-top: 7px solid #111; background: repeating-linear-gradient(0deg, #494e4d 0 10px, #242827 10px 19px); box-shadow: inset 0 7px #808480; }
.cap-layer { position: absolute; z-index: 3; inset: 0; overflow: hidden; pointer-events: none; }
.cap-flight { position: absolute; left: 0; top: 0; width: 42px; height: 42px; filter: hue-rotate(var(--cap-hue)) drop-shadow(1px 3px 2px #1b1514a8); will-change: transform; }
.cap-flight[data-phase='track'] { filter: hue-rotate(var(--cap-hue)) drop-shadow(1px 2px 1px #191918); }
@keyframes trackDrop { from { top: -48px; transform: rotate(-30deg); } to { top: calc(100% + 12px); transform: rotate(70deg); } }

/* The tree is a full viewport menu; item rules still come from the game data. */
.talent-menu { inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; color: #f7f0df; background: #1b1513; overflow: hidden; }
.talent-menu::backdrop { background: #100c0bb8; }
.talent-menu-head { position: absolute; z-index: 5; inset: 0 0 auto; height: 86px; display: flex; align-items: center; gap: 18px; padding: 0 clamp(18px, 3vw, 52px); background: linear-gradient(#17100ff2, #17100f00); }
.talent-menu-title { font-size: clamp(23px, 2.5vw, 35px); text-shadow: 0 3px #000; }
.talent-menu-resource { display: flex; align-items: center; gap: 8px; margin-left: auto; font-size: clamp(20px, 2vw, 30px); font-variant-numeric: tabular-nums; }
.talent-close { display: grid; place-items: center; width: 58px; height: 58px; margin-left: 15px; padding: 0; border: 4px solid #080707; border-radius: 8px; color: #e84433; background: #211817; font-size: 56px; font-weight: 900; line-height: 1; text-shadow: 2px 3px #080707; }
.talent-close:hover { background: #3b2421; }
.talent-menu-body, .talent-canvas { width: 100%; height: 100%; }
.talent-canvas { position: relative; }
.talent-menu .talent-graph { width: calc(100% - min(32vw, 390px) - clamp(40px, 7vw, 120px)); height: 100%; max-width: none; margin: 0; border: 0; border-radius: 0; background-image: linear-gradient(#211916d9, #211916e9), url('./assets/floor-tile.webp'); background-size: auto, 250px 250px; box-shadow: none; }
.talent-menu .talent-canvas { background-image: linear-gradient(#211916e9, #211916e9), url('./assets/floor-tile.webp'); background-size: auto, 250px 250px; }
.talent-menu .talent-graph::before, .talent-menu .talent-graph::after { content: none; }
.talent-menu .web-lines line { stroke: #a9939b87; stroke-width: .42; stroke-dasharray: none; }
.talent-menu .web-lines line.lit { stroke: #f3d387; stroke-width: .65; }
.talent-menu .web-node { width: clamp(58px, 4.5vw, 76px); height: clamp(58px, 4.5vw, 76px); border: 4px solid #57c943; border-radius: 6px; background: #a99e86; box-shadow: 0 5px 0 #100e0c, inset 0 2px #e6d5b3; }
.talent-menu .web-node.active { border-color: #e7ca35; background: #e3c54b; box-shadow: 0 5px 0 #100e0c, 0 0 20px #ffdb65b5; }
.talent-menu .web-node.future { opacity: .48; filter: grayscale(.8); }
.talent-menu .web-node.distant { opacity: .26; }
.talent-menu .web-node.selected { outline: 4px solid #fff8ed; outline-offset: 4px; }
.talent-menu .web-node .icon-sprite, .talent-menu .web-node .mini-bottle { width: 70%; height: 70%; }
.talent-menu .web-level { right: -6px; bottom: -10px; min-width: 23px; border: 2px solid #161311; border-radius: 5px; background: #e5d9ac; font-size: 12px; text-align: center; }
.talent-menu .talent-detail { position: absolute; z-index: 3; top: 45%; right: clamp(22px, 5vw, 115px); width: min(32vw, 390px); min-width: 290px; padding: 0; transform: translateY(-50%); border: 5px solid #0b0a09; border-radius: 7px; background: #4f4e47; color: #fff; box-shadow: 0 10px 24px #0008; }
.talent-menu .talent-eyebrow { padding: 13px 18px; border-bottom: 4px solid #0b0a09; background: #76746b; color: #fff7e4; font-size: 12px; letter-spacing: .04em; }
.talent-menu .talent-name { margin: 0; padding: 14px 18px 5px; font-size: clamp(19px, 1.6vw, 25px); text-shadow: 2px 3px #111; }
.talent-menu .talent-note { min-height: 60px; margin: 0; padding: 8px 18px 14px; color: #f0eadb; font-size: 15px; line-height: 1.45; }
.talent-menu .talent-action { display: grid; grid-template-columns: 1fr; gap: 0; border-top: 4px solid #0b0a09; }
.talent-menu .talent-progress { padding: 12px 18px; text-align: center; font-size: 17px; }
.talent-menu .talent-buy { width: 100%; padding: 12px; border: 0; border-top: 4px solid #0b0a09; border-radius: 0; background: #d4b240; color: #17120d; font-size: 15px; }
.talent-menu .talent-buy:disabled { background: #747169; color: #c9c6b9; }
@media (max-width: 900px) {
  .stage { grid-template-columns: 78px minmax(0, 1fr); }
  .track-head { height: 52px; }
  .track-foot { height: 46px; }
  .track-token { width: 34px; height: 34px; margin-left: -17px; }
  .talent-menu-head { height: 64px; }
  .talent-close { width: 45px; height: 45px; font-size: 42px; }
  .talent-menu .talent-graph { width: 100%; height: 72%; }
  .talent-menu .talent-detail { top: auto; right: 0; bottom: 0; left: 0; width: 100%; min-width: 0; transform: none; border-width: 3px 0 0; border-radius: 0; }
  .talent-menu .talent-note { min-height: 0; }
  .talent-menu .talent-action { grid-template-columns: 1fr 1fr; }
  .talent-menu .talent-buy { border-top: 0; border-left: 3px solid #0b0a09; }
}
@media (prefers-reduced-motion: reduce) { .track-token { animation: none; top: calc(var(--token-index) * 7%); } }
