/* The phone: one team colour field, a score strip, the decision, a line for "why not". The middle never
   changes size: the strip and the why line hold their room whether they have words or not. */
body.phone { height: 100dvh; display: block; color: var(--ink); }
body.phone.t0 { background: var(--t0); } body.phone.t1 { background: var(--t1); } body.phone.tx, body.phone.door { background: var(--field); }
#app { height: 100dvh; display: grid; grid-template-rows: 48px 1fr 40px 36px; padding: env(safe-area-inset-top) 14px env(safe-area-inset-bottom); }
.top { display: flex; align-items: center; justify-content: center; }
.score { display: flex; gap: 10px; font-weight: 700; font-size: 17px; }
.score span { background: var(--cream); border: 2px solid var(--ink); border-radius: 99px; padding: 3px 12px; white-space: nowrap; }
.score .you { background: var(--ink); color: var(--cream); }
.main { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 0; text-align: center; }
.why { align-self: center; justify-self: center; font-weight: 700; font-size: 16px; background: var(--ink); color: var(--cream); border-radius: 99px; padding: 6px 14px; visibility: hidden; white-space: nowrap; }
.why.on { visibility: visible; }
.foot { display: flex; align-items: center; justify-content: center; }
.huge { margin: 0; font-family: KFuture, SG, sans-serif; font-size: clamp(34px, 11vw, 64px); line-height: 1; color: var(--cream); -webkit-text-stroke: 0.05em var(--ink); paint-order: stroke fill; text-shadow: 0 0.08em 0 var(--ink); }
.big { margin: 0; font-weight: 700; font-size: 21px; }
.label { margin: 0; font-weight: 700; font-size: 17px; text-transform: uppercase; letter-spacing: 0.06em; }
.hint { margin: 0; font-size: 15px; }
.mark { font-size: clamp(44px, 15vw, 76px); justify-content: center; }
.huge-btn { font-family: KFuture, SG; font-weight: 400; font-size: 34px; width: 100%; max-width: 420px; padding: 22px; border-width: 4px; border-radius: 22px; box-shadow: 0 7px 0 var(--ink); }
.huge-btn.on { background: var(--open); }

/* the three calls */
.calls { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 460px; flex: 1; max-height: 62vh; }
.call { flex: 1; font-family: KFuture, SG; font-size: clamp(26px, 8.5vw, 40px); background: var(--cream); border: 4px solid var(--ink); border-radius: 22px; box-shadow: 0 7px 0 var(--ink); cursor: pointer; }
.call:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--ink); }
.call.on { background: var(--ink); color: var(--cream); box-shadow: 0 7px 0 #0006; }
.call.off { opacity: 0.4; }
.timer { width: 100%; max-width: 460px; height: 14px; border: 3px solid var(--ink); border-radius: 99px; background: #fff6; overflow: hidden; flex: none; }
.timer i { display: block; height: 100%; background: var(--ink); transform-origin: left; }

/* live: three numbered buttons, the number huge, the action under it */
.nums { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 460px; flex: 1; }
.num { flex: 1; display: flex; align-items: center; gap: 18px; padding: 0 22px; background: var(--cream); border: 4px solid var(--ink); border-radius: 22px; box-shadow: 0 7px 0 var(--ink); cursor: pointer; touch-action: none; }
.num:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--ink); }
.num b { font-family: KFuture, SG; font-weight: 400; font-size: clamp(48px, 16vw, 84px); line-height: 1; width: 1.1em; text-align: center; }
.num span { font-family: KFuture, SG; font-size: clamp(24px, 8vw, 40px); }
.num.ball { background: var(--ink); color: var(--cream); }
.num.dim { opacity: 0.35; }

/* the meter: a tall bar, power band, sweet spot near the bottom, the marker sweeping */
.meter { display: flex; align-items: stretch; gap: 18px; width: 100%; height: 100%; max-height: 72vh; padding: 8px 0; }
.meter .bar { position: relative; width: 34%; max-width: 140px; border: 5px solid var(--ink); border-radius: 24px; background: var(--cream); overflow: hidden; }
.meter .bar i { position: absolute; left: 0; right: 0; }
.meter .power { background: #ffc21a; border-top: 3px solid var(--ink); border-bottom: 3px solid var(--ink); }
.meter .sweet { background: var(--open); border-top: 3px solid var(--ink); border-bottom: 3px solid var(--ink); }
.meter .marker { height: 10px; margin-bottom: -5px; background: var(--ink); box-shadow: 0 0 0 3px var(--cream); }
.meter .tap1 { display: none; height: 6px; margin-bottom: -3px; background: var(--shut); }
.meter .side { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 12px; text-align: left; }
.next { margin-top: 18px; }

/* door */
body.door #app { display: block; overflow: auto; }
.doortop { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 20px 4px; text-align: center; }
.doorball { width: 96px; height: 96px; border-radius: 50%; border: 5px solid var(--ink); background: radial-gradient(circle at 35% 30%, #ffb062, #e8641a 70%); position: relative; animation: bounce 0.9s cubic-bezier(.3,0,.7,1) infinite alternate; }
.doorball::before, .doorball::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 4px solid transparent; border-left-color: var(--ink); border-right-color: var(--ink); transform: scaleX(0.45); }
.doorball::after { border: 0; border-top: 4px solid var(--ink); top: 50%; transform: none; border-radius: 0; height: 0; }
@keyframes bounce { from { transform: translateY(0) scale(1.05, 0.92); } to { transform: translateY(-40px); } }
.lede { margin: 0; font-weight: 700; font-size: 19px; }
.codeform { display: flex; gap: 10px; width: 100%; max-width: 380px; }
.codeform input { flex: 1; min-width: 0; font-family: KFuture, SG; font-size: 30px; text-align: center; letter-spacing: 0.2em; border: 4px solid var(--ink); border-radius: 16px; padding: 10px; text-transform: uppercase; background: var(--cream); }
.codeform input.bad { animation: shake 0.3s; }
.codeform .btn { width: auto; }
.door .btn.big { font-size: 22px; padding: 14px 22px; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.credits { position: fixed; inset: 0; background: #2a0f2ecc; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; }
.credits .inner { background: var(--cream); border: 3px solid var(--ink); border-radius: 16px; padding: 16px; max-height: 90dvh; overflow: auto; font-size: 14px; }
.credits h2 { margin: 0 0 8px; font-family: KFuture, SG; font-weight: 400; }
.shelf:empty { display: none; }

@media (orientation: landscape) and (max-height: 500px) {
  #app { grid-template-rows: 40px 1fr 34px 30px; }
  .nums, .calls { flex-direction: row; max-width: none; max-height: none; }
  .num { flex-direction: column; justify-content: center; gap: 4px; padding: 6px; }
  .huge { font-size: 38px; }
  .meter { max-height: none; }
}
/* the end panel: the game-a-day shelf sits under Rematch and scrolls inside its own box */
.main.over { justify-content: safe center; overflow-x: hidden; overflow-y: auto; }
.main .shelf { width: 100%; max-width: 460px; min-width: 0; overflow: hidden; flex: none; }
#app { overflow: hidden; max-width: 100vw; }

/* the phone-only game: the court on top at a fixed height, the call and your five under it */
.main.runmain { display: block; padding: 0; }
.run { height: 100%; display: grid; grid-template-rows: minmax(0, 46fr) minmax(0, 54fr); gap: 8px; }
.courtbox { position: relative; border: 3px solid var(--ink); border-radius: 16px; overflow: hidden; background: #ff7ab8; min-height: 0; }
.courtcv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.rshout { position: absolute; left: 0; right: 0; top: 10%; text-align: center; pointer-events: none; }
.rshout div { display: inline-block; font-family: KFuture, SG; font-size: clamp(30px, 10vw, 54px); line-height: 1; color: var(--cream); -webkit-text-stroke: 0.05em var(--ink); paint-order: stroke fill; text-shadow: 0 0.08em 0 var(--ink); animation: shout 0.4s cubic-bezier(.2,1.8,.4,1) both; }
.rshout div small { display: block; font-family: SG; font-weight: 700; font-size: 16px; -webkit-text-stroke: 0; text-shadow: none; color: var(--ink); background: var(--cream); border-radius: 99px; padding: 2px 10px; margin: 6px auto 0; width: max-content; }
.rshout.good div { color: var(--open); } .rshout.bad div { color: var(--shut); }
@keyframes shout { from { transform: scale(2); opacity: 0; } to { transform: none; opacity: 1; } }
.rpanel { display: grid; grid-template-rows: 30px minmax(48px, 1fr) 12px minmax(0, 2.2fr); gap: 7px; min-height: 0; }
.rstatus { font-weight: 700; font-size: 16px; display: flex; align-items: center; justify-content: center; text-align: center; white-space: nowrap; overflow: hidden; }
.rcalls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; min-height: 0; }
.rcall { font-family: KFuture, SG; font-size: clamp(14px, 4.4vw, 20px); line-height: 1.05; background: var(--cream); border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink); padding: 4px; cursor: pointer; }
.rcall:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.rcall.on { background: var(--ink); color: var(--cream); }
.rcall.off, .rcall.shut:not(.on) { opacity: 0.4; }
.rpanel .timer { max-width: none; height: 12px; border-width: 2px; }
.rcards { display: grid; grid-template-columns: repeat(6, 1fr); grid-template-rows: 1fr 1fr; gap: 7px; min-height: 0; }
.rcard { grid-column: span 2; display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: 2px 7px; text-align: left; background: var(--cream); border: 3px solid var(--ink); border-radius: 12px; cursor: pointer; min-height: 0; overflow: hidden; }
.rcard:nth-child(4) { grid-column: 1 / span 3; } .rcard:nth-child(5) { grid-column: 4 / span 3; }
.rcard.bench { background: #fff4e2aa; }
.rcard.sel { background: var(--ink); color: var(--cream); }
.rcard.target { border-style: dashed; }
.rrow { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; }
.rslot { font-family: KFuture, SG; font-size: 14px; white-space: nowrap; opacity: 0.6; }
.rname { font-family: KFuture, SG; font-weight: 400; font-size: clamp(14px, 4.4vw, 20px); line-height: 1.05; white-space: nowrap; }
.ebar { height: 6px; border: 2px solid currentColor; border-radius: 99px; overflow: hidden; flex: none; margin: 2px 0; }
.ebar i { display: block; height: 100%; }
.rstats { display: flex; justify-content: space-between; gap: 4px; }
.rstats span { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }
.rstats i { font-style: normal; font-size: 9px; font-weight: 700; text-transform: uppercase; opacity: 0.75; }
.rstats b { font-size: 13px; }
.rstats .use b { text-decoration: underline 2px; text-underline-offset: 2px; }
.rstats .use i { opacity: 1; }
.rcard.bench .rstats { justify-content: flex-start; gap: 18px; }
.botrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.botlabel { font-weight: 700; font-size: 17px; width: 100%; }
.botrow .btn { padding: 10px 16px; }
@media (orientation: landscape) and (max-height: 500px) {
  .run { grid-template-rows: none; grid-template-columns: 1fr 1fr; }
  .rpanel { grid-template-rows: 24px 44px 10px 1fr; }
}

/* a computer plays as a phone: the court wide on the left, your calls and your five on the right */
@media (pointer: fine) and (min-width: 900px) and (min-height: 501px) {
  #app { max-width: 1180px; margin: 0 auto; grid-template-rows: 56px 1fr 44px 40px; padding: 10px 24px; }
  .score { font-size: 20px; }
  .run { grid-template-rows: none; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; }
  .rpanel { grid-template-rows: 34px minmax(64px, 1fr) 12px minmax(0, 2.6fr); gap: 10px; }
  .rstatus { font-size: 19px; }
  .rcall { font-size: 22px; }
  .rname { font-size: 26px; } .rslot { font-size: 18px; }
  .rcard { padding: 6px 14px; gap: 4px; } .ebar { height: 9px; }
  .rstats b { font-size: 20px; } .rstats i { font-size: 12px; }
  .rshout div { font-size: 72px; }
  .calls, .nums { max-height: 70vh; }
  .door .btn.big { font-size: 24px; }
  .lede { font-size: 22px; }
}
