/* Gully Cricket: chalk on a slate board, a notebook page, a saffron Tigers XI and a blue Strikers XI, the red ball. */
:root {
  --bg: #1d2621; --slate: rgba(28, 38, 33, .94); --slate2: #26332c; --ink: #f6f1e4; --dim: rgba(246, 241, 228, .66); --line: rgba(246, 241, 228, .2);
  --paper: #f6efdc; --pink: #ff5fa2; --saffron: #f08a24; --blue: #2f8fd8; --ball: #d0312d; --green: #7ed36b; --gold: #f2c230;
  --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);
  --f: 'Nunito', system-ui, sans-serif; --chalk: 'Chalkboard SE', 'Chalkboard', 'Comic Sans MS', 'Nunito', cursive;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--f); -webkit-user-select: none; user-select: none; touch-action: manipulation; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; cursor: pointer; color: inherit; }
kbd { display: inline-block; padding: 0 5px; border: 1px solid rgba(255,255,255,.4); border-bottom-width: 2px; border-radius: 4px; background: rgba(255,255,255,.1); font: 700 12px/1.5 var(--f); }
.hidden { display: none !important; }
body.touch .key-only, body:not(.touch) .touch-only { display: none !important; }
#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 1; background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(30, 14, 0, .38)); }
#loading { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; gap: 8px; background: var(--bg); z-index: 50; transition: opacity .5s; }
#loading b { font: 900 34px var(--f); letter-spacing: .12em; }
#loading span { font: 16px var(--chalk); color: var(--dim); }
#loading.gone { opacity: 0; pointer-events: none; }

/* ---------------------------------------------------------------- HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; text-shadow: 0 1px 3px rgba(0,0,0,.55); }
#hud button { pointer-events: auto; }
.top { position: absolute; top: calc(10px + var(--st)); left: calc(12px + var(--sl)); right: calc(12px + var(--sr)); display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sb { background: var(--slate); border-radius: 12px; padding: 7px 12px 8px; min-width: 190px; box-shadow: 0 6px 18px rgba(0,0,0,.35), inset 0 0 0 1px var(--line); text-shadow: none; }
.sb-team { display: flex; align-items: center; gap: 6px; font-size: 11px; letter-spacing: .14em; color: var(--dim); }
.sb-team i { width: 10px; height: 10px; border-radius: 3px; background: var(--saffron); display: inline-block; }
.sb-team b { font-weight: 900; }
.sb-score { display: flex; align-items: baseline; gap: 8px; }
.sb-score b { font: 900 28px var(--f); font-variant-numeric: tabular-nums; line-height: 1.05; }
.sb-score span { font-size: 14px; color: var(--dim); font-variant-numeric: tabular-nums; }
.sb-need { font: 15px var(--chalk); color: var(--gold); }
.sb-need:empty { display: none; }
.over { display: flex; gap: 5px; margin-top: 4px; }
.over i { width: 28px; height: 28px; border-radius: 50%; background: rgba(20, 26, 22, .72); border: 1px solid var(--line); display: grid; place-items: center; font: 800 12px var(--f); font-style: normal; color: var(--ink); text-shadow: none; }
.over i.w { background: var(--ball); border-color: #ff8a80; }
.over i.b4 { background: #2e7d32; } .over i.b6 { background: #6a1b9a; } .over i.wd { color: var(--gold); font-size: 10px; }
.over i.next { border-style: dashed; background: transparent; }
.tr { display: flex; gap: 8px; }
.hbtn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--slate); color: var(--ink); font-size: 15px; flex: none; }
.cards { position: absolute; left: calc(12px + var(--sl)); top: calc(96px + var(--st)); display: flex; flex-direction: column; gap: 6px; }
.pc { display: flex; align-items: center; gap: 8px; background: rgba(20, 26, 22, .7); border-radius: 26px 12px 12px 26px; padding: 3px 12px 3px 3px; font-size: 13px; text-shadow: none; }
.pc img { width: 40px; height: 40px; border-radius: 50%; background: var(--slate2); object-fit: cover; }
.pc b { display: block; font-weight: 900; font-size: 14px; }
.pc span { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.pc:empty, .pc.off { display: none; }
#msg { position: absolute; left: 0; right: 0; top: 24%; text-align: center; opacity: 0; transform: scale(.7); transition: opacity .2s, transform .25s cubic-bezier(.2,1.6,.4,1); }
#msg.on { opacity: 1; transform: scale(1); }
#msg b { display: block; font: 900 72px var(--f); letter-spacing: .04em; color: #fff; -webkit-text-stroke: 2px rgba(0,0,0,.25); text-shadow: 0 4px 0 rgba(0,0,0,.25), 0 10px 30px rgba(0,0,0,.4); }
#msg span { display: inline-block; margin-top: 6px; font: 20px var(--chalk); background: rgba(20, 26, 22, .72); padding: 4px 14px; border-radius: 10px; }
#msg span:empty { display: none; }
#msg.six b { color: #ffd84a; } #msg.four b { color: #9cf27e; } #msg.out b { color: #ff6b5e; } #msg.wide b { color: #ffd84a; font-size: 52px; }
#toast { position: absolute; left: 50%; bottom: calc(18px + var(--sb)); transform: translate(-50%, 20px); display: flex; align-items: center; gap: 10px; background: var(--paper); color: #2a1d14; border-radius: 40px 16px 16px 40px; padding: 5px 16px 5px 5px; max-width: min(560px, 70vw); opacity: 0; transition: opacity .25s, transform .25s; text-shadow: none; box-shadow: 0 8px 22px rgba(0,0,0,.35); }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#toast img { width: 46px; height: 46px; border-radius: 50%; background: #e2d7bd; flex: none; }
#toast b { font-weight: 900; font-size: 13px; color: #8a3b12; }
#toast p { margin: 0; font: 16px/1.3 var(--chalk); }
body.touch.batting #toast, body.touch.bowling #toast { bottom: auto; top: calc(62px + var(--st)); }
#hint { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(64px + var(--sb)); font: 16px var(--chalk); background: rgba(20, 26, 22, .7); padding: 5px 14px; border-radius: 10px; opacity: 0; transition: opacity .3s; white-space: nowrap; }
#hint.on { opacity: 1; }
body.touch #hint { bottom: auto; top: 40%; }
#timing { position: absolute; left: 50%; bottom: calc(54px + var(--sb)); width: 260px; height: 12px; margin-left: -130px; border-radius: 6px; background: rgba(20, 26, 22, .65); box-shadow: inset 0 0 0 1px var(--line); }
#timing .tz { position: absolute; top: 0; bottom: 0; background: rgba(126, 211, 107, .75); border-radius: 6px; }
#timing .tb { position: absolute; top: -4px; bottom: -4px; width: 4px; margin-left: -2px; background: #fff; border-radius: 2px; }
#timing span { position: absolute; top: -17px; left: 0; font-size: 10px; letter-spacing: .2em; color: var(--dim); }
body.touch #timing { bottom: auto; top: calc(50% + 70px); }
body.bowling #keys { right: calc(214px + var(--sr)); max-width: 300px; }
#keys { position: absolute; right: calc(14px + var(--sr)); bottom: calc(12px + var(--sb)); font-size: 12px; color: var(--dim); text-align: right; line-height: 1.6; max-width: 380px; }
#bubbles { position: fixed; inset: 0; pointer-events: none; z-index: 4; }
.bub { position: absolute; transform: translate(-50%, -100%); background: var(--paper); color: #2a1d14; font: 700 15px var(--chalk); padding: 5px 11px; border-radius: 14px; white-space: nowrap; box-shadow: 0 4px 12px rgba(0,0,0,.3); animation: bub .25s cubic-bezier(.2,1.6,.4,1); }
.bub::after { content: ''; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: var(--paper); }
.bub.shout { background: #fff3c4; font-size: 17px; }
@keyframes bub { from { transform: translate(-50%, -80%) scale(.6); opacity: 0; } }

/* ---------------------------------------------------------------- touch controls */
.tb { position: absolute; pointer-events: auto; border-radius: 50%; border: 2px solid rgba(255,255,255,.45); background: rgba(20, 26, 22, .55); color: #fff; font: 900 22px var(--f); display: grid; place-items: center; line-height: 1; touch-action: none; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.tb span { display: block; font-size: 9px; letter-spacing: .14em; margin-top: 2px; font-weight: 800; }
.tb:active, .tb.on { background: rgba(255,255,255,.35); }
#batui, #bowlui { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
#dpad { position: absolute; left: calc(18px + var(--sl)); bottom: calc(18px + var(--sb)); width: 150px; height: 150px; border-radius: 50%; pointer-events: auto; touch-action: none; background: radial-gradient(circle, rgba(20,26,22,.35) 0 30%, rgba(20,26,22,.55) 31% 100%); border: 2px solid rgba(255,255,255,.4); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
#dpad i { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px; border-radius: 50%; background: rgba(255,255,255,.75); box-shadow: 0 2px 8px rgba(0,0,0,.4); transition: transform .06s; }
#dpad span { position: absolute; font-size: 13px; color: rgba(255,255,255,.7); }
#dpad .pd-u { left: 50%; top: 6px; transform: translateX(-50%); } #dpad .pd-d { left: 50%; bottom: 6px; transform: translateX(-50%); } #dpad .pd-l { left: 8px; top: 50%; transform: translateY(-50%); } #dpad .pd-r { right: 8px; top: 50%; transform: translateY(-50%); }
#dpad[data-dir]:not([data-dir=""]) { border-color: var(--gold); }
.shots { position: absolute; right: calc(16px + var(--sr)); bottom: calc(14px + var(--sb)); width: 210px; height: 190px; pointer-events: none; }
.shots .st { width: 70px; height: 70px; font-size: 13px; letter-spacing: .04em; }
.shots .st span { font-size: 10px; opacity: .7; }
.shots .front { right: 0; bottom: 0; border-color: #9fd3ff; background: rgba(21,101,192,.45); }
.shots .back { right: 0; top: 0; border-color: #ffd29a; background: rgba(240,138,36,.45); }
.shots .out { right: 78px; top: 44px; border-color: #9cf27e; background: rgba(46,125,50,.45); }
.shots .pill { width: 84px; justify-content: center; height: 34px; padding: 0; border-radius: 17px; font-size: 12px; top: -44px; display: flex; gap: 6px; align-items: center; }
.shots .pill span { margin: 0; font-size: 9px; opacity: .7; }
.shots .loft { right: 0; } .shots .loft.on { background: rgba(240,138,36,.85); border-color: #ffd29a; }
.shots .leave { right: 94px; }
body.touch .shots .pill span { display: none; }
#guard { position: absolute; left: calc(18px + var(--sl)); bottom: calc(180px + var(--sb)); display: flex; gap: 8px; pointer-events: none; }
#guard .tb { position: static; width: 44px; height: 44px; font-size: 15px; }
#guard .tb span { font-size: 8px; opacity: .7; }
body:not(.touch) #batui #guard { display: none; }
#t-side { right: calc(130px + var(--sr)); bottom: calc(100px + var(--sb)); width: 66px; height: 66px; font-size: 11px; }
#t-side span { font-size: 9px; }
#t-run { right: 128px; bottom: 0; width: 78px; height: 78px; font-size: 16px; border-color: var(--gold); }
#t-run.go { background: rgba(242, 194, 48, .55); animation: pulse 0.7s infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
body:not(.touch) #batui #dpad, body:not(.touch) #batui .shots { display: none; }
#skipev { position: fixed; z-index: 7; right: calc(16px + var(--sr)); top: calc(64px + var(--st)); pointer-events: auto; border: 0; border-radius: 12px; padding: 9px 16px; font: 900 15px var(--f); background: var(--paper); color: #2a1d14; box-shadow: 0 4px 0 #b8a983; }
.vars { position: absolute; left: calc(14px + var(--sl)); bottom: calc(14px + var(--sb)); display: flex; flex-direction: column; gap: 6px; pointer-events: auto; }
.vars button { border: 1px solid var(--line); background: rgba(20, 26, 22, .7); border-radius: 12px; padding: 8px 14px; font: 800 14px var(--f); text-align: left; min-width: 120px; }
.vars button.on { background: var(--paper); color: #2a1d14; }
.vars button kbd { margin-right: 6px; color: inherit; }
/* phones: the aim stick bottom left (the knob steers the yellow marker, so the finger never covers it), the deliveries above it */
#aimpad { position: absolute; left: calc(16px + var(--sl)); bottom: calc(16px + var(--sb)); width: 140px; height: 140px; border-radius: 50%; pointer-events: auto; touch-action: none; background: radial-gradient(circle, rgba(20,26,22,.3) 0 22%, rgba(20,26,22,.55) 23% 100%); border: 2px solid rgba(255,255,255,.4); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
#aimpad::before, #aimpad::after { content: ''; position: absolute; left: 50%; top: 14px; bottom: 14px; width: 1px; background: rgba(255,255,255,.18); }
#aimpad::after { top: 50%; left: 14px; right: 14px; bottom: auto; width: auto; height: 1px; }
#aimpad i { position: absolute; z-index: 1; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff3a8, #f2c230 70%); box-shadow: 0 2px 8px rgba(0,0,0,.45); }
#aimpad span { position: absolute; left: 50%; top: -18px; transform: translateX(-50%); font-size: 10px; font-weight: 800; letter-spacing: .14em; color: rgba(255,255,255,.75); }
#aimpad.on { border-color: var(--gold); }
body.touch .vars { bottom: calc(176px + var(--sb)); flex-direction: row; flex-wrap: wrap; max-width: min(46vw, 330px); }
body.touch .vars button { min-width: 0; }
#t-bowl { right: calc(20px + var(--sr)); bottom: calc(20px + var(--sb)); width: 96px; height: 96px; font-size: 17px; border-color: var(--ball); background: rgba(208, 49, 45, .45); }
#t-field { right: calc(130px + var(--sr)); bottom: calc(24px + var(--sb)); width: 66px; height: 66px; font-size: 11px; }
#t-field span { font-size: 12px; letter-spacing: 0; text-transform: none; }
.meter { position: absolute; left: 50%; bottom: calc(26px + var(--sb)); width: 300px; height: 18px; margin-left: -150px; border-radius: 9px; background: rgba(20, 26, 22, .75); box-shadow: inset 0 0 0 1px var(--line); }
.meter b { position: absolute; left: -54px; top: 0; font-size: 11px; letter-spacing: .12em; color: var(--dim); line-height: 18px; }
.meter { overflow: visible; background: linear-gradient(90deg, rgba(20,26,22,.8) 0 76.9%, rgba(120,20,20,.75) 76.9% 100%); }
.meter .mfill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 9px; background: linear-gradient(90deg, #7ed36b, #f2c230 60%, #ff7a2e 76.9%, #e53935); background-size: 300px 100%; }
.meter .mline { position: absolute; left: 76.9%; top: -5px; bottom: -5px; width: 3px; margin-left: -1px; background: #fff; border-radius: 2px; }
.meter em { position: absolute; right: 2px; top: -16px; font-style: normal; font-size: 10px; letter-spacing: .1em; color: #ff8a80; }
.meter.over .mfill { animation: blinkr .25s infinite; }
@keyframes blinkr { 50% { opacity: .5; } }
body.touch .meter { bottom: calc(130px + var(--sb)); }
#qte { position: fixed; z-index: 30; left: 50%; top: 50%; width: 150px; height: 150px; margin: -75px; border-radius: 50%; border: 0; background: rgba(208, 49, 45, .85); color: #fff; font: 900 22px var(--f); pointer-events: auto; box-shadow: 0 0 0 6px rgba(255,255,255,.4), 0 10px 30px rgba(0,0,0,.4); }
#qte i { position: absolute; inset: -18px; border-radius: 50%; border: 5px solid #fff; animation: qte var(--qd, .6s) linear forwards; }
@keyframes qte { from { transform: scale(1.7); opacity: .2; } 50% { opacity: 1; } to { transform: scale(.55); } }
#rotate { display: none; }
@media (orientation: portrait) {
  body.touch.playing #rotate { display: flex; position: fixed; inset: 0; z-index: 60; background: var(--bg); flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 30px; }
  #rotate b { font-size: 60px; animation: spin 2s infinite; }
}
@keyframes spin { 50% { transform: rotate(90deg); } }

/* ---------------------------------------------------------------- screens */
#ui { position: fixed; inset: 0; z-index: 25; pointer-events: none; }
.screen { display: none; position: absolute; inset: 0; pointer-events: auto; overflow-y: auto; padding: calc(16px + var(--st)) calc(18px + var(--sr)) calc(16px + var(--sb)) calc(18px + var(--sl)); }
.screen.on { display: flex; }
#title { background: linear-gradient(90deg, rgba(22, 30, 25, .93) 0%, rgba(22, 30, 25, .72) 40%, rgba(22, 30, 25, 0) 68%); gap: 24px; align-items: safe center; justify-content: space-between; }
.t-main { max-width: 520px; display: flex; flex-direction: column; gap: 12px; }
.kicker { margin: 0; font: 15px var(--chalk); color: var(--gold); }
.logo { margin: 0; line-height: .9; display: flex; flex-direction: column; }
.logo span { font: 900 74px var(--f); letter-spacing: .02em; color: #fff; text-shadow: 0 4px 0 #a33a1a, 0 8px 22px rgba(0,0,0,.45); }
.logo span:last-child { color: var(--paper); font-size: 58px; letter-spacing: .1em; text-shadow: 0 4px 0 #1f5f8f, 0 8px 22px rgba(0,0,0,.45); }
.lead { margin: 0; font-size: 16px; line-height: 1.5; color: rgba(246, 241, 228, .88); }
.challenge:empty { display: none; }
.challenge { background: rgba(242, 194, 48, .15); border: 1px solid var(--gold); border-radius: 10px; padding: 8px 12px; font-size: 15px; }
.menu { display: flex; flex-direction: column; gap: 8px; }
.menu .row { display: flex; gap: 8px; flex-wrap: wrap; }
.menu button, .buttons button, .ghost { border: 1px solid var(--line); background: rgba(255,255,255,.07); border-radius: 14px; padding: 10px 18px; font-size: 15px; font-weight: 700; }
.menu button:hover, .buttons button:hover { background: rgba(255,255,255,.15); }
.menu .row button { flex: 1; }
button.primary { background: var(--paper) !important; color: #2a1d14 !important; font-weight: 900; font-size: 20px !important; border: 0 !important; padding: 12px 22px !important; box-shadow: 0 4px 0 #b8a983; text-align: left; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
button.primary small { font: 14px var(--chalk); color: #7a5a3a; }
button.primary.alt { background: var(--saffron) !important; color: #2a1606 !important; box-shadow: 0 4px 0 #a3520e; }
button.primary.alt small { color: #4a2508; }
.menu button.nets { display: flex; align-items: baseline; gap: 10px; text-align: left; }
.menu button.nets small { font: 13px var(--chalk); color: var(--dim); }
#practice .seg { justify-self: start; }
.pr-kids { margin-top: 12px; flex-wrap: wrap; }
.pr-kids .kidc { flex: 1 1 120px; border: 2px solid transparent; color: inherit; }
.pr-kids .kidc.on { border-color: var(--saffron); background: rgba(240, 138, 36, .16); }
@media (max-height: 500px) { .pr-kids { flex-wrap: nowrap; gap: 6px; margin-top: 8px; } .pr-kids .kidc { flex: 1 1 0; min-width: 0; padding: 4px 2px; } .pr-kids .kidc img { width: 34px; height: 34px; } .pr-kids .kidc b { font-size: 12px; } .pr-kids .kidc small { display: none; } #practice .sub { margin: 0 0 4px; font-size: 13px; } }
button.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #b8a983; }
.disclaimer { margin: 0; font-size: 11.5px; line-height: 1.45; color: rgba(246,241,228,.5); }
.disclaimer a { color: inherit; }
.t-side { width: 300px; flex: none; display: flex; flex-direction: column; gap: 10px; align-self: center; }
.sheet { margin: auto; background: var(--slate); border-radius: 18px; padding: 18px 20px; width: 100%; box-shadow: 0 16px 40px rgba(0,0,0,.45), inset 0 0 0 1px var(--line); backdrop-filter: blur(6px); }
.sheet.narrow { max-width: 440px; } .sheet.wide { max-width: 960px; }
.sheet.center { text-align: center; }
.sheet header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.sheet header h2 { margin: 0 auto 0 0; font: 900 24px var(--f); letter-spacing: .02em; }
.sheet h2 { font: 900 24px var(--f); margin: 0 0 8px; }
.sub { margin: 0 0 12px; color: var(--dim); font-size: 14px; }
.ghost { padding: 7px 14px !important; font-size: 13px !important; }
#pause, #settings, #help, #end, #story, #versus, #toss, #pick, #innbreak { background: rgba(14, 20, 16, .55); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 8px 16px; font-size: 14px; font-weight: 800; color: var(--dim); }
.seg button.on { background: var(--paper); color: #2a1d14; }
.buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.sheet.center .buttons { justify-content: center; }
.buttons .primary { text-align: center; justify-content: center; }
.big { font: 900 44px var(--f); margin: 4px 0; }

/* story chapters */
/* versus */
.vs-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.team { border: 2px solid transparent; border-radius: 16px; background: rgba(255,255,255,.06); padding: 12px; text-align: left; }
.team.on { border-color: var(--saffron); background: rgba(240, 138, 36, .14); }
.team[data-t=tanki].on { border-color: var(--blue); background: rgba(47, 143, 216, .16); }
.team h3 { margin: 0 0 2px; font: 900 20px var(--f); }
.team p { margin: 0 0 8px; color: var(--dim); font-size: 13px; }
.roster { display: flex; gap: 8px; }
.kidc { flex: 1; text-align: center; font-size: 12px; background: rgba(0,0,0,.18); border-radius: 12px; padding: 6px 4px; position: relative; }
.kidc img { width: 54px; height: 54px; border-radius: 50%; background: var(--slate2); display: block; margin: 0 auto 3px; }
.kidc b { display: block; font-size: 14px; }
.kidc small { display: block; color: var(--dim); font-size: 11px; line-height: 1.2; }
.kidc .ord { position: absolute; left: 6px; top: 6px; width: 20px; height: 20px; border-radius: 50%; background: var(--paper); color: #2a1d14; font-weight: 900; font-size: 12px; line-height: 20px; }
.vs-opts { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; align-items: center; margin-top: 14px; }
.vs-opts label { font-weight: 800; color: var(--dim); font-size: 14px; }
/* toss */
.coin { width: 110px; height: 110px; margin: 6px auto 12px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3c0, #d4a017 55%, #9a6f0a); display: grid; place-items: center; box-shadow: 0 6px 0 #7a560a, 0 12px 26px rgba(0,0,0,.4); }
.coin i { font-style: normal; font: 900 48px var(--f); color: #7a560a; }
.coin.flip { animation: flip 1.4s cubic-bezier(.3,.6,.4,1); }
@keyframes flip { 0% { transform: translateY(0) rotateX(0); } 50% { transform: translateY(-90px) rotateX(1440deg); } 100% { transform: translateY(0) rotateX(2880deg); } }
.tossmsg { font: 20px var(--chalk); margin: 0; }
/* bowler pick */
.pick { display: flex; flex-direction: column; gap: 8px; }
.pick button { display: flex; align-items: center; gap: 12px; text-align: left; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.07); padding: 8px 12px; }
.pick button:hover { background: rgba(255,255,255,.15); }
.pick img { width: 48px; height: 48px; border-radius: 50%; background: var(--slate2); }
.pick b { display: block; font-size: 16px; }
.pick small { color: var(--dim); }
/* dialogue */
/* help */
.help { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 16px; }
.help h4 { margin: 0 0 6px; font: 900 16px var(--f); color: var(--gold); }
.help p { margin: 0 0 8px; font-size: 14px; line-height: 1.5; color: rgba(246,241,228,.88); }
.rules { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.rules li { font-size: 13.5px; line-height: 1.4; }
.rules b { color: var(--paper); }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.setrow input[type=range] { width: 150px; accent-color: var(--saffron); }
.setrow .seg button { padding: 5px 11px; font-size: 13px; }
/* end */
.end-top { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; }
.end-why { font: 18px var(--chalk); color: var(--gold); margin: 0; }
.end-big { font: 900 54px var(--f); line-height: 1.05; margin: 4px 0; }
.end-big small { font-size: 22px; color: var(--dim); }
.end-rank { font-size: 16px; font-weight: 800; letter-spacing: .06em; }
.end-best { color: var(--green); font-weight: 800; margin-top: 4px; }
.stars { font-size: 34px; letter-spacing: 6px; color: var(--gold); }
.stars i { font-style: normal; color: rgba(246,241,228,.2); }
.goals { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.goals li::before { content: '○ '; color: var(--dim); }
.goals li.ok::before { content: '● '; color: var(--gold); }
.card2 { background: rgba(0,0,0,.18); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; }
.card2 h4 { margin: 0 0 6px; font-size: 13px; letter-spacing: .1em; color: var(--dim); }
.card2 table { width: 100%; border-collapse: collapse; }
.card2 td { padding: 2px 0; } .card2 td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.e-board:empty { display: none; }
.e-board { margin: 12px 0 0; }

@media (max-width: 900px) { .t-side { display: none; } .t-main { max-width: 620px; } #title { background: linear-gradient(90deg, rgba(22,30,25,.93), rgba(22,30,25,.55)); } .chapters { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) { .help { grid-template-columns: 1fr; } .end-top { grid-template-columns: 1fr; } .diary { grid-template-columns: 1fr; } .vs-teams { grid-template-columns: 1fr; } }
@media (max-height: 500px) {
  .t-main { gap: 7px; }
  .lead { font-size: 13px; line-height: 1.38; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .logo span { font-size: 40px; } .logo span:last-child { font-size: 31px; }
  .kicker { font-size: 12px; }
  .menu button { padding: 7px 14px; font-size: 13px; } button.primary { padding: 8px 16px !important; font-size: 16px !important; }
  .disclaimer { font-size: 10px; }
  .sb { padding: 4px 10px 5px; min-width: 150px; } .sb-score b { font-size: 21px; } .sb-need { font-size: 13px; } .sb-team { font-size: 10px; }
  .over i { width: 22px; height: 22px; font-size: 10px; }
  .hbtn { width: 34px; height: 34px; font-size: 13px; }
  .cards { top: calc(90px + var(--st)); } .pc img { width: 30px; height: 30px; } .pc { font-size: 11px; padding-right: 8px; } .pc b { font-size: 12px; }
  #msg { top: 18%; } #msg b { font-size: 50px; } #msg span { font-size: 15px; }
  #dpad { width: 118px; height: 118px; } #dpad i { width: 42px; height: 42px; margin: -21px; }
  .shots { width: 176px; height: 150px; } .shots .st { width: 56px; height: 56px; font-size: 11px; } .shots .out { right: 62px; top: 34px; } #t-run { right: 104px; width: 62px; height: 62px; font-size: 13px; } .shots .pill { top: -40px; height: 30px; font-size: 11px; width: 72px; } .shots .leave { right: 80px; } #guard { bottom: calc(146px + var(--sb)); } #guard .tb { width: 38px; height: 38px; }
  #t-bowl { width: 78px; height: 78px; } #t-field { width: 56px; height: 56px; right: calc(108px + var(--sr)); } #t-side { width: 56px; height: 56px; right: calc(108px + var(--sr)); bottom: calc(86px + var(--sb)); }
  .vars button { padding: 5px 10px; font-size: 12px; min-width: 96px; }
  #aimpad { width: 112px; height: 112px; } #aimpad i { width: 42px; height: 42px; margin: -21px; }
  body.touch .vars { bottom: calc(146px + var(--sb)); gap: 5px; }
  body.touch .meter { bottom: calc(100px + var(--sb)); width: 240px; margin-left: -120px; } .meter .mfill { background-size: 240px 100%; }
  .sheet { padding: 12px 14px; } .sheet header { margin-bottom: 6px; } .sheet header h2 { font-size: 18px; }
  .help p, .rules li { font-size: 12px; } .setrow { padding: 4px 0; font-size: 13px; }
  .end-big { font-size: 38px; } .stars { font-size: 24px; }
  #pause .menu { display: grid; grid-template-columns: 1fr 1fr; }
  #end-buttons { position: sticky; bottom: -12px; background: var(--slate2); margin: 8px -14px -12px; padding: 8px 14px; border-radius: 0 0 18px 18px; }
  .kidc img { width: 38px; height: 38px; } .team { padding: 8px; } .team h3 { font-size: 16px; } .team p { display: none; }
  .vs-opts { margin-top: 8px; } .coin { width: 80px; height: 80px; } .big { font-size: 32px; }
  #qte { width: 120px; height: 120px; margin: -60px; }
  #toast p { font-size: 13px; } #toast img { width: 36px; height: 36px; }
  #timing { width: 200px; margin-left: -100px; }
}
@media (max-height: 340px) {
  .cards { display: none; } .lead { -webkit-line-clamp: 1; }
  .logo span { font-size: 32px; } .logo span:last-child { font-size: 25px; }
  .vars { flex-direction: row; flex-wrap: wrap; max-width: 46vw; } .vars button { min-width: 0; }
  .over { display: none; }
}
/* very short landscape (Safari with the tab bar): the deliveries sit beside the aim stick, not above it */
@media (max-height: 300px) {
  body.touch .vars { bottom: calc(14px + var(--sb)); left: calc(140px + var(--sl)); max-width: min(38vw, 300px); }
}

/* the Colony Cup run on the story screen */

/* story screen: Chotu's summer, a card per chapter in its ground's colour (the won ones show their photo) */
.st-head { display: flex; align-items: center; gap: 10px; margin-right: auto; min-width: 0; }
.st-head img { width: 46px; height: 46px; border-radius: 50%; background: #e2d7bd; flex: none; }
.st-head b { display: block; font: 900 26px/1 var(--f); }
.st-head span { font: 15px var(--chalk); color: var(--gold); }
.chapters { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 8px 4px 16px; margin: 4px -4px 0; scrollbar-width: thin; }
.chapters .chap { flex: 0 0 168px; scroll-snap-align: center; position: relative; border: 0; border-top: 6px solid var(--vc); border-radius: 14px; background: var(--paper); color: #2a1d14; padding: 0 0 10px; text-align: left; overflow: hidden; box-shadow: 0 5px 0 color-mix(in srgb, var(--vc) 60%, #000), 0 10px 20px rgba(0,0,0,.3); }
.ch-ph { position: relative; height: 104px; background: color-mix(in srgb, var(--vc) 32%, #f6efdc); display: grid; place-items: center; overflow: hidden; }
.ch-ph img { width: 100%; height: 100%; object-fit: cover; }
.ch-ph img.pov { width: 76px; height: 76px; border-radius: 50%; background: #e2d7bd; }
.ch-ph i { position: absolute; left: 8px; top: 4px; font: 900 24px var(--f); font-style: normal; color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,.55); }
.chap em { display: block; padding: 8px 10px 0; font: 12.5px var(--chalk); font-style: normal; color: color-mix(in srgb, var(--vc) 75%, #000); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chap b { display: block; padding: 0 10px; font: 900 16px/1.15 var(--f); }
.chap small { display: block; padding: 3px 10px 0; font-size: 12px; line-height: 1.3; color: #5a4a3a; min-height: 2.6em; }
.chap .st { display: block; padding: 4px 10px 0; font-size: 14px; letter-spacing: 2px; color: #c8a03a; }
.chap .st i { font-style: normal; color: #d9ccaa; }
.chap.lock .st { visibility: hidden; } .chap.lock em { color: var(--dim); }
.chapters .chap.lock { background: #4a564f; color: var(--dim); box-shadow: none; cursor: default; border-top-color: #59655e; }
.chap.lock .ch-ph { background: #3d4842; } .chap.lock img { filter: grayscale(1) brightness(.5); } .chap.lock small { color: var(--dim); }
.chap.next { outline: 3px solid var(--saffron); outline-offset: 2px; }

/* story scenes: comic bubbles over the 3D, captions, cards, flashbacks, a title card per chapter */
#scene { background: linear-gradient(0deg, rgba(14, 20, 16, .5), rgba(14, 20, 16, 0) 22%); padding: 0 !important; }
#game { transition: filter .35s; }
body.carded #game { filter: blur(3px) brightness(.68); }
body.flash #game { filter: sepia(.85) contrast(1.08) brightness(.92); }
body.flash.carded #game { filter: sepia(.85) blur(3px) brightness(.6); }
body.flash #scene::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 48%, rgba(40, 25, 10, .6)); }
.sc-bar { position: absolute; left: calc(16px + var(--sl)); right: calc(16px + var(--sr)); bottom: calc(12px + var(--sb)); display: flex; align-items: center; gap: 10px; }
.sc-dots { flex: 1; display: flex; gap: 4px; min-width: 0; }
.sc-dots i { flex: 1; max-width: 26px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .25); }
.sc-dots i.on { background: var(--gold); }
#dlg-skip { padding: 8px 14px; }
.sc-next { width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--paper); color: #2a1d14; font: 900 24px var(--f); box-shadow: 0 4px 0 #b8a983; flex: none; }
.sc-bub { position: absolute; left: 0; top: 0; width: max-content; max-width: min(420px, 64vw); background: #fffdf5; color: #1f1610; border: 3px solid #1f1610; border-radius: 22px; padding: 9px 16px 11px; box-shadow: 4px 5px 0 rgba(0,0,0,.35); opacity: 0; transform: scale(.8); transform-origin: var(--tx, 30px) 100%; transition: opacity .12s, transform .2s cubic-bezier(.3, 1.6, .5, 1); pointer-events: none; }
.sc-bub.on { opacity: 1; transform: scale(1); }
.sc-bub::before { content: ''; position: absolute; left: var(--tx, 30px); bottom: -19px; margin-left: -12px; border: 12px solid transparent; border-top: 18px solid #1f1610; border-bottom: 0; }
.sc-bub::after { content: ''; position: absolute; left: var(--tx, 30px); bottom: -12px; margin-left: -8px; border: 8px solid transparent; border-top: 12px solid #fffdf5; border-bottom: 0; }
.sc-bub img { float: left; width: 34px; height: 34px; border-radius: 50%; margin: -1px 8px 0 -5px; background: #e2d7bd; }
.sc-bub img:not([src]), .sc-bub img[src=""] { display: none; }
.sc-bub b { display: block; font: 900 11.5px var(--f); letter-spacing: .07em; text-transform: uppercase; color: #8a3b12; }
.sc-bub p { margin: 1px 0 0; font: 700 21px/1.25 var(--chalk); }
.sc-bub.shout { background: #fff1a8; border-radius: 10px; } .sc-bub.shout::after { border-top-color: #fff1a8; }
.sc-bub.shout.on { transform: scale(1) rotate(-1.5deg); }
.sc-bub.shout p { font: 900 24px/1.15 var(--f); }
.sc-bub.think { border-style: dashed; } .sc-bub.sad p { color: #34465e; }
.sc-cap { position: absolute; left: calc(16px + var(--sl)); top: calc(16px + var(--st)); max-width: min(520px, 76vw); background: #f2c230; color: #1f1610; border: 3px solid #1f1610; padding: 10px 14px; font: 800 19px/1.3 var(--f); box-shadow: 4px 5px 0 rgba(0,0,0,.35); opacity: 0; transform: translateY(-14px) rotate(-1deg); transition: .25s; pointer-events: none; }
.sc-cap.on { opacity: 1; transform: translateY(0) rotate(-1deg); }
body.flash .sc-cap { background: #eadcbc; font-style: italic; }
.sc-card { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity .2s; padding-bottom: 40px; }
.sc-card.on { opacity: 1; }
.sc-card > div { transform: rotate(-2deg) scale(.88); transition: transform .3s cubic-bezier(.3, 1.5, .5, 1); box-shadow: 0 18px 40px rgba(0,0,0,.5); }
.sc-card.on > div { transform: rotate(-2deg) scale(1); }
.cd-notice { position: relative; width: min(360px, 80vw); background: #fbf8ee; color: #222; padding: 18px 20px 16px; font-family: 'Courier New', monospace; }
.cd-notice h4 { margin: 0 0 8px; text-align: center; font-size: 18px; letter-spacing: .1em; border-bottom: 2px solid #222; padding-bottom: 6px; }
.cd-notice p { font-size: 15px; line-height: 1.45; margin: 0 0 12px; }
.cd-notice small { display: block; text-align: right; font-size: 12px; }
.stamp { position: absolute; left: 50%; top: 48%; transform: translate(-50%, -50%) rotate(-14deg); border: 4px solid #c62828; color: #c62828; font: 900 30px var(--f); font-style: normal; padding: 2px 12px; letter-spacing: .08em; opacity: .88; animation: stamp .35s .3s both; }
@keyframes stamp { from { transform: translate(-50%, -50%) rotate(-14deg) scale(2.2); opacity: 0; } to { transform: translate(-50%, -50%) rotate(-14deg) scale(1); opacity: .88; } }
.cd-phone { width: min(300px, 76vw); background: #111; border-radius: 26px; padding: 14px 14px 18px; border: 3px solid #333; }
.ph-top { display: flex; align-items: center; gap: 8px; color: #eee; padding-bottom: 10px; border-bottom: 1px solid #333; }
.ph-top img { width: 34px; height: 34px; border-radius: 50%; background: #2e7d32; } .ph-top b { flex: 1; font: 700 15px var(--f); } .ph-top small { color: #888; }
.cd-phone p { margin: 12px 0 0; background: #e7f8d6; color: #111; border-radius: 14px 14px 14px 4px; padding: 10px 12px; font: 16px/1.35 var(--f); }
.cd-letter { width: min(360px, 80vw); background: #fffef8; color: #222; padding: 16px 20px; font-family: Georgia, serif; }
.cd-letter small { display: block; text-align: center; font-size: 11px; letter-spacing: .12em; color: #555; }
.cd-letter h4 { margin: 8px 0 6px; text-align: center; letter-spacing: .06em; } .cd-letter p { margin: 0; font-size: 16px; line-height: 1.45; }
.cd-score { width: min(320px, 76vw); background: #22302a; color: #f4f1e8; border: 8px solid #6d4c2f; padding: 14px; text-align: center; font-family: var(--chalk); }
.cd-score small { font-size: 16px; color: var(--gold); letter-spacing: .08em; } .cd-score b { display: block; font-size: 56px; line-height: 1.1; } .cd-score span { font-size: 17px; }
.cd-chalk { width: min(440px, 86vw); background: #2f3a33; border: 8px solid #8a6a44; padding: 24px 16px; text-align: center; }
.cd-chalk b { font: 34px/1.2 var(--chalk); color: #f6f2e8; }
.cd-route { width: min(400px, 86vw); background: #f6efdc; color: #2a1d14; padding: 14px 18px 10px; }
.cd-route small { font: 900 13px var(--f); letter-spacing: .12em; color: #8a3b12; }
.cd-route ol { list-style: none; margin: 8px 0 0 10px; padding: 0 0 0 18px; border-left: 4px dashed #c9b994; }
.cd-route li { position: relative; padding: 5px 0 5px 6px; }
.cd-route li::before { content: ''; position: absolute; left: -31px; top: 9px; width: 18px; height: 18px; border-radius: 50%; background: var(--vc); border: 3px solid #f6efdc; }
.cd-route li b { display: block; font: 900 17px var(--f); } .cd-route li span { font: 14px var(--chalk); color: #6a5a45; }
.sc-title { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; opacity: 0; transition: opacity .35s; background: radial-gradient(ellipse at center, rgba(10, 14, 12, .55), rgba(10, 14, 12, 0) 70%); }
.sc-title.on { opacity: 1; }
.sc-title em { font: 18px var(--chalk); font-style: normal; color: var(--gold); }
.sc-title b { font: 900 clamp(38px, 8vw, 74px)/1 var(--f); text-shadow: 0 4px 0 rgba(0,0,0,.3), 0 8px 30px rgba(0,0,0,.5); margin: 6px 0 12px; }
.sc-title .vn { background: var(--vc); color: #fff; font: 800 15px var(--f); padding: 5px 14px; border-radius: 99px; letter-spacing: .04em; }
.sc-title .by { margin-top: 12px; display: flex; align-items: center; gap: 8px; font: 16px var(--chalk); background: rgba(20, 26, 22, .75); padding: 4px 14px 4px 4px; border-radius: 99px; }
.sc-title .by img { width: 32px; height: 32px; border-radius: 50%; background: #e2d7bd; }
.polaroid { margin: 0 auto 12px; background: #fff; padding: 8px 8px 0; box-shadow: 0 8px 20px rgba(0,0,0,.35); transform: rotate(-2deg); max-width: 300px; }
.polaroid img, .ph-empty { display: block; width: 100%; aspect-ratio: 7 / 5; object-fit: cover; background: #ddd; }
.polaroid figcaption { font: 20px var(--chalk); color: #2a1d14; text-align: center; padding: 6px 0 8px; }
@media (max-height: 500px) {
  .chapters .chap { flex-basis: 142px; } .ch-ph { height: 64px; } .ch-ph img.pov { width: 50px; height: 50px; } .chap small { display: none; } .chap b { font-size: 14px; }
  .st-head img { width: 34px; height: 34px; } .st-head b { font-size: 20px; } .st-head span { font-size: 13px; }
  .sc-bub { max-width: min(360px, 58vw); padding: 6px 12px 8px; } .sc-bub p { font-size: 16px; } .sc-bub.shout p { font-size: 18px; } .sc-bub img { width: 26px; height: 26px; }
  .sc-cap { font-size: 15px; padding: 7px 10px; } .sc-title b { font-size: 36px; margin: 2px 0 8px; } .sc-title em { font-size: 15px; } .sc-title .by { font-size: 14px; margin-top: 8px; }
  .sc-next { width: 44px; height: 44px; font-size: 20px; } .sc-card > div, .sc-card.on > div { transform: rotate(-2deg) scale(.78); }
  .polaroid { max-width: 200px; } .polaroid figcaption { font-size: 16px; }
}
