/* =========================================================
   PaoloOS 13 — style.css
   ========================================================= */

:root {
  --font-ui: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --font-display: "Orbitron", "JetBrains Mono", sans-serif;
  --font-pixel: "Press Start 2P", "JetBrains Mono", monospace;
  --radius: 18px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.22, .9, .25, 1);
  --hard: 3px 3px 0 rgba(0, 0, 0, .55);
}

/* ---------- TEMAS ---------- */
body[data-theme="mission"] {
  --bg: #070B1A; --bg2: #0E1633; --panel: #111A3D; --panel-2: #18244F;
  --text: #E6F1FF; --muted: #8DA2C9; --accent: #38E1FF; --accent2: #FF8A3D;
  --ok: #3DFFA2; --danger: #FF4D6D; --line: rgba(56, 225, 255, .25);
  --glow: 0 0 22px rgba(56, 225, 255, .35); --on-accent: #070B1A;
}
body[data-theme="espboy"] {
  --bg: #0F380F; --bg2: #1C4A1C; --panel: #9BBC0F; --panel-2: #8BAC0F;
  --text: #0F380F; --muted: #306230; --accent: #0F380F; --accent2: #306230;
  --ok: #0F380F; --danger: #0F380F; --line: #306230;
  --glow: none; --radius: 0px; --on-accent: #9BBC0F;
  --font-ui: "Press Start 2P", monospace; --font-display: "Press Start 2P", monospace;
}
body[data-theme="mars"] {
  --bg: #1A0905; --bg2: #3A140A; --panel: #2E1008; --panel-2: #4A1D10;
  --text: #FBE7D3; --muted: #D19A7A; --accent: #FF6B35; --accent2: #F2C57C;
  --ok: #F2C57C; --danger: #FF3B3B; --line: rgba(255, 107, 53, .3);
  --glow: 0 0 22px rgba(255, 107, 53, .35); --on-accent: #1A0905;
}
body[data-theme="garage"] {
  --bg: #0B0B0D; --bg2: #18181C; --panel: #16161A; --panel-2: #24242A;
  --text: #F4F4F5; --muted: #A1A1AA; --accent: #FF2D2D; --accent2: #FFD60A;
  --ok: #22E07A; --danger: #FF2D2D; --line: rgba(255, 45, 45, .3);
  --glow: 0 0 22px rgba(255, 45, 45, .3); --on-accent: #0B0B0D;
}
body[data-theme="blueprint"] {
  --bg: #0B3D91; --bg2: #0A3380; --panel: #092C6E; --panel-2: #0D4AB0;
  --text: #FFFFFF; --muted: #B7CCF2; --accent: #FFFFFF; --accent2: #FC3D21;
  --ok: #8CF5C2; --danger: #FC3D21; --line: rgba(255, 255, 255, .35);
  --glow: none; --radius: 6px; --on-accent: #0B3D91;
}
body[data-theme="synthwave"] {
  --bg: #120024; --bg2: #2A0845; --panel: #1E0638; --panel-2: #3A0D63;
  --text: #FDE7FF; --muted: #C59BDB; --accent: #FF2E97; --accent2: #00F0FF;
  --ok: #00F0FF; --danger: #FF2E97; --line: rgba(255, 46, 151, .35);
  --glow: 0 0 26px rgba(255, 46, 151, .45); --on-accent: #120024;
}
body[data-theme="apollo"] {
  --bg: #000000; --bg2: #111008; --panel: #100E06; --panel-2: #22200F;
  --text: #FFF6D6; --muted: #C9B57A; --accent: #D4AF37; --accent2: #FFFFFF;
  --ok: #D4AF37; --danger: #FF5A36; --line: rgba(212, 175, 55, .35);
  --glow: 0 0 26px rgba(212, 175, 55, .4); --on-accent: #000;
}

/* ---------- BASE ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(900px 600px at 70% 0%, var(--bg2), var(--bg) 70%);
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
body[data-theme="espboy"] { font-size: 10px; line-height: 1.8; }
body[data-theme="blueprint"] {
  background-image:
    linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
}
body[data-theme="synthwave"] { background: linear-gradient(180deg, #120024 0%, #2A0845 60%, #FF2E97 160%); }

button { font-family: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button, .app, .tile { user-select: none; -webkit-user-select: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 11px; }
.center { text-align: center; }

#stars, #confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#stars { z-index: 0; }
#confetti { z-index: 9999; }
body[data-theme="espboy"] #stars, body[data-theme="blueprint"] #stars { opacity: .25; }

/* ---------- APARELHO ---------- */
.device {
  position: relative; z-index: 1;
  width: 100%; height: 100vh; height: 100dvh;
  overflow: hidden; isolation: isolate;
}
@media (min-width: 560px) {
  body.mode-mobile { display: grid; place-items: center; }
  .mode-mobile .device {
    width: 420px; height: min(880px, calc(100dvh - 40px));
    border-radius: 44px; border: 10px solid #05060c;
    box-shadow: 0 0 0 2px #2a2f45, 0 30px 80px rgba(0,0,0,.6), var(--glow);
    --safe-t: 14px; --safe-b: 10px;
  }
}

.crt {
  position: absolute; inset: 0; z-index: 500; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.09) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply; opacity: .55;
}
body[data-theme="espboy"] .crt, body[data-theme="blueprint"] .crt { opacity: .25; }

/* ---------- BOTÕES ---------- */
.btn {
  background: var(--accent); color: var(--on-accent); border: 2px solid rgba(0,0,0,.5);
  border-radius: calc(var(--radius) * .6); padding: 12px 16px; min-height: 46px;
  font-weight: 800; font-family: var(--font-ui); letter-spacing: .3px; font-size: 14px;
  box-shadow: var(--hard); transition: transform .08s, box-shadow .08s, filter .2s;
}
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0,0,0,.55); }
.btn.ghost { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.btn.alt { background: var(--accent2); color: #111; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-big { font-size: 16px; padding: 14px 24px; font-family: var(--font-display); min-height: 54px; }
.btn.wide { width: 100%; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-row.three { grid-template-columns: repeat(3, 1fr); }

/* ---------- BOOT ---------- */
.boot {
  position: absolute; inset: 0; z-index: 400; display: flex; flex-direction: column; justify-content: center;
  padding: calc(24px + var(--safe-t)) 22px calc(24px + var(--safe-b));
  background: #000; color: #3DFFA2; cursor: pointer;
}
.boot-log {
  font-family: "JetBrains Mono", monospace; font-size: 12px; line-height: 1.65;
  white-space: pre-wrap; margin: 0; text-shadow: 0 0 8px rgba(61,255,162,.6);
}
.boot-logo { text-align: center; animation: pop .5s var(--ease); margin-top: 22px; }
.boot-logo h1 {
  font-family: "Orbitron", sans-serif; font-size: 44px; margin: 14px 0 0;
  color: #fff; letter-spacing: 2px; text-shadow: 0 0 30px rgba(56,225,255,.7);
}
.boot-sub { color: #8DA2C9; font-family: "Press Start 2P", monospace; font-size: 8px; letter-spacing: 2px; text-transform: uppercase; margin: 8px 0 22px; }
.boot-hint { color: #4c5a7a; font-size: 11px; margin-top: 14px; }
.boot .btn { background: #38E1FF; color: #070B1A; width: 100%; max-width: 280px; }
.logo-mark {
  width: 96px; height: 96px; margin: 0 auto; border-radius: 50%;
  display: grid; place-items: center; position: relative;
  font-family: "Orbitron", sans-serif; font-weight: 900; font-size: 42px; color: #fff;
  background: radial-gradient(circle at 30% 30%, #1F4FD8, #0B3D91 60%, #061B45);
  box-shadow: 0 0 0 4px #fff, 0 0 40px rgba(56,225,255,.6);
}
.logo-mark span {
  position: absolute; right: -10px; bottom: -4px; font-size: 18px; background: #FC3D21;
  border-radius: 999px; padding: 3px 8px; box-shadow: 0 0 0 3px #fff;
}
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- HOME ---------- */
.home {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  transition: transform .34s var(--ease), filter .34s, border-radius .34s;
  transform-origin: 50% 0;
}
.statusbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(6px + var(--safe-t)) 18px 4px; min-height: 40px;
  font-family: var(--font-display); font-size: 13px; font-weight: 700;
}
.sb-clock { min-width: 64px; }
.sb-notch {
  font-family: var(--font-pixel); font-size: 8px; padding: 6px 12px; border-radius: 999px;
  background: #000; color: var(--accent); border: 1px solid var(--line);
}
.sb-right { display: flex; align-items: center; gap: 2px; min-width: 64px; justify-content: flex-end; }
.sb-btn { background: none; border: 0; font-size: 16px; width: 34px; height: 34px; border-radius: 50%; }
.sb-btn:active { background: var(--panel-2); }
.sb-batt { width: 24px; height: 12px; border: 2px solid var(--text); border-radius: 3px; position: relative; margin-left: 4px; padding: 1px; }
.sb-batt::after { content: ""; position: absolute; right: -5px; top: 2px; width: 3px; height: 4px; background: var(--text); border-radius: 0 2px 2px 0; }
.sb-batt i { display: block; height: 100%; width: 100%; background: var(--ok); border-radius: 1px; }

.home-scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 16px 24px;
  overscroll-behavior: contain; scrollbar-width: none;
}
.home-scroll::-webkit-scrollbar { display: none; }

/* Widgets */
.w-bday {
  position: relative; width: 100%; display: block; text-align: left; overflow: hidden;
  border: 2px solid rgba(0,0,0,.6); border-radius: calc(var(--radius) + 6px); padding: 18px 18px 16px;
  background:
    radial-gradient(circle at 85% 20%, rgba(255,255,255,.25), transparent 40%),
    linear-gradient(135deg, var(--accent), var(--accent2));
  color: #0b0b12; box-shadow: var(--hard), var(--glow);
  margin: 6px 0 12px;
}
.w-bday:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0,0,0,.55); }
.w-bday .k { font-family: var(--font-pixel); font-size: 8px; letter-spacing: 1px; opacity: .8; }
.w-bday .big {
  font-family: "Orbitron", sans-serif; font-weight: 900; font-size: 92px; line-height: .95; margin: 8px 0 2px;
  color: #fff; text-shadow: 4px 4px 0 rgba(0,0,0,.45); letter-spacing: -2px;
}
.w-bday .t { font-family: var(--font-display); font-weight: 900; font-size: 18px; line-height: 1.15; }
.w-bday .s { font-size: 12px; margin-top: 8px; font-weight: 700; opacity: .85; }
.w-bday .orbit { position: absolute; right: 18px; top: 34px; width: 120px; height: 120px; border: 2px dashed rgba(0,0,0,.25); border-radius: 50%; animation: spin 9s linear infinite; }
.w-bday .orbit::before { content: "🚀"; position: absolute; left: -12px; top: 40px; font-size: 22px; transform: rotate(-30deg); }
.w-bday .planet { position: absolute; right: 56px; top: 72px; width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #fff, #c8c8c8 45%, #777); box-shadow: inset -6px -6px 0 rgba(0,0,0,.2); }
@keyframes spin { to { transform: rotate(360deg); } }

.widget-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 6px; }
.widget {
  border: 2px solid rgba(0,0,0,.5); border-radius: var(--radius); padding: 12px; text-align: left;
  background: var(--panel); box-shadow: var(--hard); min-height: 92px; display: flex; flex-direction: column; justify-content: space-between;
  outline: 1px solid var(--line); outline-offset: -3px;
}
.widget:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0,0,0,.55); }
.widget .k { font-family: var(--font-pixel); font-size: 7px; color: var(--muted); letter-spacing: 1px; }
.widget .v { font-family: var(--font-display); font-weight: 900; font-size: 17px; color: var(--accent); word-break: break-all; }
.widget .u { font-size: 10px; color: var(--muted); }

.sec-label {
  font-family: var(--font-pixel); font-size: 8px; letter-spacing: 2px; color: var(--muted);
  margin: 20px 4px 10px; text-transform: uppercase; display: flex; align-items: center; gap: 8px;
}
.sec-label::after { content: ""; flex: 1; height: 2px; background: repeating-linear-gradient(90deg, var(--line) 0 4px, transparent 4px 8px); }

.app-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px 6px; }
.app {
  background: none; border: 0; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 6px;
  position: relative;
}
.tile {
  width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; font-size: 28px;
  background: linear-gradient(160deg, var(--c1, #38E1FF), var(--c2, #0B3D91));
  border: 2px solid rgba(0,0,0,.6);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.35), inset 0 -4px 0 rgba(0,0,0,.25), var(--hard);
  transition: transform .1s;
}
.app:active .tile { transform: translate(2px, 2px) scale(.94); box-shadow: inset 0 3px 0 rgba(255,255,255,.35), inset 0 -4px 0 rgba(0,0,0,.25), 1px 1px 0 rgba(0,0,0,.55); }
.app .lbl { font-size: 10.5px; font-weight: 700; text-align: center; line-height: 1.15; max-width: 78px; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
body[data-theme="espboy"] .app .lbl { color: #9BBC0F; font-size: 7px; text-shadow: none; }
body[data-theme="espboy"] .tile, body[data-theme="espboy"] .w-bday, body[data-theme="espboy"] .widget { border-radius: 0; }
.badge {
  position: absolute; top: -6px; right: calc(50% - 38px); min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: #FF2D55; color: #fff; font-size: 11px; font-weight: 800;
  display: grid; place-items: center; border: 2px solid var(--bg); animation: pop .4s var(--ease);
}

.dock {
  margin: 0 12px calc(10px + var(--safe-b)); padding: 10px 8px; border-radius: 28px;
  display: grid; grid-template-columns: repeat(4, 1fr); justify-items: center;
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  border: 2px solid rgba(0,0,0,.5); outline: 1px solid var(--line); outline-offset: -4px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: var(--hard);
}
.dock .lbl { display: none; }

/* ---------- PILHA DE TELAS ---------- */
#stack { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
#stack > * { pointer-events: auto; }

.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  background: var(--bg); background-image: linear-gradient(180deg, var(--bg2), var(--bg) 40%);
  box-shadow: -14px 0 30px rgba(0,0,0,.45);
  transform: translateX(0); transition: transform .34s var(--ease), filter .34s;
  will-change: transform;
}
.screen.off { transform: translateX(104%); }
.under { transform: translateX(-28%) !important; filter: brightness(.55); }
.home.under { transform: translateX(-28%); }
.behind { transform: scale(.93) translateY(10px) !important; filter: brightness(.6); border-radius: 26px; overflow: hidden; }

.scr-head {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px;
  padding: calc(6px + var(--safe-t)) 8px 8px; min-height: 52px;
  border-bottom: 2px dashed var(--line); background: color-mix(in srgb, var(--bg) 85%, transparent);
}
.back {
  justify-self: start; background: none; border: 0; color: var(--accent); font-weight: 800; font-size: 14px;
  display: flex; align-items: center; gap: 2px; padding: 8px 8px; border-radius: 12px; max-width: 120px;
}
.back b { font-size: 26px; line-height: 0; margin-top: -3px; font-weight: 400; }
.back span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back:active { background: var(--panel-2); }
.scr-head h1 {
  margin: 0; font-family: var(--font-pixel); font-size: 10px; letter-spacing: .5px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; line-height: 1.6;
}
.head-r { justify-self: end; font-size: 20px; padding-right: 8px; }
.scr-body {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 16px 16px calc(24px + var(--safe-b));
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
.scr-body.flush { padding: 0; display: flex; flex-direction: column; }

/* Sheets */
.sheet-wrap { position: absolute; inset: 0; }
.backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); opacity: 0; transition: opacity .3s; }
.sheet-wrap.show .backdrop { opacity: 1; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 86%;
  display: flex; flex-direction: column;
  background: var(--panel); border-top: 2px solid var(--accent);
  border-radius: 26px 26px 0 0; box-shadow: 0 -20px 50px rgba(0,0,0,.5);
  transform: translateY(0); transition: transform .34s var(--ease);
}
.sheet.off { transform: translateY(105%); }
.sheet.dragging { transition: none; }
.grab-zone { padding: 10px 16px 6px; touch-action: none; cursor: grab; }
.grabber { width: 44px; height: 5px; border-radius: 9px; background: var(--muted); opacity: .6; margin: 0 auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h1 { margin: 0; font-family: var(--font-pixel); font-size: 10px; }
.sheet-head .x { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2); }
.sheet .scr-body { padding-top: 8px; }

/* ---------- TOASTS ---------- */
.toasts {
  position: absolute; left: 12px; right: 12px; top: calc(8px + var(--safe-t)); z-index: 300;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none; align-items: center;
}
.toast {
  background: var(--panel); border: 2px solid var(--accent); border-radius: 18px; width: 100%; max-width: 380px;
  padding: 10px 14px; box-shadow: var(--hard), var(--glow); animation: toastIn .35s var(--ease);
  display: flex; gap: 10px; align-items: center;
}
.toast .t-ico { font-size: 24px; }
.toast small { color: var(--muted); display: block; font-size: 11px; }
.toast.out { animation: toastOut .3s ease-in forwards; }
@keyframes toastIn { from { transform: translateY(-140%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateY(-140%); opacity: 0; } }

/* ---------- COMPONENTES DE APP ---------- */
.col { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.between { justify-content: space-between; }
.h { font-family: var(--font-pixel); margin: 6px 0 2px; font-size: 9px; color: var(--accent); letter-spacing: 1px; line-height: 1.6; }
.card {
  background: var(--panel); border: 2px solid rgba(0,0,0,.45); outline: 1px solid var(--line); outline-offset: -4px;
  border-radius: calc(var(--radius) * .8); padding: 14px; box-shadow: var(--hard);
}
.stat { display: flex; flex-direction: column; min-width: 0; }
.stat b { font-family: var(--font-display); font-size: 18px; color: var(--accent); white-space: nowrap; }
.stat span { font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; font-weight: 700; }
.field > label b { color: var(--text); }
input[type="range"] { width: 100%; accent-color: var(--accent); height: 30px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button {
  flex: 1 1 auto; min-height: 42px; border: 2px solid var(--line); background: var(--panel-2);
  border-radius: 12px; padding: 8px 12px; font-size: 13px; font-weight: 700;
}
.seg button.on { background: var(--accent); color: var(--on-accent); border-color: rgba(0,0,0,.5); box-shadow: 2px 2px 0 rgba(0,0,0,.5); }
.bar { height: 10px; background: rgba(127,127,127,.22); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .3s; }
canvas.game { display: block; width: 100%; background: #000; border-radius: calc(var(--radius) * .7); touch-action: none; border: 2px solid rgba(0,0,0,.6); }
.sticky-cta {
  position: sticky; bottom: calc(-24px - var(--safe-b)); margin: 4px -16px calc(-24px - var(--safe-b));
  padding: 12px 16px calc(14px + var(--safe-b));
  background: linear-gradient(180deg, transparent, var(--bg) 35%);
}
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 12px; scrollbar-width: none; background: #050505; border-top: 1px solid #1d2b1d; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid #2c5a3c; background: #0b1a10; color: #3DFFA2; border-radius: 999px; padding: 8px 12px; font-size: 12px; font-family: "JetBrains Mono", monospace; }
.chip:active { background: #3DFFA2; color: #000; }

/* Controles de jogo */
.ctl {
  min-height: 64px; border-radius: 18px; border: 2px solid rgba(0,0,0,.6); background: var(--panel-2); color: var(--text);
  font-size: 18px; font-weight: 800; box-shadow: var(--hard); touch-action: none;
}
.ctl.go { background: var(--accent); color: var(--on-accent); }
.ctl.pressed, .ctl:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0,0,0,.55); filter: brightness(1.2); }
.ctl:disabled { opacity: .4; }
code { font-size: 10.5px; background: var(--panel-2); padding: 1px 5px; border-radius: 5px; word-break: break-all; }
.game-col { display: flex; flex-direction: column; gap: 10px; padding: 12px 12px calc(12px + var(--safe-b)); flex: 1; min-height: 0; }
.game-col canvas.game { flex: 1; min-height: 200px; }
.hud { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.hud .card { padding: 8px 10px; }
.hud .stat b { font-size: 15px; }

/* Rocket Lab */
.telemetry { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.telemetry .card { padding: 8px 8px; }
.telemetry .stat b { font-size: 13px; }
.telemetry .stat span { font-size: 8px; }

/* Garagem */
.car-stage {
  background: linear-gradient(180deg, transparent 62%, rgba(0,0,0,.35) 62%), var(--panel-2);
  border-radius: calc(var(--radius) * .8); border: 2px solid rgba(0,0,0,.5);
  display: grid; place-items: center; min-height: 150px; overflow: hidden; box-shadow: var(--hard);
}
.car-stage svg { width: 96%; filter: drop-shadow(0 10px 14px rgba(0,0,0,.5)); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(0,0,0,.5); }
.swatch.on { border-color: var(--text); box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent); }
.text-in {
  background: var(--panel-2); border: 2px solid var(--line); color: var(--text); padding: 12px; border-radius: 12px;
  font-family: var(--font-display); font-size: 16px; text-transform: uppercase; letter-spacing: 2px; width: 100%;
}
.gauge { display: flex; align-items: baseline; gap: 8px; }
.rpm { font-family: var(--font-display); font-size: 30px; font-weight: 900; }
.shift-light { width: 20px; height: 20px; border-radius: 50%; background: #333; display: inline-block; align-self: center; border: 2px solid #000; }
.shift-light.on { background: var(--ok); box-shadow: 0 0 16px var(--ok); }

/* ESPBoy */
.espboy {
  width: min(320px, 100%); margin: 0 auto; padding: 18px 18px 26px; border-radius: 16px 16px 60px 16px;
  background: linear-gradient(145deg, #2A2F45, #1A1E30); box-shadow: inset 0 2px 0 rgba(255,255,255,.1), 0 20px 40px rgba(0,0,0,.5);
  font-family: "Press Start 2P", monospace; color: #9AA4C7; border: 2px solid #000;
}
.espboy .bezel { background: #111426; border-radius: 10px 10px 30px 10px; padding: 14px; }
.espboy .bezel small { display: block; font-size: 7px; color: #FF4D6D; margin-bottom: 6px; }
.espboy canvas { width: 100%; image-rendering: pixelated; background: #000; display: block; border-radius: 2px; }
.espboy .brand { font-size: 10px; margin: 12px 0 18px; color: #9AA4C7; font-style: italic; }
.espboy .brand b { color: #38E1FF; }
.espboy .controls { display: flex; justify-content: space-between; align-items: center; }
.joy { width: 112px; height: 112px; border-radius: 50%; background: #0D1020; position: relative; box-shadow: inset 0 4px 10px rgba(0,0,0,.6); }
.joy button { position: absolute; width: 40px; height: 40px; border: 0; background: #2E3452; border-radius: 8px; font-size: 12px; color: #9AA4C7; touch-action: none; }
.joy button:active { background: #4a5380; }
.joy .u { left: 36px; top: 0; } .joy .d { left: 36px; bottom: 0; } .joy .l { left: 0; top: 36px; } .joy .r { right: 0; top: 36px; }
.ab { width: 60px; height: 60px; border-radius: 50%; border: 0; background: #FF4D6D; color: #fff; font-family: inherit; font-size: 12px; box-shadow: 0 5px 0 #A3233B; touch-action: none; }
.ab:active { transform: translateY(4px); box-shadow: 0 1px 0 #A3233B; }

/* Terminal */
.term { background: #000; color: #3DFFA2; font-family: "JetBrains Mono", monospace; font-size: 13px; flex: 1; min-height: 0; padding: 12px; overflow-y: auto; text-shadow: 0 0 6px rgba(61,255,162,.45); }
.term .line { white-space: pre-wrap; word-break: break-word; }
.term .in { display: flex; gap: 8px; align-items: center; }
.term input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: #fff; font: inherit; font-size: 16px; }
.term .c-acc { color: #38E1FF; } .term .c-warn { color: #FF8A3D; } .term .c-err { color: #FF4D6D; } .term .c-gold { color: #D4AF37; }

/* Carta */
.letter { text-align: center; }
.letter .transmission { font-family: var(--font-pixel); font-size: 7px; letter-spacing: 1px; color: var(--muted); line-height: 1.8; }
.letter .big13 { font-family: "Orbitron", sans-serif; font-size: 110px; font-weight: 900; line-height: 1; color: var(--accent); text-shadow: 5px 5px 0 rgba(0,0,0,.5), var(--glow); }
.letter h2 { font-family: var(--font-display); font-size: 22px; margin: 4px 0 6px; }
.letter .msg { text-align: left; line-height: 1.7; white-space: pre-line; font-size: 14px; min-height: 120px; }
.typing::after { content: "▌"; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Paolômetro */
.big-counter { font-family: var(--font-display); font-weight: 900; font-size: 30px; color: var(--accent); text-shadow: 3px 3px 0 rgba(0,0,0,.5); font-variant-numeric: tabular-nums; word-break: break-all; line-height: 1.1; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.facts .card { padding: 12px; }
.facts .stat b { font-size: 15px; white-space: normal; word-break: break-word; }
.facts .stat .e { font-size: 22px; margin-bottom: 4px; }

/* Pixel Maker */
.pix { width: 100%; aspect-ratio: 1; display: block; touch-action: none; border: 2px solid rgba(0,0,0,.6); border-radius: 10px; box-shadow: var(--hard); background: #222; }
.palette { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.pal { aspect-ratio: 1; border: 2px solid rgba(0,0,0,.6); border-radius: 8px; }
.pal.on { outline: 3px solid var(--text); outline-offset: 1px; transform: scale(1.06); }

/* Temas / Conquistas */
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.theme-card { border: 2px solid var(--line); border-radius: 16px; padding: 0; overflow: hidden; background: var(--panel-2); text-align: left; box-shadow: var(--hard); }
.theme-card.on { border-color: var(--accent); box-shadow: var(--hard), var(--glow); }
.theme-card .pv { height: 64px; display: flex; align-items: flex-end; gap: 6px; padding: 8px; }
.theme-card .pv i { width: 18px; height: 18px; border-radius: 50%; display: block; border: 2px solid rgba(0,0,0,.4); }
.theme-card .nm { padding: 10px; font-size: 12px; font-weight: 700; }
.theme-card.locked { opacity: .5; }
.ach { display: flex; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px dashed var(--line); }
.ach .a-ico { font-size: 28px; width: 42px; height: 42px; display: grid; place-items: center; background: var(--panel-2); border-radius: 12px; flex: none; }
.ach small { font-size: 11px; }
.ach.locked { opacity: .4; filter: grayscale(1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- DESKTOP ---------- */
.desktop { position: absolute; inset: 0 0 var(--taskbar-h) 0; z-index: 1; }
.mode-desktop { --taskbar-h: 54px; }
.icons {
  position: absolute; inset: 16px; display: grid;
  grid-template-columns: repeat(auto-fill, 96px); grid-auto-rows: 100px;
  gap: 8px; align-content: start;
}
.icon {
  background: none; border: 1px solid transparent; border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--text); padding: 8px 4px; transition: background .15s, border-color .15s, transform .15s; position: relative;
}
.icon:hover, .icon:focus-visible { background: var(--panel); border-color: var(--line); outline: none; transform: translateY(-2px); }
.icon .ico { font-size: 38px; line-height: 1; filter: drop-shadow(0 4px 10px rgba(0,0,0,.4)); }
.icon .lbl { font-size: 11px; text-align: center; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.icon .badge { top: 2px; right: 16px; }
body[data-theme="espboy"] .icon .lbl { color: #9BBC0F; font-size: 8px; text-shadow: none; }
body[data-theme="espboy"] .icon:hover { background: #306230; }
.desk-banner { position: absolute; right: 28px; bottom: 24px; text-align: right; pointer-events: none; font-family: var(--font-display); opacity: .9; }
.desk-banner .big { font-size: clamp(28px, 5vw, 56px); font-weight: 900; color: var(--accent); text-shadow: var(--glow); }
.desk-banner .small { color: var(--muted); letter-spacing: 4px; font-size: 12px; text-transform: uppercase; }
body[data-theme="espboy"] .desk-banner .big { color: #9BBC0F; font-size: 24px; }

.win {
  position: absolute; z-index: 10; min-width: 300px; min-height: 200px; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.55), var(--glow); overflow: hidden; animation: winIn .22s ease-out;
}
body[data-theme="espboy"] .win { border: 4px solid #0F380F; box-shadow: 6px 6px 0 #0F380F; }
.win.closing { animation: winOut .18s ease-in forwards; }
@keyframes winIn { from { transform: scale(.92) translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes winOut { to { transform: scale(.92); opacity: 0; } }
.win-bar {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px;
  background: var(--panel-2); border-bottom: 1px solid var(--line); cursor: grab; user-select: none; touch-action: none;
}
.win-bar:active { cursor: grabbing; }
.win-title { flex: 1; font-family: var(--font-display); font-size: 12px; letter-spacing: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body[data-theme="espboy"] .win-title { font-size: 9px; }
.win-btns { display: flex; gap: 6px; }
.win-btns button { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); background: transparent; font-size: 12px; line-height: 1; display: grid; place-items: center; }
.win-btns button:hover { background: var(--danger); color: #fff; }
body[data-theme="espboy"] .win-btns button { border-radius: 0; }
.win-body { flex: 1; min-height: 0; overflow: auto; padding: 16px 16px 24px; position: relative; }
.win-body.flush { padding: 0; display: flex; flex-direction: column; }
.win.max { inset: 0 !important; width: auto !important; height: auto !important; border-radius: 0; }

.taskbar {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--taskbar-h); z-index: 100;
  display: flex; align-items: center; gap: 8px; padding: 0 10px;
  background: var(--panel); border-top: 1px solid var(--line);
}
.start-btn { height: 40px; padding: 0 12px; border-radius: calc(var(--radius) * .7); border: 0; background: var(--accent); color: var(--on-accent); box-shadow: var(--glow); font-family: var(--font-display); font-weight: 900; }
.task-apps { flex: 1; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.task-apps::-webkit-scrollbar { display: none; }
.task-app { height: 38px; padding: 0 12px; border-radius: calc(var(--radius) * .6); border: 1px solid var(--line); background: transparent; white-space: nowrap; font-size: 12px; }
.task-app.active { background: var(--panel-2); border-color: var(--accent); }
.tray { display: flex; align-items: center; gap: 6px; }
.tray-btn { background: transparent; border: 0; font-size: 18px; width: 36px; height: 36px; border-radius: 50%; }
.tray-btn:hover { background: var(--panel-2); }
.clock { font-family: var(--font-display); font-size: 13px; min-width: 52px; text-align: right; }
.start-menu {
  position: absolute; left: 10px; bottom: calc(var(--taskbar-h) + 8px); z-index: 101; width: 300px; padding: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.6), var(--glow); animation: winIn .18s ease-out;
}
.start-head { display: flex; gap: 12px; align-items: center; padding: 6px 6px 12px; border-bottom: 1px solid var(--line); }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-family: var(--font-display); font-weight: 900; font-size: 20px; }
.start-menu ul { list-style: none; margin: 8px 0 0; padding: 0; max-height: 60vh; overflow: auto; }
.start-menu li button { width: 100%; text-align: left; background: transparent; border: 0; padding: 10px; border-radius: 8px; display: flex; gap: 10px; align-items: center; font-size: 13px; }
.start-menu li button:hover { background: var(--panel-2); }
.mode-desktop .toasts { left: auto; right: 16px; top: 16px; width: 360px; align-items: flex-end; }
.mode-desktop .toast { animation-name: toastInR; }
.mode-desktop .toast.out { animation-name: toastOutR; }
@keyframes toastInR { from { transform: translateX(120%); } to { transform: none; } }
@keyframes toastOutR { to { transform: translateX(120%); opacity: 0; } }
.mode-desktop .crt { opacity: .3; }
.mode-desktop .boot { align-items: center; }
.mode-desktop .boot-log { width: min(560px, 100%); font-size: 13px; }
