/* Art direction layer ("Werkstatt-Comic"), loaded after app.css, scene.css and bytey.css.
   Concept: warm paper, deep ink-navy outlines with hard sticker shadows, cobalt as the brand colour,
   amber as the reward colour, one mascot (Bytey) who reacts to everything. Nunito at weight 900 for headlines. */

:root { --paper: #FBF5E9; --dots: rgba(20, 33, 61, .055); --ticket-bg: #FFFDF5; --stage-bg: #E6DECB; }
:root[data-theme="dark"] { --ticket-bg: var(--card); --stage-bg: #121A30; }

h1, h2, .page-head h2 { font-weight: 900; letter-spacing: -.02em; }

/* ---------- effects layer ---------- */
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 200; overflow: hidden; }
.fx-bit { position: absolute; border-radius: 2px; will-change: transform, opacity; }
.fx-bit.star { clip-path: polygon(50% 0, 62% 38%, 100% 38%, 69% 60%, 80% 100%, 50% 75%, 20% 100%, 31% 60%, 0 38%, 38% 38%); border-radius: 0; }
.stamp { position: absolute; left: 50%; top: 42%; z-index: 6; translate: -50% -50%; rotate: -8deg; pointer-events: none; font-weight: 1000; letter-spacing: .08em; font-size: clamp(2rem, 6.5vw, 4.4rem); color: var(--green); border: 6px solid var(--green); border-radius: 18px; padding: .02em .32em; background: rgba(255, 255, 255, .9); box-shadow: 0 6px 0 rgba(20, 33, 61, .25); animation: stamp-in 1.6s both; }
:root[data-theme="dark"] .stamp { background: rgba(22, 31, 56, .92); color: #5FE39A; border-color: #5FE39A; }
@keyframes stamp-in { 0% { scale: 3; opacity: 0; } 14% { scale: 1; opacity: 1; } 22% { scale: 1.06; } 30% { scale: 1; } 82% { opacity: 1; } 100% { opacity: 0; translate: -50% -60%; } }
.float-score { font-size: 2.4rem; font-weight: 1000; paint-order: stroke fill; -webkit-text-stroke: 5px var(--edge); text-shadow: 0 3px 0 var(--edge); }
.float-score.plus { color: #7CF2A0; }
.float-score.minus { color: #FF8A98; }
.stage.flash-good { animation: stage-good .7s ease-out; }
.stage.flash-bad { animation: stage-bad .6s ease-out; }
@keyframes stage-good { 0% { box-shadow: 0 4px 0 var(--edge), inset 0 0 0 0 rgba(31, 157, 85, 0); } 25% { box-shadow: 0 4px 0 var(--edge), inset 0 0 0 12px rgba(31, 157, 85, .5); } 100% { box-shadow: 0 4px 0 var(--edge), inset 0 0 0 0 rgba(31, 157, 85, 0); } }
@keyframes stage-bad { 0% { box-shadow: 0 4px 0 var(--edge), inset 0 0 0 0 rgba(217, 52, 74, 0); } 25% { box-shadow: 0 4px 0 var(--edge), inset 0 0 0 12px rgba(217, 52, 74, .45); } 100% { box-shadow: 0 4px 0 var(--edge), inset 0 0 0 0 rgba(217, 52, 74, 0); } }
.combo { position: absolute; left: 12px; top: 12px; z-index: 5; display: flex; align-items: center; gap: .4em; padding: .2em .9em .2em .6em; border: 2px solid var(--edge); border-radius: var(--r-pill); background: var(--amber); color: #14213D; font-weight: 1000; box-shadow: 0 3px 0 var(--edge); }
.combo .icon { fill: currentColor; stroke-width: 1.5; }
.combo.bump { animation: combo-pop .55s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes combo-pop { 0% { scale: .6; rotate: -8deg; } 60% { scale: 1.2; } 100% { scale: 1; rotate: 0deg; } }
.bump { animation: bump .45s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes bump { 40% { transform: scale(1.18); } }

/* ---------- title screen ---------- */
body:has(#v-menu:not([hidden])) { background: radial-gradient(900px 620px at 76% 42%, rgba(47, 91, 255, .95), rgba(27, 46, 122, .9) 55%, transparent 100%), radial-gradient(rgba(142, 240, 255, .16) 1.5px, transparent 1.6px) 0 0 / 26px 26px, #0E1A38; background-attachment: fixed; }
.title-screen { justify-content: space-between; color: #fff; }
.title-grid { flex: 1; width: min(1180px, 100%); margin: 0 auto; padding: var(--sp-6) var(--sp-5); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: center; gap: var(--sp-5); }
.title-main { display: grid; gap: var(--sp-4); justify-items: start; text-align: left; max-width: 480px; }
.title-logo { margin: 0; font-size: clamp(3.4rem, 9vw, 6.2rem); line-height: .9; font-weight: 1000; letter-spacing: -.025em; }
.title-logo span { display: block; paint-order: stroke fill; -webkit-text-stroke: 3.5px var(--edge); text-shadow: 0 7px 0 var(--edge); }
.title-logo .t1 { color: #FFC857; rotate: -2deg; transform-origin: left bottom; }
.title-logo .t2 { color: #fff; margin-left: .12em; }
.title-main .tagline { color: rgba(255, 255, 255, .88); font-size: 1.3rem; font-weight: 700; }
.title-main .account-bar { background: rgba(255, 255, 255, .1); border: 2px solid rgba(255, 255, 255, .22); color: #fff; justify-content: flex-start; }
.title-main .account-bar .muted, .title-main .muted { color: rgba(255, 255, 255, .75); }
.title-main .menu-buttons { width: 100%; }
.btn-play { background: #FFC857; color: #14213D; font-size: 1.45rem; min-height: 68px; }
.btn-play:hover { background: #FFD479; }
.title-main .btn-ghost { background: rgba(255, 255, 255, .95); color: #14213D; }
.title-main .btn-ghost:hover { background: #fff; }
.title-hero { position: relative; }
.hero-art { width: 100%; height: auto; display: block; filter: drop-shadow(0 18px 24px rgba(0, 0, 0, .35)); }
.hero-ticket { animation: hero-float 5s ease-in-out var(--d, 0s) infinite; }
@keyframes hero-float { 50% { transform: translateY(-9px); } }
.hero-art .twinkle { transform-box: fill-box; transform-origin: center; animation: spin-twinkle 2.4s ease-in-out infinite; }
.hero-art .twinkle.t2 { animation-delay: 1s; }
@keyframes spin-twinkle { 50% { transform: scale(.5) rotate(40deg); opacity: .6; } }
.hero-art .steam { animation: steam 2.4s ease-in-out infinite; }
@keyframes steam { 0% { transform: translateY(6px); opacity: 0; } 40% { opacity: 1; } 100% { transform: translateY(-8px); opacity: 0; } }
.title-screen .footer, .title-screen .footer .link-btn { color: rgba(255, 255, 255, .78); }
.title-screen .footer .link-btn:hover { color: #fff; }
.title-screen .theme-fixed { background: rgba(255, 255, 255, .95); }
body:has(#v-menu:not([hidden])) .fab-report { background: #fff; }
@media (max-width: 860px) {
  .title-grid { grid-template-columns: 1fr; padding: var(--sp-5) var(--sp-4); }
  .title-main { max-width: none; }
  .title-hero { order: -1; max-width: 420px; margin: 0 auto; }
  .title-logo { font-size: clamp(3rem, 14vw, 4.6rem); }
}

/* waiting rooms: the animated mascot replaces the picture */
.bytey-wait { width: 124px; animation: none; margin-bottom: -4px; }

/* ---------- level selection ---------- */
.level-grid { grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: var(--sp-5) var(--sp-4); }
.level-card { padding: 0; overflow: hidden; gap: 0; animation: card-in .5s cubic-bezier(.2, .9, .3, 1.2) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes card-in { from { opacity: 0; transform: translateY(18px) scale(.96); } }
.level-art { position: relative; height: 124px; overflow: hidden; border-bottom: 2px solid var(--edge); background: var(--wall-2); }
.level-thumb { width: 100%; height: 100%; display: block; }
.thumb-wall { fill: var(--wall-1); }
.level-card:hover:not(.locked) .level-thumb { transform: scale(1.05); }
.level-thumb { transition: transform .35s ease; transform-origin: center; }
.level-body { padding: var(--sp-4); display: grid; gap: var(--sp-3); }
.level-no { rotate: -6deg; box-shadow: 0 2px 0 var(--edge); }
.level-card.locked { box-shadow: none; }
.level-card.locked .level-art { filter: grayscale(1); opacity: .55; }
.level-card.locked .level-no { rotate: 0deg; }
.level-lock { position: absolute; inset: 0; display: grid; place-items: center; }
.level-lock .icon { width: 44px; height: 44px; padding: 10px; border-radius: 50%; background: var(--card); color: var(--ink); border: 2px solid var(--edge); box-shadow: 0 3px 0 var(--edge); stroke-width: 2.4; }
.level-best { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.star-row { display: inline-flex; gap: 2px; color: var(--line); }
.star-row .icon { width: 1.35em; height: 1.35em; stroke-width: 1.8; }
.star-row .on { color: var(--amber); }
.star-row .on .icon { fill: currentColor; stroke: var(--edge); }

/* ---------- game: HUD, ticket, Bytey ---------- */
.hud { background: linear-gradient(180deg, #1B2A52, var(--hud)); }
.hud .stat { background: rgba(255, 255, 255, .07); border: 2px solid var(--hud-line); border-radius: var(--r-md); padding: 3px var(--sp-4); }
.hud .stat b { color: #fff; }
.hud .stat:nth-of-type(4) b, .hud .stat:has(#g-score) b { color: #FFC857; }
.hud .stat.bump { animation: bump .45s cubic-bezier(.3, 1.8, .5, 1); }
.hud .brand img { filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .4)); }
.hint-btn { box-shadow: 0 3px 0 var(--edge); }

.card.ticket { background: var(--ticket-bg); border: 2px solid var(--edge); box-shadow: var(--sticker); position: relative; overflow: visible; }
.card.ticket .ticket-bar { background: repeating-linear-gradient(135deg, #FFC857 0 14px, #FFB938 14px 28px); color: #14213D; border-bottom: 3px dashed var(--edge); border-radius: calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0 0; font-weight: 900; letter-spacing: .02em; }
.ticket-bar .x i { background: rgba(20, 33, 61, .25); border: 2px solid var(--edge); }
.ticket-bar .x i.done { background: var(--green); }
.ticket-bar .x i.now { background: var(--cobalt); }
.card.ticket::before, .card.ticket::after { content: ''; position: absolute; top: 28px; width: 20px; height: 20px; border-radius: 50%; background: var(--paper); border: 2px solid var(--edge); z-index: 1; }
.card.ticket::before { left: -11px; clip-path: inset(0 0 0 50%); }
.card.ticket::after { right: -11px; clip-path: inset(0 50% 0 0); }
.ticket-body .text { font-size: 1.28rem; font-weight: 900; }
.ticket-body .progress { height: 12px; border: 2px solid var(--edge); border-radius: 99px; background: var(--soft-2); overflow: hidden; }
.ticket-body .progress i { background: repeating-linear-gradient(135deg, #1F9D55 0 10px, #36B96D 10px 20px); }
#t-cat { border: 2px solid var(--red); color: var(--red); border-radius: 6px; padding: 0 .5em; rotate: -3deg; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; font-size: var(--fs-xs); align-self: center; }

.bytey { align-items: flex-end; gap: var(--sp-2); }
.bytey-fig-box { width: 104px; flex: none; margin-bottom: -6px; }
.bubble { align-self: stretch; display: grid; align-content: center; font-weight: 650; font-size: 1.02rem; }
.bubble::before { top: auto; bottom: 26px; }
.bubble::after { top: auto; bottom: 28px; }
.bubble .who { color: var(--cobalt-2); }
:root[data-theme="dark"] .bubble .who { color: #8FAAFF; }

.stage { border-width: 3px; }

/* ---------- countdown ---------- */
.overlay .count { font-weight: 1000; paint-order: stroke fill; -webkit-text-stroke: 10px var(--edge); text-shadow: 0 12px 0 var(--edge); animation: count-pop .8s cubic-bezier(.2, 1.5, .4, 1); }
.overlay .count:last-child { color: #FFC857; }
@keyframes count-pop { 0% { scale: 2.2; opacity: 0; } 35% { scale: .92; opacity: 1; } 55% { scale: 1.04; } 100% { scale: 1; } }

/* ---------- results ---------- */
.results { overflow: hidden; position: relative; }
.results::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 150px; background: radial-gradient(circle at 20% 0%, rgba(255, 200, 87, .45), transparent 60%), repeating-linear-gradient(135deg, rgba(47, 91, 255, .09) 0 16px, transparent 16px 32px); -webkit-mask-image: linear-gradient(#000 40%, transparent); mask-image: linear-gradient(#000 40%, transparent); pointer-events: none; }
.results > * { position: relative; }
.results .big { align-items: center; gap: var(--sp-4); }
.results-bytey { width: 150px; flex: none; }
.big-text { display: grid; gap: 4px; }
.results-points { display: flex; align-items: baseline; gap: .4em; color: var(--muted); font-weight: 800; }
.results-score { font-size: 3.4rem; line-height: 1; font-weight: 1000; color: var(--ink); font-variant-numeric: tabular-nums; }
.big-stars { gap: 6px; }
.big-stars .icon { width: 54px; height: 54px; stroke-width: 1.6; color: var(--line); }
.big-stars .on .icon { color: var(--amber); fill: currentColor; stroke: var(--edge); animation: star-in .7s cubic-bezier(.3, 1.7, .5, 1) calc(var(--n) * .35s + .5s) both; }
@keyframes star-in { 0% { scale: 0; rotate: -90deg; } 100% { scale: 1; rotate: 0deg; } }
@media (max-width: 560px) {
  .results .big { flex-direction: column; text-align: center; }
  .results-points { justify-content: center; }
  .big-stars { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .level-card, .hero-ticket, .hero-art .twinkle, .hero-art .steam, .stamp, .combo.bump, .bump, .stage.flash-good, .stage.flash-bad, .big-stars .on .icon, .overlay .count { animation: none !important; }
}

/* the scene never letterboxes: the bands above and below continue wall and floor */
.stage { background: radial-gradient(rgba(20, 33, 61, .07) 1.5px, transparent 1.6px) 0 0 / 26px 26px, linear-gradient(var(--wall-1) 0 62%, var(--floor) 62%); }
:root[data-theme="dark"] .stage { background: linear-gradient(var(--wall-1) 0 62%, var(--floor) 62%); }

/* phone: ticket, tabs, scene, then Bytey with his bubble underneath (instead of hiding him) */
@media (max-width: 720px) {
  #v-game .hud .stat { padding: 2px 4px; }
  #v-game .hud .stat small { font-size: .68rem; letter-spacing: .04em; }
  #v-game .top-row { display: contents; }
  #v-game .ticket { order: 1; }
  #v-game .tip-pill { order: 2; }
  #v-game .tabs { order: 3; }
  #v-game .stage { order: 4; flex: none; display: block; }
  #v-game .stage svg { height: auto; }
  #v-game .win-view { order: 4; }
  #v-game .bytey { display: flex; order: 5; flex: 1; min-height: 0; align-items: center; gap: var(--sp-3); }
  #v-game .bytey-fig-box { width: 88px; margin: 0; }
  #v-game .bubble { align-self: center; min-height: 0; }
  #v-game .bubble::before, #v-game .bubble::after { top: 50%; bottom: auto; translate: 0 -50%; }
  .level-art { height: 92px; }
  .ticket::before, .ticket::after { display: none; }
}

/* ---------- 0.10.0 wide layout: read on the left, work on the right ----------
   From 1001px up, ticket, Bytey and log sit in a column beside the workplace, so the scene gets the full height.
   Below that the earlier stacked layout stays as it was (tablet, phone). */
.game-left { display: none; }
@media (min-width: 1001px) {
  #v-game .game { max-width: none; grid-template-columns: clamp(300px, 23vw, 400px) minmax(0, 1fr); }
  #v-game .top-row { display: none; }
  #v-game .game-left { display: flex; flex-direction: column; gap: var(--sp-3); min-height: 0; }
  #v-game .game-left > .ticket, #v-game .game-left > .bytey { flex: none; }
  #v-game .game-left > .game-side { flex: 1; min-height: 0; }

  /* compact ticket: category stamp moves into the header */
  #v-game .game-left .ticket-bar #t-cat { margin-left: auto; margin-right: 6px; font-size: .68rem; padding: 0 .4em; }
  #v-game .game-left .ticket-bar .x { margin-left: 0; }
  #v-game .game-left .ticket-body .text { font-size: 1.05rem; line-height: 1.3; margin: 1px 0 6px; }
  #v-game .game-left .ticket-body .note { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
  #v-game .game-left .ticket-body .progress { height: 9px; }
  #v-game .game-left .ticket-body .progress.almost i { background: repeating-linear-gradient(135deg, #F2A33A 0 10px, #FFC857 10px 20px); }
  #v-game .game-left .ticket-steps { justify-content: flex-start; }

  /* Bytey card: big comic bubble in the colour of the result, Bytey below it */
  #v-game .game-left .bytey { flex-direction: column-reverse; align-items: stretch; gap: 0; }
  #v-game .game-left .bytey-fig-box { width: clamp(110px, 9vw, 150px); margin: -4px 0 0 4px; align-self: flex-start; }
  #v-game .game-left .bubble { min-height: 96px; align-self: stretch; display: block; padding: var(--sp-3) var(--sp-4); border-width: 3px 3px 3px 10px; border-color: var(--edge) var(--edge) var(--edge) var(--cobalt); box-shadow: 4px 4px 0 var(--edge); font-size: clamp(1.02rem, .4vw + .7rem, 1.3rem); font-weight: 700; line-height: 1.35; }
  #v-game .game-left .bubble.good { border-color: var(--green); }
  #v-game .game-left .bubble.bad { border-color: var(--red); }
  #v-game .game-left .bubble.hint { border-color: var(--amber); }
  #v-game .game-left .bubble::before, #v-game .game-left .bubble::after { top: auto; translate: none; border-right-color: transparent; border-left-width: 8px; }
  #v-game .game-left .bubble::before { left: 34px; bottom: -22px; border-width: 11px 10px 0; border-top-color: var(--edge); }
  #v-game .game-left .bubble::after { left: 37px; bottom: -14px; border-width: 8px 7px 0; border-top-color: var(--card); }
  #v-game .game-left .bubble.good::before { border-top-color: var(--green); } #v-game .game-left .bubble.good::after { border-top-color: var(--good-bg); }
  #v-game .game-left .bubble.bad::before { border-top-color: var(--red); } #v-game .game-left .bubble.bad::after { border-top-color: var(--bad-bg); }
  #v-game .game-left .bubble.hint::before { border-top-color: var(--amber); } #v-game .game-left .bubble.hint::after { border-top-color: var(--hint-bg); }
  #v-game .game-left .bubble .who { display: block; width: fit-content; margin: 0 0 6px; padding: 1px 9px; rotate: -2deg; border: 2px solid var(--edge); border-radius: var(--r-pill); background: var(--cobalt); color: #fff; font-size: .72rem; letter-spacing: .08em; }
  #v-game .game-left .bubble.good .who { background: #8CE0AE; color: #14213D; }
  #v-game .game-left .bubble.bad .who { background: #FF9BA8; color: #14213D; }
  #v-game .game-left .bubble.hint .who { background: #FFC857; color: #14213D; }
  #v-game .game-left .bubble.pop { animation: pop .25s ease-out, bubble-ring 1.1s ease-out; }

  /* the workplace takes the whole height; the svg is pinned to the box (Safari sizes a plain height:100% svg by its aspect ratio instead) */
  #v-game .stage { position: relative; display: block; }
  #v-game .stage svg { position: absolute; inset: 0; width: 100%; height: 100%; }
}
@keyframes bubble-ring { 0% { outline: 0 solid rgba(47, 91, 255, .5); } 40% { outline: 7px solid rgba(47, 91, 255, .35); } 100% { outline: 0 solid transparent; } }
@media (prefers-reduced-motion: reduce) { #v-game .game-left .bubble.pop { animation: none; } }

.star-total { display: inline-flex; align-items: center; gap: .4em; margin: 0 0 .8rem; padding: .25rem .8rem; font-weight: 800; background: var(--amber); color: var(--ink, #14213D); border: 2px solid var(--ink, #14213D); border-radius: 999px; box-shadow: 2px 2px 0 var(--ink, #14213D); }
.star-total .icon { width: 1.1em; height: 1.1em; }

/* ============ Daily challenge ============ */
.btn-daily { background: var(--cobalt); color: #fff; position: relative; flex-wrap: wrap; }
.btn-daily:hover { background: var(--cobalt-2); }
.daily-streak { font-size: var(--fs-xs); font-weight: 800; background: #FFC857; color: #14213D; border-radius: 999px; padding: 2px 10px; margin-left: 8px; }
.daily { gap: var(--sp-3); }
.daily-meta { justify-content: center; }
.daily-board .sub { grid-column: 2 / 4; }
.daily-result { background: var(--accent-soft); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); }

/* ============ Career ============ */
.career { width: 100%; }
.career-card { display: grid; gap: 6px; background: rgba(255,255,255,.1); border: 2px solid rgba(255,255,255,.22); border-radius: var(--r-md); padding: 10px 14px; color: inherit; }
.card .career-card, .career-result .career-card { background: var(--soft); border-color: var(--line); }
.career-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.career-top .muted { margin-left: auto; font-size: var(--fs-xs); }
.career-bar { height: 10px; border-radius: 999px; background: rgba(20,33,61,.25); overflow: hidden; }
.career-bar i { display: block; height: 100%; background: #FFC857; border-radius: 999px; transition: width .6s; }
.title-main .career-card small { color: rgba(255,255,255,.8); }
.career-result { margin-top: var(--sp-3); }
.career-result.up { background: var(--amber-soft); border: 2px solid var(--amber); border-radius: var(--r-md); padding: var(--sp-3); }
.rank-up { font-size: var(--fs-xl); color: var(--amber-ink); }
.outfit-list { list-style: none; margin: var(--sp-3) 0 0; padding: 0; display: grid; gap: 6px; }
.outfit-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; opacity: .6; }
.outfit-list li.got { opacity: 1; }
