@font-face { font-family: 'Anton'; src: url('../fonts/anton.woff2') format('woff2'); font-display: block; }
:root {
  --paper: #efe3c4; --paper2: #e2d1a6; --ink: #151015; --cyan: #17b3d6; --cyanD: #0b6f8f; --mag: #e6327f; --magD: #9c1650;
  --yel: #f4e01c; --grn: #74e03a; --grnD: #3c9418; --org: #ff6a14; --red: #e8262b; --white: #fff8e8;
  --ts: 1; --fs: calc(clamp(12px, min(0.95vw, 1.7vh), 19px) * var(--ts)); /* the HUD scales with the window: 12px on a laptop, 15px at 1600x900, 18px at 1080p */ --head: 'Anton', Impact, 'Arial Black', 'Helvetica Neue', sans-serif; --body: 'Trebuchet MS', Verdana, 'Segoe UI', sans-serif;
  --topH: 3.733rem; --botH: 4.133rem;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--ink); font-family: var(--body); font-size: var(--fs);
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: none; }
#app { position: fixed; inset: 0; }
#stage { position: absolute; inset: 0; }
#stage canvas { display: block; }
.hidden { display: none !important; }
button { color: var(--ink); }
img.ic { width: 1.5em; height: 1.5em; vertical-align: middle; image-rendering: auto; }
img.ic.s { width: 1.15em; height: 1.15em; }
img.ic.l { width: 2.2em; height: 2.2em; }
b, strong { font-weight: 800; }
.paper { background: var(--paper); background-image: radial-gradient(rgba(21,16,21,.09) 1px, transparent 1.4px); background-size: 0.467rem 0.467rem;
  border: 0.2rem solid var(--ink); box-shadow: 0.333rem 0.333rem 0 var(--ink); border-radius: 0.333rem 0.6rem 0.267rem 0.533rem; }
.h { font-family: var(--head); letter-spacing: .5px; text-transform: uppercase; }
.btn { font-family: var(--head); text-transform: uppercase; font-size: 1em; letter-spacing: .8px; font-weight: 400; color: var(--ink); background: var(--yel);
  border: 0.2rem solid var(--ink); box-shadow: 0.2rem 0.2rem 0 var(--ink); border-radius: 0.4rem 0.267rem 0.467rem 0.333rem; padding: .35em .8em; cursor: pointer; line-height: 1.1; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.cy { background: var(--cyan); } .btn.mg { background: var(--mag); color: var(--white); } .btn.gn { background: var(--grn); } .btn.wh { background: var(--white); }
.btn.rd { background: var(--red); color: var(--white); } .btn.sm { font-size: .82em; padding: .22em .55em; box-shadow: 2px 2px 0 var(--ink); }
.btn[disabled], .btn.off { opacity: .45; cursor: not-allowed; filter: grayscale(.6); }
.pulse { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0.2rem 0.2rem 0 var(--ink), 0 0 0 0 rgba(230,50,127,.9); } 50% { box-shadow: 0.2rem 0.2rem 0 var(--ink), 0 0 0 0.467rem rgba(230,50,127,0); } }
.reduced .pulse { animation: none; outline: 0.2rem dashed var(--mag); outline-offset: 0.2rem; }

/* ---------- top strip ---------- */
#top { position: absolute; left: 0; right: 0; top: 0; height: var(--topH); display: flex; align-items: center; gap: 0.533rem; padding: 0.4rem 0.667rem;
  background: var(--ink); border-bottom: 0.2rem solid var(--mag); z-index: 20; }
#logo { font-family: var(--head); color: var(--yel); font-size: 1.25em; line-height: .9; transform: rotate(-3deg); text-shadow: 2px 2px 0 var(--mag); white-space: nowrap; }
#logo span { color: var(--white); display: block; font-size: .7em; }
#stats { display: flex; gap: 0.4rem; flex: 1; min-width: 0; overflow: hidden; }
.chip { background: var(--paper); border: 0.167rem solid var(--ink); border-radius: 0.4rem; padding: 2px 0.533rem; display: flex; flex-direction: column; justify-content: center;
  min-width: 0; white-space: nowrap; box-shadow: 2px 2px 0 var(--mag); cursor: pointer; }
.chip .k { font-size: .66em; text-transform: uppercase; font-weight: 800; opacity: .75; line-height: 1.1; }
.chip .v { font-family: var(--head); font-size: 1.12em; line-height: 1.1; }
.chip.bad { background: #ffc9c9; } .chip.good .v { color: var(--grnD); } .chip.hot { background: var(--yel); animation: hot .6s steps(2) infinite; }
@keyframes hot { 50% { background: var(--org); } }
.reduced .chip.hot { animation: none; }
.bar { height: 0.4rem; border: 1.5px solid var(--ink); background: var(--white); border-radius: 0.2rem; overflow: hidden; margin-top: 2px; }
.bar i { display: block; height: 100%; background: var(--grn); }
#speed { display: flex; gap: 0.267rem; }
#speed .btn { padding: .25em .5em; min-width: 2.3em; }
#speed .btn.on { background: var(--mag); color: var(--white); }

/* ---------- area tabs ---------- */
#areas { position: absolute; left: 50%; transform: translateX(-50%); top: calc(var(--topH) + 0.533rem); z-index: 13; display: flex; gap: 0.4rem; }
.atab { position: relative; display: flex; align-items: center; gap: 0.333rem; font-family: var(--head); text-transform: uppercase; font-size: .95em; letter-spacing: .6px;
  background: var(--white); border: 0.2rem solid var(--ink); border-radius: 0.467rem 0.333rem 0.533rem 0.4rem; box-shadow: 0.2rem 0.2rem 0 var(--ink); padding: .25em .7em; cursor: pointer; }
.atab.on { background: var(--yel); transform: translateY(-2px) rotate(-1deg); }
.atab.lock { opacity: .55; cursor: not-allowed; filter: grayscale(.7); }
.atab small { font-size: .7em; background: var(--ink); color: var(--yel); border-radius: 0.2rem; padding: 0 0.267rem; }
.spon { border: 0.167rem solid var(--ink); border-radius: 0.4rem; background: var(--white); padding: 0.4rem 0.6rem; margin: 0.533rem 0; box-shadow: 0.2rem 0.2rem 0 var(--ink); }
.spon .h { font-size: 1.05em; } .spon .note { margin: 2px 0 0.267rem; }
.card .ar { font-size: .66em; font-family: var(--head); text-transform: uppercase; color: var(--cyanD); }
.card .ar.away { color: var(--magD); }

.cks { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.333rem; margin: 0.533rem 0; }
.ck { border: 0.167rem solid var(--ink); border-radius: 0.4rem; background: var(--white); text-align: center; padding: 0.267rem 2px; font-family: var(--head); }
.ck small { display: block; font-size: .68em; opacity: .7; } .ck b { font-weight: 400; font-size: 1.1em; }
.ck.got { background: var(--grn); opacity: .7; } .ck.now { background: var(--yel); transform: translateY(-0.2rem) rotate(-2deg); box-shadow: 0.2rem 0.2rem 0 var(--ink); }
.chip.pop { animation: cashpop .35s ease-out; }
@keyframes cashpop { 40% { transform: scale(1.18); background: var(--yel); } }
.reduced .chip.pop { animation: none; }

/* ---------- goals ---------- */
#goals { position: absolute; left: 0.667rem; top: calc(var(--topH) + 0.667rem); width: 20rem; max-width: calc(100vw - 1.333rem); z-index: 12; padding: 0.533rem 0.667rem; transform: rotate(-.4deg); }
#goals .gh { display: flex; align-items: baseline; gap: 0.4rem; cursor: pointer; }
#goals .gh .h { font-size: 1.2em; }
#goals .num { background: var(--mag); color: var(--white); font-family: var(--head); padding: 0 0.4rem; border-radius: 0.267rem; }
#goals .sub { font-size: .82em; font-style: italic; margin: 2px 0 0.4rem; }
#goals ul { list-style: none; margin: 0; padding: 0; }
#goals li { display: flex; gap: 0.4rem; align-items: flex-start; margin: 0.267rem 0; font-size: .92em; }
#goals li .cb { width: 1.1em; height: 1.1em; border: 0.167rem solid var(--ink); border-radius: 0.2rem; flex: none; margin-top: 1px; background: var(--white); text-align: center; line-height: .9em; font-weight: 900; }
#goals li.done { opacity: .6; } #goals li.done .cb { background: var(--grn); }
#goals li .pr { margin-left: auto; font-family: var(--head); white-space: nowrap; }
#goals .hint { font-size: .8em; background: var(--white); border: 2px dashed var(--ink); padding: 0.267rem 0.4rem; margin-top: 0.4rem; border-radius: 0.267rem; }
#goals.min ul, #goals.min .hint, #goals.min .sub, #goals.min .next { display: none; }
#goals .next { margin-top: 0.533rem; width: 100%; }

/* ---------- side sheet ---------- */
#sheet { position: absolute; right: 0.667rem; top: calc(var(--topH) + 0.667rem); bottom: calc(var(--botH) + 0.667rem); width: 22.667rem; z-index: 13; display: flex; flex-direction: column; }
#sheet .sh-head { display: flex; align-items: center; gap: 0.533rem; padding: 0.533rem 0.667rem 0.4rem; border-bottom: 0.2rem solid var(--ink); background: var(--yel); border-radius: 0.267rem 0.467rem 0 0; }
#sheet .sh-head .h { font-size: 1.2em; flex: 1; }
#sheet .sh-body { overflow-y: auto; padding: 0.533rem 0.667rem 0.8rem; flex: 1; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.x { background: var(--ink); color: var(--white); border: none; width: 1.8em; height: 1.8em; border-radius: 50%; font-weight: 900; cursor: pointer; font-size: 1em; }
.gag { font-style: italic; font-size: .88em; margin: 0 0 0.533rem; }
.status { padding: 0.333rem 0.533rem; border: 0.167rem solid var(--ink); border-radius: 0.333rem; background: var(--white); font-weight: 700; margin: 0.4rem 0; display: flex; gap: 0.4rem; align-items: center; }
.status.blocked { background: #ffd0d0; }
.sec { margin: 0.667rem 0 0.267rem; font-family: var(--head); text-transform: uppercase; font-size: .95em; border-bottom: 2px solid var(--ink); }
.row { display: flex; align-items: center; gap: 0.4rem; margin: 0.267rem 0; flex-wrap: wrap; }
.row .grow { flex: 1; }
.recipe { display: flex; align-items: center; gap: 0.267rem; flex-wrap: wrap; font-weight: 700; background: var(--white); border: 2px solid var(--ink); border-radius: 0.333rem; padding: 0.267rem 0.4rem; }
.stock { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.stock .it { display: flex; align-items: center; gap: 0.2rem; background: var(--white); border: 2px solid var(--ink); border-radius: 0.333rem; padding: 1px 0.4rem 1px 2px; font-family: var(--head); }
.stock .it.in { background: #c9f0f8; } .stock .it.out { background: #fbf3a0; } .stock .it.exp { background: #fbd0e2; }
.wk { display: flex; align-items: center; gap: 0.4rem; padding: 0.2rem 0; border-bottom: 1px dashed rgba(21,16,21,.3); font-size: .9em; }
.wk img { width: 1.733rem; height: 2.667rem; object-fit: cover; object-position: top; }
.stars { color: var(--org); letter-spacing: -1px; font-size: .95em; }
.note { font-size: .82em; opacity: .85; }
.warnbox { background: #ffe1a8; border: 2px solid var(--ink); border-radius: 0.333rem; padding: 0.333rem 0.467rem; font-size: .86em; margin: 0.267rem 0; }
.card-o { border: 0.167rem solid var(--ink); border-radius: 0.4rem; padding: 0.4rem 0.533rem; margin: 0.467rem 0; background: var(--white); box-shadow: 0.2rem 0.2rem 0 var(--ink); }
.card-o .top { display: flex; align-items: center; gap: 0.4rem; }
.card-o .pay { margin-left: auto; font-family: var(--head); font-size: 1.2em; color: var(--grnD); }
.card-o .buyer { font-size: .8em; font-style: italic; }
.prog { height: 0.6rem; border: 2px solid var(--ink); border-radius: 0.267rem; background: var(--paper2); overflow: hidden; margin: 0.267rem 0; }
.prog i { display: block; height: 100%; background: var(--mag); }
table.fin { width: 100%; border-collapse: collapse; font-size: .9em; }
table.fin td { padding: 2px 0.267rem; border-bottom: 1px dashed rgba(21,16,21,.25); }
table.fin td:last-child { text-align: right; font-family: var(--head); }
table.fin tr.tot td { border-top: 0.167rem solid var(--ink); border-bottom: none; font-weight: 800; }
.pos { color: var(--grnD); } .neg { color: var(--red); }
input[type=range] { width: 100%; accent-color: var(--mag); }
.seg { display: flex; gap: 0; border: 0.167rem solid var(--ink); border-radius: 0.4rem; overflow: hidden; }
.seg button { flex: 1; border: none; border-right: 2px solid var(--ink); background: var(--white); font-family: var(--head); text-transform: uppercase; padding: 0.333rem 0.267rem; cursor: pointer; font-size: .82em; }
.seg button:last-child { border-right: none; } .seg button.on { background: var(--mag); color: var(--white); }

/* ---------- bottom bar + drawer ---------- */
#bot { position: absolute; left: 0; right: 0; bottom: 0; height: var(--botH); display: flex; gap: 0.533rem; align-items: center; justify-content: center; padding: 0.4rem 0.667rem;
  background: var(--ink); border-top: 0.2rem solid var(--cyan); z-index: 20; }
#bot .btn { display: flex; align-items: center; gap: 0.333rem; position: relative; font-size: 1.02em; }
#bot .btn img { width: 1.5em; height: 1.5em; }
#bot .btn.on { background: var(--mag); color: var(--white); }
.badge { position: absolute; top: -0.6rem; right: -0.6rem; background: var(--red); color: var(--white); border: 2px solid var(--ink); border-radius: 66.6rem; font-size: .75em; min-width: 1.6em; padding: 0 0.267rem; text-align: center; }
#drawer { position: absolute; left: 0.667rem; right: 0.667rem; bottom: calc(var(--botH) + 0.533rem); z-index: 14; padding: 0.4rem 0.533rem 0.533rem; max-width: 73.333rem; margin: 0 auto; }
#drawer .tabs { display: flex; gap: 0.267rem; margin-bottom: 0.4rem; flex-wrap: wrap; }
#drawer .tabs button { font-family: var(--head); text-transform: uppercase; border: 0.167rem solid var(--ink); background: var(--white); border-radius: 0.333rem 0.333rem 0 0; padding: 0.2rem 0.6rem; cursor: pointer; }
#drawer .tabs button.on { background: var(--cyan); }
#drawer .tabs button.x { background: var(--ink); color: var(--white); border-radius: 50%; padding: 0; width: 1.9em; height: 1.9em; }
#cards { display: flex; gap: 0.533rem; overflow-x: auto; padding: 0.267rem 2px 0.533rem; touch-action: pan-x; -webkit-overflow-scrolling: touch; }
.card { flex: none; width: 10rem; border: 0.2rem solid var(--ink); border-radius: 0.467rem; background: var(--white); box-shadow: 0.2rem 0.2rem 0 var(--ink); cursor: pointer; padding: 0.267rem 0.4rem 0.4rem; position: relative; }
.card:hover { background: #fffbe0; transform: translateY(-2px); }
.card .thumb { height: 4.667rem; display: flex; align-items: flex-end; justify-content: center; }
.card .thumb img { max-height: 4.667rem; max-width: 8rem; }
.card .nm { font-family: var(--head); text-transform: uppercase; font-size: .9em; line-height: 1.05; margin-top: 2px; }
.card .cs { font-family: var(--head); color: var(--grnD); }
.card .ds { font-size: .72em; line-height: 1.2; }
.card.lock { opacity: .55; cursor: not-allowed; filter: grayscale(.7); }
.card.lock::after { content: attr(data-lock); position: absolute; inset: auto 0.267rem 0.267rem 0.267rem; background: var(--ink); color: var(--yel); font-family: var(--head); text-align: center; font-size: .78em; border-radius: 0.267rem; padding: 1px; }
.card.poor .cs { color: var(--red); }
.card.owned { opacity: .6; }

/* ---------- alerts ---------- */
#alerts { position: absolute; right: 0.667rem; top: calc(var(--topH) + 4.133rem); z-index: 15; display: flex; flex-direction: column; gap: 0.4rem; width: min(22rem, calc(100vw - 1.333rem)); pointer-events: none; font-size: .9em; } /* top right, clear of the goals panel and the bottom menus */
.alert { pointer-events: auto; display: flex; gap: 0.467rem; align-items: center; background: var(--white); border: 0.167rem solid var(--ink); border-radius: 0.4rem; box-shadow: 0.2rem 0.2rem 0 var(--ink);
  padding: 0.333rem 0.6rem; font-size: .88em; font-weight: 700; cursor: pointer; animation: slidein .25s ease-out; }
.alert.block { background: #ffd0d0; } .alert.warn { background: #ffe1a8; } .alert.event { background: #d4f3fb; } .alert.good { background: #d7f7c4; }
.alert.fade { opacity: 0; transition: opacity .6s; }
@keyframes slidein { from { transform: translateX(-2rem); opacity: 0; } }
#sheet:not(.hidden) ~ #alerts { right: 24rem; } /* slide left of an open Orders/Staff sheet */
.alert:not([data-act]) { pointer-events: none; } /* plain notices never eat clicks */

/* ---------- placing bar ---------- */
#placebar { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--botH) + 0.8rem); z-index: 16; padding: 0.4rem 0.667rem; display: flex; gap: 0.533rem; align-items: center; flex-wrap: wrap; justify-content: center; width: max-content; max-width: calc(100vw - 1.067rem); }

/* ---------- modal ---------- */
#modal { position: absolute; inset: 0; z-index: 40; background: rgba(21,16,21,.66); display: flex; align-items: center; justify-content: center; padding: 0.933rem; }
#modal .box { width: min(42.667rem, 100%); max-height: calc(100vh - 1.867rem); overflow-y: auto; padding: 1.067rem 1.2rem; position: relative; touch-action: pan-y; }
#modal .box h1 { font-family: var(--head); font-size: 2em; margin: 0 0 0.267rem; line-height: 1; text-transform: uppercase; transform: rotate(-1deg); }
#modal .box h1 .num { background: var(--mag); color: var(--white); padding: 0 0.533rem; border-radius: 0.333rem; }
#modal .box h2 { font-family: var(--head); margin: 0.667rem 0 0.267rem; text-transform: uppercase; font-size: 1.1em; }
#modal .grand { font-style: italic; font-size: 1.04em; background: var(--white); border: 0.167rem solid var(--ink); padding: 0.533rem 0.667rem; border-radius: 0.4rem; transform: rotate(.3deg); }
#modal .rules { margin: 0.4rem 0; padding-left: 1.2em; } #modal .rules li { margin: 0.2rem 0; }
#modal .acts { display: flex; gap: 0.667rem; justify-content: flex-end; margin-top: 0.933rem; flex-wrap: wrap; }
.panels { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.533rem; margin: 0.667rem 0; }
.panel { border: 0.2rem solid var(--ink); background: var(--white); border-radius: 0.4rem; padding: 0.533rem; min-height: 8rem; display: flex; flex-direction: column; gap: 0.4rem; box-shadow: 0.2rem 0.2rem 0 var(--ink); }
.panel:nth-child(2) { background: #d4f3fb; transform: rotate(.6deg); } .panel:nth-child(3) { background: #fbd0e2; transform: rotate(-.5deg); }
.panel .who { font-family: var(--head); text-transform: uppercase; font-size: .85em; background: var(--ink); color: var(--yel); padding: 1px 0.4rem; border-radius: 0.2rem; align-self: flex-start; }
.panel img { height: 3.6rem; align-self: center; }
.choices { display: grid; gap: 0.533rem; margin-top: 0.533rem; }
.choice { border: 0.2rem solid var(--ink); border-radius: 0.467rem; background: var(--white); padding: 0.533rem 0.667rem; cursor: pointer; box-shadow: 0.2rem 0.2rem 0 var(--ink); }
.choice:hover { background: #fffbe0; } .choice .h { font-size: 1.1em; } .choice.off { opacity: .5; cursor: not-allowed; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.667rem; font-size: .92em; }

/* ---------- title screen ---------- */
:root { --title-img: url('../img/title.jpg'); --title-img-p: url('../img/title-portrait.jpg'); --studio-img: url('../img/studio-logo.webp'); }
/* portrait / squarish: the whole key art on top, menu card below, blurred art fills the rest */
#title { position: absolute; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(8px, 2.2vh, 22px);
  overflow: hidden; background: var(--ink); padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
#title::before { content: ''; position: absolute; inset: -40px; background: var(--title-img) center / cover no-repeat; filter: blur(18px) brightness(.42) saturate(1.2); }
#title .art { position: relative; flex: 0 1 auto; width: 100%; max-width: 1280px; aspect-ratio: 16 / 9; max-height: 100%; min-height: 0; background: var(--title-img) center / contain no-repeat; }
#title .box { position: relative; flex: none; box-shadow: 6px 6px 0 var(--ink); padding: clamp(10px, 2.2vh, 22px) clamp(14px, 3vw, 26px); text-align: center; width: min(480px, 100%); transform: rotate(-1deg); }
#title .big { font-family: var(--head); font-size: clamp(1.6em, 5vh, 3.4em); line-height: .85; color: var(--mag); text-shadow: 3px 3px 0 var(--ink); -webkit-text-stroke: 1.5px var(--ink); }
#title .big span { color: var(--yel); display: block; }
#title .tag { font-style: italic; margin: 0 0 clamp(8px, 1.6vh, 14px); font-size: clamp(13px, 1.2vh + .5vw, 16px); line-height: 1.3; }
#title .acts { display: flex; flex-direction: column; gap: clamp(6px, 1.2vh, 10px); align-items: center; }
#title .acts .btn { width: min(240px, 100%); font-size: clamp(16px, 2.6vh, 20px); }
#title .box p { margin: 8px 0 12px; }
/* tall screens: the portrait key art, framed, menu card below */
@media (max-aspect-ratio: 1/1) {
  #title::before { background-image: var(--title-img-p); }
  #title .art { flex: 1 1 auto; width: 100%; aspect-ratio: auto; max-height: 150vw; background-image: var(--title-img-p); background-size: cover; background-position: center top;
    border: 3px solid var(--ink); border-radius: 6px 9px 5px 8px; box-shadow: 5px 5px 0 var(--ink); transform: rotate(.6deg); }
  #title .box { width: min(520px, 100%); }
}
/* wide screens: art fills the screen, card sits over the bottom of it */
@media (min-aspect-ratio: 13/10) and (min-height: 501px) {
  #title { justify-content: flex-end; padding-bottom: max(3vh, env(safe-area-inset-bottom)); }
  #title .art { position: absolute; inset: 0; width: auto; max-width: none; aspect-ratio: auto; background-size: cover; background-position: right top; }
  #title .box { width: min(460px, 100%); }
}
/* phone held sideways: art on the left, card on the right */
@media (orientation: landscape) and (max-height: 500px) {
  #title { flex-direction: row; gap: 14px; }
  #title .art { flex: 1 1 0; width: auto; height: 100%; max-height: none; aspect-ratio: auto; }
  #title .box { width: min(300px, 40vw); }
  #title .tag { font-size: 12px; }
}

/* studio splash (doubles as the loading screen) */
#loading { position: absolute; inset: 0; z-index: 60; background: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2vh;
  transition: opacity .45s ease; cursor: pointer; }
#loading.out { opacity: 0; pointer-events: none; }
#loading .studio { width: min(72vw, 56vh, 440px); aspect-ratio: 1217 / 1293; background: var(--studio-img) center / contain no-repeat; animation: stIn .7s cubic-bezier(.2, 1.4, .4, 1) both; }
#loading .ld { color: var(--yel); font-family: var(--head); font-size: clamp(16px, 3vh, 26px); letter-spacing: 1px; opacity: 0; animation: ldIn .4s 2.2s forwards; }
@keyframes stIn { from { opacity: 0; transform: scale(.86) rotate(-4deg); } to { opacity: 1; transform: none; } }
@keyframes ldIn { to { opacity: .85; } }
@media (prefers-reduced-motion: reduce) { #loading .studio { animation: none; } }

/* ---------- small screens ---------- */
@media (max-width: 820px) {
  :root { --topH: 3.333rem; --botH: 3.733rem; }
  #logo { display: none; }
  .chip { padding: 1px 0.333rem; } .chip .k { font-size: .58em; } .chip .v { font-size: .95em; }
  .chip.opt { display: none; }
  #bot .btn span.lbl { display: none; }
  #bot { gap: 0.4rem; }
  #goals { width: 16.667rem; font-size: .9em; }
  #sheet { left: 0; right: 0; width: auto; top: auto; bottom: var(--botH); height: 56vh; border-radius: 0.667rem 0.667rem 0 0; }
  .panels { grid-template-columns: 1fr; }
  #drawer { left: 0.267rem; right: 0.267rem; }
  .card { width: 8.533rem; }
}
@media (max-height: 520px) {
  #goals { font-size: .82em; width: 16rem; }
  #sheet { top: calc(var(--topH) + 0.267rem); bottom: calc(var(--botH) + 0.267rem); height: auto; left: auto; right: 0.4rem; width: 21.333rem; }
  .card .thumb { height: 3.067rem; } .card .thumb img { max-height: 3.067rem; } .card .ds { display: none; }
}

body.on-title #goals, body.on-title #sheet, body.on-title #alerts, body.on-title #drawer, body.on-title #stats, body.on-title #speed { visibility: hidden; }
.h, .chip .v, #goals .num, .card .nm, .card .cs, #modal .box h1, #modal .box h2, .sec, .stock .it, table.fin td:last-child, .card-o .pay, .panel .who, .badge, #title .big { font-weight: 400; letter-spacing: .6px; }

@media (max-width: 600px) {
  :root { --topH: 6.133rem; }
  #top { flex-wrap: wrap; align-content: flex-start; height: var(--topH); gap: 0.333rem; padding: 0.333rem 0.4rem; }
  #speed { order: 1; width: 100%; justify-content: flex-end; }
  #speed .btn { padding: .15em .45em; }
  #stats { order: 2; flex: 1 1 100%; }
  .chip { flex: 1; }
  #goals { width: calc(100vw - 5.067rem); }
  #bot { gap: 0.267rem; padding: 0.4rem 0.267rem; }
  #bot .btn { padding: .25em .38em; } #bot .btn img { width: 1.3em; height: 1.3em; }
}
@media (max-width: 820px) {
  #areas { left: auto; right: 0.533rem; transform: none; top: calc(var(--topH) + 0.4rem); flex-direction: column; align-items: flex-end; }
  .atab span:not(.badge) { display: none; } .atab { padding: .25em .45em; }
}
body.on-title #areas { visibility: hidden; }

/* ---------- milestones, daily request, weekly score ---------- */
#goals .mile { margin-top: 0.533rem; font-size: .82em; }
#goals .mile .row { display: flex; align-items: center; gap: 0.267rem; }
#goals .mile .prog { height: 0.6rem; margin-top: 0.2rem; }
#goals .daily { margin-top: 0.4rem; font-size: .82em; background: var(--yel); border: 0.167rem solid var(--ink); border-radius: 0.267rem; padding: 0.2rem 0.4rem; cursor: pointer; transform: rotate(.6deg); box-shadow: 2px 2px 0 var(--ink); }
#goals .weekly { display: flex; justify-content: space-between; margin-top: 0.4rem; font-size: .78em; opacity: .8; }
#goals .weekly b { font-family: var(--head); font-weight: 400; }
#goals .weekly { cursor: pointer; } #goals .weekly:hover { opacity: 1; text-decoration: underline; }
.season-top { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; margin-bottom: 0.4rem; }
.season-top > div { background: rgba(21,16,21,.06); border: 2px solid var(--ink); border-radius: 0.333rem; padding: 0.333rem 0.467rem; }
.season-top small { display: block; font-size: .72em; text-transform: uppercase; letter-spacing: .5px; opacity: .7; }
.season-top b { font-family: var(--head); font-weight: 400; font-size: 1.25em; }
svg.bars { width: 100%; height: auto; display: block; margin: 0.267rem 0 2px; }
svg.bars rect { fill: var(--cyan); stroke: var(--ink); stroke-width: 1.5; }
svg.bars rect.best { fill: var(--yel); } svg.bars rect.now { fill: var(--mag); }
svg.bars text { font-size: 0.667rem; text-anchor: middle; fill: var(--ink); font-family: var(--body); }
svg.bars text.v { font-weight: 700; font-size: 0.633rem; } svg.bars text.l.now { font-weight: 700; }
#goals.min .mile, #goals.min .daily, #goals.min .weekly { display: none; }
.card-o.daily { background: #fff3a8; border-color: var(--mag); box-shadow: 0.267rem 0.267rem 0 var(--mag); }
.card-o .dtag { font-family: var(--head); font-size: .78em; color: var(--white); background: var(--mag); padding: 1px 0.4rem; border-radius: 0.2rem; display: inline-block; margin-bottom: 0.267rem; letter-spacing: .5px; }
.row.fix { margin: 0.4rem 0; flex-wrap: wrap; }
.row.fix .btn { animation: pulse 1.2s ease-in-out infinite; }

/* ---------- report card (screenshot-ready) ---------- */
.report { background: var(--white); border: 0.267rem solid var(--ink); box-shadow: 0.4rem 0.4rem 0 var(--mag); padding: 0.667rem 0.8rem; margin: 0.667rem 0; transform: rotate(-.6deg); position: relative;
  background-image: radial-gradient(var(--cyan) 1.2px, transparent 1.4px), radial-gradient(var(--mag) 1.2px, transparent 1.4px); background-size: 1.067rem 1.067rem, 1.467rem 1.467rem; background-position: 0 0, 0.467rem 0.6rem; }
.report .rh { display: flex; flex-direction: column; background: var(--ink); color: var(--yel); font-family: var(--head); padding: 0.267rem 0.533rem; margin: -0.667rem -0.8rem 0.533rem; font-size: 1.2em; letter-spacing: 1px; }
.report .rh small { color: var(--white); font-size: .6em; letter-spacing: .5px; }
.report .kv { background: rgba(255,248,232,.92); padding: 0.267rem 0.4rem; }
.report .grade { display: grid; grid-template-columns: 1fr auto; align-items: center; margin-top: 0.533rem; background: rgba(255,248,232,.92); padding: 0.267rem 0.4rem; border: 2px dashed var(--ink); }
.report .grade span { font-family: var(--head); letter-spacing: .6px; }
.report .grade b { grid-row: span 2; font-family: var(--head); font-weight: 400; font-size: 3em; color: var(--red); transform: rotate(-8deg); border: 0.267rem solid var(--red); border-radius: 0.533rem; padding: 0 0.8rem; line-height: 1.1; }
.report .grade small { font-size: .8em; }
.report .quote { font-style: italic; margin-top: 0.533rem; background: var(--yel); padding: 0.267rem 0.4rem; border: 2px solid var(--ink); }
.report .foot { font-family: var(--head); font-size: .75em; text-align: right; margin-top: 0.4rem; color: var(--magD); letter-spacing: 1px; }
@media (max-width: 640px) { .atab > span:not(.badge) { display: none; } .atab { padding-left: 0.533rem; padding-right: 0.533rem; } }

/* first-play controls card */
#hint { position: fixed; left: 50%; bottom: 5.6rem; transform: translateX(-50%); z-index: 40; display: flex; gap: 0.933rem; padding: 0.667rem 1.067rem; cursor: pointer; animation: hintIn .4s ease-out; transition: opacity .5s; max-width: calc(100vw - 2.133rem); flex-wrap: wrap; justify-content: center; }
#hint span { display: flex; flex-direction: column; align-items: center; font-size: 0.867rem; font-weight: 700; white-space: nowrap; }
#hint b { font-size: 1.6rem; line-height: 1.2; font-family: Anton, Impact, sans-serif; }
#hint.out { opacity: 0; }
@keyframes hintIn { from { opacity: 0; transform: translate(-50%, 0.8rem); } }
@media (max-width: 820px) { #alerts { left: 0.667rem; right: 3.867rem; width: auto; top: calc(var(--topH) + 4.8rem); } #sheet:not(.hidden) ~ #alerts { right: 3.867rem; } }

/* ---------- fluid HUD layout ---------- */
/* area tabs sit in the strip between the goals card and the open sheet, and shrink their labels before they ever overlap either */
@media (min-width: 821px) {
  #areas { left: 21.6rem; right: 0.667rem; transform: none; justify-content: center; container-type: inline-size; }
  /* the sheet hugs its content instead of running floor to ceiling */
  #sheet { bottom: auto; max-height: calc(100vh - var(--topH) - var(--botH) - 1.4rem); }
  #sheet .sh-body { flex: 0 1 auto; }
  body:has(#sheet:not(.hidden)) #areas { right: 24rem; }
  .atab { min-width: 0; flex: 0 1 auto; }
  .atab > span:not(.badge) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .atab > img { flex: none; }
  /* too tight for names: icons only (the name stays in the tooltip) */
  @container (max-width: 34rem) { .atab > span:not(.badge) { display: none; } .atab { padding: .25em .5em; } }
}
/* phones keep a fixed, thumb-friendly text size */
@media (max-width: 820px), (max-height: 520px) { :root { --fs: calc(14px * var(--ts)); } }

/* not in the RookieGamers ad loop yet: no "watch a message" buttons */
body.no-ads .adbtn { display: none !important; }
