/* ==========================================================================
   TYPING TURBO — arcade.css
   Shared chrome for the four arcade modes (Space Typers, Treasure Typing,
   Keyboard Kingdom, Ocean Word Quest) plus a small section per mode.
   ========================================================================== */

.arcade-screen { background: var(--bg-0); color: var(--txt); }

.arcade-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  touch-action: manipulation;
}
.arcade-canvas { display: block; width: 100%; height: 100%; }

/* Layer modes can drop DOM widgets into (buttons need pointer-events:auto). */
.arcade-ui { position: absolute; inset: 0; pointer-events: none; }
.arcade-ui button, .arcade-ui .arcade-clickable { pointer-events: auto; }

/* ---------------------------------------------------------------- HUD */

.arcade-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
  font-variant-numeric: tabular-nums;
}
.arcade-card {
  background: rgba(8, 11, 26, 0.72);
  border: 1px solid var(--stroke);
  border-radius: 13px;
  padding: 5px 11px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
}
.arcade-card__label { font-size: 0.56rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--txt-faint); font-weight: 900; }
.arcade-card__value { font-size: 1.2rem; font-weight: 900; line-height: 1.1; }
.arcade-card--score .arcade-card__value { color: var(--yellow); }
.arcade-card--wpm .arcade-card__value { color: var(--cyan); }
.arcade-card--acc .arcade-card__value { color: var(--green); }
.arcade-card--special .arcade-card__value { color: #ffd9ec; }
.arcade-pause { pointer-events: auto; margin-left: auto; }

/* ---------------------------------------------------------------- messages */

.arcade-msg {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 15;
}
.arcade-msg--count { background: radial-gradient(circle at 50% 50%, rgba(5, 6, 13, 0.25), rgba(5, 6, 13, 0.65)); }
.arcade-msg__text {
  font-size: clamp(1.6rem, 6vw, 2.8rem);
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.4);
  animation: arcadeMsgPop 0.5s var(--ease-back) both;
}
@keyframes arcadeMsgPop { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- word bar */

.arcade-word {
  position: absolute;
  left: 50%;
  bottom: 100px;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  max-width: min(760px, calc(100% - 16px));
  padding: 8px 18px;
  border-radius: 16px;
  background: rgba(6, 8, 18, 0.82);
  border: 1px solid var(--stroke-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: none;
  z-index: 12;
}
.arcade-word .wchar { font-size: clamp(1.3rem, 4.6vw, 2.2rem); }

/* ---------------------------------------------------------------- controls */

.arcade-controls {
  flex: 0 0 auto;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(5, 6, 13, 0.4), rgba(5, 6, 13, 0.9));
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.arcade-quick { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; width: 100%; }
.arcade-controls__row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ---------------------------------------------------------------- screen flash */

.arcade-flash--good { box-shadow: inset 0 0 90px rgba(60, 233, 123, 0.35); }
.arcade-flash--bad { box-shadow: inset 0 0 90px rgba(255, 77, 94, 0.45); }

/* ---------------------------------------------------------------- results extras */

.arcade-trophy {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-top: 12px;
  padding: 10px 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 224, 122, 0.18), rgba(217, 155, 0, 0.14));
  border: 1px solid rgba(255, 240, 180, 0.5);
  font-weight: 800;
}
.arcade-trophy__icon { font-size: 1.6rem; }

/* ---------------------------------------------------------------- stage picker */

.arcade-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 8px;
}
.arcade-stage-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius);
  border: 1.5px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--txt);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s var(--ease-out), border-color 0.15s, box-shadow 0.15s;
}
.arcade-stage-btn:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--stroke-strong); }
.arcade-stage-btn[aria-pressed="true"] {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(34, 224, 255, 0.28);
  background: rgba(34, 224, 255, 0.1);
}
.arcade-stage-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.arcade-stage-btn__icon { font-size: 1.4rem; flex: 0 0 auto; }
.arcade-stage-btn__name { display: block; font-weight: 800; font-size: 0.84rem; }
.arcade-stage-btn__meta { display: block; font-size: 0.68rem; color: var(--txt-dim); }
.arcade-stage-btn__stars { color: var(--yellow); font-size: 0.82rem; letter-spacing: 1px; margin-left: auto; }

/* ========================================================================== */
/* TREASURE TYPING                                                            */
/* ========================================================================== */

.treasure-grid {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 90px 14px 120px;
  pointer-events: none;
}
.treasure-board {
  pointer-events: auto;
  display: grid;
  gap: 8px;
  width: min(680px, 100%);
}
.treasure-tile {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(46px, 9vh, 74px);
  padding: 6px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(60, 44, 20, 0.85), rgba(30, 22, 10, 0.9));
  border: 2px solid rgba(255, 219, 140, 0.28);
  font-family: var(--mono);
  font-weight: 800;
  font-size: clamp(0.8rem, 2.4vw, 1.5rem);
  color: #ffe9b0;
  cursor: pointer;
  transition: transform 0.12s var(--ease-out), border-color 0.15s, box-shadow 0.15s;
  user-select: none;
}
.treasure-tile:hover { transform: translateY(-2px); }
.treasure-tile.is-focused {
  border-color: #ffe98a;
  box-shadow: 0 0 0 3px rgba(255, 210, 63, 0.3), 0 0 26px rgba(255, 200, 40, 0.5);
  color: #fff;
}
.treasure-tile.is-done {
  background: linear-gradient(180deg, rgba(60, 233, 123, 0.22), rgba(8, 40, 24, 0.9));
  border-color: rgba(60, 233, 123, 0.6);
  color: var(--green);
  cursor: default;
}
.treasure-tile.is-done::after { content: "✔"; position: absolute; top: 4px; right: 6px; font-size: 0.8em; color: var(--green); }
.treasure-tile.is-locked { border-color: rgba(255, 107, 214, 0.55); color: #ffd9ec; }
.treasure-tile.is-clear { opacity: 0.35; }
.treasure-meta { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; pointer-events: none; }
.treasure-foe {
  position: absolute;
  right: 12px;
  top: 84px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(8, 11, 26, 0.8);
  border: 1px solid rgba(255, 77, 94, 0.5);
  font-weight: 800;
  font-size: 0.8rem;
}

/* ========================================================================== */
/* KEYBOARD KINGDOM                                                           */
/* ========================================================================== */

.kingdom-shop {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  padding: 16px;
  pointer-events: none;
}
.kingdom-shop .panel { pointer-events: auto; width: min(620px, 100%); padding: 14px; }
.kingdom-shop__title { text-align: center; margin-bottom: 8px; }
.kingdom-shop__row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.kingdom-gold { color: var(--yellow); font-weight: 900; }

/* ========================================================================== */
/* OCEAN WORD QUEST                                                           */
/* ========================================================================== */

.ocean-oxygen {
  position: absolute;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  width: min(420px, 80%);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.ocean-oxygen .bar { flex: 1 1 auto; height: 12px; }
.ocean-oxygen .bar > i { background: linear-gradient(90deg, var(--cyan), var(--green)); }
.ocean-oxygen.is-low .bar > i { background: linear-gradient(90deg, var(--red), var(--orange)); }

/* ========================================================================== */
/* RESPONSIVE                                                                 */
/* ========================================================================== */

@media (max-width: 620px) {
  .arcade-card__value { font-size: 1rem; }
  .arcade-word { bottom: 96px; padding: 6px 12px; }
  .treasure-grid { padding: 76px 8px 116px; }
  .treasure-board { gap: 6px; }
  .arcade-hud { gap: 6px; }
}
@media (max-height: 480px) {
  .arcade-word { bottom: 84px; }
  .treasure-grid { padding: 60px 8px 100px; }
}
