/* ============================================================
   Pokemon Emerald Online — Cartoon Colorful Browser-Game Theme
   Vivid colors, chunky 3D button shadows, rounded "bouncy" cards.
   All original class/ID names preserved so app-online.js keeps working.
   ============================================================ */

:root {
  /* vivid palette */
  --sky-1: #4fc3f7;
  --sky-2: #7e57ff;
  --grass-1: #7ed957;
  --grass-2: #2fb457;
  --sun: #ffd23f;
  --coral: #ff6b6b;
  --berry: #ff7eb6;

  --panel: #ffffff;
  --panel-edge: #2b2b46;
  --cream: #fff8e1;
  --text: #2b2b46;
  --muted: #6b6b88;

  --mint: #2fb457;
  --mint-light: #7ed957;
  --mint-shadow: #1c7a39;
  --gold: #ffb43f;
  --gold-shadow: #c97a13;
  --blue: #4fc3f7;
  --blue-shadow: #2a7fc0;
  --red: #ff6b6b;
  --red-shadow: #c0303a;
  --purple: #9b6bff;
  --purple-shadow: #6a37c2;

  --ink: #ffffff;
  --shadow: #1a1a2e;

  color: var(--text);
  background: var(--sky-1);
  font-family: "Baloo 2", "Nunito", "Trebuchet MS", Verdana, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  min-height: 100dvh;
  margin: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  background:
    radial-gradient(circle at 12% 8%, rgba(255,255,255,.55) 0 6px, transparent 7px) 0 0 / 120px 120px,
    radial-gradient(120% 120% at 15% 0%, var(--sky-1) 0%, var(--blue) 35%, var(--sky-2) 100%);
  background-attachment: fixed;
}

/* floating clouds decoration */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(60px 28px at 20% 18%, #ffffffcc 0 60%, transparent 62%),
    radial-gradient(80px 34px at 78% 30%, #ffffffb3 0 60%, transparent 62%),
    radial-gradient(50px 24px at 60% 75%, #ffffffaa 0 60%, transparent 62%),
    radial-gradient(70px 30px at 12% 80%, #ffffffbb 0 60%, transparent 62%);
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(100vw, 860px);
  max-width: 100vw;
  min-height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  display: grid;
  grid-template-areas:
    "masthead"
    "display"
    "status"
    "controls"
    "keys";
  grid-template-rows: auto auto auto auto auto;
  gap: clamp(12px, 2.6vw, 20px);
  align-content: center;
  justify-items: stretch;
  overflow-x: clip;
}

.shell:fullscreen {
  width: 100vw;
  height: 100vh;
  min-height: 0;
  max-width: none;
  background: linear-gradient(160deg, var(--sky-1), var(--sky-2));
}

.shell > *,
.masthead > * { min-width: 0; }

/* ---------- Masthead / logo ---------- */
.masthead {
  grid-area: masthead;
  display: grid;
  justify-items: center;
  gap: clamp(4px, .8vmin, 9px);
}

.github-link {
  display: inline-flex;
  align-items: center;
  gap: .42em;
  color: #fff;
  font-size: clamp(13px, 2.6vw, 20px);
  font-weight: 700;
  text-decoration: none;
  background: var(--purple);
  padding: 6px 14px;
  border-radius: 999px;
  border: 3px solid #fff;
  box-shadow: 0 4px 0 var(--purple-shadow);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.github-link:hover,
.github-link:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--purple-shadow);
}
.github-link svg {
  width: 1.1em; height: 1.1em; display: block; fill: #fff;
}

h1 {
  width: 100%;
  max-width: 100%;
  margin: 0;
  color: #fff;
  font-size: clamp(28px, 8vw, 56px);
  line-height: .9;
  letter-spacing: -.02em;
  text-align: center;
  font-weight: 900;
  text-shadow:
    0 3px 0 var(--grass-2),
    0 6px 0 #1c7a39,
    0 9px 12px rgba(0,0,0,.35);
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ---------- Game display card ---------- */
.display-panel {
  grid-area: display;
  position: relative;
  width: min(100%, 64dvh);
  min-height: 0;
  aspect-ratio: 3 / 2;
  padding: clamp(8px, 1.6vmin, 16px);
  justify-self: center;
  display: grid;
  place-items: center;
  border: 5px solid #fff;
  border-radius: clamp(18px, 4vmin, 36px);
  background: linear-gradient(160deg, #2fb457, #1c7a39);
  box-shadow:
    0 10px 0 #145c2b,
    0 18px 30px rgba(0,0,0,.4),
    inset 0 2px 0 #ffffff55;
}

#screen,
#overlay {
  grid-area: 1 / 1;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  aspect-ratio: 3 / 2;
  display: block;
  object-fit: contain;
  image-rendering: pixelated;
  border-radius: clamp(8px, 1.6vmin, 18px);
  border: 4px solid #0e3d1e;
  box-shadow: inset 0 0 0 3px #ffffff66;
}

#screen { background: #f8f8f8; }
#overlay { background: transparent; pointer-events: none; }

/* ---------- Status line ---------- */
.status {
  grid-area: status;
  min-height: 1.25em;
  -webkit-user-select: none;
  user-select: none;
  color: #fff;
  background: #2b2b46;
  border: 3px solid #fff;
  border-radius: 999px;
  padding: 4px 16px;
  font-size: clamp(12px, 3.2vw, 17px);
  font-weight: 700;
  text-align: center;
  box-shadow: 0 4px 0 #15152a;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* ---------- Controls ---------- */
.controls {
  grid-area: controls;
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 2.5vw, 18px);
}

.dpad,
.face {
  min-width: 0;
  display: grid;
  gap: clamp(6px, 1.7vw, 12px);
  justify-content: center;
  justify-items: center;
}

.dpad {
  grid-template-columns: repeat(3, clamp(38px, 11vw, 58px));
  grid-template-rows: repeat(2, clamp(38px, 11vw, 58px));
}
.dpad [data-key='up']    { grid-column: 2; }
.dpad [data-key='left']  { grid-column: 1; grid-row: 2; }
.dpad [data-key='right'] { grid-column: 3; grid-row: 2; }
.dpad [data-key='down']  { grid-column: 2; grid-row: 2; }

.face {
  grid-template-columns: repeat(2, auto);
  justify-content: center;
}

/* ---------- Chunky 3D buttons (UI chrome only) ----------
   IMPORTANT: the heavy 3D box-shadow is applied ONLY to the on-page
   control buttons (.dpad/.face/.utility/.speed), NOT to the generic
   `button` selector. The in-game HTML overlays (duel/trade/interact
   menus) reuse <button> and must stay flat so they look like the
   game's own UI, not the emulator chrome. */
button,
.upload-save {
  min-width: 0;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  border: 0;
  border-radius: 16px;
  color: #fff;
  background: var(--blue);
  font: inherit;
  font-size: clamp(13px, 3.8vw, 18px);
  font-weight: 900;
  cursor: pointer;
  touch-action: none;
}

/* specific button colors (control chrome) */
.dpad button { background: var(--purple); box-shadow: 0 6px 0 var(--purple-shadow); }
.dpad button:hover { box-shadow: 0 7px 0 var(--purple-shadow); }
.dpad button:active { transform: translateY(6px); box-shadow: 0 0 0 var(--purple-shadow); }

.face button[data-key='a']     { background: var(--mint-light); box-shadow: 0 6px 0 var(--mint-shadow); }
.face button[data-key='a']:active { transform: translateY(6px); box-shadow: 0 0 0 var(--mint-shadow); }
.face button[data-key='b']     { background: var(--coral); box-shadow: 0 6px 0 var(--red-shadow); }
.face button[data-key='b']:active { transform: translateY(6px); box-shadow: 0 0 0 var(--red-shadow); }
.face button[data-key='start'],
.face button[data-key='select'] { background: var(--gold); box-shadow: 0 6px 0 var(--gold-shadow); color: #4a2c00; }
.face button[data-key='start']:active,
.face button[data-key='select']:active { transform: translateY(6px); box-shadow: 0 0 0 var(--gold-shadow); }

.speed-control,
.utility-controls {
  grid-column: 1 / -1;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  display: grid;
  min-width: 0;
  gap: clamp(8px, 1.8vw, 14px);
}

.audio-controls {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.8vw, 14px);
  min-width: 0;
}
.audio-controls #mute-toggle {
  flex: 0 0 auto;
  font-size: clamp(16px, 4vw, 22px);
  line-height: 1;
  padding: clamp(6px, 1.4vw, 12px) clamp(10px, 2vw, 18px);
  background: var(--berry);
  box-shadow: 0 6px 0 #d44e93;
}
.audio-controls #mute-toggle:active { transform: translateY(6px); box-shadow: 0 0 0 #d44e93; }
.audio-controls #volume-slider {
  flex: 1 1 auto;
  min-width: 0;
  accent-color: var(--mint);
  cursor: pointer;
  height: 10px;
}
.audio-controls #volume-value {
  flex: 0 0 auto;
  color: #fff;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  font-size: clamp(12px, 3.4vw, 15px);
  min-width: 3.5ch;
  text-align: right;
}

.speed-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: #fff;
  font-size: clamp(14px, 4vw, 18px);
  font-weight: 900;
  text-shadow: 0 2px 0 #2a7fc0;
}
#speed-value { color: var(--sun); font-variant-numeric: tabular-nums; }

.speed-buttons,
.utility-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.speed-buttons { display: grid; gap: clamp(7px, 1.7vw, 14px); }

#fullscreen,
#duel-challenge { grid-column: 1 / -1; }
#duel-challenge { background: var(--coral); box-shadow: 0 6px 0 var(--red-shadow); }
#duel-challenge:active { transform: translateY(6px); box-shadow: 0 0 0 var(--red-shadow); }

.upload-save {
  display: grid;
  place-items: center;
  background: var(--mint-light);
  box-shadow: 0 6px 0 var(--mint-shadow);
}
.upload-save:active { transform: translateY(6px); box-shadow: 0 0 0 var(--mint-shadow); }

#upload-save {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.keys {
  grid-area: keys;
  margin: 0;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  color: #fff;
  background: #2b2b46cc;
  border: 3px solid #fff;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: clamp(12px, 3.5vw, 15px);
  font-weight: 700;
  text-align: center;
  box-shadow: 0 4px 0 #15152a;
}

/* ============================================================
   AUTH / ONLINE PAGE (online.html)
   ============================================================ */
.auth-panel,
.rom-upload-panel,
.progress-panel {
  /* these use inline grid display toggled by JS; theme them as cards */
  background: var(--panel);
  border: 4px solid var(--panel-edge);
  border-radius: 22px;
  box-shadow: 0 8px 0 #d9d9e8, 0 16px 30px rgba(0,0,0,.25);
  color: var(--text);
}

.auth-panel h2,
.rom-upload-panel h2,
.progress-panel h3 {
  margin: 0;
  color: var(--mint-shadow);
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 900;
  text-align: center;
  letter-spacing: -.01em;
}

/* login/signup toggle tabs */
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 4px;
}
.auth-tab {
  border: 3px solid var(--panel-edge);
  border-radius: 14px;
  background: #eef0f8;
  color: var(--muted);
  font-weight: 900;
  font-size: 15px;
  padding: 10px;
  cursor: pointer;
  box-shadow: 0 4px 0 #d9d9e8;
  transition: transform 80ms, box-shadow 80ms;
}
.auth-tab.active {
  background: var(--mint-light);
  color: #fff;
  border-color: var(--mint-shadow);
  box-shadow: 0 4px 0 var(--mint-shadow);
}
.auth-tab:active { transform: translateY(4px); box-shadow: 0 0 0 var(--mint-shadow); }

.form-group { display: grid; gap: 6px; }
.form-group label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}
.form-group input {
  padding: 12px 14px;
  border: 3px solid #d9d9e8;
  border-radius: 14px;
  background: #f6f7fc;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px #4fc3f755;
}

.btn-primary {
  padding: 14px 24px;
  border: 3px solid #fff;
  border-radius: 16px;
  background: var(--mint);
  box-shadow: 0 6px 0 var(--mint-shadow);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 80ms, box-shadow 80ms;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 7px 0 var(--mint-shadow); }
.btn-primary:active { transform: translateY(6px); box-shadow: 0 0 0 var(--mint-shadow); }

.btn-secondary {
  background: var(--gold);
  box-shadow: 0 6px 0 var(--gold-shadow);
  color: #4a2c00;
}
.btn-secondary:active { box-shadow: 0 0 0 var(--gold-shadow); }

.error-message {
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  min-height: 1em;
}

/* ROM dropzone */
.rom-drop-zone {
  padding: 48px 20px;
  border: 4px dashed var(--blue);
  border-radius: 18px;
  text-align: center;
  cursor: pointer;
  background: #eaf6ff;
  transition: border-color .2s, background .2s, transform .1s;
}
.rom-drop-zone:hover,
.rom-drop-zone.dragover {
  border-color: var(--mint);
  background: #e6fff1;
  transform: scale(1.01);
}
.rom-drop-zone .icon { font-size: 52px; margin-bottom: 12px; }
.rom-drop-zone .text { color: var(--text); font-size: 18px; font-weight: 900; margin-bottom: 8px; }
.rom-drop-zone .hint { color: var(--muted); font-size: 13px; font-weight: 600; }

/* progress */
.progress-bar {
  width: 100%;
  height: 26px;
  background: #eef0f8;
  border: 3px solid #d9d9e8;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--mint-light), var(--mint));
  border-radius: 999px;
  transition: width .3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}
.progress-text { color: var(--muted); font-size: 13px; text-align: center; font-weight: 700; }

.stats-panel {
  gap: 8px;
  padding: 12px;
  background: #f6f7fc;
  border-radius: 12px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

/* game + chat layout: lobby */
.game-panel { display: grid; gap: 12px; }
.chat-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--panel);
  border: 4px solid var(--panel-edge);
  border-radius: 18px;
  box-shadow: 0 8px 0 #d9d9e8, 0 16px 30px rgba(0,0,0,.2);
  max-height: 220px;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  max-height: 130px;
  padding: 10px;
  background: #f6f7fc;
  border: 3px solid #d9d9e8;
  border-radius: 12px;
  font-size: 13px;
}
.chat-message { margin-bottom: 4px; color: var(--text); }
.chat-message.system { color: var(--muted); font-style: italic; }
.chat-username { color: var(--mint-shadow); font-weight: 900; }
.chat-input { display: flex; gap: 8px; }
.chat-input input {
  flex: 1;
  padding: 10px 12px;
  border: 3px solid #d9d9e8;
  border-radius: 12px;
  background: #f6f7fc;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.chat-input input:focus { outline: none; border-color: var(--blue); }
.chat-input button {
  padding: 8px 16px;
  border: 3px solid #fff;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}
.chat-input button:hover { box-shadow: none; }
.chat-input button:active { transform: translateY(2px); box-shadow: none; }

/* btn-primary used by auth/disconnect/clouds — keep its 3D look */
.btn-primary {
  border: 3px solid #fff;
  box-shadow: 0 6px 0 var(--mint-shadow);
  transition: transform 80ms, box-shadow 80ms;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 7px 0 var(--mint-shadow); }
.btn-primary:active { transform: translateY(6px); box-shadow: 0 0 0 var(--mint-shadow); }
.btn-secondary {
  box-shadow: 0 6px 0 var(--gold-shadow);
}
.btn-secondary:active { transform: translateY(6px); box-shadow: 0 0 0 var(--gold-shadow); }

/* game controls inside lobby get rounded cards */
#game-controls {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: var(--panel);
  border: 4px solid var(--panel-edge);
  border-radius: 22px;
  box-shadow: 0 8px 0 #d9d9e8, 0 16px 30px rgba(0,0,0,.2);
}

.disconnect-box {
  display: grid;
  gap: 16px;
  padding: 28px;
  max-width: 300px;
  text-align: center;
  background: var(--panel);
  border: 4px solid var(--panel-edge);
  border-radius: 22px;
  box-shadow: 0 8px 0 #d9d9e8, 0 20px 40px rgba(0,0,0,.4);
}
.disconnect-box h2 { margin: 0; color: var(--mint-shadow); font-size: 24px; font-weight: 900; }
.disconnect-box p { margin: 0; color: var(--text); font-size: 14px; line-height: 1.4; font-weight: 600; }
.disconnect-box .btn-primary { background: var(--mint); }

/* keep in-game overlays (duel/trade menus) untouched — those are styled inline in online.html */

/* ============================================================
   FULLSCREEN GAME MODE (online.html, after ROM loads)
   Hides emulator chrome; the game canvas fills the viewport.
   ============================================================ */
body.game-active {
  background: #0a0a14;
  overflow: hidden;
}
body.game-active::before { display: none; }
body.game-active .shell {
  width: 100vw;
  height: 100dvh;
  min-height: 0;
  padding: 0;
  gap: 0;
  display: block;
  place-items: stretch;
}
body.game-active .masthead,
body.game-active .status,
body.game-active .controls,
body.game-active .keys,
body.game-active #game-controls,
body.game-active #keys-info {
  display: none !important;
}
body.game-active #game-display {
  display: grid !important;
  place-items: center;
  width: 100vw;
  height: 100dvh;
  min-height: 0;
  padding: 0;
  background:
    radial-gradient(120% 120% at 50% 0%, #7ed957 0%, #2fb457 45%, #1c7a39 100%);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}

/* The wrap is the container; its size equals the visible game area. The
   stage's base font-size is expressed in cqw (1% of the wrap width) so all
   in-game menus that use `em` scale proportionally with the canvas size.
   Zoom (--game-scale) is applied on top via transform. */
body.game-active #game-stage-wrap {
  container-type: size;
  width: min(100vw, 150dvh);
  height: min(66.66vw, 100dvh);
  display: grid;
  place-items: center;
}

/* The stage IS the game "screen": a console bezel (rounded, thick light
   border, inner shadow) that wraps the canvas. It scales with --game-scale,
   so shrinking the game also shrinks this frame. */
body.game-active #game-stage {
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: 3 / 2;
  font-size: clamp(8px, 2.3cqw, 26px);
  transform: scale(var(--game-scale, 1));
  transform-origin: center center;
  display: grid;
  place-items: center;
  background: #0e3d1e;
  border: clamp(6px, 1.4vmin, 18px) solid #0a2a14;
  border-radius: clamp(10px, 2.4vmin, 28px);
  box-shadow:
    0 clamp(6px, 1.6vmin, 20px) 0 #0a2a14,
    0 clamp(12px, 3vmin, 36px) rgba(0, 0, 0, 0.45),
    inset 0 0 0 2px #1c7a39;
}

body.game-active #screen,
body.game-active #overlay {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  border: 0;
  border-radius: clamp(2px, 0.6vmin, 6px);
  box-shadow: none;
  image-rendering: pixelated;
}
body.game-active #overlay { pointer-events: none; }

/* In-canvas volume control (bottom-right corner of the game) */
.ingame-audio {
  position: absolute;
  right: 0.8em;
  bottom: 0.8em;
  z-index: 14;
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.4em 0.7em;
  background: rgba(20, 20, 40, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  backdrop-filter: blur(4px);
  transition: opacity .2s;
  font-size: clamp(10px, 1.6cqw, 18px);
}
.ingame-audio button {
  flex: 0 0 auto;
  width: 2.1em;
  height: 2.1em;
  padding: 0;
  border: 2px solid rgba(255,255,255,0.6);
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 1em;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.ingame-audio button:active { transform: scale(0.94); }
.ingame-audio input[type='range'] {
  width: 6em;
  accent-color: var(--mint-light);
  cursor: pointer;
}

/* In-canvas zoom control (top-right corner of the game) */
.ingame-zoom {
  position: absolute;
  top: 0.8em;
  right: 0.8em;
  z-index: 14;
  display: flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.35em 0.55em;
  background: rgba(20, 20, 40, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  backdrop-filter: blur(4px);
  transition: opacity .2s;
  font-size: clamp(10px, 1.6cqw, 18px);
}
.ingame-zoom button {
  flex: 0 0 auto;
  width: 1.9em;
  height: 1.9em;
  padding: 0;
  border: 2px solid rgba(255,255,255,0.6);
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 1.1em;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.ingame-zoom button:active { transform: scale(0.92); }

/* Logout button: transparent by default, turns red on hover */
#ingame-logout {
  background: transparent !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
  color: rgba(255, 255, 255, 0.85);
  transition: background .15s, color .15s, border-color .15s;
}
#ingame-logout:hover {
  background: #ff4d4d !important;
  border-color: #ff4d4d !important;
  color: #fff;
}

/* float-in controls stay subtle until hovered directly (not the whole game) */
.ingame-audio, .ingame-zoom { opacity: 0.35; }
.ingame-audio:hover, .ingame-zoom:hover { opacity: 1; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
  .shell { gap: 9px; align-content: start; }
  .display-panel { width: min(100%, 50dvh); }
  .controls { gap: 8px; }
  .speed-control, .utility-controls, .speed-buttons { gap: 7px; }
}

@media (min-width: 560px) {
  .utility-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #fullscreen, #duel-challenge { grid-column: auto; }
}

@media (min-width: 900px) and (min-aspect-ratio: 6 / 5) {
  body { overflow: hidden; }
  .shell {
    width: min(100vw, 1500px);
    height: 100dvh;
    min-height: 0;
    padding: clamp(10px, 2.1vmin, 24px);
    align-content: center;
  }
  h1 { font-size: clamp(28px, 6.2vmin, 64px); }
  .display-panel { width: min(100%, 70dvh); align-self: center; }
  .dpad { grid-template-columns: repeat(3, clamp(40px, 6.5vmin, 64px)); grid-template-rows: repeat(2, clamp(40px, 6.5vmin, 64px)); }
  button, .upload-save { font-size: clamp(12px, 1.85vmin, 17px); }
  .speed-heading { font-size: clamp(12px, 1.85vmin, 16px); }
  .status { font-size: clamp(11px, 1.7vmin, 16px); }
  .keys { font-size: clamp(10px, 1.45vmin, 14px); }
}

@media (max-width: 380px) {
  .shell { gap: 10px; }
  h1 { font-size: clamp(25px, 8.4vw, 34px); }
  .controls { grid-template-columns: minmax(98px, .8fr) minmax(0, 1.2fr); gap: 10px 8px; }
  .dpad { grid-template-columns: repeat(3, clamp(32px, 10.5vw, 40px)); grid-template-rows: repeat(2, clamp(32px, 10.5vw, 40px)); gap: 6px; }
  button, .upload-save { min-height: 38px; font-size: 12px; }
  .speed-heading, .status, .keys { font-size: 12px; }
}

/* load a rounded font if available (optional progressive enhancement) */
@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@600;700;800;900&display=swap');
