/* Sky Dragon. One look: Papercut, cream paper on a night-blue ground, vermilion and gold. */
:root {
  --bg: #0c0f22;
  --ink: #f6ead0;
  --dim: rgba(246, 234, 208, .66);
  --gold: #ffcf6e;
  --red: #ef5a43;
  --deep: #a22a22;
  --jade: #5fd6b4;
  --chip: rgba(246, 234, 208, .08);
  --display: 'Bagel Fat One', 'Cooper Black', Georgia, serif;
  --ui: 'Sora', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--ink); overflow: hidden; }
body { font: 14px/1.35 var(--ui); -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
#stage { position: fixed; inset: 0; touch-action: none; overflow: hidden; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#frame { position: absolute; pointer-events: none; box-shadow: 0 0 0 2px #f6ead0, 0 0 0 5px var(--deep), 0 14px 34px rgba(0, 0, 0, .5); border-radius: 2px; }

#hud {
  position: absolute; left: 0; right: 0; top: 0; pointer-events: none;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) max(16px, env(safe-area-inset-right, 0px)) 6px max(16px, env(safe-area-inset-left, 0px));
  display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 4px 12px;
}
#score { font: 400 34px/1 var(--display); font-variant-numeric: tabular-nums; color: var(--ink); text-shadow: 2px 3px 0 var(--deep); }
#score.bump { animation: bump .25s ease-out; }
@keyframes bump { 40% { transform: scale(1.12); color: var(--gold); } }
.right { text-align: right; display: grid; gap: 3px; justify-items: end; }
#level { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
#clock { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--gold); }
#clock.warn { color: var(--red); }
.meter { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
.track { position: relative; flex: 1; height: 8px; border-radius: 4px; background: rgba(246, 234, 208, .12); overflow: hidden; }
#bar { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, var(--red), var(--gold)); border-radius: 4px; transition: width .25s ease-out; }
.mark { position: absolute; top: -2px; bottom: -2px; left: 75%; width: 2px; background: var(--ink); opacity: .6; }
#pct { min-width: 3.4em; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
#lives { display: flex; gap: 6px; }
.chips { position: absolute; left: max(16px, var(--edge, 0px), env(safe-area-inset-left, 0px)); top: 100%; display: flex; gap: 6px; }
.chip {
  position: relative; overflow: hidden; isolation: isolate; padding: 3px 10px; border-radius: 8px;
  font: 600 11px/1.2 var(--ui); letter-spacing: .14em; text-transform: uppercase; color: #1b1206; background: rgba(255, 169, 77, .35);
}
.chip::before { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--left, 100%); background: #ffa94d; z-index: -1; }
#gold { background: rgba(255, 207, 110, .35); }
#gold::before { background: var(--gold); }
#lives i { width: 11px; height: 11px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff7de, var(--gold) 60%, #c47b22); box-shadow: 1px 2px 0 rgba(0, 0, 0, .35); }

#dock {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 8px max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 10px) max(16px, env(safe-area-inset-left, 0px));
  display: flex; gap: 8px; align-items: center; justify-content: space-between;
}
button {
  font: 600 12px/1 var(--ui); color: var(--ink); background: var(--chip); border: 1px solid rgba(246, 234, 208, .18);
  border-radius: 10px; padding: 10px 12px; cursor: pointer; transition: transform .12s, background .2s, border-color .2s;
}
button:active { transform: scale(.96); }
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button[aria-pressed='true'] { border-color: var(--gold); }
.hint { font-size: 11px; color: var(--dim); text-align: center; }

/* centred, but never cut off: on a short screen it scrolls, and it keeps clear of the dock (responsive check 18 Nov) */
#title {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center;
  overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) max(20px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 72px) max(20px, env(safe-area-inset-left, 0px));
  background: radial-gradient(ellipse at 50% 45%, rgba(12, 15, 34, .55), rgba(12, 15, 34, .88) 70%);
  transition: opacity .35s;
}
#title.out { opacity: 0; pointer-events: none; }
#title > :first-child { margin-top: auto; }
#title > :last-child { margin-bottom: auto; }
#title > * { flex: none; }

#title h1 { margin: 0 0 10px; font: 400 clamp(46px, 15vw, 72px)/.95 var(--display); color: var(--ink); text-shadow: 3px 4px 0 var(--deep), 6px 8px 0 rgba(0, 0, 0, .35); }
.how { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; max-width: 32ch; font-size: 13.5px; color: var(--dim); counter-reset: n; }
.how li { position: relative; padding-left: 30px; text-align: left; }
.how li::before { counter-increment: n; content: counter(n); position: absolute; left: 0; top: -1px; width: 21px; height: 21px; border-radius: 50%; background: var(--deep); color: var(--ink); font: 600 11px/21px var(--ui); text-align: center; }
.how b { color: var(--ink); font-weight: 600; }
.how b.gold { color: var(--gold); }
.how b.jade { color: var(--jade); }
.how b.turbo { color: #ffa94d; }
.how b.fire { color: #c8a8ff; }
.how b.ember { color: #ff5a7a; }
#play { font: 400 24px/1 var(--display); padding: 16px 30px; border-radius: 14px; background: var(--red); border: 0; color: #fff4dc; box-shadow: 0 5px 0 var(--deep), 0 12px 24px rgba(0, 0, 0, .4); }
#play:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--deep); }
#last { margin: 0; max-width: 34ch; font-size: 12px; color: var(--dim); }
.levels { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; font-size: 11px; color: var(--dim); }
.levels button { padding: 7px 10px; min-width: 32px; }

#banner {
  position: absolute; left: 0; right: 0; top: 36%; text-align: center; pointer-events: none;
  opacity: 0; transform: translateY(10px) scale(.96); transition: opacity .3s, transform .45s cubic-bezier(.2, 1.4, .4, 1);
}
#banner.in { opacity: 1; transform: none; }
#banner-title { font: 400 40px/1 var(--display); letter-spacing: .03em; color: var(--ink); text-shadow: 3px 4px 0 var(--deep), 6px 8px 0 rgba(0, 0, 0, .35); }
#banner-sub { margin-top: 8px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }

/* The last 10 seconds of a level, large in the sky; the last 3 in red. It never blocks a swipe. */
#count {
  position: absolute; left: 0; right: 0; top: 50%; translate: 0 -50%; text-align: center; pointer-events: none;
  font: 400 clamp(110px, 38vw, 200px)/1 var(--display); color: var(--ink); opacity: .55; font-variant-numeric: tabular-nums;
  text-shadow: 4px 6px 0 var(--deep), 8px 12px 0 rgba(0, 0, 0, .35);
}
#count.last { color: var(--red); opacity: .8; text-shadow: 4px 6px 0 #4a0f0f, 8px 12px 0 rgba(0, 0, 0, .35); }
#count.go { animation: count .9s ease-out both; }
@keyframes count { from { transform: scale(1.35); opacity: 0; } 18% { opacity: .85; } to { transform: scale(.92); } }

#pops { position: absolute; inset: 0; pointer-events: none; }
.pop {
  position: absolute; transform: translate(-50%, -50%); font: 400 20px/1 var(--display); color: var(--ink);
  text-shadow: 2px 2px 0 var(--deep), 0 2px 10px rgba(0, 0, 0, .6); animation: pop 1.2s cubic-bezier(.2, .9, .3, 1) forwards; white-space: nowrap;
}
.pop.big { font-size: 30px; color: var(--gold); }
.pop.jade { color: var(--jade); }
.pop.turbo { color: #ffa94d; }
.pop.fire { color: #c8a8ff; }
.pop.warn { color: #ffd2c4; font-size: 18px; }
@keyframes pop {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); }
  15% { opacity: 1; transform: translate(-50%, -60%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -190%) scale(1); }
}
.titlebar { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; font-size: 12px; color: var(--dim); }
.titlebar { gap: 4px 18px; }
.titlebar .tlink { background: none; border: 0; padding: 8px 2px; font: 600 12px/1 var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); text-decoration: none; }
#acct { margin: -8px 0 0; font-size: 12px; color: var(--dim); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--gold); text-decoration: underline; text-underline-offset: 3px; font: inherit; }

/* Sheets: game over, leaderboard, pause, sign-in. Cream paper cards on the night. */
.sheet {
  position: absolute; inset: 0; z-index: 5; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; overflow-y: auto; -webkit-user-select: text; user-select: text;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 16px) max(16px, env(safe-area-inset-left, 0px));
  background: rgba(8, 10, 24, .78);
}
.card {
  box-sizing: border-box; width: min(100%, 360px); display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 20px 18px; border-radius: 14px;
  background: #f6ead0; color: #2a1810; box-shadow: 0 0 0 3px var(--deep), 6px 8px 0 rgba(0, 0, 0, .35);
}
.card.wide { width: min(100%, 420px); max-height: 100%; overflow: hidden; grid-template-rows: auto auto auto 1fr auto auto; }
.card h2 { margin: 0; font: 400 30px/1 var(--display); color: var(--deep); text-wrap: balance; }
.card .k { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: #8a5a3a; font-weight: 600; }
.card .sub, .card .fine { margin: 0; font-size: 13px; color: #5b4030; }
.card .fine { font-size: 11px; }
.card b { color: #2a1810; }
.card b.gold { color: var(--deep); }
.card button { color: #2a1810; background: rgba(42, 24, 16, .06); border-color: rgba(42, 24, 16, .2); }
.card button.primary, .card button.gold { background: var(--red); border-color: var(--deep); color: #fff4dc; box-shadow: 0 3px 0 var(--deep); }
.card button.full { width: 100%; padding: 13px; font-size: 14px; }
.card button[disabled] { opacity: .55; }
.card .linkbtn { color: var(--deep); background: none; border: 0; box-shadow: none; padding: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions button { flex: 1; }
.actions.col { flex-direction: column; }
.final { font: 400 52px/1 var(--display); color: var(--deep); font-variant-numeric: tabular-nums; }
.ohead { display: grid; gap: 6px; }
.osub, .obest { margin: 0; color: #5b4030; }
.obest { font-size: 12.5px; }
.bcard { display: grid; gap: 10px; padding: 12px; border-radius: 10px; background: rgba(42, 24, 16, .06); }
/* rank, next place and whitelist spot side by side */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; }
.tile { display: grid; gap: 2px; padding: 8px 6px; border-radius: 8px; background: #fffaf0; text-align: center; min-width: 0; }
.tile span { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: #8a5a3a; font-weight: 600; }
.tile b { font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile b.ok { color: #1f7a5a; } .tile b.todo { color: var(--deep); }
.tile[hidden] { display: none; }
.bname { margin: 0; font-size: 12.5px; color: #5b4030; }
.pacct { font-size: 12.5px; color: #5b4030; text-align: center; }
.bh { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; color: #8a5a3a; }
#bstate.ok { color: #1f7a5a; } #bstate.warn { color: var(--deep); }
.row { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.bnote { margin: 0; font-size: 12.5px; color: #5b4030; }
.bact { display: flex; gap: 8px; } .bact button { flex: 1; }
.lform { display: grid; gap: 6px; }
#lsignin { gap: 12px; }
.lform label { font-size: 12px; font-weight: 600; }
.card input { box-sizing: border-box; font: 15px var(--ui); padding: 11px 12px; border-radius: 10px; border: 1px solid rgba(42, 24, 16, .3); background: #fffaf0; color: #2a1810; -webkit-user-select: text; user-select: text; }
.or { display: flex; align-items: center; gap: 10px; font-size: 11px; color: #8a5a3a; text-transform: uppercase; letter-spacing: .14em; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: rgba(42, 24, 16, .2); }
.lmsg { margin: 0; font-size: 12.5px; color: #1f7a5a; } .lmsg.err { color: var(--deep); }
#ldev details { font-size: 12px; } #ldev button { margin: 4px 4px 0 0; }
.lblist { margin: 0; padding: 0; list-style: none; overflow-y: auto; min-height: 120px; border-top: 1px solid rgba(42, 24, 16, .15); }
.lblist li { display: grid; grid-template-columns: 2.2em 1fr auto; gap: 6px; align-items: center; padding: 7px 10px 7px 4px; border-bottom: 1px solid rgba(42, 24, 16, .1); font-variant-numeric: tabular-nums; }
.lblist .rk { font-weight: 600; color: #8a5a3a; text-align: left; }
.lblist .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lblist .sc { font-weight: 600; }
.lblist li.you { background: rgba(239, 90, 67, .14); }
.lblist li.wl .rk { color: var(--deep); }
.lblist li.house { color: #8a6a55; font-style: italic; }
.lblist li.house .sc { font-weight: 400; }
.lblist .lbempty, .lblist .gap { display: block; text-align: center; color: #8a5a3a; }
.lamp { display: inline-block; width: 10px; height: 13px; border-radius: 4px 4px 5px 5px; background: linear-gradient(#ffcf6e, #e8863a); box-shadow: 0 0 0 1.5px #a22a22 inset; vertical-align: -2px; }
.rules { overflow-y: auto; font-size: 13px; color: #3e2a1e; -webkit-user-select: text; user-select: text; }
.rules p { margin: 0 0 8px; }
.rules h3 { margin: 12px 0 4px; font: 400 18px/1.1 var(--display); color: var(--deep); }
.rules ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
#title .logo { width: 120px; height: auto; margin-bottom: -6px; opacity: .92; }
.legend { margin: 0; display: flex; gap: 6px; align-items: center; font-size: min(11.5px, 2.55vw); white-space: nowrap; overflow: hidden; color: #5b4030; }
.lbcard { font-size: 13px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.lbcard p { margin: 0; }
/* Post on X (/skyshot/js/xpost.js) */
.xpanel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding-top: 10px; border-top: 1px solid rgba(42, 24, 16, .14); font-size: 12.5px; color: #5b4030; }
.xpanel p { margin: 0; }
.xpanel .xok { color: #1f7a5a; } .xpanel .xwarn { color: var(--deep); }
.xrow { display: flex; } .xrow button { flex: 1; }
.xform { display: flex; gap: 6px; } .xform input { flex: 1; min-width: 0; width: 0; padding: 8px 10px; }
.xin { position: relative; flex: 1; min-width: 0; display: flex; } .xin input { padding-right: 32px; }
.xclr { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border: 0; border-radius: 50%; background: rgba(0,0,0,.08); color: inherit; font: 600 15px/1 inherit; cursor: pointer; }
.xmsg.err { color: var(--deep); }
.xv { font-style: normal; color: #1f7a5a; margin-left: 5px; }
.lbrename summary { cursor: pointer; list-style: none; color: #5b4030; }
.lbrename summary::-webkit-details-marker { display: none; }
.lbrename[open] summary { margin-bottom: 8px; }
.lbname { display: flex; gap: 6px; } .lbname input { flex: 1; min-width: 0; width: 0; padding: 8px 10px; }

@media (prefers-reduced-motion: reduce) { .pop { animation-duration: .01s; } #banner, #title { transition: none; } }

/* The game logo on the start screen (arcade logos, Otto Nox 11 Nov): replaces the PixelPyro logo and the heading. */
#title .gamelogo { margin: 0 0 8px; text-shadow: none; line-height: 0; }
#title .gamelogo img { width: min(78vw, 340px); height: auto; filter: drop-shadow(0 6px 24px rgba(0, 0, 0, .55)); }
#bx:empty, .bact:empty { display: none; }
/* the privacy link at the email field (go-live check 12 Nov) */
.privacy { justify-self: center; margin-top: 4px; font-size: 12px; opacity: .75; color: inherit; }

/* HUD and dock as wide as the field (Otto Nox 14 Nov, the same layout as Skyshot): --edge is the space left of the frame
   (main.js layout); the dock buttons are pills with an icon, like Skyshot's */
#hud, #dock { padding-left: max(16px, var(--edge, 0px), env(safe-area-inset-left, 0px)); padding-right: max(16px, var(--edge, 0px), env(safe-area-inset-right, 0px)); }
.dockbtn { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 10px 14px 10px 12px; }
.dockbtn svg { width: 16px; height: 16px; flex: none; }
#title .credit { font-size: 11px; color: var(--dim); }
#title .credit a { color: var(--dim); }
.dockbtn span { white-space: nowrap; }
#dock .hint { min-width: 0; }
/* the sound button is an icon only (Otto Nox 14 Nov): speaker with waves when on, crossed out when off */
.dockbtn.icon { width: 40px; height: 40px; padding: 0; justify-content: center; }
#sound .off, #sound[aria-pressed='false'] .on { display: none; }
#sound[aria-pressed='false'] .off { display: block; }
/* the title on shorter phones (responsive check 18 Nov) */
@media (max-height: 760px) {
  #title { gap: 12px; }
  #title .gamelogo img { width: min(66vw, 270px); }
  .how { gap: 6px; font-size: 12.5px; }
}
@media (max-height: 600px) {
  #title { gap: 8px; padding-top: calc(env(safe-area-inset-top, 0px) + 8px); padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 62px); }
  #title .gamelogo img { width: min(56vw, 190px); }
  .how { gap: 4px; font-size: 12px; line-height: 1.28; }
  #play { font-size: 21px; padding: 12px 26px; }
  .titlebar { gap: 2px 10px; }
  .titlebar .tlink { font-size: 10.5px; letter-spacing: .06em; padding: 6px 2px; }
}/* the result card on narrow phones (responsive check 18 Nov): tile labels and buttons stay on one line */
@media (max-width: 360px) {
  .tile { padding: 8px 4px; }
  .tile span { font-size: 9px; letter-spacing: .04em; }
  .tile b { font-size: 14px; }
  .actions button { white-space: nowrap; padding-left: 8px; padding-right: 8px; }
}
/* phone on its side: the field would be a sliver, so ask to turn it upright; a run pauses (main.js, 18 Nov) */
#turn { display: none; position: fixed; inset: 0; z-index: 50; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 0 max(24px, env(safe-area-inset-right, 0px)) 0 max(24px, env(safe-area-inset-left, 0px)); background: var(--bg); text-align: center; }
#turn p { margin: 0; font: 400 26px/1.1 var(--display); color: var(--ink); text-shadow: 2px 3px 0 var(--deep); }
#turn span { font-size: 13px; color: var(--dim); }
.turnphone { width: 30px; height: 50px; border: 3px solid var(--gold); border-radius: 7px; transform: rotate(90deg); animation: turnup 2.4s ease-in-out infinite; }
@keyframes turnup { 0%, 25% { transform: rotate(90deg); } 55%, 100% { transform: rotate(0); } }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) { #turn { display: flex; } }
