/* Windows, buttons, menus, dialogs, HUD and minigames. Desktop first here;
   mobile.css reshapes it for phones. */

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font: 600 15px var(--font); cursor: pointer; text-decoration: none;
  transition: transform .06s, background .15s;
}
.btn:hover { background: #2d3240; }
.btn:active { transform: scale(.97); }
.btn:focus-visible, .key:focus-visible, .diff:focus-visible, .spot-card:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #ff9c3d, #f07400); border-color: #ffb066; color: #1a0f00; }
.btn.danger { background: #4a1820; border-color: var(--bad); }
.btn.big { min-height: 54px; font-size: 17px; width: 100%; }
.btn.ghost { background: transparent; }

/* ---------- windows ---------- */
.win {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .55); width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  display: flex; flex-direction: column;
}
.win-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 14px; background: linear-gradient(90deg, #2a1f3d, #1d2a3a); font: 700 14px var(--font); letter-spacing: .04em; text-transform: uppercase;
}
.win-x { background: none; border: 0; color: var(--text); font-size: 24px; line-height: 1; cursor: pointer; min-width: 36px; min-height: 36px; }
.win-body { padding: 16px; overflow: auto; }

.menu-wrap, .dlg-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 12px; }
#screens.minigame > .win { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }

/* ---------- brand ---------- */
.brand { text-align: center; line-height: .9; text-shadow: 0 0 24px rgba(255, 61, 240, .6); }
.brand-top { font: 64px var(--display); letter-spacing: .04em; color: #fff; -webkit-text-stroke: 2px var(--pink); }
.brand-sub { font: 30px var(--display); color: var(--accent); }
.brand-tag { font: italic 600 14px var(--font); color: var(--muted); margin-top: 6px; }

/* ---------- menus ---------- */
.main-menu, .auth { display: flex; flex-direction: column; gap: 10px; }
.auth label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.auth input { min-height: 46px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #0f1116; color: var(--text); font-size: 16px; }
.auth .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.or { text-align: center; color: var(--muted); font-size: 13px; }
.form-msg { min-height: 1.2em; margin: 0; color: var(--bad); font-size: 14px; }
.who { margin: 0; color: var(--muted); font-size: 14px; text-align: center; }
.diff-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin-top: 6px; }
.diff-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.diff { min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: #0f1116; color: var(--text); font: 600 15px var(--font); cursor: pointer; }
.diff.on { background: var(--accent-2); color: #002433; border-color: var(--accent-2); }
.diff-blurb { margin: 0; text-align: center; color: var(--muted); font-size: 14px; }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }

table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: left; }
td { text-align: right; font-variant-numeric: tabular-nums; }
.verdict { font-style: italic; color: var(--accent); }
.board { padding-left: 24px; }
.board li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.recent { padding-left: 18px; font-size: 14px; color: var(--muted); }
.run-end h2 { font: 40px var(--display); margin: 0; color: var(--accent); }
.run-end.res-ego_death h2, .run-end.res-hernia h2 { color: var(--bad); }
.report, .run-end, .stats { display: flex; flex-direction: column; gap: 12px; }

/* ---------- dialogs ---------- */
.dlg { display: flex; flex-direction: column; gap: 12px; }
.dlg-speaker { font: 700 13px var(--font); color: var(--accent-2); text-transform: uppercase; letter-spacing: .08em; }
.dlg-text { margin: 0; font-size: 17px; line-height: 1.45; -webkit-user-select: text; user-select: text; }
.dlg-options { display: flex; flex-direction: column; gap: 8px; }
.dlg-opt { justify-content: flex-start; text-align: left; flex-wrap: wrap; }
.dlg-opt kbd { font: 700 12px var(--font); background: #0f1116; border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; color: var(--muted); }
.dlg-opt small { flex-basis: 100%; margin-left: 34px; color: var(--muted); font-weight: 400; font-size: 13px; }
.dlg-opt.primary small { color: #3a2000; }

/* ---------- HUD ---------- */
.hud-top {
  position: absolute; top: calc(10px + var(--safe-t)); left: 50%; transform: translateX(-50%);
  display: flex; gap: 14px; align-items: center; padding: 8px 14px; border-radius: 999px;
  background: rgba(17, 19, 24, .78); border: 1px solid var(--line); backdrop-filter: blur(6px);
}
.meter { display: flex; align-items: center; gap: 6px; font: 700 12px var(--font); }
.meter-label { color: var(--muted); letter-spacing: .06em; }
.meter-bar { width: 110px; height: 10px; border-radius: 99px; background: #0b0c10; overflow: hidden; border: 1px solid #2a2f3b; }
.meter-fill { height: 100%; width: 50%; border-radius: 99px; transition: width .2s; }
.meter-ego .meter-fill { background: linear-gradient(90deg, var(--pink), #ff9df6); }
.meter-energy .meter-fill { background: linear-gradient(90deg, var(--good), #b6ffd5); }
.meter-gag .meter-fill { background: linear-gradient(90deg, #9ccc65, #e53935); width: 0; }
.meter-val { min-width: 22px; text-align: right; font-variant-numeric: tabular-nums; }
.meter.low .meter-bar { animation: pulse-red 1s infinite; }
@keyframes pulse-red { 50% { box-shadow: 0 0 0 3px rgba(255, 77, 94, .6); } }

.macros { display: flex; gap: 4px; }
.ring-wrap { position: relative; width: 30px; height: 30px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #0b0c10; stroke-width: 5; }
.ring-fg { fill: none; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 0 100; transition: stroke-dasharray .3s; }
.ring-protein .ring-fg { stroke: var(--protein); }
.ring-carbs .ring-fg { stroke: var(--carbs); }
.ring-fat .ring-fg { stroke: var(--fat); }
.ring-txt { position: absolute; inset: 0; display: grid; place-items: center; font: 800 11px var(--font); }
.ring-wrap.hit .ring-txt { color: var(--good); }
.ring-wrap.over .ring-fg { stroke: var(--bad); }
.strain { display: none; font: 800 11px var(--font); color: #1a0000; background: var(--bad); padding: 3px 7px; border-radius: 6px; animation: pulse-red 1s infinite; }
.strain.show { display: block; }

.hud-side { position: absolute; top: 70px; left: 14px; width: 240px; display: flex; flex-direction: column; gap: 10px; }
.watch {
  padding: 14px; border-radius: 28px; background: #07080b; border: 3px solid #2c3140;
  box-shadow: inset 0 0 0 2px #000, 0 10px 30px rgba(0, 0, 0, .5);
}
.watch-clock { font: 44px var(--display); color: var(--accent-2); line-height: 1; letter-spacing: .03em; }
.watch-day { font: 700 13px var(--font); color: var(--accent); margin: 2px 0 8px; }
.watch-gains { display: flex; align-items: center; gap: 6px; font: 700 11px var(--font); }
.watch-gains .lbl { color: var(--muted); }
.watch-gains-bar { flex: 1; height: 8px; border-radius: 99px; background: #1a1d25; overflow: hidden; }
.watch-gains-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #ffd29e); transition: width .4s; }
.watch-stats { font-size: 12px; color: var(--muted); margin-top: 6px; }
.tasks-wrap { padding: 10px 12px; border-radius: var(--radius); background: rgba(17, 19, 24, .78); border: 1px solid var(--line); }
.tasks-title { font: 800 11px var(--font); color: var(--muted); letter-spacing: .12em; }
.tasks { list-style: none; margin: 6px 0 0; padding: 0; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.tasks li::before { content: '○ '; color: var(--muted); }
.tasks li.done { color: var(--good); }
.tasks li.done::before { content: '● '; }
.goal { padding: 10px 12px; border-radius: var(--radius); background: rgba(255, 138, 30, .14); border: 1px solid rgba(255, 138, 30, .5); font-size: 13px; line-height: 1.35; }

.prompt {
  position: absolute; left: 50%; bottom: 74px; transform: translateX(-50%) scale(.9); opacity: 0;
  padding: 10px 16px; border-radius: 999px; background: var(--accent); color: #1a0f00; font: 800 15px var(--font);
  transition: opacity .15s, transform .15s; white-space: nowrap;
}
.prompt.show { opacity: 1; transform: translateX(-50%) scale(1); }

.notes { position: absolute; top: 70px; right: 14px; width: 320px; display: flex; flex-direction: column; gap: 6px; }
.note {
  display: flex; gap: 8px; align-items: flex-start; padding: 9px 11px; border-radius: 12px; font-size: 13px; line-height: 1.3;
  background: rgba(17, 19, 24, .9); border-left: 4px solid var(--accent-2); animation: pop .25s; transition: opacity .4s, transform .4s;
}
.note b { font-size: 10px; letter-spacing: .08em; padding: 2px 5px; border-radius: 4px; background: var(--accent-2); color: #00222e; flex: none; }
.note-done { border-color: var(--good); } .note-done b { background: var(--good); }
.note-warning { border-color: var(--warn); } .note-warning b { background: var(--warn); }
.note-notice { border-color: var(--pink); } .note-notice b { background: var(--pink); }
.note-alert { border-color: var(--bad); } .note-alert b { background: var(--bad); color: #fff; }
.note.out { opacity: 0; transform: translateX(20px); }

.taskbar {
  position: absolute; left: 0; right: 0; bottom: 0; height: calc(48px + var(--safe-b)); padding: 6px 10px calc(6px + var(--safe-b));
  display: flex; align-items: center; gap: 8px; background: rgba(10, 11, 15, .92); border-top: 1px solid var(--line); pointer-events: auto;
}
.taskbar button { min-height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: 600 14px var(--font); cursor: pointer; }
.tb-start { background: linear-gradient(180deg, #ff9c3d, #f07400) !important; color: #1a0f00 !important; border-color: #ffb066 !important; }
.tb-spacer { flex: 1; }
.tb-clock { font: 700 15px var(--font); color: var(--accent-2); font-variant-numeric: tabular-nums; }

.bubbles { position: absolute; inset: 0; overflow: hidden; }
.bubble {
  position: absolute; left: 0; top: 0; max-width: 200px; padding: 7px 10px; border-radius: 12px; background: #fff; color: #111;
  font: 600 13px var(--font); line-height: 1.25; box-shadow: 0 4px 14px rgba(0, 0, 0, .35); will-change: transform;
}
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: #fff; }

/* ---------- minigames ---------- */
.mg .win-body { display: flex; flex-direction: column; gap: 12px; }
.mg-lead { margin: 0; color: var(--muted); font-size: 15px; }
.mg-hint { margin: 0; text-align: center; color: var(--muted); font-size: 12px; }
.mg-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.chip { display: inline-block; padding: 3px 8px; margin-left: 6px; border-radius: 99px; background: var(--panel-2); font-size: 12px; color: var(--muted); }

.lift-head { font-size: 17px; }
.lift-fig { width: 100%; max-height: 150px; }
.lift-fig .floor { stroke: #444; stroke-width: 3; }
.lift-fig .limb, .lift-fig .back { fill: none; stroke: #f1c7a5; stroke-width: 9; stroke-linecap: round; }
.lift-fig .back.bad { stroke: var(--bad); }
.lift-fig .headc { fill: #f1c7a5; }
.lift-fig .barline { stroke: #ccd; stroke-width: 5; }
.lift-fig .plate { fill: #222; stroke: #555; }
.form-police { text-align: center; font: 800 13px var(--font); color: #fff; background: var(--bad); border-radius: 8px; padding: 6px; animation: pulse-red 1s infinite; }
.lift-track { position: relative; height: 42px; border-radius: 12px; background: #0b0c10; border: 2px solid var(--line); overflow: hidden; }
.lift-zone { position: absolute; top: 0; bottom: 0; background: linear-gradient(180deg, #3ddc84, #1f9e5a); }
.lift-cursor { position: absolute; top: -2px; bottom: -2px; width: 6px; margin-left: -3px; background: #fff; box-shadow: 0 0 10px #fff; border-radius: 3px; }
.lift-dots, .rice-progress { display: flex; justify-content: center; gap: 8px; }
.dot { width: 16px; height: 16px; border-radius: 50%; background: #2a2f3b; }
.dot.good { background: var(--good); }
.dot.bad { background: var(--bad); }
.lift-msg { text-align: center; font: 800 18px var(--font); min-height: 1.3em; color: var(--accent); }
.btn.push { font: 32px var(--display); letter-spacing: .05em; min-height: 76px; background: linear-gradient(180deg, #ff9c3d, #f07400); color: #1a0f00; border: 0; }

.spot-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.spot-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; text-align: center; font: 14px var(--font); position: relative;
}
.spot-card:hover { border-color: var(--accent-2); }
.spot-card kbd { position: absolute; top: 6px; left: 8px; font-size: 11px; color: var(--muted); }
.spot-face { font-size: 44px; line-height: 1; }
.spot-card q { font-size: 12px; color: var(--muted); font-style: italic; }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key {
  min-height: 64px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font: 800 28px var(--font); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; touch-action: manipulation;
}
.key small { font-size: 11px; font-weight: 600; color: var(--muted); }
.key:active, .key.lit { background: var(--accent-2); color: #002433; }
.key.lit small { color: #002433; }
.key.blank { visibility: hidden; }
.keypad.locked { opacity: .6; pointer-events: none; }

.rice-stage { display: flex; align-items: center; justify-content: center; gap: 24px; min-height: 110px; }
.rice-face { font-size: 72px; transition: transform .2s; }
.rice-call { text-align: center; }
.rice-word { font: 22px var(--display); color: var(--warn); letter-spacing: .05em; }
.rice-arrow { font: 800 64px var(--font); color: #fff; line-height: 1; }
.rice-arrow.pop { animation: pop .2s; }
.rice-timer { height: 8px; border-radius: 99px; background: #0b0c10; overflow: hidden; }
.rice-timer-fill { height: 100%; background: var(--accent-2); }
.meter-gag .meter-bar { flex: 1; width: auto; height: 14px; }

.flex-stage { display: flex; flex-direction: column; align-items: center; min-height: 150px; border-radius: 14px; background: linear-gradient(180deg, #cfe6f2 0%, #7fa6bb 100%); padding: 8px; }
.flex-pose svg { width: 120px; height: 110px; }
.flex-pose .headc { fill: #f1c7a5; }
.flex-pose .torso { fill: #f1c7a5; stroke: #c99570; stroke-width: 2; }
.flex-pose .limb { fill: none; stroke: #f1c7a5; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; }
.flex-pose .limb.thin { stroke-width: 5; }
.flex-name { font: 20px var(--display); color: #10202a; min-height: 1.2em; }
.flex-status { text-align: center; font-weight: 700; color: var(--accent); min-height: 1.3em; }
.posepad { grid-template-columns: 1fr 1fr; }
.posepad .key { font-size: 26px; }
