:root {
  color-scheme: light;
  --ink: #21313a;
  --muted: #557179;
  --panel: rgba(255, 250, 222, 0.84);
  --line: rgba(42, 84, 92, 0.16);
  --accent: #f76d2d;
  --accent-dark: #c07114;
  --sun: #ffd33d;
  --shadow: 0 16px 36px rgba(43, 102, 124, 0.18);
  --shadow-strong: 0 28px 70px rgba(43, 102, 124, 0.24);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #85cfea;
  color: var(--ink);
}

button,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.game-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 241, 172, 0.28), transparent 36%),
    linear-gradient(180deg, #82d2ec 0%, #a9e5f2 56%, #f1cb78 100%);
}

#world {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

#world:active {
  cursor: grabbing;
}

#world.world-cursor-pointer {
  cursor: pointer;
}

#world.world-cursor-pointer:active {
  cursor: pointer;
}

.hud {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.brand,
.compass,
.learning-prompt,
.store-prompt,
.character-prompt,
.player-prompt,
.arcade-prompt,
.learning-panel,
.store-panel,
.character-panel,
.build-blocks-panel,
.multiplayer-chat-panel,
.arcade-panel,
.arcade-detail-panel,
.help-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: min(390px, calc(100vw - 120px));
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
}

.mark {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border: 3px solid #fff6d8;
  border-radius: 8px;
  background:
    radial-gradient(circle at 36% 36%, #fff6d8 0 7%, transparent 8%),
    radial-gradient(circle at 64% 64%, #fff6d8 0 7%, transparent 8%),
    radial-gradient(circle at 50% 38%, var(--sun) 0 18%, transparent 19%),
    linear-gradient(145deg, #f3c24d 0 48%, #e25b3f 49% 100%);
  box-shadow: inset 0 -5px 0 rgba(192, 113, 20, 0.24);
}

.brand h1,
.brand p,
.help-panel h2,
.help-panel p {
  margin: 0;
}

.brand h1 {
  font-size: clamp(1.05rem, 2.3vw, 1.45rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.brand p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.88rem;
}

.hud-actions {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  pointer-events: auto;
}

.zoom-controls {
  display: flex;
  gap: 6px;
  padding: 0;
}

.wallet {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(42, 84, 92, 0.18);
  border-radius: 8px;
  background: rgba(255, 250, 220, 0.84);
  box-shadow: var(--shadow);
  font-weight: 850;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.wallet span {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 8px;
  background: var(--sun);
  color: var(--ink);
  font-size: 0.72rem;
  box-shadow: inset 0 -5px 0 rgba(192, 113, 20, 0.18);
}

.wallet strong {
  min-width: 2ch;
  text-align: right;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(42, 84, 92, 0.18);
  border-radius: 8px;
  background: rgba(255, 250, 220, 0.88);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-weight: 900;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.zoom-reset {
  width: 50px;
  font-size: 0.82rem;
}

.build-button {
  width: 60px;
  font-size: 0.72rem;
}

.chat-button {
  position: relative;
  width: 58px;
  font-size: 0.7rem;
}

.chat-button.has-unread::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 9px;
  height: 9px;
  border: 2px solid #fffaf0;
  border-radius: 50%;
  background: var(--accent);
}

.icon-button:hover,
.icon-button:focus-visible,
.primary-button:hover,
.primary-button:focus-visible,
.secondary-button:hover,
.secondary-button:focus-visible,
.plain-button:hover,
.plain-button:focus-visible,
input[type="text"]:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(255, 211, 61, 0.36);
  outline-offset: 2px;
}

.icon-button:disabled {
  cursor: default;
  opacity: 0.46;
}

.compass {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 2;
  width: 128px;
  height: 128px;
  overflow: hidden;
  border-radius: 8px;
}

#miniMap {
  display: block;
  width: 100%;
  height: 100%;
}

.learning-prompt,
.store-prompt,
.character-prompt,
.player-prompt,
.arcade-prompt {
  position: absolute;
  left: 50%;
  bottom: 24px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: min(360px, calc(100vw - 36px));
  padding: 12px;
  border-radius: 8px;
  transform: translateX(-50%);
}

.learning-prompt[hidden],
.store-prompt[hidden],
.character-prompt[hidden],
.player-prompt[hidden],
.arcade-prompt[hidden],
.learning-panel[hidden],
.store-panel[hidden],
.character-panel[hidden],
.build-blocks-panel[hidden],
.multiplayer-chat-panel[hidden],
.arcade-panel[hidden],
.arcade-detail-panel[hidden] {
  display: none;
}

.learning-prompt div,
.store-prompt div,
.character-prompt div,
.player-prompt div,
.arcade-prompt div {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.learning-prompt strong,
.store-prompt strong,
.character-prompt strong,
.player-prompt strong,
.arcade-prompt strong {
  overflow: hidden;
  font-size: 0.98rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.learning-prompt span,
.store-prompt span,
.character-prompt span,
.player-prompt span,
.arcade-prompt span {
  color: var(--muted);
  font-size: 0.82rem;
}

.character-role {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  align-items: center;
  min-height: 18px;
  padding: 1px 7px;
  border: 1px solid rgba(42, 84, 92, 0.16);
  border-radius: 8px;
  background: rgba(255, 211, 61, 0.26);
  color: var(--ink);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.1;
  text-transform: uppercase;
}

.learning-prompt .primary-button,
.store-prompt .primary-button,
.character-prompt .primary-button,
.player-prompt .primary-button,
.arcade-prompt .primary-button {
  flex: 0 0 auto;
  min-width: 84px;
}

.learning-panel,
.store-panel,
.character-panel,
.build-blocks-panel,
.multiplayer-chat-panel,
.arcade-panel,
.arcade-detail-panel {
  position: absolute;
  top: 96px;
  right: 18px;
  z-index: 4;
  display: grid;
  gap: 16px;
  width: min(430px, calc(100vw - 36px));
  max-height: calc(100vh - 132px);
  max-height: calc(100svh - 132px);
  overflow: auto;
  padding: 16px;
  border-radius: 8px;
  box-shadow: var(--shadow-strong);
}

.arcade-panel {
  width: min(520px, calc(100vw - 36px));
}

.arcade-detail-panel {
  width: min(480px, calc(100vw - 36px));
}

.learning-panel__header,
.store-panel__header,
.character-panel__header,
.build-blocks-panel__header,
.multiplayer-chat-panel__header,
.arcade-panel__header,
.arcade-detail-panel__header,
.mini-game__meta,
.mini-game__actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.learning-panel__header p,
.learning-panel__header h2,
.store-panel__header p,
.store-panel__header h2,
.character-panel__header p,
.character-panel__header h2,
.build-blocks-panel__header p,
.build-blocks-panel__header h2,
.multiplayer-chat-panel__header p,
.multiplayer-chat-panel__header h2,
.arcade-panel__header p,
.arcade-panel__header h2,
.arcade-detail-panel__header p,
.arcade-detail-panel__header h2,
.mini-game h3,
.mini-game p {
  margin: 0;
}

.learning-panel__header p,
.store-panel__header p,
.character-panel__header p,
.build-blocks-panel__header p,
.multiplayer-chat-panel__header p,
.arcade-panel__header p,
.arcade-detail-panel__header p,
.arcade-panel__eyebrow,
.store-points,
.character-safety,
.multiplayer-chat-safety,
.mini-game__meta,
.mini-game__feedback {
  color: var(--muted);
  font-size: 0.82rem;
}

.character-panel__header .character-role {
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 0.68rem;
}

.learning-panel__header h2,
.store-panel__header h2,
.character-panel__header h2,
.build-blocks-panel__header h2,
.multiplayer-chat-panel__header h2,
.arcade-panel__header h2,
.arcade-detail-panel__header h2,
.mini-game h3 {
  margin-top: 2px;
  font-size: 1.1rem;
  line-height: 1.08;
}

.learning-panel__header .plain-button,
.store-panel__header .plain-button,
.character-panel__header .plain-button,
.build-blocks-panel__header .plain-button,
.multiplayer-chat-panel__header .plain-button,
.arcade-panel__header .plain-button,
.arcade-detail-panel__header .plain-button {
  min-height: 34px;
  padding: 0 10px;
}

.learning-launcher,
.store-items {
  display: grid;
  gap: 10px;
}

.learning-launcher[hidden] {
  display: none;
}

.build-block-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.build-block-piece {
  appearance: none;
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 86px;
  padding: 7px 6px 8px;
  border: 1px solid rgba(42, 84, 92, 0.18);
  border-radius: 8px;
  background: rgba(255, 250, 220, 0.88);
  color: var(--ink);
  box-shadow: inset 0 -6px 0 rgba(43, 102, 124, 0.08);
}

.build-block-piece[aria-pressed="true"] {
  border-color: rgba(192, 113, 20, 0.42);
  background: #fff1a8;
  box-shadow:
    inset 0 0 0 3px rgba(255, 250, 220, 0.76),
    inset 0 -6px 0 rgba(192, 113, 20, 0.14);
}

.build-block-piece__icon {
  width: 34px;
  height: 26px;
  background: var(--block-color);
  border: 1px solid rgba(42, 84, 92, 0.22);
  box-shadow: inset 0 -7px 0 rgba(33, 49, 58, 0.14);
}

.build-block-piece__icon--cylinder,
.build-block-piece__icon--polyCylinder,
.build-block-piece__icon--lowSphere,
.build-block-piece__icon--dodeca {
  border-radius: 50%;
}

.build-block-piece__icon--cone,
.build-block-piece__icon--roof,
.build-block-piece__icon--wedge,
.build-block-piece__icon--sail,
.build-block-piece__icon--fin {
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.build-block-piece__icon--terrain,
.build-block-piece__icon--water {
  height: 16px;
  margin-top: 6px;
}

.build-block-piece__preview {
  display: grid;
  width: 68px;
  max-width: 100%;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(42, 84, 92, 0.12);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255, 241, 168, 0.28), rgba(130, 210, 236, 0.16)),
    rgba(255, 250, 220, 0.56);
  box-shadow: inset 0 -5px 0 rgba(43, 102, 124, 0.06);
  overflow: hidden;
}

.build-block-piece__preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.build-block-piece span:last-child {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 820;
  line-height: 1;
  text-overflow: ellipsis;
  text-transform: uppercase;
}

.build-blocks-panel__footer {
  display: flex;
  align-items: center;
  gap: 10px;
}

.build-blocks-panel__footer strong {
  flex: 0 1 180px;
  min-width: 120px;
  color: var(--ink);
  font-size: 0.86rem;
}

.build-blocks-panel {
  position: absolute;
  inset: 18px;
  top: 18px;
  right: 18px;
  bottom: 18px;
  left: 18px;
  z-index: 6;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: auto;
  max-height: none;
  padding: 18px;
}

.build-blocks-layout {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(420px, 1fr);
  gap: 16px;
  min-height: 0;
}

.build-blocks-tools,
.build-editor {
  min-height: 0;
}

.build-blocks-tools {
  display: grid;
  align-content: start;
  gap: 14px;
  overflow: auto;
}

.build-blocks-panel .build-block-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.build-editor {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 12px;
}

.build-editor-stage {
  position: relative;
  min-height: 0;
  border: 1px solid rgba(42, 84, 92, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 250, 222, 0.34), rgba(130, 210, 236, 0.14)),
    rgba(255, 250, 222, 0.22);
  overflow: hidden;
}

#buildEditorCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 360px;
  touch-action: none;
}

.build-editor-status {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid rgba(42, 84, 92, 0.16);
  border-radius: 8px;
  background: rgba(255, 250, 220, 0.86);
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1;
  text-transform: uppercase;
}

.build-editor-cell {
  appearance: none;
  position: relative;
  min-width: 0;
  min-height: 52px;
  aspect-ratio: 1;
  border: 1px solid rgba(42, 84, 92, 0.16);
  border-radius: 8px;
  background: rgba(255, 250, 220, 0.72);
  box-shadow: inset 0 -5px 0 rgba(43, 102, 124, 0.08);
}

.build-editor-cell.is-selected {
  border-color: rgba(192, 113, 20, 0.42);
  background: rgba(255, 241, 168, 0.5);
}

.build-editor-block {
  position: absolute;
  left: 50%;
  bottom: calc(8px + var(--stack-index) * 9px);
  width: 30px;
  height: 22px;
  transform: translateX(-50%);
  border: 1px solid rgba(42, 84, 92, 0.22);
  border-radius: 3px;
  background: var(--block-color);
  box-shadow: inset 0 -6px 0 rgba(33, 49, 58, 0.14);
}

.build-editor-block--cylinder,
.build-editor-block--polyCylinder,
.build-editor-block--lowSphere,
.build-editor-block--dodeca {
  border-radius: 50%;
}

.build-editor-block--cone,
.build-editor-block--roof,
.build-editor-block--wedge,
.build-editor-block--sail,
.build-editor-block--fin {
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.build-editor-actions,
.build-editor-modes {
  display: grid;
  gap: 10px;
}

.build-editor-modes {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.build-editor-modes button[aria-pressed="true"] {
  border-color: rgba(192, 113, 20, 0.42);
  background: #fff1a8;
  box-shadow: inset 0 0 0 3px rgba(255, 250, 220, 0.72);
}

.build-editor-actions {
  grid-template-columns: auto auto minmax(140px, 1fr);
}
.learning-game-button,
.store-item,
.mini-game__choices button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 220, 0.82);
  color: var(--ink);
  text-align: left;
  box-shadow: inset 0 -5px 0 rgba(37, 40, 61, 0.12);
}

.learning-game-button {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  min-height: 74px;
  padding: 10px;
}

.learning-game-button:hover,
.learning-game-button:focus-visible,
.store-item button:hover,
.store-item button:focus-visible,
.mini-game__choices button:hover,
.mini-game__choices button:focus-visible {
  outline: 3px solid rgba(255, 211, 61, 0.36);
  outline-offset: 2px;
}

.learning-game-button span {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--game-color);
  color: #fffaf0;
  font-weight: 900;
  box-shadow: inset 0 -6px 0 rgba(33, 49, 58, 0.14);
}

.learning-game-button strong {
  display: block;
  font-size: 0.96rem;
}

.learning-game-button small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

.store-points {
  margin: -4px 0 0;
}

.store-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 10px;
}

.store-item__swatch {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(42, 84, 92, 0.22);
  border-radius: 8px;
  background: var(--item-color);
  box-shadow: inset 0 -7px 0 rgba(33, 49, 58, 0.14);
}

.store-item strong,
.store-item small {
  display: block;
}

.store-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

.store-item button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 220, 0.86);
  color: var(--ink);
  padding: 0 12px;
  font-weight: 820;
  white-space: nowrap;
}

.store-item button:disabled {
  cursor: default;
  opacity: 0.55;
}

.mini-game {
  display: grid;
  gap: 14px;
}

.mini-game[hidden] {
  display: none;
}

.mini-game__meta strong {
  color: var(--ink);
}

.mini-game #miniGameQuestion {
  font-size: 1rem;
  line-height: 1.35;
}

.mini-game__choices {
  display: grid;
  gap: 8px;
}

.mini-game__choices button {
  min-height: 46px;
  padding: 10px 12px;
  font-weight: 760;
}

.mini-game__choices button.is-correct {
  border-color: #2e8a4f;
  background: #e4f4df;
}

.mini-game__choices button.is-wrong {
  border-color: #e25b3f;
  background: #ffe7df;
}

.mini-game__choices button:disabled {
  cursor: default;
}

.mini-game__feedback {
  min-height: 1.4em;
}

.mini-game__actions {
  align-items: center;
}

.character-panel {
  gap: 12px;
}

.chat-notification {
  position: absolute;
  right: 18px;
  bottom: 164px;
  z-index: 5;
  display: grid;
  gap: 4px;
  width: min(310px, calc(100vw - 36px));
  border: 2px solid var(--line);
  border-radius: 2px;
  background:
    repeating-linear-gradient(90deg, rgba(37, 40, 61, 0.035) 0 2px, transparent 2px 8px),
    rgba(255, 250, 240, 0.98);
  color: var(--ink);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  text-align: left;
  outline: 2px solid rgba(255, 255, 255, 0.42);
  outline-offset: -6px;
  animation: chat-notification-in 180ms ease-out;
}

.chat-notification[hidden] {
  display: none;
}

.chat-notification.is-leaving {
  animation: chat-notification-out 180ms ease-in forwards;
}

.chat-notification strong {
  font-size: 0.78rem;
  line-height: 1.2;
  text-transform: uppercase;
}

.chat-notification span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.chat-notification:hover,
.chat-notification:focus-visible {
  outline: 3px solid rgba(226, 91, 63, 0.28);
  outline-offset: 2px;
}

@keyframes chat-notification-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes chat-notification-out {
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

.multiplayer-chat-recipients {
  display: flex;
  gap: 8px;
  min-height: 42px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.multiplayer-chat-recipient {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  max-width: 160px;
  flex: 0 0 auto;
  border: 1px solid rgba(42, 84, 92, 0.18);
  border-radius: 8px;
  background: rgba(255, 250, 220, 0.86);
  color: var(--ink);
  padding: 0 10px;
  font-size: 0.82rem;
  font-weight: 820;
  box-shadow: inset 0 -4px 0 rgba(43, 102, 124, 0.08);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multiplayer-chat-recipient[data-selected="true"] {
  border-color: rgba(192, 113, 20, 0.42);
  background: #fff1a8;
  box-shadow:
    inset 0 0 0 3px rgba(255, 250, 220, 0.72),
    inset 0 -4px 0 rgba(192, 113, 20, 0.14);
}

.multiplayer-chat-recipient span {
  display: grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fffaf0;
  font-size: 0.7rem;
  line-height: 1;
}

.multiplayer-chat-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.character-messages {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow: auto;
  padding-right: 2px;
}

.multiplayer-chat-messages {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow: auto;
  padding-right: 2px;
}

.character-message,
.multiplayer-chat-message {
  display: grid;
  gap: 4px;
  max-width: 92%;
  padding: 10px 12px;
  border: 2px solid rgba(37, 40, 61, 0.18);
  border-radius: 2px;
  background:
    repeating-linear-gradient(90deg, rgba(37, 40, 61, 0.035) 0 2px, transparent 2px 8px),
    #fffaf0;
  box-shadow: inset 0 -4px 0 rgba(37, 40, 61, 0.09);
}

.character-message[data-role="user"],
.multiplayer-chat-message[data-role="self"] {
  justify-self: end;
  background: #f2ead7;
}

.multiplayer-chat-message[data-role="system"] {
  justify-self: center;
  max-width: 100%;
  background: rgba(240, 188, 76, 0.2);
  text-align: center;
}

.character-message strong,
.multiplayer-chat-message strong {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.character-message span,
.multiplayer-chat-message span {
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.character-message.is-thinking span {
  color: var(--muted);
}

.character-form,
.multiplayer-chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.character-form input,
.multiplayer-chat-form input {
  min-width: 0;
}

.character-form .primary-button,
.multiplayer-chat-form .primary-button {
  min-width: 78px;
  flex: 0 0 auto;
}

.character-safety,
.multiplayer-chat-safety {
  margin: -4px 0 0;
}

.audio-chat {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: -4px;
}

.audio-chat[data-status="connected"] .audio-chat__toggle {
  display: none;
}

.audio-chat[data-status="off"] .audio-chat__controls,
.audio-chat[data-status="connecting"] .audio-chat__controls,
.audio-chat[data-status="error"] .audio-chat__controls {
  display: none;
}

.audio-chat__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  font-weight: 820;
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(255, 250, 220, 0.86);
  border: 1px solid rgba(42, 84, 92, 0.18);
  border-radius: 8px;
  box-shadow: inset 0 -4px 0 rgba(43, 102, 124, 0.08);
}

.audio-chat__toggle:hover,
.audio-chat__toggle:focus-visible {
  outline: 3px solid rgba(255, 211, 61, 0.36);
  outline-offset: 2px;
}

.audio-chat[data-status="connecting"] .audio-chat__toggle {
  pointer-events: none;
  opacity: 0.7;
}

.audio-chat[data-status="error"] .audio-chat__toggle {
  border-color: var(--accent);
  background: rgba(247, 109, 45, 0.12);
}

.audio-chat__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
}

.audio-chat[data-status="connecting"] .audio-chat__dot {
  background: var(--sun);
  animation: audio-chat-pulse 900ms ease-in-out infinite;
}

.audio-chat[data-status="error"] .audio-chat__dot {
  background: var(--accent);
}

.audio-chat__controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.audio-chat__icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 36px;
  padding: 0 8px;
  border: 1px solid rgba(42, 84, 92, 0.18);
  border-radius: 8px;
  background: rgba(255, 250, 220, 0.86);
  color: var(--ink);
  font-weight: 820;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: inset 0 -4px 0 rgba(43, 102, 124, 0.08);
}

.audio-chat__icon-button:hover,
.audio-chat__icon-button:focus-visible {
  outline: 3px solid rgba(255, 211, 61, 0.36);
  outline-offset: 2px;
}

.audio-chat__icon-button[aria-pressed="true"] {
  background: rgba(255, 211, 61, 0.26);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.audio-chat__icon-button--off {
  background: rgba(37, 40, 61, 0.06);
}

.audio-chat__waveform {
  width: 110px;
  height: 30px;
  border: 1px solid rgba(42, 84, 92, 0.16);
  border-radius: 8px;
  background:
    repeating-linear-gradient(90deg, rgba(42, 84, 92, 0.06) 0 1px, transparent 1px 6px),
    rgba(255, 250, 220, 0.86);
  box-shadow: inset 0 -3px 0 rgba(43, 102, 124, 0.08);
}

.audio-chat__error {
  width: 100%;
  margin: 0;
  color: var(--accent-dark);
  font-size: 0.78rem;
}

.audio-chat__roster {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: grid;
  gap: 4px;
}

.audio-chat__roster-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border: 2px solid rgba(37, 40, 61, 0.18);
  border-radius: 2px;
  background: #fffaf0;
  font-size: 0.82rem;
  color: var(--ink);
}

.audio-chat__roster-item.is-muted {
  opacity: 0.55;
}

.audio-chat__roster-item.is-deafened .audio-chat__roster-mic::after {
  content: " (deafened)";
  color: var(--muted);
  font-size: 0.74rem;
}

.audio-chat__roster-mic {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 820;
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.audio-chat__roster-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
}

.audio-chat__roster-item.is-talking .audio-chat__roster-dot {
  background: var(--accent);
  animation: audio-chat-pulse 800ms ease-in-out infinite;
}

.audio-chat__roster-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.audio-chat-avatars {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}

.audio-chat-avatar {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -100%);
  pointer-events: none;
}

.audio-chat-avatar__ring {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(37, 40, 61, 0.32);
  background: #fffaf0;
  box-shadow:
    inset 0 -3px 0 rgba(37, 40, 61, 0.12),
    0 4px 0 rgba(37, 40, 61, 0.18);
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  font-weight: 820;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  position: relative;
}

.audio-chat-avatar.is-talking .audio-chat-avatar__ring {
  border-color: var(--accent);
  background: rgba(226, 91, 63, 0.18);
  animation: audio-chat-ring-pulse 700ms ease-in-out infinite;
}

.audio-chat-avatar.is-muted .audio-chat-avatar__ring {
  opacity: 0.45;
  border-style: dashed;
}

.audio-chat-avatar__deaf {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fffaf0;
  display: none;
}

.audio-chat-avatar.is-deafened .audio-chat-avatar__deaf {
  display: block;
}

@keyframes audio-chat-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.4);
    opacity: 0.6;
  }
}

@keyframes audio-chat-ring-pulse {
  0%,
  100% {
    box-shadow:
      inset 0 -3px 0 rgba(37, 40, 61, 0.12),
      0 4px 0 rgba(37, 40, 61, 0.18),
      0 0 0 0 rgba(226, 91, 63, 0.55);
  }
  50% {
    box-shadow:
      inset 0 -3px 0 rgba(37, 40, 61, 0.12),
      0 4px 0 rgba(37, 40, 61, 0.18),
      0 0 0 8px rgba(226, 91, 63, 0);
  }
}

.creator {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(33, 49, 58, 0.08), rgba(33, 49, 58, 0.1)),
    linear-gradient(180deg, rgba(255, 241, 172, 0.28), transparent 36%),
    linear-gradient(180deg, #82d2ec 0%, #a9e5f2 56%, #f1cb78 100%);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 1;
  transition:
    opacity 260ms ease,
    transform 260ms ease;
}

.creator[hidden] {
  display: none;
}

.creator.is-closing {
  opacity: 0;
  transform: translateY(10px);
}

.creator-inner {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(280px, 430px);
  width: min(800px, 100%);
  max-height: calc(100vh - 36px);
  max-height: calc(100svh - 36px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 222, 0.88);
  box-shadow: var(--shadow-strong);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.creator-preview {
  display: grid;
  align-content: center;
  gap: 14px;
  min-height: 470px;
  padding: 28px 22px;
  background:
    linear-gradient(180deg, rgba(255, 241, 172, 0.32), transparent 42%),
    #82d2ec;
}

#avatarPreview {
  width: 100%;
  aspect-ratio: 1;
}

.creator-preview p {
  margin: 0;
  text-align: center;
  color: var(--ink);
  font-size: clamp(1.3rem, 3vw, 2rem);
  font-weight: 850;
  line-height: 1.08;
  letter-spacing: 0;
}

.creator-controls {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 28px;
}

.field-group {
  display: grid;
  gap: 8px;
}

.field-group label,
.field-group > span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
  text-transform: uppercase;
}

select,
input[type="text"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 220, 0.86);
  color: var(--ink);
  padding: 0 12px;
  font-weight: 720;
  min-width: 0;
}

input[type="text"]::placeholder {
  color: rgba(105, 112, 143, 0.72);
}

.swatch-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.swatch {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid rgba(42, 84, 92, 0.22);
  border-radius: 8px;
  background: var(--swatch);
  box-shadow: inset 0 -7px 0 rgba(33, 49, 58, 0.14);
}

.swatch[aria-pressed="true"] {
  border-color: rgba(192, 113, 20, 0.42);
  box-shadow:
    inset 0 0 0 4px rgba(255, 250, 220, 0.72),
    inset 0 -7px 0 rgba(33, 49, 58, 0.14);
}

.style-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(58px, 1fr));
  gap: 8px;
}

.style-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 42px;
  padding: 0 8px;
  border: 1px solid rgba(42, 84, 92, 0.18);
  border-radius: 8px;
  background: rgba(255, 250, 220, 0.86);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 820;
  line-height: 1;
  box-shadow: inset 0 -5px 0 rgba(43, 102, 124, 0.08);
}

.style-button[aria-pressed="true"] {
  border-color: rgba(192, 113, 20, 0.42);
  background: #fff1a8;
  box-shadow:
    inset 0 0 0 3px rgba(255, 250, 220, 0.72),
    inset 0 -5px 0 rgba(192, 113, 20, 0.14);
}

.creator-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.primary-button,
.secondary-button,
.plain-button {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 0 16px;
  font-weight: 820;
}

.primary-button {
  flex: 1;
  background: var(--sun);
  color: var(--ink);
  border-color: rgba(192, 113, 20, 0.22);
  box-shadow: inset 0 -5px 0 rgba(192, 113, 20, 0.18);
}

.secondary-button,
.plain-button {
  background: rgba(255, 250, 220, 0.86);
  color: var(--ink);
}

.help-panel {
  position: absolute;
  top: 76px;
  right: 18px;
  z-index: 4;
  width: min(330px, calc(100vw - 36px));
  padding: 16px;
  border-radius: 8px;
}

.help-panel .plain-button {
  float: right;
  min-height: 34px;
  padding: 0 10px;
}

.help-panel p {
  clear: both;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

@media (max-width: 720px) {
  .hud {
    top: 10px;
    left: 10px;
    right: 10px;
  }

  .brand {
    min-width: 0;
    max-width: calc(100vw - 120px);
    padding: 10px;
  }

  .mark {
    width: 30px;
    height: 30px;
  }  .compass {
    right: 10px;
    bottom: 142px;
    width: 96px;
    height: 96px;
  }

  .chat-notification {
    right: 10px;
    bottom: 250px;
    width: min(300px, calc(100vw - 20px));
  }

  .hud-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .wallet {
    min-height: 38px;
    padding: 0 9px;
  }

  .learning-prompt,
  .store-prompt,
  .character-prompt,
  .player-prompt,
  .arcade-prompt {
    left: 10px;
    right: 10px;
    bottom: 10px;
    min-width: 0;
    transform: none;
  }

  .learning-panel,
  .store-panel,
  .character-panel,
  .build-blocks-panel,
  .multiplayer-chat-panel,
  .arcade-panel,
  .arcade-detail-panel {
    top: 74px;
    right: 10px;
    left: 10px;
    width: auto;
    max-height: calc(100vh - 96px);
    max-height: calc(100svh - 96px);
  }

  .build-blocks-layout {
    grid-template-columns: 1fr;
  }

  .build-blocks-panel__footer {
    flex-wrap: wrap;
  }

  .store-item {
    grid-template-columns: 38px 1fr;
  }

  .store-item button {
    grid-column: 1 / -1;
  }

  .character-form,
  .multiplayer-chat-form {
    grid-template-columns: 1fr;
  }

  .creator {
    padding: 10px;
  }

  .creator-inner {
    grid-template-columns: 1fr;
  }

  .creator-preview {
    min-height: 230px;
    padding: 18px;
  }

  #avatarPreview {
    width: min(190px, 64vw);
    justify-self: center;
  }

  .creator-controls {
    gap: 14px;
    padding: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.debug-panel {
  position: fixed;
  bottom: 14px;
  left: 14px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink);
  pointer-events: auto;
}

.debug-panel__title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.debug-panel button {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-family: inherit;
  text-align: left;
}

.debug-panel button:hover,
.debug-panel button:focus-visible {
  background: var(--sun);
  border-color: var(--ink);
  outline: none;
}

/* === Full-screen arcade game panel (Bubble Pop) ===
 *
 * `.game-panel` covers the entire viewport on top of the 3D canvas; the 3D
 * render loop continues underneath without pausing. Each in-game panel
 * (Bubble Pop, future games) inherits the takeover layout and supplies its
 * own HUD + body content. */
.game-panel {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, #1c2540 0%, #2c3a66 100%);
  color: #fff6d8;
  font-family: inherit;
  pointer-events: auto;
  overflow: hidden;
}

.game-panel[hidden] {
  display: none;
}

.game-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 2px solid rgba(255, 246, 216, 0.16);
  background: rgba(28, 37, 64, 0.85);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.game-panel__title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.game-panel__title h2 {
  margin: 0;
  font-size: clamp(1.2rem, 2.4vw, 1.65rem);
  letter-spacing: 0.02em;
}

.game-panel__eyebrow {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #ffd97a;
}

.game-panel__hud {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.game-panel__stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.05;
  color: rgba(255, 246, 216, 0.7);
}

/* `display: flex` on .game-panel__stat overrides the default user-agent
 * `[hidden] { display: none }` rule. Snake hides its OPPONENT stat in 1P
 * mode via the `hidden` attribute; this rule restores the expected
 * behavior. (Mirrors .game-panel__opponent[hidden] below for the BP
 * opponent grid pane.) */
.game-panel__stat[hidden] {
  display: none;
}

.game-panel__stat strong {
  font-size: 1.35rem;
  color: #fff6d8;
  font-variant-numeric: tabular-nums;
}

.game-panel__hud .primary-button {
  min-height: 40px;
  padding: 0 16px;
}

.game-panel__body {
  flex: 1 1 auto;
  display: flex;
  align-items: stretch;
  gap: 16px;
  padding: 16px 22px 22px;
  min-height: 0;
}

.game-panel__main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 0;
  position: relative;
}

.game-panel__canvas {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 6px;
  background: rgba(13, 18, 36, 0.55);
  touch-action: none;
  cursor: crosshair;
}

.game-panel__status {
  margin: 0;
  padding: 10px 14px;
  border-radius: 6px;
  background: rgba(255, 246, 216, 0.92);
  color: #25283d;
  font-weight: 700;
  text-align: center;
  align-self: center;
  max-width: min(420px, 90%);
}

.game-panel__reconnect {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 18, 36, 0.72);
  border-radius: 6px;
  z-index: 5;
  pointer-events: none;
}

.game-panel__reconnect[hidden] {
  display: none;
}

.game-panel__reconnect-text {
  margin: 0;
  padding: 14px 22px;
  border-radius: 6px;
  background: rgba(255, 246, 216, 0.95);
  color: #25283d;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.game-panel__opponent {
  flex: 0 0 auto;
  width: clamp(180px, 22vw, 280px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 6px;
  background: rgba(13, 18, 36, 0.55);
  border: 1px solid rgba(255, 246, 216, 0.12);
}

.game-panel__opponent[hidden] {
  display: none;
}

.game-panel__opponent-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255, 246, 216, 0.7);
}

.game-panel__opponent-head strong {
  font-size: 1.1rem;
  color: #fff6d8;
  font-variant-numeric: tabular-nums;
}

.game-panel__opponent-canvas {
  flex: 1 1 auto;
  width: 100%;
  min-height: 220px;
  display: block;
  border-radius: 4px;
  background: rgba(13, 18, 36, 0.7);
}

@media (max-width: 600px) {
  .game-panel__body {
    flex-direction: column;
    padding: 12px;
    gap: 12px;
  }

  /* Per Doc-Review Resolutions: opponent's mini-grid stacks vertically
   * below the main canvas on viewports < 600px wide. */
  .game-panel__opponent {
    width: auto;
    flex: 0 0 38vh;
    flex-direction: row;
    align-items: center;
  }

  .game-panel__opponent-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .game-panel__opponent-canvas {
    min-height: 0;
    height: 100%;
  }

  .game-panel__header {
    padding: 10px 14px;
  }
}

/* === Spectator-mode HUD ===
 *
 * `.bubble-pop-panel.spectator` flips the panel into a passive-watch shape.
 * The eyebrow line carries the "Watching · MODE · Names" label so we don't
 * need an extra header element; the score column hides because it doesn't
 * belong to the spectator. The canvas cursor falls back to default — there's
 * no aim-and-fire affordance to telegraph. The renderer itself already
 * suppresses the aim line for non-player roles, so this is purely chrome. */

.game-panel.spectator .game-panel__canvas {
  cursor: default;
}

/* Spectator does not own a score; hide the player-side score stat to keep
 * the HUD honest. The Best stat also goes away — personal best is the
 * spectator's, which is irrelevant while watching someone else play. */
.game-panel.spectator .game-panel__hud .game-panel__stat {
  display: none;
}

/* The eyebrow line lifts up visually in spectator mode so the "Watching:"
 * banner reads more like a header than a label. */
.game-panel.spectator .game-panel__eyebrow {
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  color: #fff6d8;
}

/* Simulated/recorded broadcasts get a subtle "Recorded" pill via a ::before
 * marker on the eyebrow so the user can always tell live from playback at
 * a glance, even if they missed the click that opened it. */
.game-panel.spectator.simulated .game-panel__eyebrow::before {
  content: "REC";
  display: inline-block;
  margin-right: 8px;
  padding: 1px 6px;
  border-radius: 2px;
  background: rgba(255, 215, 130, 0.55);
  color: #4a2e07;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  vertical-align: middle;
}

/* === Tic-Tac-Toe panel ===
 *
 * Reuses the .game-panel chrome above; canvas cursor + background tint
 * are the only TTT-specific styles. Mode-picker buttons (rendered on the
 * arcade-detail panel) are below in .tic-tac-toe-mode-buttons. */

.tic-tac-toe-panel .game-panel__canvas {
  cursor: pointer;
  background: rgba(13, 18, 36, 0.78);
}

.tic-tac-toe-mode-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.tic-tac-toe-mode-buttons .primary-button {
  flex: 1 1 140px;
  min-width: 140px;
}

/* TTT game-over overlay — covers the canvas with a semi-transparent
 * card showing the result + Play Again / Back buttons. */
.ttt-game-over {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 18, 36, 0.78);
  z-index: 10;
  border-radius: inherit;
}

.ttt-game-over[hidden] {
  display: none;
}

.ttt-game-over__card {
  background: rgba(20, 28, 50, 0.96);
  border: 1px solid rgba(255, 246, 216, 0.18);
  border-radius: 16px;
  padding: 28px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
  max-width: 92%;
}

.ttt-game-over__result {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  color: #fff6d8;
  text-align: center;
}

.ttt-game-over__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.tic-tac-toe-panel .game-panel__main {
  position: relative; /* anchor for .ttt-game-over inset:0 */
}

/* Leaderboard widget table — W/L/T columns are right-aligned numerics. */
.ttt-leaderboard {
  width: 100%;
  border-collapse: collapse;
  color: #fff6d8;
  font-size: 0.92rem;
}

.ttt-leaderboard th,
.ttt-leaderboard td {
  padding: 6px 10px;
  text-align: left;
}

.ttt-leaderboard th {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 246, 216, 0.7);
  border-bottom: 1px solid rgba(255, 246, 216, 0.18);
}

.ttt-leaderboard tbody tr + tr td {
  border-top: 1px solid rgba(255, 246, 216, 0.08);
}

.ttt-leaderboard__rank,
.ttt-leaderboard__wins,
.ttt-leaderboard__losses,
.ttt-leaderboard__ties,
.ttt-leaderboard__pct {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ttt-leaderboard__name {
  font-weight: 700;
}

.ttt-leaderboard__pct {
  color: #ffd97a;
  font-weight: 700;
}

.arcade-detail-panel__leaderboard-note {
  margin-left: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(74, 143, 220, 0.16);
  border: 1px solid rgba(74, 143, 220, 0.36);
  color: #d6e8ff;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  vertical-align: middle;
}

.game-panel__mute {
  font-size: 1.1rem;
  padding: 0 10px;
}

/* === Bug Hunt ===
 *
 * Fixed-shooter arcade game. Mounts inside `.bug-hunt-panel` (the standard
 * `.game-panel` chrome shared with Bubble Pop / TTT). The detail panel
 * follows the `.arcade-detail-panel` shell; only the mode-button row, the
 * leaderboard groupings, the game-over overlay, and the bonus overlay
 * are Bug Hunt-specific styles. */

.bug-hunt-panel .game-panel__canvas {
  cursor: crosshair;
  background: rgba(8, 12, 28, 0.92);
}

.bug-hunt-panel .game-panel__main {
  position: relative; /* anchor for .bug-hunt-game-over and .bug-hunt-bonus-overlay inset:0 */
}

.bug-hunt-mode-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.bug-hunt-mode-buttons .primary-button {
  flex: 1 1 180px;
  min-width: 180px;
}

/* Bug Hunt leaderboard — two stacked groups (1P Solo + 2P Co-op). Each
 * group has its own table; an empty group falls through to the shared
 * `.arcade-detail-panel__empty` placeholder copy. */
.bug-hunt-leaderboard__group {
  margin-top: 14px;
}

.bug-hunt-leaderboard__group:first-child {
  margin-top: 0;
}

.bug-hunt-leaderboard__group-title {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 246, 216, 0.78);
}

.bug-hunt-leaderboard {
  width: 100%;
  border-collapse: collapse;
  color: #fff6d8;
  font-size: 0.92rem;
}

.bug-hunt-leaderboard th,
.bug-hunt-leaderboard td {
  padding: 6px 10px;
  text-align: left;
}

.bug-hunt-leaderboard th {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 246, 216, 0.7);
  border-bottom: 1px solid rgba(255, 246, 216, 0.18);
}

.bug-hunt-leaderboard tbody tr + tr td {
  border-top: 1px solid rgba(255, 246, 216, 0.08);
}

.bug-hunt-leaderboard__rank,
.bug-hunt-leaderboard__score,
.bug-hunt-leaderboard__wave {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bug-hunt-leaderboard__name {
  font-weight: 700;
}

.bug-hunt-leaderboard__score {
  color: #ffd97a;
  font-weight: 700;
}

/* Bug Hunt game-over overlay — covers the canvas with a semi-transparent
 * card showing the result + Play Again / Exit buttons. */
.bug-hunt-game-over {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 12, 28, 0.82);
  z-index: 10;
  border-radius: inherit;
}

.bug-hunt-game-over[hidden] {
  display: none;
}

.bug-hunt-game-over__card {
  background: rgba(20, 28, 50, 0.96);
  border: 1px solid rgba(255, 246, 216, 0.18);
  border-radius: 16px;
  padding: 28px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
  max-width: 92%;
}

.bug-hunt-game-over__eyebrow {
  margin: 0;
  font-size: clamp(1.0rem, 2.4vw, 1.25rem);
  font-weight: 700;
  color: #e25b3f;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
}

.bug-hunt-game-over__result {
  margin: 0;
  font-size: clamp(1.4rem, 3.4vw, 1.9rem);
  font-weight: 800;
  color: #fff6d8;
  text-align: center;
  line-height: 1.3;
}

.bug-hunt-game-over__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}

/* Between-wave bonus overlay. Shown for ~1.5s between waves with the wave
 * number + bonus points. Lower z-index than .bug-hunt-game-over so a
 * terminal mid-wave still paints the game-over card on top. */
.bug-hunt-bonus-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 12, 28, 0.55);
  z-index: 8;
  pointer-events: none;
  border-radius: inherit;
}

.bug-hunt-bonus-overlay[hidden] {
  display: none;
}

.bug-hunt-bonus-overlay__card {
  background: rgba(20, 28, 50, 0.92);
  border: 1px solid rgba(255, 217, 122, 0.36);
  border-radius: 14px;
  padding: 18px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4);
}

.bug-hunt-bonus-overlay__title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffd97a;
  letter-spacing: 0.04em;
}

.bug-hunt-bonus-overlay__score {
  margin: 0;
  font-size: 1.0rem;
  font-weight: 600;
  color: #fff6d8;
}

/* Detail-panel description copy (Bug Hunt introduces a one-line per-game
 * description above the mode buttons; harmless for other games since they
 * don't render this element). */
.arcade-detail-panel__description {
  margin: 12px 0 0;
  color: rgba(255, 246, 216, 0.78);
  font-size: 0.92rem;
  line-height: 1.45;
}

/* === Snake — pixel-art arcade game ===
 *
 * Detail panel reuses every existing arcade-detail-panel class wholesale —
 * mode buttons go in .arcade-detail-panel__actions, the dual leaderboard
 * tabs use .arcade-detail-panel__tabs / __tab / .is-active, the table
 * inherits .arcade-detail-panel__leaderboard table styling. Snake-specific
 * styles below cover ONLY the pieces unique to snake: the pixel-art
 * canvas, the 2P countdown overlay, and a hide rule for the window-tabs
 * row when the 2P leaderboard tab is active. */

.snake-leaderboard-windowtabs[hidden] {
  display: none;
}

/* Pixel-art canvas: crisp scaling. The renderer draws integer pixels;
 * `image-rendering: pixelated` tells the browser not to anti-alias when
 * the canvas backing store gets scaled to fit the viewport. */
.snake-canvas {
  cursor: default;
  background: #1a1a2e;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.snake-panel .game-panel__main {
  position: relative; /* anchor for #snakeGameOver + #snakeCountdown inset:0 */
}

/* 3-2-1 countdown overlay shown for the first 3 seconds of every 2P
 * snake match. Cosmetic only — the reducer is already ticking under the
 * overlay; the wiring module suppresses the visual reveal until the
 * countdown completes. */
.snake-countdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 18, 36, 0.6);
  z-index: 9;
  border-radius: inherit;
  pointer-events: none;
}

.snake-countdown[hidden] {
  display: none;
}

.snake-countdown__text {
  font-size: clamp(4rem, 12vw, 8rem);
  font-weight: 900;
  color: #fff6d8;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  font-variant-numeric: tabular-nums;
}

/* === Rock Field ===
 *
 * Vector-shooter panel chrome. Reuses .game-panel + .arcade-detail-panel +
 * .ttt-game-over (the game-over overlay is identical in shape). RF-specific
 * tweaks: a darker canvas backdrop suited to vector strokes, a 2-column
 * mode-picker layout (only 1P + 2P-online — no 2P-local), and a small
 * leaderboard table reusing TTT's W/L/T column shape. */

.rock-field-panel .game-panel__canvas {
  background: #16172a;
  cursor: crosshair;
}

.rock-field-panel .game-panel__main {
  position: relative; /* anchor for .ttt-game-over inset:0 (reused) */
}

.rock-field-mode-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.rock-field-mode-buttons .primary-button {
  flex: 1 1 200px;
  min-width: 180px;
}

/* RF leaderboards: 1P single-score table and 2P W/L/T table. Reuses
 * .ttt-leaderboard tone — rounded card, muted header — without
 * duplicating that block's row styles. */
.rf-leaderboard,
.rf-top-players {
  width: 100%;
  border-collapse: collapse;
  color: #fff6d8;
  font-size: 0.92rem;
}

.rf-leaderboard th,
.rf-top-players th,
.rf-leaderboard td,
.rf-top-players td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 246, 216, 0.10);
}

.rf-leaderboard th:last-child,
.rf-leaderboard td:last-child,
.rf-top-players th:nth-child(n+3),
.rf-top-players td:nth-child(n+3) {
  text-align: right;
}

.rf-leaderboard thead th,
.rf-top-players thead th {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 246, 216, 0.6);
  border-bottom: 1px solid rgba(255, 246, 216, 0.22);
}

/* === Arcade panel ===
 *
 * `.arcade-panel` is the eight-card game grid that opens when the player
 * walks up to MAKE. `.arcade-detail-panel` is the per-game detail panel
 * (Bubble Pop today; later games will reuse the same shell). Both ride the
 * same right-rail panel chrome shared with learning/store/character. */

.arcade-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.game-card {
  display: grid;
  grid-template-rows: auto auto;
  align-content: start;
  justify-items: center;
  gap: 6px;
  min-height: 110px;
  padding: 14px 10px;
  border: 2px solid var(--line);
  border-radius: 4px;
  background:
    repeating-linear-gradient(135deg, rgba(37, 40, 61, 0.04) 0 2px, transparent 2px 8px),
    #fffaf0;
  color: var(--ink);
  text-align: center;
  font: inherit;
  font-weight: 820;
  cursor: pointer;
  box-shadow: inset 0 -5px 0 rgba(37, 40, 61, 0.12);
  transition: transform 80ms ease-out;
}

.game-card:hover,
.game-card:focus-visible {
  outline: 3px solid rgba(226, 91, 63, 0.32);
  outline-offset: 2px;
  transform: translateY(-1px);
}

.game-card__emoji {
  font-size: 2rem;
  line-height: 1;
}

.game-card__title {
  font-size: 0.95rem;
  font-weight: 900;
}

.game-card__badge {
  margin-top: 2px;
  padding: 1px 7px;
  border: 1px solid rgba(37, 40, 61, 0.16);
  background: rgba(115, 86, 168, 0.18);
  color: var(--ink);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.2;
}

.game-card.disabled {
  cursor: default;
  background:
    repeating-linear-gradient(135deg, rgba(37, 40, 61, 0.045) 0 2px, transparent 2px 8px),
    #f1ede1;
  color: rgba(37, 40, 61, 0.55);
  box-shadow: inset 0 -5px 0 rgba(37, 40, 61, 0.08);
}

.game-card.disabled:hover,
.game-card.disabled:focus-visible {
  outline: none;
  transform: none;
}

.game-card.disabled .game-card__emoji {
  filter: grayscale(0.6);
  opacity: 0.7;
}

.game-card.disabled .game-card__badge {
  background: rgba(82, 58, 41, 0.18);
}

/* === Arcade detail panel === */

.arcade-detail-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.arcade-detail-panel__actions .primary-button,
.arcade-detail-panel__actions .secondary-button {
  flex: 1 1 120px;
  min-height: 40px;
}

.arcade-detail-panel__secondary {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.18) 0 2px, transparent 2px 8px),
    #7356a8;
}

.arcade-detail-panel__personal-best {
  margin: 0;
  padding: 8px 10px;
  border: 1px dashed rgba(82, 58, 41, 0.32);
  border-radius: 2px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 760;
  background: rgba(255, 246, 216, 0.7);
}

.arcade-detail-panel__section {
  display: grid;
  gap: 8px;
}

.arcade-detail-panel__section h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.arcade-detail-panel__live {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.arcade-detail-panel__watch-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.arcade-detail-panel__watch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: 2px;
  background: #fffaf0;
  font-size: 0.84rem;
}

.arcade-detail-panel__watch-row strong {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arcade-detail-panel__watch-row .arcade-detail-panel__watch-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border: 1px solid rgba(37, 40, 61, 0.16);
  background: rgba(168, 222, 216, 0.45);
  color: var(--ink);
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Live row gets a green pulsing dot + green-tinted background. */
.arcade-detail-panel__watch-tag--live {
  background: rgba(120, 198, 121, 0.55);
  border-color: rgba(33, 96, 38, 0.45);
  color: #143a18;
}

.arcade-detail-panel__watch-tag--recorded {
  background: rgba(255, 215, 130, 0.5);
  border-color: rgba(168, 117, 12, 0.4);
  color: #4a2e07;
}

.arcade-detail-panel__watch-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2e8b3a;
  box-shadow: 0 0 0 0 rgba(46, 139, 58, 0.7);
  animation: arcadeWatchPulse 1.6s ease-out infinite;
}

@keyframes arcadeWatchPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(46, 139, 58, 0.6);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(46, 139, 58, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(46, 139, 58, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .arcade-detail-panel__watch-dot {
    animation: none;
  }
}

.arcade-detail-panel__watch-row button {
  min-height: 30px;
  padding: 0 12px;
  border: 2px solid var(--line);
  border-radius: 2px;
  background: #fffaf0;
  color: var(--ink);
  font-weight: 820;
  cursor: pointer;
}

.arcade-detail-panel__watch-row button:hover,
.arcade-detail-panel__watch-row button:focus-visible {
  outline: 3px solid rgba(226, 91, 63, 0.28);
  outline-offset: 2px;
}

.arcade-detail-panel__watch-empty {
  margin: 0;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-style: italic;
}

.arcade-detail-panel__leaderboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.arcade-detail-panel__tabs {
  display: inline-flex;
  border: 2px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.arcade-detail-panel__tab {
  padding: 4px 10px;
  border: none;
  background: #fffaf0;
  color: var(--ink);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 820;
  cursor: pointer;
}

.arcade-detail-panel__tab + .arcade-detail-panel__tab {
  border-left: 2px solid var(--line);
}

.arcade-detail-panel__tab.is-active {
  background: var(--sun);
  color: var(--ink);
}

.arcade-detail-panel__leaderboard {
  display: grid;
  gap: 6px;
  min-height: 60px;
}

.arcade-detail-panel__leaderboard table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.arcade-detail-panel__leaderboard thead th {
  text-align: left;
  padding: 4px 6px;
  border-bottom: 2px solid rgba(82, 58, 41, 0.22);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.arcade-detail-panel__leaderboard tbody td {
  padding: 5px 6px;
  border-bottom: 1px solid rgba(82, 58, 41, 0.12);
}

.arcade-detail-panel__leaderboard tbody tr:last-child td {
  border-bottom: none;
}

.arcade-detail-panel__leaderboard td.rank,
.arcade-detail-panel__leaderboard td.score {
  font-weight: 900;
  text-align: right;
  width: 14%;
}

.arcade-detail-panel__leaderboard td.rank {
  text-align: left;
  width: 10%;
}

.arcade-detail-panel__leaderboard td.ended {
  text-align: right;
  color: var(--muted);
  font-size: 0.78rem;
  width: 22%;
  white-space: nowrap;
}

.arcade-detail-panel__leaderboard td.name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 0;
}

.arcade-detail-panel__loading,
.arcade-detail-panel__empty,
.arcade-detail-panel__error {
  margin: 0;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

.arcade-detail-panel__error {
  color: var(--ink);
  background: rgba(226, 91, 63, 0.12);
  border: 1px solid rgba(226, 91, 63, 0.35);
  border-radius: 2px;
}

/* === Arcade toast ===
 *
 * Tiny bottom-center bubble for "Coming soon!", "Copied!", etc. Mirrors the
 * chat-notification animation rhythm. */

.arcade-toast {
  position: absolute;
  left: 50%;
  bottom: 92px;
  z-index: 6;
  transform: translateX(-50%);
  min-width: 0;
  max-width: min(360px, calc(100vw - 36px));
  padding: 10px 16px;
  border: 2px solid var(--line);
  border-radius: 2px;
  background: rgba(255, 250, 240, 0.98);
  color: var(--ink);
  font: inherit;
  font-weight: 820;
  cursor: pointer;
  box-shadow: var(--shadow);
  outline: 2px solid rgba(255, 255, 255, 0.42);
  outline-offset: -6px;
  animation: chat-notification-in 180ms ease-out;
}

.arcade-toast[hidden] {
  display: none;
}

.arcade-toast.is-leaving {
  animation: chat-notification-out 180ms ease-in forwards;
}

@media (max-width: 600px) {
  .arcade-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .arcade-detail-panel__leaderboard table {
    font-size: 0.8rem;
  }

  .arcade-toast {
    bottom: 76px;
  }
}

/* === Opponent picker + challenge modals ===
 *
 * `.arcade-opponent-picker` is the inline list shown inside the Bubble Pop
 * detail panel when "Play 2P" is clicked. `.challenge-overlay` is the modal
 * shell shared by the challenger's "Waiting for opponent..." overlay and
 * the recipient's "Player X wants to play" prompt — both use the same card
 * chrome but different actions.
 */

.arcade-opponent-picker {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 2px;
  background: rgba(168, 222, 216, 0.18);
  box-shadow: inset 0 -3px 0 rgba(37, 40, 61, 0.08);
}

.arcade-opponent-picker[hidden] {
  display: none;
}

.arcade-opponent-picker__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.arcade-opponent-picker__head h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.arcade-opponent-picker__hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.arcade-opponent-picker__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.arcade-opponent-picker__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: 2px;
  background: #fffaf0;
  font-size: 0.86rem;
}

.arcade-opponent-picker__row strong {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arcade-opponent-picker__row button {
  min-height: 32px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: 2px;
  background: var(--sun);
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.arcade-opponent-picker__row button:hover,
.arcade-opponent-picker__row button:focus-visible {
  outline: 3px solid rgba(226, 91, 63, 0.32);
  outline-offset: 2px;
}

.arcade-opponent-picker__row button:disabled {
  opacity: 0.6;
  cursor: default;
}

.arcade-opponent-picker__empty {
  margin: 0;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-style: italic;
}

.arcade-opponent-picker__error {
  margin: 0;
  padding: 8px 10px;
  color: var(--ink);
  background: rgba(226, 91, 63, 0.12);
  border: 1px solid rgba(226, 91, 63, 0.35);
  border-radius: 2px;
  font-size: 0.84rem;
}

/* Modal shell shared by both challenge overlays. Centered, dimmed backdrop,
 * card-style content with the same chrome as the reconnect overlay. */
.challenge-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 18, 36, 0.55);
  padding: 20px;
}

.challenge-overlay[hidden] {
  display: none;
}

.challenge-overlay__card {
  display: grid;
  gap: 12px;
  padding: 22px 26px;
  min-width: 280px;
  max-width: min(420px, calc(100vw - 40px));
  border: 2px solid var(--line);
  border-radius: 4px;
  background: #fffaf0;
  color: var(--ink);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.32);
  text-align: center;
}

.challenge-overlay__title {
  margin: 0;
  font-size: 1.04rem;
  font-weight: 900;
  letter-spacing: 0.01em;
}

.challenge-overlay__title strong {
  color: var(--accent, #e25b3f);
}

.challenge-overlay__subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.challenge-overlay__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.challenge-overlay__actions .primary-button,
.challenge-overlay__actions .secondary-button {
  min-width: 110px;
  min-height: 40px;
}

.challenge-overlay--prompt .challenge-overlay__card {
  background:
    repeating-linear-gradient(135deg, rgba(168, 222, 216, 0.18) 0 2px, transparent 2px 8px),
    #fffaf0;
}

/* === Block Drop ====================================================== */

/* Block Drop play panel — full-screen, single-canvas. The renderer paints
 * the Next preview, HUD (score / level / lines), 2P opponent viewport,
 * and the per-side garbage warning bar entirely on canvas, so only the
 * panel chrome (mute / Exit) and the game-over overlay are DOM. */
.block-drop-panel .game-panel__canvas {
  cursor: default;
  background: rgba(13, 18, 36, 0.92);
}

.block-drop-panel .game-panel__main {
  position: relative; /* anchor for .block-drop-game-over inset:0 */
}

/* BD status flash — surfaces "Match ended" / "Replay ended" / forfeit copy
 * to spectators while the play panel is still up. Hidden by default; the
 * spectator-terminal hook pops it for ~1.5s before the panel closes. */
.block-drop-status {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 18px;
  background: rgba(20, 28, 50, 0.92);
  border: 1px solid rgba(255, 246, 216, 0.22);
  border-radius: 999px;
  color: #fff6d8;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  z-index: 11;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.block-drop-status[hidden] {
  display: none;
}

/* Mode-picker buttons rendered on the BD detail panel. Mirrors
 * .tic-tac-toe-mode-buttons. */
.block-drop-mode-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.block-drop-mode-buttons .primary-button,
.block-drop-mode-buttons .secondary-button {
  flex: 1 1 140px;
  min-width: 140px;
}

/* BD game-over overlay — covers the canvas with a semi-transparent
 * card showing the result + Play Again / Back buttons. Mirrors
 * .ttt-game-over. */
.block-drop-game-over {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 18, 36, 0.78);
  z-index: 10;
  border-radius: inherit;
}

.block-drop-game-over[hidden] {
  display: none;
}

.block-drop-game-over__card {
  background: rgba(20, 28, 50, 0.96);
  border: 1px solid rgba(255, 246, 216, 0.18);
  border-radius: 16px;
  padding: 28px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
  max-width: 92%;
}

.block-drop-game-over__result {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  color: #fff6d8;
  text-align: center;
}

.block-drop-game-over__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Detail-panel widgets. Inherit from .arcade-detail-panel__section so
 * the spacing + chrome match BP / TTT — the BD-specific classes are
 * hooks for future per-widget tweaks (e.g., compact 2P W/L table). */
.block-drop-leaderboard-widget {
  /* placeholder hook */
}

.block-drop-watch-list {
  /* placeholder hook */
}

/* Per-viewport HUD inside the BD canvas is painted by the renderer; this
 * class is reserved for any future DOM overlay (e.g., a "swap to 2P"
 * pill) that needs to sit above the canvas. */
.block-drop-viewport-hud {
  /* placeholder hook */
}
