/* app.css — title, lobby, tasks and the factory screens. */

.screen-holder { flex: 1; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

/* ── chrome ───────────────────────────────────────────────────────────── */
.chrome { position: relative; z-index: 80; }
.menu-btn {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top, 0px));
  right: 10px;
  z-index: 85;
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 2px solid #000;
  background: var(--panel2);
  color: var(--ink);
  font-size: 22px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.5);
  cursor: pointer;
}
.menu-btn.subtle { opacity: 0.45; width: 36px; height: 36px; font-size: 18px; }
.menu-panel {
  position: fixed;
  top: calc(60px + env(safe-area-inset-top, 0px));
  right: 10px;
  z-index: 85;
  width: min(92vw, 340px);
  max-height: calc(100dvh - 80px);
  overflow: auto;
  display: flex; flex-direction: column; gap: 8px;
}
.menu-head { font-size: 20px; }
.menu-head .display { font-size: 26px; color: var(--hazard); }
.menu-sub { margin-top: 6px; font-weight: 800; color: var(--ink-dim); text-transform: uppercase; font-size: 13px; letter-spacing: 0.08em; }
.menu-member { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.menu-member .row { flex-wrap: nowrap; gap: 6px; }
.menu-member .btn.small { min-height: 34px; padding: 2px 10px; font-size: 16px; }

/* ── title / join ─────────────────────────────────────────────────────── */
.title-screen { gap: 18px; padding-top: 28px; }
.title-logo { font-size: clamp(56px, 16vw, 128px); line-height: 0.86; margin-top: 8px; }
.tagline { font-size: 20px; margin: 0; color: var(--ink-dim); }
.tagline b { color: var(--danger); }
.title-belt { width: 100%; height: 130px; display: block; }
.join-row { display: flex; gap: 10px; width: 100%; max-width: 420px; }
.code-input { flex: 1; letter-spacing: 0.3em; }
.how { text-align: left; max-width: 560px; }
.how h3 { margin-bottom: 6px; color: var(--hazard); }
.how ol { margin: 0 0 8px 20px; padding: 0; }
.how li { margin: 4px 0; }
.join-screen { gap: 16px; max-width: 520px; }
.choice-grid { display: grid; gap: 14px; width: 100%; grid-template-columns: 1fr; }
@media (min-width: 640px) { .choice-grid { grid-template-columns: 1fr 1fr; } .join-screen { max-width: 820px; } }
.choice { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.choice .input { font-size: 24px; }
.alt-roles { margin-top: 6px; }
.rejoin { display: flex; flex-direction: column; gap: 8px; align-items: center; border-color: var(--hazard); }

/* ── lobby ────────────────────────────────────────────────────────────── */
.lobby { max-width: 980px; }
.lobby-grid { display: grid; gap: 16px; width: 100%; grid-template-columns: 1fr; }
.lobby-side { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.lobby-title { font-size: clamp(34px, 9vw, 64px); text-align: center; }
.join-box { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; max-width: 360px; }
.join-box .big-code { font-size: clamp(48px, 13vw, 88px); }
.qr { width: 150px; height: 150px; image-rendering: pixelated; border: 4px solid #000; border-radius: 10px; background: #fff; }
.lobby-main { display: flex; flex-direction: column; gap: 10px; }
.floor { width: 100%; height: clamp(170px, 34vh, 300px); display: block; border: 3px solid #000; border-radius: var(--radius); background: #23212b; touch-action: none; cursor: grab; }
.lobby-hint { text-align: center; margin-top: -4px; }
.lobby-list { display: flex; flex-direction: column; gap: 4px; }
.list-head { font-family: var(--font-display); font-size: 24px; letter-spacing: 0.05em; }
.list-head b { color: var(--hazard); }
.lobby-worker { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: var(--panel); border: 2px solid #000; border-radius: 10px; font-weight: 700; }
.lobby-worker.away { opacity: 0.45; }
.lw-icon { width: 24px; text-align: center; }
.lw-name { flex: 1; }
.lobby-others { margin-top: 4px; }
.lobby-status { display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center; margin-top: 6px; }
.lobby-status p { margin: 0; }
.host-row { width: 100%; }
.chaos-btn { font-family: var(--font-body); font-size: 14px; font-weight: 800; letter-spacing: 0; text-transform: none; }

/* On a big screen the lobby is a two-column poster with a huge QR code. */
@media (min-width: 900px) {
  .lobby-grid { grid-template-columns: minmax(300px, 380px) 1fr; align-items: start; }
  .lobby-display .lobby-grid { grid-template-columns: minmax(340px, 30vw) 1fr; }
}
.lobby-display { padding: 24px 32px; max-width: none; }
.lobby-display .qr { width: min(26vw, 340px); height: min(26vw, 340px); }
.lobby-display .join-box { max-width: none; }
.lobby-display .join-box .big-code { font-size: clamp(64px, 8vw, 140px); }
.lobby-display .floor { height: 34vh; }
.lobby-display .lobby-title { font-size: clamp(34px, 4.6vw, 72px); }
.lobby-display .lobby-worker { padding: 3px 10px; }
.lobby-display .lobby-status h2 { font-size: clamp(24px, 3vw, 40px); }
.lobby-display .lobby-worker { font-size: clamp(16px, 1.8vw, 22px); }

/* ── microphone check / recording ─────────────────────────────────────── */
.mic-check { max-width: 520px; }
.meter { display: flex; gap: 4px; align-items: flex-end; height: 56px; }
.meter i { display: block; width: 12px; height: 20%; background: var(--panel2); border: 2px solid #000; border-radius: 4px; transition: height 0.06s, background 0.06s; }
.meter i:nth-child(3n) { height: 35%; } .meter i:nth-child(4n) { height: 50%; } .meter i:nth-child(5n+2) { height: 28%; }
.meter i.on { background: var(--ok); height: 100%; }
.meter i.on:nth-child(n+11) { background: var(--hazard); }
.meter i.on:nth-child(n+14) { background: var(--danger); }
.meter.big i { width: 14px; }
.rec-btn {
  width: 190px; height: 190px;
  border-radius: 50%;
  border: 5px solid #000;
  background: radial-gradient(circle at 35% 30%, #ff7a64, var(--danger) 55%, #a8210f);
  color: #fff;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.5), inset 0 -6px 0 rgba(0, 0, 0, 0.25);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  cursor: pointer;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: none;
  transition: transform 0.08s;
}
.rec-btn .rec-dot { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 3px solid #000; }
.rec-btn .rec-text { padding: 0 20px; text-shadow: 0 2px 0 #000; }
.rec-btn.live { transform: scale(0.94) translateY(5px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.5), 0 0 0 12px rgba(255, 79, 58, 0.25); }
.rec-btn.live .rec-dot { animation: pulse 0.5s infinite; background: #ff0; }
.rec-status { min-height: 2.8em; text-align: center; margin: 0; }
.rec-status b { color: var(--hazard); }
.rec-box { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; }
.rec-progress { width: 200px; height: 8px; background: var(--panel2); border: 2px solid #000; border-radius: 6px; overflow: hidden; }
.rec-progress-fill { height: 100%; width: 0; background: var(--danger); }
.lead { font-size: 20px; font-weight: 700; margin: 0; }

/* ── tasks ────────────────────────────────────────────────────────────── */
.task { padding-top: 10px; gap: 10px; max-width: 560px; }
.task-body { width: 100%; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.task-head { text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; padding: 0 44px; }
.task-title { font-size: clamp(26px, 7.4vw, 44px); }
.task-sub { margin: 0; color: var(--ink-dim); }
.task-label { font-family: var(--font-display); font-size: 22px; color: #1b1500; background: var(--hazard); border: 2px solid #000; padding: 2px 12px; border-radius: 8px; transform: rotate(-1.5deg); }
.chaos { background: var(--danger); color: #1a0500; border: 3px solid #000; border-radius: 10px; padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; transform: rotate(1deg); box-shadow: var(--shadow); animation: slam 0.5s both 0.3s; }
.chaos span { font-size: 12px; font-weight: 900; letter-spacing: 0.1em; }
.chaos b { font-size: 18px; }
.timer { position: relative; width: calc(100% - 44px); align-self: flex-start; height: 22px; background: var(--panel2); border: 3px solid #000; border-radius: 12px; overflow: hidden; }
.timer-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--ok), #9fe07a); transition: width 0.2s linear; }
.timer-label { position: absolute; inset: 0; text-align: center; font-weight: 900; font-size: 14px; line-height: 16px; color: #000; }
.timer.urgent .timer-fill { background: var(--danger); animation: shake 0.3s infinite; }
.see-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.see { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.see figcaption { font-size: 13px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 800; }
.thumb { background: #e8e1cf; }
.done-btn { max-width: 400px; }

/* drawing pad */
.pad { width: 100%; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.pad-wrap { position: relative; width: min(100%, 62dvh, 520px); aspect-ratio: 1; }
.pad-canvas { width: 100%; height: 100%; display: block; background: #e8e1cf; border: 4px solid #000; border-radius: 14px; touch-action: none; box-shadow: var(--shadow); cursor: crosshair; }
.pad.done .pad-canvas { cursor: not-allowed; }
.pad-counter { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); background: rgba(29, 27, 34, 0.85); color: #fff; padding: 2px 10px; border-radius: 8px; font-weight: 900; font-size: 13px; letter-spacing: 0.05em; pointer-events: none; white-space: nowrap; }
.pad-counter.low { background: var(--hazard); color: #000; }
.pad-counter.out { background: var(--danger); color: #000; }
.pad-counter.shake { animation: shake 0.3s 2; }
.pad-bar { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; width: 100%; }
.pad-colors, .pad-tools { display: flex; gap: 8px; }
.pad-color { width: 46px; height: 46px; border-radius: 50%; border: 3px solid #000; cursor: pointer; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.5); }
.pad-color.on { outline: 4px solid var(--hazard); outline-offset: 2px; transform: translateY(-3px); }
.pad-tool { min-width: 46px; height: 46px; border-radius: 12px; border: 3px solid #000; background: var(--panel2); color: var(--ink); font-size: 22px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 8px; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.5); }
.pad-tool.on { background: var(--hazard); color: #000; }
.pad-tool:disabled { opacity: 0.35; }
.pad-tool .undo-n { font-size: 13px; font-weight: 900; }
.pen-dot { display: block; border-radius: 50%; background: currentColor; }
.pen-dot.thin { width: 8px; height: 8px; }
.pen-dot.fat { width: 20px; height: 20px; }

/* choices */
.options { display: grid; gap: 10px; width: 100%; }
.option { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 12px 16px; background: var(--panel); border: 3px solid #000; border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer; transition: transform 0.08s; }
.option:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45); }
.option b { font-family: var(--font-display); font-size: 28px; letter-spacing: 0.03em; color: var(--hazard); }
.option span { color: var(--ink-dim); }
.mech-stage { width: 100%; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.name-input { font-size: 38px; max-width: 420px; }

/* quality control */
.qc { max-width: 620px; }
.qc-badge { background: var(--blue); color: #fff; border: 3px solid #000; border-radius: 999px; padding: 4px 14px; font-weight: 900; letter-spacing: 0.08em; }
.qc-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; }
.qc-choice { background: var(--panel); border: 3px solid #000; border-radius: var(--radius); padding: 10px; cursor: pointer; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; }
.qc-choice .thumb { width: 100% !important; height: auto !important; aspect-ratio: 1; }
.qc-choice.label { font-family: var(--font-display); font-size: 26px; min-height: 110px; color: var(--ink); }
.qc-choice.picked { background: var(--ok); transform: scale(0.96); }
.wait-belt { display: flex; gap: 18px; height: 50px; align-items: flex-end; }
.wait-belt span { width: 34px; height: 34px; background: #a07b4f; border: 3px solid #000; animation: belt 1.4s linear infinite; }
.wait-belt span:nth-child(2) { animation-delay: 0.45s; }
.wait-belt span:nth-child(3) { animation-delay: 0.9s; }
@keyframes belt { 0% { transform: translateX(-60px); opacity: 0; } 20%, 80% { opacity: 1; } 100% { transform: translateX(60px); opacity: 0; } }
.mini-progress { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.mini-progress .bar { width: 100%; height: 12px; background: var(--panel2); border: 2px solid #000; border-radius: 8px; overflow: hidden; }
.mini-progress .fill { height: 100%; background: var(--hazard); transition: width 0.4s; }

/* ── intro / complete ─────────────────────────────────────────────────── */
.intro, .complete { gap: 22px; }
.intro h1, .complete h1 { font-size: clamp(54px, 14vw, 140px); }
.intro-stats { display: flex; flex-direction: column; gap: 4px; font-size: clamp(20px, 4.4vw, 34px); font-weight: 700; }
.intro-stats b { font-family: var(--font-display); color: var(--hazard); font-size: 1.3em; }
.intro-count { min-height: 1.2em; font-size: clamp(60px, 18vw, 180px); font-family: var(--font-display); }
.intro-count .count-num { color: var(--ink); text-shadow: 0 6px 0 #000; }
.intro-count .stamp { font-size: clamp(40px, 10vw, 110px); }

/* ── public factory ───────────────────────────────────────────────────── */
.public-factory { align-items: stretch; }
.pf-inner { width: 100%; max-width: 1200px; margin: 0 auto; padding: 18px 16px 28px; display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; }
.pf-inner h1 { font-size: clamp(36px, 8vw, 96px); }
.big-bar { width: 100%; height: 38px; background: var(--panel2); border: 4px solid #000; border-radius: 12px; overflow: hidden; }
.big-bar-fill { height: 100%; width: 0; background: repeating-linear-gradient(-45deg, var(--hazard) 0 22px, #e0ac00 22px 44px); transition: width 0.6s cubic-bezier(0.2, 1.3, 0.5, 1); }
.big-count { font-family: var(--font-display); font-size: clamp(22px, 4vw, 40px); }
.factory-canvas { width: 100%; height: clamp(160px, 30vh, 340px); display: block; }
.worker-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; width: 100%; }
.worker { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; background: var(--panel); border: 3px solid #000; border-radius: 12px; font-weight: 800; font-size: clamp(16px, 2vw, 24px); }
.worker.away { opacity: 0.5; }
.worker-icon { font-size: 1.3em; }
.pf-code { font-size: 20px; color: var(--ink-dim); }
.pf-code b { color: var(--hazard); font-family: var(--font-display); font-size: 28px; }

@media (min-width: 720px) {
  .options { grid-template-columns: 1fr; }
}
@media (max-height: 640px) and (max-width: 600px) {
  .task-title { font-size: 24px; }
  .rec-btn { width: 150px; height: 150px; }
}
