/* ============================================================
   extra.css — gate registration, Act 1 pathos, user bar,
   Paint, gallery, games, leaderboards, lightbox
   ============================================================ */

/* ---------- gate: registration ---------- */
.gate__label { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .16em; color: var(--gold); text-transform: uppercase; margin: 6px 0 8px; }
.gate__input {
  display: block; width: 100%; max-width: 360px; margin: 0 auto 14px; background: rgba(255,255,255,.04); color: var(--paper);
  border: 1px solid rgba(201,162,39,.5); border-bottom-width: 2px; padding: 12px 14px; font-family: var(--serif); font-size: 20px; text-align: center;
}
.gate__input:focus { outline: none; border-color: var(--gold-l); background: rgba(201,162,39,.08); }
.gate__input::placeholder { color: rgba(241,233,214,.35); font-size: 15px; font-family: var(--mono); }
.gate__err { font-family: var(--mono); font-size: 12px; color: #e07a73; margin: -6px 0 12px; }

/* ---------- act 1: layout v2 + pathos ---------- */
.act1 { isolation: isolate; }
.act1::before { /* gold double frame */
  content: ""; position: absolute; inset: 14px; border: 1px solid rgba(201,162,39,.35); pointer-events: none; z-index: 3;
  box-shadow: inset 0 0 0 4px var(--ink), inset 0 0 0 5px rgba(201,162,39,.2);
}
.act1::after { /* film grain */
  content: ""; position: absolute; inset: -50%; z-index: 4; pointer-events: none; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/></filter><rect width='240' height='240' filter='url(%23n)'/></svg>");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain { 0% { transform: translate(0,0); } 20% { transform: translate(-3%,2%); } 40% { transform: translate(2%,-4%); } 60% { transform: translate(-4%,-2%); } 80% { transform: translate(3%,3%); } 100% { transform: translate(0,0); } }
.act1__corner { position: absolute; width: 34px; height: 34px; z-index: 3; pointer-events: none; border-color: var(--gold); border-style: solid; border-width: 0; }
.act1__corner.tl { top: 14px; left: 14px; border-top-width: 2px; border-left-width: 2px; }
.act1__corner.tr { top: 14px; right: 14px; border-top-width: 2px; border-right-width: 2px; }
.act1__corner.bl { bottom: 14px; left: 14px; border-bottom-width: 2px; border-left-width: 2px; }
.act1__corner.br { bottom: 14px; right: 14px; border-bottom-width: 2px; border-right-width: 2px; }
.act1__watermark {
  position: absolute; right: -2%; top: 6%; font-family: var(--serif); font-weight: 600; font-size: clamp(160px, 34vw, 420px); line-height: 1;
  color: transparent; -webkit-text-stroke: 1px rgba(201,162,39,.16); letter-spacing: -.04em; pointer-events: none; z-index: 0; user-select: none;
}
.act1__secret {
  position: absolute; top: 46px; left: -60px; z-index: 3; transform: rotate(-32deg); transform-origin: center; pointer-events: none;
  background: repeating-linear-gradient(90deg, #8b1a1a 0 18px, #a52424 18px 36px); color: #fff; font-family: var(--mono); font-size: 10px;
  letter-spacing: .3em; text-transform: uppercase; padding: 5px 80px; box-shadow: 0 4px 14px rgba(0,0,0,.5); white-space: nowrap;
}
.act1__ministry {
  position: absolute; top: 24px; left: 0; right: 0; text-align: center; z-index: 3; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .22em; text-transform: uppercase; color: rgba(241,233,214,.55); padding: 0 120px;
}
.act1__dust { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.act1__dust i {
  position: absolute; width: 3px; height: 3px; border-radius: 50%; background: var(--gold-l); opacity: 0; filter: blur(.4px);
  animation: dust linear infinite; box-shadow: 0 0 6px 1px rgba(235,207,116,.5);
}
@keyframes dust { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: .9; } 85% { opacity: .6; } 100% { transform: translate(var(--dx), var(--dy)); opacity: 0; } }

.act1__grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 440px; grid-template-areas: "head photo" "doc photo";
  gap: 0 40px; align-items: start; align-content: start; padding: 96px 48px 72px;
}
.act1__head { grid-area: head; }
.act1__doc { grid-area: doc; }
.act1__photo { grid-area: photo; align-self: end; justify-self: center; margin: 0; position: relative; }
.act1__photo img {
  height: min(84vh, 880px); width: auto; position: relative; z-index: 1;
  filter: drop-shadow(0 30px 60px rgba(0,0,0,.65)) drop-shadow(0 0 2px rgba(235,207,116,.35));
  animation: photoIn 1.6s cubic-bezier(.2,.8,.2,1) both .3s, kenburns 22s ease-in-out infinite alternate 2s;
  transform-origin: 50% 70%;
}
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.06) translateY(-1.5%); } }
.doc__title {
  background: linear-gradient(100deg, var(--paper) 0%, var(--paper) 40%, var(--gold-l) 50%, var(--paper) 60%, var(--paper) 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 6s ease-in-out infinite 1.5s;
}
@keyframes shimmer { 0%, 70% { background-position: 100% 0; } 100% { background-position: -40% 0; } }
.doc__countdown { font-family: var(--mono); font-size: 13px; color: var(--gold); letter-spacing: .1em; margin: 0 0 10px; min-height: 1.5em; }
.doc__countdown b { font-size: 22px; font-family: var(--serif); color: var(--gold-l); }
.doc__reader { font-family: var(--mono); font-size: 12.5px; color: var(--paper-dim); margin: 14px 0 0; }
.doc__reader b { color: var(--gold-l); font-weight: 500; }
.act1__skip {
  position: absolute; right: 28px; bottom: 30px; z-index: 5; background: transparent; border: 1px solid rgba(201,162,39,.35);
  color: var(--paper-dim); font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; padding: 8px 14px;
}
.act1__skip:hover { color: var(--gold-l); border-color: var(--gold); }
.act1.flash::before { animation: flash .35s ease-out; }
@keyframes flash { 0% { box-shadow: inset 0 0 0 4px var(--ink), inset 0 0 0 5px rgba(201,162,39,.2), inset 0 0 0 2000px rgba(255,240,200,.55); } 100% { box-shadow: inset 0 0 0 4px var(--ink), inset 0 0 0 5px rgba(201,162,39,.2); } }

@media (max-width: 820px) {
  .act1__grid {
    grid-template-columns: minmax(0, 1fr) 44%; grid-template-areas: "head photo" "doc doc";
    gap: 0 12px; padding: 70px 20px 70px; min-height: 100svh;
  }
  .act1__head { align-self: end; padding-bottom: 12px; }
  .act1__photo { position: static; height: auto; align-self: end; justify-self: end; pointer-events: none; }
  .act1__photo img { height: 44svh; max-height: 420px; opacity: 1; -webkit-mask-image: none; mask-image: none; animation: photoIn 1.6s cubic-bezier(.2,.8,.2,1) both .3s; }
  .act1__photo::before { inset: 10% -40% -10% -40%; }
  .seal { width: 80px; height: 80px; left: -30px; right: auto; bottom: 6%; }
  .seal span { font-size: 30px; }
  .act1__doc { padding-bottom: 20px; }
  .doc__title { font-size: clamp(36px, 11vw, 56px); }
  .doc__title::after { margin-top: 14px; }
  .act1__watermark { font-size: 50vw; top: auto; bottom: -4%; right: -6%; }
  .act1__ministry { font-size: 9px; padding: 0 56px 0 70px; top: 22px; letter-spacing: .14em; }
  .act1__secret { top: 32px; left: -70px; font-size: 9px; padding: 4px 70px; }
  .act1__skip { right: 16px; bottom: 22px; }
}

/* ---------- hero: user + counter ---------- */
.hero__user { margin: 0 0 10px; font-size: 14px; color: #000080; }
.hero__user a { color: #0000ff; font-size: 12px; }
.counter { background: var(--cream); border: 2px outset #c0c0c0; padding: 6px 10px; font: 13px Verdana, sans-serif; cursor: pointer; display: inline-flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; justify-content: center; }
.counter:active { border-style: inset; }
.counter .online { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: #006400; }
.counter .online i { width: 8px; height: 8px; border-radius: 50%; background: #0c0; box-shadow: 0 0 6px #0c0; display: inline-block; animation: blink 1.4s steps(1) infinite; }
.lcd.spin { animation: lcdspin .6s steps(6); }
@keyframes lcdspin { 0% { filter: blur(2px); color: #ff0; } 100% { filter: none; } }

/* ---------- Paint ---------- */
.paint .win__body { padding: 6px; }
.paint__menu { display: flex; gap: 12px; font-size: 12px; padding: 2px 6px 6px; }
.paint__menu span:first-letter { text-decoration: underline; }
.paint__layout { display: grid; grid-template-columns: 64px 1fr; gap: 6px; }
.paint__tools { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; align-content: start; }
.ptool {
  height: 28px; display: grid; place-items: center; font-size: 15px; background: var(--win); border: 2px solid; border-color: #fff var(--win-darker) var(--win-darker) #fff; padding: 0;
}
.ptool.on { border-color: var(--win-darker) #fff #fff var(--win-darker); background: #fff; box-shadow: inset 1px 1px #808080; }
.paint__widths { grid-column: 1 / -1; display: grid; gap: 2px; margin-top: 6px; background: #fff; border: 2px inset #808080; padding: 4px; }
.pw { height: 16px; display: flex; align-items: center; padding: 0 6px; background: transparent; border: 1px solid transparent; }
.pw i { display: block; width: 100%; background: #000; border-radius: 2px; }
.pw.on { background: var(--navy); } .pw.on i { background: #fff; }
.paint__canvaswrap { position: relative; background: #808080; border: 2px inset #808080; padding: 4px; overflow: hidden; }
.paint__canvaswrap canvas { display: block; width: 100%; height: auto; background: #fff; touch-action: none; cursor: crosshair; }
.paint__canvaswrap canvas.ov { position: absolute; left: 4px; top: 4px; width: calc(100% - 8px); background: transparent; pointer-events: none; }
.paint__bottom { display: grid; grid-template-columns: auto 1fr; gap: 6px; align-items: center; margin-top: 6px; }
.paint__cur { width: 40px; height: 40px; border: 2px inset #808080; background: #fff; position: relative; }
.paint__cur i { position: absolute; inset: 6px; background: #000; }
.paint__cur b { position: absolute; left: 14px; top: 14px; right: 2px; bottom: 2px; background: #fff; border: 1px solid #808080; }
.palette { display: grid; grid-template-columns: repeat(14, 1fr); gap: 2px; }
.pc { aspect-ratio: 1; border: 1px solid #808080; padding: 0; min-width: 0; }
.pc.on { outline: 2px solid #000; outline-offset: -2px; }
.paint__extra { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; font-size: 12px; }
.paint__extra .in98 { width: auto; flex: 1; min-width: 120px; }
.paint__stamps { display: flex; gap: 2px; flex-wrap: wrap; }
.paint__stamps button { font-size: 18px; width: 32px; height: 30px; padding: 0; }
.paint__actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: space-between; align-items: center; margin-top: 8px; }
.paint__actions .left { display: flex; gap: 6px; }
.paint__status { font-size: 12px; color: #333; width: 100%; min-height: 1.2em; }
@media (max-width: 560px) {
  .paint__layout { grid-template-columns: 1fr; }
  .paint__tools { grid-template-columns: repeat(9, 1fr); }
  .paint__widths { grid-template-columns: repeat(4, 1fr); margin-top: 2px; }
  .palette { grid-template-columns: repeat(14, 1fr); }
}

/* ---------- gallery ---------- */
.gl-count { font-size: 13px; margin: 0 0 8px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gallery figure { margin: 0; background: var(--cream); border: 3px outset #c0c0c0; padding: 5px; cursor: zoom-in; }
.gallery figure img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border: 1px solid #808080; background: #fff; }
.gallery figcaption { font-size: 12px; text-align: center; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery figcaption b { color: #800080; }
.gallery__empty { font-size: 14px; color: #555; padding: 10px; text-align: center; background: var(--cream); border: 2px inset #c0c0c0; }
.lightbox { width: min(760px, 100%); }
.lightbox .win__body { display: block; }
.lightbox img { width: 100%; height: auto; border: 2px inset #808080; background: #fff; }
.lightbox .row-btns { justify-content: flex-end; }

/* ---------- games ---------- */
.games__sub { margin: 0 0 10px; font-size: 13px; }
.games__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.gcard { background: #fff; border: 2px solid; border-color: #fff var(--win-darker) var(--win-darker) #fff; padding: 8px; display: grid; grid-template-columns: 44px 1fr; gap: 8px; align-items: start; text-align: left; }
.gcard .ico { font-size: 32px; line-height: 1; }
.gcard b { display: block; font-size: 14px; }
.gcard small { display: block; font-size: 11.5px; color: #333; margin: 2px 0 6px; }
.gcard .best { font-size: 11px; color: #800080; }
.games__stage .stage__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.games__stage .stage__head h3 { margin: 0; font-size: 16px; }
.games__stage .how { font-size: 12px; color: #333; margin: 0 0 8px; }
.stage__area { background: #000; border: 2px inset #808080; position: relative; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.stage__area canvas { display: block; width: 100%; height: auto; touch-action: none; }
.stage__hud { display: flex; justify-content: space-between; font: bold 13px Verdana, sans-serif; margin: 6px 0; }
.stage__result { background: var(--cream); border: 2px inset #c0c0c0; padding: 10px; margin-top: 8px; font-size: 14px; }
.stage__result .big { font: bold 26px "Arial Black", Impact, sans-serif; color: #ff0000; text-shadow: 2px 2px #000080; }
.stage__result ol { margin: 6px 0 0; padding-left: 22px; font-size: 13px; }
.stage__result li.me { background: #ffff99; }
.overlay-start { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.55); color: #fff; font: bold 18px Verdana, sans-serif; cursor: pointer; text-align: center; padding: 10px; }
.dpad { display: grid; grid-template-columns: repeat(3, 48px); gap: 4px; justify-content: center; margin-top: 8px; }
.dpad button { height: 40px; font-size: 18px; }
.dpad .e { visibility: hidden; }
.grid-game { display: grid; gap: 4px; padding: 4px; background: #000; }
.grid-game button { aspect-ratio: 1; font-size: clamp(22px, 7vw, 40px); background: #b58b5a; border: 2px outset #d9b27c; padding: 0; min-width: 0; line-height: 1; }
.grid-game.wall button { background: #cbb89a; border-color: #e6d7bd #8f7d5e #8f7d5e #e6d7bd; }
.grid-game.wall button.crack { background: #cbb89a; }
.grid-game.wall button.fixed { background: #f3eee2; }
.puzzle { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; background: #000; padding: 3px; aspect-ratio: 1; }
.puzzle button { padding: 0; border: 1px solid #333; background-color: #fffbe6; background-repeat: no-repeat; background-size: 300% 300%; cursor: pointer; min-width: 0; }
.puzzle button.empty { background-image: none !important; background-color: #000; cursor: default; }
.memory { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 6px; background: #c0c0c0; }
.memory button { aspect-ratio: 3 / 4; font-size: clamp(24px, 8vw, 44px); background: var(--navy); border: 2px outset #4040c0; color: transparent; min-width: 0; padding: 0; transition: transform .2s; }
.memory button.open, .memory button.done { background: #fff; color: #000; border-style: inset; }
.memory button.done { opacity: .6; }
.react { height: 260px; display: grid; place-items: center; text-align: center; font: bold 20px Verdana, sans-serif; color: #fff; cursor: pointer; padding: 12px; transition: background .1s; }
.react.wait { background: #a00; } .react.go { background: #0a0; } .react.idle { background: #000080; }
.react small { display: block; font-size: 12px; margin-top: 8px; opacity: .85; }

/* ---------- leaders ---------- */
.lb-sub { font-size: 12px; color: #555; margin: 0 0 8px; }
.lb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.lb-box { background: var(--cream); border: 2px inset #c0c0c0; padding: 8px; font-size: 13px; }
.lb-box.overall { grid-column: 1 / -1; background: #fff8dc; border: 3px double #b8860b; }
.lb-box h4 { margin: 0 0 6px; font-size: 14px; color: #800000; }
.lb-box ol { margin: 0; padding-left: 20px; }
.lb-box li.me { background: #ffff99; }
.lb-box li span { float: right; color: #000080; font-weight: bold; }
.lb-box .none { color: #777; font-size: 12px; }

/* ---------- gate notice ---------- */
.notice-bg { position: fixed; inset: 0; z-index: 90; background: rgba(3,10,18,.78); display: grid; place-items: center; padding: 20px; backdrop-filter: blur(3px); }
.notice { width: min(520px, 100%); background: var(--ink-2); border: 1px solid var(--gold); padding: 28px 26px 26px; text-align: center; position: relative; box-shadow: 0 30px 80px rgba(0,0,0,.6); animation: gateIn .4s ease both; }
.notice::before { content: ""; position: absolute; inset: 6px; border: 1px solid rgba(201,162,39,.3); pointer-events: none; }
.notice__title { font-family: var(--mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin: 14px 0 12px; }
.notice__text { font-size: 19px; line-height: 1.4; margin: 0 0 22px; color: var(--paper); }

/* ---------- Win98 taskbar (bottom nav) + start menu + tabs ---------- */
body.phase-act2 { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
.taskbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: var(--win); border-top: 2px solid #fff;
  box-shadow: 0 -1px 0 var(--win-dark); display: flex; align-items: stretch; gap: 4px; padding: 3px 4px calc(3px + env(safe-area-inset-bottom, 0px));
  font-family: Arial, sans-serif; height: calc(56px + env(safe-area-inset-bottom, 0px));
}
.start {
  display: flex; align-items: center; gap: 5px; font-weight: bold; font-size: 13px; padding: 0 8px; background: var(--win);
  border: 2px solid; border-color: #fff var(--win-darker) var(--win-darker) #fff; box-shadow: inset 1px 1px var(--win-light), inset -1px -1px var(--win-dark); flex: none;
}
.start.on { border-color: var(--win-darker) #fff #fff var(--win-darker); box-shadow: none; }
.start__logo { width: 16px; height: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; transform: skewX(-8deg); }
.start__logo::before, .start__logo::after { content: ""; display: block; }
.start__logo { background: conic-gradient(from 90deg at 50% 50%, #f00 0 25%, #0a0 0 50%, #00f 0 75%, #ff0 0); border-radius: 2px; }
.taskbar__tabs { flex: 1; display: flex; gap: 3px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.taskbar__tabs::-webkit-scrollbar { display: none; }
.tabbtn {
  flex: 1 0 auto; min-width: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 2px 6px;
  font-size: 10.5px; line-height: 1.1; background: var(--win); border: 2px solid; border-color: #fff var(--win-darker) var(--win-darker) #fff; white-space: nowrap;
}
.tabbtn .ic { font-size: 18px; line-height: 1; }
.tabbtn.on { border-color: var(--win-darker) #fff #fff var(--win-darker); background: repeating-conic-gradient(#fff 0 25%, #e8e8e8 0 50%) 0 0 / 4px 4px; font-weight: bold; }
.tray { display: flex; align-items: center; gap: 6px; padding: 0 6px 0 8px; border: 2px solid; border-color: var(--win-dark) #fff #fff var(--win-dark); flex: none; }
.tray__btn { background: transparent; border: 0; font-size: 20px; padding: 0 2px; line-height: 1; }
.tray__btn.playing { animation: trayPulse 1s ease-in-out infinite; }
@keyframes trayPulse { 50% { transform: scale(1.18); } }
.tray__clock { font-size: 11px; min-width: 34px; text-align: center; }
.volpop {
  position: absolute; right: 6px; bottom: calc(100% + 4px); width: min(300px, 92vw); background: var(--win); border: 2px solid; border-color: #fff var(--win-darker) var(--win-darker) #fff;
  padding: 10px; font-size: 12px; display: grid; gap: 8px; box-shadow: 3px 3px 0 rgba(0,0,0,.35);
}
.volpop input[type=range] { width: 100%; accent-color: var(--navy); }
.startmenu {
  position: fixed; left: 4px; bottom: calc(60px + env(safe-area-inset-bottom, 0px)); z-index: 61; display: flex; background: var(--win);
  border: 2px solid; border-color: #fff var(--win-darker) var(--win-darker) #fff; box-shadow: 4px 4px 0 rgba(0,0,0,.4); font-family: Arial, sans-serif;
  max-height: calc(100vh - 100px); overflow: auto;
}
.startmenu__side { width: 26px; background: linear-gradient(0deg, #1084d0, var(--navy)); color: #fff; display: flex; align-items: flex-end; justify-content: center; padding: 8px 0; }
.startmenu__side span { writing-mode: vertical-rl; transform: rotate(180deg); font-weight: bold; font-size: 16px; letter-spacing: .04em; }
.startmenu__side b { font-weight: normal; opacity: .8; }
.startmenu ul { list-style: none; margin: 0; padding: 4px 0; min-width: 230px; }
.startmenu li { padding: 0; }
.startmenu li.sep { border-top: 1px solid var(--win-dark); border-bottom: 1px solid #fff; margin: 3px 2px; }
.startmenu a { display: flex; align-items: center; gap: 10px; padding: 7px 18px 7px 10px; color: #000; text-decoration: none; font-size: 13px; }
.startmenu a:hover, .startmenu a:focus { background: var(--navy); color: #fff; }
.startmenu a .ic { width: 22px; text-align: center; font-size: 17px; }
.tab { animation: fadeIn .25s ease both; }

/* compact hero (mobile first) */
.hero { padding: 12px 10px 8px; }
.hero__photo { width: min(220px, 52vw); margin: 4px auto 6px; }
.hero__age { font-size: 17px; margin: 2px 0 6px; }
.age { font-size: 52px; }
.hero__sub { font-size: 13px; margin-bottom: 8px; }
.hero__user { font-size: 13px; }
@media (min-width: 700px) { .hero__photo { width: 260px; } .age { font-size: 64px; } }

/* ---------- hero row (photo + info side by side), lang placement, narrow taskbar ---------- */
.hero__row { display: grid; grid-template-columns: 38% 1fr; gap: 8px 12px; align-items: center; text-align: left; margin: 6px 0 4px; }
.hero__row .hero__photo { width: 100%; margin: 0; }
.hero__info { min-width: 0; }
.hero__age { font-size: 15px; line-height: 1.2; }
.hero__age .age { display: block; font-size: 58px; margin: 2px 0; }
.hero__tools { justify-content: flex-start; gap: 8px; }
.counter { font-size: 12px; padding: 5px 8px; text-align: left; }
@media (min-width: 700px) { .hero__row { grid-template-columns: 240px 1fr; gap: 20px; } .hero__age { font-size: 20px; } .hero__age .age { font-size: 84px; } }
body.phase-act2 .lang { top: 40px; }
@media (max-width: 440px) {
  .start span:not(.start__logo) { display: none; }
  .start { padding: 0 8px; }
  .tabbtn { min-width: 50px; padding: 2px 3px; font-size: 9.5px; }
  .tray__clock { display: none; }
  .tray { padding: 0 4px; }
}
/* act1 mobile title + ministry fixes */
@media (max-width: 820px) {
  .doc__title { font-size: clamp(30px, 9.5vw, 56px); white-space: nowrap; }
  .act1__ministry { top: 48px; padding: 0 20px; }
  .ornament--top { top: 18px; }
  .act1__grid { padding-top: 84px; }
}

.spin-photo { height: auto; }
.hero__photo img { height: auto; }

/* ---------- act1: keep CTA visible on mobile; desktop header spacing; act2 lang placement ---------- */
@media (max-width: 820px) {
  .doc__cta.on { position: sticky; bottom: 14px; z-index: 6; background: linear-gradient(180deg, rgba(6,20,33,0) 0%, rgba(6,20,33,.92) 30%); padding: 14px 0 6px; margin-top: 14px; }
  .doc__cta .btn-gold--big { width: 100%; text-align: center; box-shadow: 0 0 0 1px rgba(0,0,0,.4), 0 10px 30px rgba(201,162,39,.45); }
  .act1__skip { bottom: auto; top: 72px; right: 14px; padding: 6px 10px; font-size: 10.5px; background: rgba(6,20,33,.6); }
}
@media (min-width: 821px) {
  .act1__ministry { top: 52px; }
  .ornament--top { top: 18px; }
  .lang { top: 24px; right: 28px; }
  .tabbtn { flex: 0 1 170px; }
}
body.phase-act2 .lang { position: absolute; top: 44px; right: 12px; }

/* skip button: fixed, out of the header's way; hidden once the dossier is typed */
@media (max-width: 820px) {
  .act1__skip { position: fixed; top: auto; bottom: 18px; right: 14px; z-index: 7; }
  .act1__ministry { top: 50px; font-size: 8px; letter-spacing: .1em; padding: 0 16px; }
  .act1__grid { padding-top: 92px; }
}
.act1.typed .act1__skip { display: none; }

/* iOS: no callout / selection / rubber-band while drawing or playing */
.paint__canvaswrap, .paint__canvaswrap canvas, .stage__area, .stage__area canvas, .dpad button, .grid-game button, .memory button, .react {
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: none;
}
html { overscroll-behavior-y: none; }
.inapp { background: #fff3c4; border: 2px solid #c9a227; padding: 10px 12px; margin: 0 0 8px; font-size: 13px; line-height: 1.4; }
.inapp p { margin: 0 0 8px; }

/* ---------- Paint: object bar, fullscreen mode ---------- */
.paint__fsbar { display: flex; justify-content: flex-end; margin: 0 0 6px; }
.paint__main { min-width: 0; }
.objbar { width: 100%; background: #e8f0ff; border: 2px inset #808080; padding: 6px 8px; display: grid; gap: 6px; font-size: 12px; }
.objbar__hint { color: #333; font-size: 11px; line-height: 1.3; }
.objbar label { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 6px; }
.objbar input[type=range] { width: 100%; accent-color: var(--navy); }
.objbar__btns { display: flex; flex-wrap: wrap; gap: 4px; }
.objbar__btns .btn98 { min-width: 40px; padding: 5px 8px; }
body.paint-fs { overflow: hidden; }
body.paint-fs #paint { position: fixed; inset: 0; z-index: 120; margin: 0; border: 0; box-shadow: none; display: flex; flex-direction: column; background: var(--win); overflow: auto; padding: 0; }
body.paint-fs #paint .win__title { flex: none; }
body.paint-fs #paint .win__body { flex: 1; display: flex; flex-direction: column; padding: 4px; min-height: 0; }
body.paint-fs .paint__menu, body.paint-fs .how, body.paint-fs .inapp { display: none; }
body.paint-fs .paint__fsbar { margin: 0 0 4px; }
body.paint-fs .paint__layout { flex: 1; min-height: 0; }
body.paint-fs .paint__canvaswrap { width: min(100%, calc((100dvh - 250px) * 4 / 3)); margin: 0 auto; }
body.paint-fs .taskbar, body.paint-fs .lang, body.paint-fs .toast { display: none !important; }
@media (orientation: landscape) and (max-height: 500px) {
  body.paint-fs .paint__layout { grid-template-columns: 64px 1fr; }
  body.paint-fs .paint__canvaswrap { width: min(100%, calc((100dvh - 120px) * 4 / 3)); }
  body.paint-fs .paint__bottom { grid-template-columns: 32px 1fr; }
  body.paint-fs .palette { grid-template-columns: repeat(28, 1fr); }
  body.paint-fs .paint__actions { margin-top: 4px; }
}
#paint:fullscreen { width: 100%; height: 100%; }

/* ---------- Snake d-pad: fixed-size buttons, no overlap ---------- */
.dpad { grid-template-columns: repeat(3, 64px); gap: 6px; }
.dpad button { min-width: 0; width: 64px; height: 48px; font-size: 20px; padding: 0; }

/* fullscreen layout: content flows from the top and scrolls when it does not fit */
body.paint-fs .paint__layout { flex: none; min-height: 0; align-content: start; }
body.paint-fs .paint__canvaswrap { width: min(100%, calc((100dvh - 300px) * 4 / 3)); }
@media (orientation: landscape) and (max-height: 500px) {
  body.paint-fs .paint__canvaswrap { width: min(100%, calc((100dvh - 110px) * 4 / 3)); }
  body.paint-fs .paint__extra { max-width: 100%; }
}

/* ---------- performance: cheaper decorative animations on phones ---------- */
.glitter { animation: glitter 4s steps(20) infinite; }
.sparkles, .sparkles::before, .sparkles::after { animation-duration: 2.4s; }
.spin-photo { will-change: transform; }
.marquee span, .age { will-change: transform; }
@media (max-width: 700px) {
  .glitter { animation-duration: 6s; }
  .sparkles::after { display: none; }
}
body.paint-fs .marquee, body.paint-fs .hero, body.paint-fs .tab:not([data-tab="paint"]), body.paint-fs .footer { display: none !important; }
body.paint-fs .tab[data-tab="paint"] #gallery { display: none; }
