:root {
  --ui-bg: #0b1120;
  --ui-panel: #111a2e;
  --ui-surface: #18233c;
  --ui-border: rgba(148, 163, 184, 0.18);
  --ui-text: #f1f5f9;
  --ui-muted: #94a3b8;
  --paper: #172033;
  --ink: #f1f5f9;
  --muted: #cbd5e1;
  --card: #1e293b;
  --accent: #38bdf8;
  --good: #22c55e;
  --amber: #f59e0b;
  font-family: Fredoka, 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--ui-bg);
  color: var(--ui-text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, p { margin: 0; }
p, h1, h2, .card { overflow-wrap: anywhere; }
button, input { font: inherit; color: inherit; max-width: 100%; }
button { cursor: pointer; }
input { font-size: 16px; }
#app { height: 100%; }

h1, h2, .display, .logo, .btn.primary, .hack-btn {
  font-family: Fredoka, Arial Rounded MT Bold, sans-serif;
  font-weight: 700;
  letter-spacing: -0.015em;
}
#guess, .password-pill, .tile, .slot, .url-bar, .att-ch, .log-count, .log-empty {
  font-family: 'Share Tech Mono', ui-monospace, monospace;
}

.logo {
  font-family: 'Press Start 2P', monospace;
  color: #fbbf24;
  white-space: pre-line;
  font-size: clamp(16px, 2.2vw, 24px);
  line-height: 1.55;
  letter-spacing: 0.02em;
}
.muted { color: var(--ui-muted); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stack { display: grid; gap: 10px; max-width: 520px; width: 100%; margin: 0 auto; }

.screen {
  height: 100%;
  padding: 20px 18px 28px;
  overflow: auto;
  color: var(--ui-text);
  background:
    radial-gradient(circle at 20% 10%, rgba(56, 189, 248, 0.1), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(251, 191, 36, 0.08), transparent 48%),
    var(--ui-bg);
}

.card {
  background: var(--ui-panel);
  border: 1px solid var(--ui-border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.36);
}

/* Unified Dark-Glass & 3D Game Button Hierarchy */
.btn, .mini, .btn-ghost, .btn-glass {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f1f5f9;
  border-radius: 11px;
  padding: 9px 14px;
  min-height: 40px;
  font-size: 14px;
  font-weight: 600;
  backdrop-filter: blur(6px);
  transition: background 130ms ease, border-color 130ms ease, transform 80ms ease;
}
.btn { min-height: 46px; font-size: 15px; }
.mini { min-height: 34px; padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn:hover:not(:disabled), .mini:hover:not(:disabled), .btn-ghost:hover:not(:disabled), .btn-glass:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
}
.btn:active:not(:disabled), .mini:active:not(:disabled), .btn-ghost:active:not(:disabled), .btn-glass:active:not(:disabled) {
  transform: translateY(1px);
}
.btn:disabled, .mini:disabled, .btn-glass:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.btn.primary, .hack-btn {
  background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
  color: #1a120c;
  border: 0;
  border-bottom: 4px solid #b45309;
  border-radius: 12px;
  min-height: 48px;
  padding: 10px 18px;
  font-size: 16px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.28);
  transition: filter 120ms ease, transform 80ms ease, border-bottom-width 80ms ease, box-shadow 120ms ease;
}
.btn.primary:hover, .hack-btn:hover {
  filter: brightness(1.06);
  box-shadow: 0 8px 22px rgba(245, 158, 11, 0.42);
}
.btn.primary:active, .hack-btn:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.24);
}
.mini-cta { min-height: 38px; padding: 6px 14px; font-size: 13.5px; }

.btn-green {
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%);
  color: #052e16;
  border: 0;
  border-bottom: 4px solid #15803d;
  border-radius: 12px;
  font-weight: 800;
}

.coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  min-height: 32px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #bae6fd;
  font-weight: 700;
  font-size: 13px;
}

.secret-note {
  font-size: 13.5px;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(34, 197, 94, 0.14);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #bbf7d0;
}

/* Overlays, Toast, Ad Stub, Ghost Drag */
#toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translate(-50%) translateY(20px);
  z-index: 80;
  color: #fff;
  background: #1e293b;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 999px;
  max-width: min(420px, 92vw);
  padding: 10px 16px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}
#toast.show { opacity: 1; transform: translate(-50%) translateY(0); }

#ad {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(5, 8, 16, 0.78);
  backdrop-filter: blur(4px);
  display: none;
  place-items: center;
  padding: 16px;
}
#ad.show { display: grid; }
.ad-card {
  background: #162238;
  color: #f1f5f9;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 18px;
  width: min(420px, 100%);
  padding: 18px;
  display: grid;
  gap: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}
.ad-kicker { font-size: 11px; letter-spacing: 0.08em; color: #38bdf8; font-weight: 700; }
.ad-row { display: flex; gap: 10px; flex-wrap: wrap; }

#ghost {
  position: fixed;
  z-index: 70;
  pointer-events: none;
  background: #fde68a;
  color: #1a120c;
  border: 2px solid #f59e0b;
  border-radius: 10px;
  padding: 6px 10px;
  font-weight: 700;
  display: none;
}

.shake { animation: 0.4s linear shake; }
@keyframes shake {
  20% { transform: translate(-6px); }
  40% { transform: translate(6px); }
  60% { transform: translate(-3px); }
  80% { transform: translate(3px); }
}

/* BYTE Animations */
.byte-idle { animation: 1.8s ease-in-out infinite bob; }
.byte-wink { animation: 0.45s squish; }
.byte-laughing { animation: 0.5s squish; }
.byte-shocked { animation: 0.4s linear shake; }
.byte-celebrating { animation: 0.45s infinite alternate hop; }
@keyframes bob { 50% { transform: translateY(-4px); } }
@keyframes squish { 40% { transform: scale(1.12, 0.88); } to { transform: none; } }
@keyframes hop { to { transform: translateY(-7px) rotate(-4deg); } }

@media (prefers-reduced-motion: reduce) {
  .byte-idle, .byte-wink, .byte-laughing, .byte-shocked, .byte-celebrating,
  .shake, .tut-hand, .access-banner, .comic-still, .flash, .bars, .glitch-in .hero-portrait {
    animation: none !important;
  }
}

.sr {
  clip: rect(0 0 0 0);
  width: 1px;
  height: 1px;
  position: absolute;
  overflow: hidden;
}
