:root { --ink: #101820; --paper: #fff7e6; --gold: #ffcf3a; --red: #d9412e; --teal: #17756b; --sky: #4fd8ff; --f: 'Titillium Web', 'Nunito', system-ui, sans-serif; --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px); --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #14202b; color: var(--paper); font-family: var(--f); -webkit-user-select: none; user-select: none; touch-action: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; }
#fade { position: fixed; inset: 0; background: #0b1118; opacity: 0; pointer-events: none; transition: opacity .28s; z-index: 30; }
#fade.on { opacity: 1; }
#loading { position: fixed; inset: 0; z-index: 60; background: #14202b; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; transition: opacity .4s; }
#loading b { font-size: 44px; color: var(--gold); } #loading span { opacity: .75; }
#loading.done { opacity: 0; pointer-events: none; }
#rotate { position: fixed; inset: 0; z-index: 70; background: #14202b; display: none; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; }
.rotate-icon { font-size: 64px; color: var(--gold); animation: rot 2s infinite; } @keyframes rot { 50% { transform: rotate(90deg); } }
@media (orientation: portrait) { body.touch.playing:not(.bumshi-sideways) #rotate { display: flex; } }

/* ---------- screens ---------- */
#ui { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.screen { position: absolute; inset: 0; pointer-events: auto; display: flex; align-items: center; justify-content: center; padding: calc(12px + var(--st)) calc(14px + var(--sr)) calc(12px + var(--sb)) calc(14px + var(--sl)); background: linear-gradient(90deg, rgba(10, 16, 22, .82), rgba(10, 16, 22, .35) 60%, rgba(10, 16, 22, .1)); overflow: auto; }
/* title: static key-art home. Illustrated gully behind, Chotu on the left, big menu in the centre, next match and story road on the right */
body.home #game { visibility: hidden; }
#title { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 470px) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; gap: 6px 22px; align-items: center; overflow: hidden; background: transparent; }
#title button { font-family: var(--f); cursor: pointer; }
.t-bg { position: absolute; inset: 0; z-index: 0; display: none; } body.home .t-bg { display: block; } .t-bg svg { width: 100%; height: 100%; display: block; }
.t-bg::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 60% 75% at 50% 52%, rgba(8, 13, 18, .62), rgba(8, 13, 18, 0) 70%), linear-gradient(180deg, rgba(8, 13, 18, .5), rgba(8, 13, 18, 0) 22%); }
.t-top { grid-column: 1 / -1; grid-row: 1; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 42px; }
.t-top > a[hidden] + .t-icons { margin-left: auto; }
.t-icons { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.t-ic { width: 42px; height: 42px; border-radius: 50%; background: rgba(16, 24, 32, .74); border: 1.5px solid rgba(255, 247, 230, .22); color: var(--paper); font-size: 20px; font-weight: 900; display: grid; place-items: center; padding: 0; transition: transform .12s, background .12s; }
.t-ic:hover { background: rgba(255, 207, 58, .2); transform: translateY(-1px); }

.t-hero { grid-column: 1; grid-row: 2; align-self: end; justify-self: center; position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto; justify-items: center; gap: 6px; height: 100%; max-height: 640px; min-height: 0; }
.t-hero img { height: 100%; min-height: 0; max-width: 100%; object-fit: contain; object-position: bottom; filter: drop-shadow(0 18px 24px rgba(0, 0, 0, .55)); }
.t-hero img:not([src]) { visibility: hidden; }
.t-pro { position: relative; display: flex; align-items: center; gap: 10px; padding: 5px 14px 5px 5px; background: rgba(16, 24, 32, .86); border: 1.5px solid rgba(255, 247, 230, .2); border-radius: 13px; color: var(--paper); text-align: left; white-space: nowrap; transition: border-color .12s; }
.t-pro:hover { border-color: var(--gold); }
.t-ovr { width: 44px; height: 46px; border-radius: 9px; background: var(--gold); color: var(--ink); display: grid; place-items: center; align-content: center; line-height: 1; }
.t-ovr b { font-size: 22px; font-weight: 900; } .t-ovr i { font-style: normal; font-size: 9px; font-weight: 800; letter-spacing: .1em; }
.t-who { display: grid; gap: 1px; } .t-who b { font-size: 16px; font-weight: 900; } .t-who small { font-size: 11.5px; opacity: .75; }
.t-who em { font-style: normal; font-size: 11px; font-weight: 800; color: var(--gold); }

.t-center { grid-column: 2; grid-row: 2; display: flex; flex-direction: column; align-items: stretch; gap: clamp(8px, 2vh, 18px); width: 100%; }
.t-logo { text-align: center; }
.t-logo h1 { margin: 0; display: grid; font-style: italic; font-weight: 900; line-height: .86; letter-spacing: -.015em; font-size: clamp(40px, 10.5vh, 96px); text-shadow: 0 5px 0 rgba(0, 0, 0, .4); }
.t-logo h1 span:last-child { color: var(--gold); }
.t-logo p { margin: 8px 0 0; font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; opacity: .8; }
.t-menu { display: grid; gap: clamp(6px, 1.3vh, 10px); }
.t-play { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: clamp(12px, 2.6vh, 20px) 22px; color: var(--ink); text-align: left; background: linear-gradient(135deg, #ffe066, #f5b800); border: 0; border-radius: 16px; box-shadow: 0 6px 0 #a87a00, 0 16px 36px rgba(0, 0, 0, .45); transition: transform .1s, box-shadow .1s; }
.t-play:hover { transform: translateY(-2px); box-shadow: 0 8px 0 #a87a00, 0 20px 40px rgba(0, 0, 0, .5); }
.t-play:active { transform: translateY(4px); box-shadow: 0 2px 0 #a87a00, 0 8px 20px rgba(0, 0, 0, .4); }
.t-pl { display: grid; gap: 2px; } .t-pl b { font-size: clamp(22px, 5vh, 34px); font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: .02em; line-height: 1; } .t-pl small { font-size: 13.5px; font-weight: 700; opacity: .8; }
.t-play > i { width: 46px; height: 46px; flex: none; border-radius: 50%; background: var(--ink); color: var(--gold); display: grid; place-items: center; font-style: normal; font-size: 18px; padding-left: 3px; animation: nudge 1.4s ease-in-out infinite; } @keyframes nudge { 50% { transform: translateX(4px); } }
.t-mi { display: flex; align-items: center; gap: 14px; padding: clamp(8px, 1.7vh, 13px) 16px; color: var(--paper); text-align: left; background: rgba(16, 24, 32, .82); border: 1.5px solid rgba(255, 247, 230, .16); border-radius: 13px; transition: transform .12s, border-color .12s, background .12s; }
.t-mi:hover { transform: translateX(3px); border-color: var(--gold); background: rgba(30, 42, 54, .92); }
.t-mi > span:last-child { display: grid; gap: 1px; } .t-mi b { font-size: clamp(16px, 3vh, 19px); font-weight: 900; } .t-mi small { font-size: 12px; opacity: .72; }
.t-ico { width: 34px; height: 34px; flex: none; border-radius: 9px; background: rgba(255, 207, 58, .14); color: var(--gold); display: grid; place-items: center; font-size: 18px; }
#gf-like { align-self: center; } #gf-like > span { display: none; }

.t-info { grid-column: 3; grid-row: 2; display: grid; gap: 10px; align-content: center; justify-self: end; width: min(100%, 300px); }
.t-card { background: rgba(16, 24, 32, .84); border: 1.5px solid rgba(255, 247, 230, .14); border-radius: 14px; padding: 12px 14px; }
.t-k { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; }
.t-fx { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; text-align: center; font-size: 12px; font-weight: 700; line-height: 1.2; }
.t-fx .cr { width: 38px; height: 38px; margin: 0 auto 4px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 900; letter-spacing: .03em; border: 2px solid rgba(255, 255, 255, .5); }
.t-fx .vs { font-size: 12px; font-weight: 900; opacity: .55; } .t-fx .drill { grid-column: 1 / -1; font-size: 14px; }
.t-goals { list-style: none; margin: 10px 0 0; padding: 10px 0 0; border-top: 1px solid rgba(255, 247, 230, .12); display: grid; gap: 4px; font-size: 12.5px; }
.t-goals li::before { content: '\2606  '; color: var(--gold); } .t-goals li.ok::before { content: '\2605  '; }
.t-road ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.t-road li { position: relative; display: flex; align-items: center; gap: 10px; padding: 4px 0; font-size: 12.5px; font-weight: 700; opacity: .5; }
.t-road li i { width: 14px; height: 14px; flex: none; border-radius: 50%; border: 2px solid rgba(255, 247, 230, .6); background: #101820; position: relative; z-index: 1; }
.t-road li:not(:last-child)::after { content: ''; position: absolute; left: 6px; top: 18px; width: 2px; height: calc(100% - 8px); background: rgba(255, 247, 230, .2); }
.t-road li.done { opacity: .85; } .t-road li.done i { background: var(--gold); border-color: var(--gold); }
.t-road li.now { opacity: 1; color: var(--gold); } .t-road li.now i { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(255, 207, 58, .25); }
.t-road li span { margin-left: auto; font-size: 11px; font-weight: 600; opacity: .8; color: var(--paper); }

.t-legal { grid-column: 1 / -1; grid-row: 3; margin: 0; font-size: 10.5px; opacity: .5; text-align: center; } .t-legal a { color: inherit; }
.t-drawer { position: absolute; z-index: 5 !important; top: 0; right: 0; bottom: 0; width: min(340px, 88vw); padding: calc(14px + var(--st)) calc(14px + var(--sr)) calc(14px + var(--sb)) 16px; background: rgba(12, 19, 26, .97); border-left: 1.5px solid rgba(255, 247, 230, .14); box-shadow: -20px 0 50px rgba(0, 0, 0, .45); overflow: auto; transform: translateX(105%); transition: transform .22s ease; }
#title > .t-drawer { position: absolute; }
.t-drawer.open { transform: none; }
.t-x { position: sticky; top: 0; float: right; width: 36px; height: 36px; border-radius: 50%; background: rgba(255, 247, 230, .1); border: 1.5px solid rgba(255, 247, 230, .2); color: var(--paper); font-size: 22px; line-height: 1; padding: 0; z-index: 1; }
@media (max-height: 520px) {
  .t-road { display: none; }
  #title { grid-template-columns: minmax(0, 1fr) minmax(0, 380px) minmax(0, 1fr); gap: 4px 14px; }
  .t-logo h1 { font-size: clamp(30px, 10vh, 48px); } .t-logo p { margin-top: 4px; font-size: 10px; } .t-center { gap: 7px; }
  .t-play { padding: 9px 16px; border-radius: 13px; } .t-pl b { font-size: 21px; } .t-pl small { font-size: 12px; } .t-play > i { width: 36px; height: 36px; font-size: 14px; }
  .t-mi { padding: 6px 12px; gap: 10px; border-radius: 11px; } .t-mi b { font-size: 14.5px; } .t-mi small { font-size: 11px; } .t-ico { width: 28px; height: 28px; font-size: 15px; }
  .t-ic { width: 36px; height: 36px; font-size: 17px; } .t-ic[data-a="settings"] { font-size: 20px; } .t-top { min-height: 36px; }
  .t-card { padding: 9px 11px; } .t-goals { font-size: 11.5px; margin-top: 7px; padding-top: 7px; } .t-road li { padding: 2px 0; font-size: 11.5px; } .t-fx .cr { width: 32px; height: 32px; }
  .t-pro { padding: 3px 10px 3px 3px; } .t-ovr { width: 36px; height: 38px; } .t-ovr b { font-size: 18px; } .t-who b { font-size: 14px; } .t-who small { font-size: 10.5px; }
  #gf-like, .t-legal { display: none; } .t-menu .t-mi[data-a="player"] { display: none; }
}
@media (max-width: 760px) { #title { grid-template-columns: minmax(0, .8fr) minmax(0, 360px) minmax(0, 1fr); } .t-road { display: none; } .t-info { width: 100%; } }
@media (max-width: 620px) { #title { grid-template-columns: 1fr; overflow: auto; } .t-hero, .t-info { display: none; } .t-center { grid-column: 1; } }
.menu { display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.menu button, .row button { background: rgba(255, 247, 230, .1); border: 1.5px solid rgba(255, 247, 230, .28); border-radius: 12px; padding: 10px 16px; font-weight: 700; font-size: 16px; text-align: left; backdrop-filter: blur(6px); }
.menu button small { display: block; font-weight: 400; font-size: 12.5px; opacity: .8; margin-top: 1px; }
.menu button.primary, .row button.primary { background: var(--gold); color: var(--ink); border-color: var(--gold); font-size: 18px; }
.menu button:hover, .row button:hover { filter: brightness(1.15); }
.row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; } .row button { flex: 1; text-align: center; white-space: nowrap; }
.challenge:empty { display: none; }
.panel { background: rgba(16, 24, 32, .93); border: 1.5px solid rgba(255, 247, 230, .16); border-radius: 18px; padding: 18px 20px; width: min(520px, 100%); max-height: 100%; overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.panel.wide { width: min(880px, 100%); }
.panel h2 { margin: 0 0 4px; font-size: 28px; font-weight: 900; font-style: italic; }
.panel small { color: var(--gold); letter-spacing: .1em; font-weight: 700; font-size: 12px; text-transform: uppercase; }
.panel i { opacity: .7; } .sub { margin: 0 0 10px; opacity: .78; font-size: 14px; }
#chapters .screen, .screen:not(#title) { background: rgba(8, 13, 18, .62); }

.clist { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.clist h3 { grid-column: 1 / -1; margin: 8px 0 0; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.clist button { text-align: left; background: rgba(255, 247, 230, .07); border: 1.5px solid rgba(255, 247, 230, .16); border-radius: 12px; padding: 9px 12px; display: grid; grid-template-columns: 30px 1fr auto; gap: 2px 8px; align-items: center; }
.clist button b { font-size: 15.5px; } .clist button em { grid-column: 2 / 4; font-style: normal; font-size: 12px; opacity: .7; }
.clist button .n { grid-row: 1 / 3; font-size: 22px; font-weight: 900; opacity: .5; font-style: italic; }
.clist button .s { color: var(--gold); letter-spacing: 1px; font-size: 14px; white-space: nowrap; }
.clist button.lock { opacity: .42; cursor: default; } .clist button.next { border-color: var(--gold); background: rgba(255, 207, 58, .12); }

.stars-l { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 4px; font-size: 14.5px; }
.stars-l li::before { content: '☆ '; color: var(--gold); } .stars-l li.ok::before { content: '★ '; } .stars-l li.ok { color: #ffe9a8; }
.vs { display: flex; align-items: center; gap: 10px; margin: 10px 0 2px; font-weight: 900; font-size: 18px; font-style: italic; } .vs span { opacity: .6; font-size: 13px; font-style: normal; font-weight: 400; }
#br-text { margin: 8px 0 0; line-height: 1.45; }

/* player card */
.pl { display: flex; gap: 20px; align-items: flex-start; } .pl-r { flex: 1; min-width: 0; }
.card { width: 190px; flex: none; aspect-ratio: 5 / 7; border-radius: 14px 14px 40px 40px; background: linear-gradient(160deg, #ffe07a, #e2a81f 55%, #b97c12); color: #2a1c05; padding: 12px; position: relative; box-shadow: 0 10px 30px rgba(0, 0, 0, .5), inset 0 0 0 2px rgba(255, 255, 255, .45); }
.card .ov { font-size: 44px; font-weight: 900; line-height: .9; } .card .po { font-weight: 800; font-size: 15px; } .card .fl { font-size: 11px; font-weight: 700; margin-top: 4px; line-height: 1.25; }
.card img { position: absolute; right: 8px; top: 10px; width: 112px; height: 112px; border-radius: 50%; object-fit: cover; }
.card .nm { position: absolute; left: 0; right: 0; top: 50%; text-align: center; font-weight: 900; font-size: 21px; letter-spacing: .04em; border-top: 2px solid rgba(42, 28, 5, .35); border-bottom: 2px solid rgba(42, 28, 5, .35); padding: 2px 0; text-transform: uppercase; }
.card .st { position: absolute; left: 14px; right: 14px; bottom: 26px; display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; font-weight: 800; font-size: 14.5px; } .card .st b { font-weight: 900; margin-right: 4px; }
.attrs { display: grid; gap: 6px; } .attrs div { display: grid; grid-template-columns: 82px 1fr 30px 34px; gap: 8px; align-items: center; font-size: 14px; }
.attrs .bar { height: 9px; border-radius: 6px; background: rgba(255, 255, 255, .13); overflow: hidden; } .attrs .bar i { display: block; height: 100%; background: linear-gradient(90deg, #f08a2a, var(--gold)); border-radius: 6px; }
.attrs b { text-align: right; } .attrs button { background: var(--gold); color: var(--ink); border-radius: 8px; font-weight: 900; height: 26px; } .attrs button:disabled { opacity: .2; }
.pts { margin: 10px 0 6px; font-weight: 700; color: var(--gold); }
.squad { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; } .squad span { background: rgba(255, 255, 255, .08); border-radius: 8px; padding: 4px 8px; } .squad b { color: var(--gold); margin-right: 4px; }

.quote { display: flex; gap: 12px; align-items: center; margin: 12px 0; } .quote img { width: 72px; height: 72px; border-radius: 50%; flex: none; border: 2px solid var(--gold); } .quote p { margin: 0; line-height: 1.4; } .quote b { display: block; color: var(--gold); font-size: 13px; }
.end .e-score { font-size: 40px; font-weight: 900; font-style: italic; margin: 2px 0 6px; } .e-score span { font-size: 16px; opacity: .7; font-style: normal; margin: 0 8px; }
.e-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; } .e-chotu { font-size: 13.5px; opacity: .9; } .e-up { color: var(--gold); font-weight: 700; margin: 6px 0 0; min-height: 1em; } .e-help { margin: 8px 0 0; font-size: 13px; opacity: .85; text-align: center; } .e-help:empty { display: none; }
.e-pts { margin: 6px 0; font-size: 15px; } .e-pts b { font-size: 30px; color: var(--gold); } .e-pts span { opacity: .65; }
.set { display: grid; gap: 10px; } .set label { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 15px; } .set select, .set input[type=range] { width: 55%; font: inherit; padding: 4px; border-radius: 8px; } .set input[type=checkbox] { width: 22px; height: 22px; }
body.touch .kb { display: none; }
.help { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px 22px; font-size: 14px; line-height: 1.45; } .help h3 { margin: 6px 0 2px; color: var(--gold); font-size: 15px; } .help p { margin: 0 0 4px; } .help kbd { background: rgba(255, 255, 255, .14); border-radius: 5px; padding: 0 6px; font: inherit; font-weight: 700; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; font-weight: 700; }
.sb { position: absolute; left: calc(12px + var(--sl)); top: calc(10px + var(--st)); display: flex; align-items: stretch; height: 34px; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 14px rgba(0, 0, 0, .4); font-size: 16px; }
.sb-t { background: #14202b; padding: 0 10px; display: flex; align-items: center; letter-spacing: .06em; border-left: 5px solid var(--gold); } .sb-t.them { border-left: 0; border-right: 5px solid var(--red); }
.sb b { background: var(--paper); color: var(--ink); padding: 0 10px; display: flex; align-items: center; font-size: 19px; font-weight: 900; min-width: 62px; justify-content: center; }
.sb i { background: var(--teal); padding: 0 10px; display: flex; align-items: center; font-style: normal; font-variant-numeric: tabular-nums; }
.goals { position: absolute; left: calc(12px + var(--sl)); top: calc(50px + var(--st)); font-size: 12.5px; font-weight: 600; background: rgba(16, 24, 32, .62); border-radius: 8px; padding: 4px 9px; max-width: 46vw; } .goals:empty { display: none; } .goals b { color: var(--gold); }
.h-top { position: absolute; right: calc(12px + var(--sr)); top: calc(10px + var(--st)); display: flex; gap: 8px; pointer-events: auto; }
.h-top button { width: 38px; height: 34px; border-radius: 8px; background: rgba(16, 24, 32, .7); font-size: 14px; }
#h-toast { position: absolute; left: 50%; top: calc(12px + var(--st)); transform: translateX(-50%); background: rgba(16, 24, 32, .8); border-radius: 10px; padding: 6px 16px; font-size: 16px; opacity: 0; transition: opacity .25s; white-space: nowrap; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; }
#h-toast.on { opacity: 1; } #h-toast.big { font-size: clamp(26px, 7vh, 54px); font-weight: 900; font-style: italic; color: var(--gold); top: 22%; background: none; text-shadow: 0 4px 0 rgba(0, 0, 0, .45), 0 0 30px rgba(0, 0, 0, .5); }
#h-tip { position: absolute; left: 50%; bottom: calc(18% + var(--sb)); transform: translateX(-50%); background: var(--gold); color: var(--ink); border-radius: 12px; padding: 7px 16px; font-size: 15px; opacity: 0; transition: opacity .3s; text-align: center; max-width: 70vw; } #h-tip.on { opacity: 1; } #h-tip kbd { background: rgba(0, 0, 0, .16); border-radius: 5px; padding: 0 6px; font: inherit; font-weight: 900; }
#h-tag { position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); text-align: center; font-size: 12px; text-shadow: 0 1px 3px #000; will-change: transform; white-space: nowrap; }
.pw { width: 64px; height: 7px; border-radius: 5px; background: rgba(0, 0, 0, .55); margin: 2px auto 0; overflow: hidden; opacity: 0; } .pw.on { opacity: 1; } .pw i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #7be06a, var(--gold) 60%, var(--red)); }
.sta { position: absolute; left: calc(12px + var(--sl)); bottom: calc(10px + var(--sb)); display: flex; align-items: center; gap: 5px; font-size: 13px; } .sta div { width: 90px; height: 7px; border-radius: 5px; background: rgba(0, 0, 0, .5); overflow: hidden; } .sta i { display: block; height: 100%; background: var(--sky); width: 100%; }
.keys { position: absolute; left: 50%; bottom: calc(8px + var(--sb)); transform: translateX(-50%); font-size: 12px; font-weight: 600; background: rgba(16, 24, 32, .6); border-radius: 8px; padding: 4px 12px; white-space: nowrap; } .keys b { color: var(--gold); }
body.touch .keys { display: none; } body.touch .sta { left: 50%; transform: translateX(-50%); }
.pad, .btns { display: none; }
body.touch .pad { display: block; position: absolute; left: 0; bottom: 0; width: 46%; height: 78%; pointer-events: auto; }
#stick { position: absolute; left: calc(26px + var(--sl)); bottom: calc(22px + var(--sb)); width: 112px; height: 112px; border-radius: 50%; background: rgba(255, 255, 255, .1); border: 2px solid rgba(255, 255, 255, .28); } #stick i { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px; border-radius: 50%; background: rgba(255, 255, 255, .6); }
body.touch .btns { display: block; position: absolute; right: calc(10px + var(--sr)); bottom: calc(10px + var(--sb)); width: 232px; height: 190px; pointer-events: none; }
.btns button { position: absolute; pointer-events: auto; border-radius: 50%; width: 62px; height: 62px; background: rgba(16, 24, 32, .55); border: 2px solid rgba(255, 255, 255, .45); display: flex; align-items: center; justify-content: center; touch-action: none; } .btns b { font-size: 10.5px; letter-spacing: .03em; pointer-events: none; }
.btns .b-shoot { right: 0; bottom: 44px; width: 78px; height: 78px; background: rgba(217, 65, 46, .7); } .btns .b-pass { right: 84px; bottom: 0; background: rgba(23, 117, 107, .7); width: 70px; height: 70px; } .btns .b-lob { right: 160px; bottom: 30px; } .btns .b-through { right: 88px; bottom: 78px; }
.btns .b-chip { right: 8px; bottom: 128px; width: 52px; height: 52px; } .btns .b-sprint { right: 150px; bottom: 100px; background: rgba(79, 216, 255, .3); }
.btns button.on { filter: brightness(1.5); transform: scale(.94); }

/* ---------- dialogue ---------- */
#talk { position: fixed; inset: 0; z-index: 15; pointer-events: auto; }
#talk::before, #talk::after { content: ''; position: absolute; left: 0; right: 0; height: 9%; background: #0b1118; } #talk::before { top: 0; } #talk::after { bottom: 0; }
#t-skip { position: absolute; z-index: 2; right: calc(14px + var(--sr)); top: calc(10px + var(--st)); background: rgba(16, 24, 32, .7); border: 1.5px solid rgba(255, 255, 255, .3); border-radius: 10px; padding: 6px 14px; font-weight: 700; }
.t-chap { position: absolute; z-index: 2; left: calc(16px + var(--sl)); top: calc(12px + var(--st)); font-weight: 900; font-style: italic; font-size: 18px; text-shadow: 0 2px 6px #000; } .t-chap small { display: block; color: var(--gold); font-style: normal; font-size: 12px; letter-spacing: .1em; }
.t-box { position: absolute; z-index: 2; left: 50%; bottom: calc(4% + var(--sb)); transform: translateX(-50%); width: min(760px, 94vw); background: rgba(16, 24, 32, .92); border: 1.5px solid rgba(255, 247, 230, .2); border-radius: 16px; padding: 12px 34px 12px 14px; display: flex; gap: 14px; align-items: center; min-height: 92px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.t-box img { width: 74px; height: 74px; border-radius: 50%; flex: none; border: 2px solid var(--gold); background: #2b3a55; } .t-box.narr img { display: none; } .t-box.narr p { font-style: italic; text-align: center; opacity: .95; } .t-box.narr { justify-content: center; padding-left: 34px; }
.t-box b { color: var(--gold); font-size: 14px; letter-spacing: .04em; } .t-box p { margin: 2px 0 0; font-size: clamp(15px, 2.6vh, 19px); line-height: 1.38; font-weight: 600; }
.t-box.gone { visibility: hidden; } .t-box.shout { animation: shout .32s; } .t-box.shout p { font-weight: 800; font-size: clamp(16px, 2.9vh, 21px); } @keyframes shout { 20% { transform: translateX(calc(-50% - 7px)); } 45% { transform: translateX(calc(-50% + 6px)); } 70% { transform: translateX(calc(-50% - 3px)); } }
.t-next { position: absolute; right: 12px; bottom: 8px; color: var(--gold); animation: bob 1s infinite; } @keyframes bob { 50% { transform: translateY(3px); } }

@media (max-height: 430px) {
  .menu { gap: 5px; } .menu button { padding: 6px 12px; font-size: 14px; } .menu button.primary { font-size: 15px; } .menu button small { font-size: 11px; }
  .panel { padding: 12px 14px; } .panel h2 { font-size: 21px; }
  .card { width: 138px; padding: 9px; } .card .ov { font-size: 32px; } .card img { width: 78px; height: 78px; } .card .nm { font-size: 15px; } .card .st { font-size: 11.5px; bottom: 18px; } .card .fl { font-size: 9.5px; }
  .attrs div { font-size: 12.5px; gap: 6px; } .attrs { gap: 3px; } .t-box { min-height: 70px; padding: 8px 30px 8px 10px; } .t-box img { width: 56px; height: 56px; } .end .e-score { font-size: 28px; } .stars-l { font-size: 13px; margin: 6px 0; gap: 2px; }
  .set { gap: 6px; } .set label { font-size: 13.5px; } #stick { width: 96px; height: 96px; bottom: calc(12px + var(--sb)); }
}
@media (max-width: 620px) { .e-cols { grid-template-columns: 1fr; } .pl { flex-direction: column; align-items: center; } }
/* short screens: the end screen's buttons stay in view at the bottom of the panel */
@media (max-height: 520px) { .end .row { position: sticky; bottom: -12px; margin: 8px -14px -12px; padding: 8px 14px 10px; background: rgba(16, 24, 32, .97); border-top: 1px solid rgba(255, 247, 230, .12); z-index: 2; } #pause .panel h2 { margin: 0; } #pause .stars-l { margin: 2px 0; } #pause .menu button { padding-top: 7px; padding-bottom: 7px; } }
@media (max-height: 520px) { #pause .menu { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; } #pause .menu > .primary, #pause .menu > .row { grid-column: 1 / -1; } #pause .menu > .row { margin: 0; } #pause .menu button { font-size: 14px; } }
@media (max-height: 520px) { #pause .stars-l { display: flex; flex-wrap: wrap; gap: 2px 14px; } }
/* touch: tips sit up top under the scoreboard, never over the stick or the buttons */
body.touch #h-tip { bottom: auto; top: calc(52px + var(--st)); max-width: min(50vw, 480px); font-size: 14px; padding: 6px 14px; line-height: 1.3; pointer-events: none; }
/* very short screens (Safari with its tab bar in landscape): a smaller button cluster and stick */
@media (max-height: 360px) {
  body.touch .btns { transform: scale(.8); transform-origin: right bottom; }
  body.touch #stick { width: 84px; height: 84px; }
  body.touch #h-tip { font-size: 13px; padding: 5px 12px; }
  #h-toast.big { top: 26%; }
}
@media (max-height: 340px) {
  #pause .panel { padding: 8px 12px; } #pause .panel h2 { font-size: 18px; } #pause .stars-l { margin: 3px 0; font-size: 12px; }
  #pause .menu { gap: 4px; } #pause .menu button { padding: 4px 10px; font-size: 13px; min-height: 0; }
}
