:root {
  --bg-deep: #070b10;
  --bg-mid: #0b0f13;
  --panel: rgba(18, 26, 34, 0.72);
  --panel-border: rgba(0, 212, 255, 0.18);
  --accent: #00d4ff;
  --accent-soft: #7cffd4;
  --text: #d8dee3;
  --muted: #8b98a5;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Noto Sans TC", "Microsoft JhengHei", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(0, 212, 255, 0.12), transparent 30%),
    radial-gradient(circle at 85% 12%, rgba(124, 255, 212, 0.08), transparent 24%),
    linear-gradient(145deg, var(--bg-deep), var(--bg-mid) 55%, #05080c 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at center, black 35%, transparent 95%);
}

.site-version {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 40;
  padding: 6px 8px;
  color: rgba(216, 222, 227, 0.56);
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: rgba(7, 11, 16, 0.22);
  border: 1px solid rgba(0, 212, 255, 0.08);
  border-radius: 999px;
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.16);
  pointer-events: none;
  user-select: none;
}

.site-shell {
  width: min(1240px, calc(100vw - 32px));
  min-height: calc(100vh - 92px);
  margin: 0 auto;
  padding: 36px 0 96px;
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(360px, 1.08fr);
  gap: 24px;
  align-items: center;
}

.glass-panel {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.glass-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 38%);
}

.hero-copy {
  padding: 34px;
}

.wishbooth-entry-area {
  margin-top: 34px;
  display: flex;
  justify-content: center;
}

.wishbooth-entry-button {
  display: inline-grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(0, 212, 255, 0.22);
  border-radius: 20px;
  background: rgba(5, 10, 15, 0.72);
  color: var(--text);
  justify-items: center;
  text-align: center;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.wishbooth-entry-button:hover,
.wishbooth-entry-button:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(0, 212, 255, 0.64);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.16), 0 18px 28px rgba(0, 0, 0, 0.24);
}

.wishbooth-entry-image {
  display: block;
  width: min(100%, 220px);
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 16px 26px rgba(0, 0, 0, 0.26);
}

.wishbooth-entry-label,
.wishbooth-mark {
  color: var(--accent-soft);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.wishbooth-modal[hidden] {
  display: none;
}

.wishbooth-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}

.wishbooth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 10, 0.72);
  backdrop-filter: blur(8px);
}

.wishbooth-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 540px);
  padding: 26px;
  display: grid;
  gap: 16px;
}

.wishbooth-dialog-header {
  display: grid;
  gap: 8px;
}

.wishbooth-label {
  color: var(--muted);
  font-size: 14px;
}

.wishbooth-input {
  width: 100%;
  min-height: 140px;
  padding: 14px 16px;
  border: 1px solid rgba(0, 212, 255, 0.18);
  border-radius: 16px;
  background: rgba(3, 8, 13, 0.84);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.wishbooth-input:focus-visible {
  outline: none;
  border-color: rgba(124, 255, 212, 0.68);
  box-shadow: inset 0 0 0 1px rgba(124, 255, 212, 0.12);
}

.wishbooth-status,
.wishbooth-admin-status {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.wishbooth-status.is-error,
.wishbooth-admin-status.is-error {
  color: #ff9a8a;
}

.wishbooth-status.is-success,
.wishbooth-admin-status.is-success {
  color: var(--accent-soft);
}

.wishbooth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.wishbooth-action-button {
  min-width: 96px;
  padding: 12px 18px;
  border: 1px solid rgba(0, 212, 255, 0.24);
  border-radius: 999px;
  background: rgba(3, 8, 13, 0.82);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.wishbooth-action-button:hover,
.wishbooth-action-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(0, 212, 255, 0.68);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.14), 0 12px 18px rgba(0, 0, 0, 0.22);
}

.wishbooth-action-button-secondary {
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--muted);
}

.logo {
  width: min(100%, 520px);
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 20px 38px rgba(0, 0, 0, 0.5));
}

.line {
  width: min(320px, 70%);
  height: 1px;
  margin: 28px 0 24px;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.8), transparent);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-soft);
  font-size: 12px;
  letter-spacing: 0.26em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 16px;
  font-size: clamp(40px, 5vw, 66px);
  line-height: 1.08;
  letter-spacing: 0.08em;
  font-weight: 650;
}

h2 {
  margin: 0;
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 600;
}

h3 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
}

.lead {
  margin-bottom: 12px;
  color: var(--text);
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.6;
}

.sublead,
.panel-header p,
.status-text,
.leaderboard-empty,
.leaderboard-label {
  color: var(--muted);
  line-height: 1.6;
}

#temporary-interactive-module {
  padding: 26px;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 0.72fr);
  gap: 16px;
  align-items: start;
}

.game-panel,
.score-panel {
  padding: 18px;
  border-radius: 20px;
  background: rgba(8, 13, 18, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.game-panel {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.game-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  gap: 10px;
  width: min(320px, 100%);
  margin: 0 auto;
}

.game-cell {
  aspect-ratio: 1 / 1;
  min-height: 72px;
  border: 1px solid rgba(0, 212, 255, 0.55);
  border-radius: 16px;
  background: rgba(3, 8, 13, 0.72);
  color: #d8dee3;
  font: inherit;
  font-size: clamp(28px, 7vw, 48px);
  font-weight: 700;
  cursor: pointer;
  box-shadow: inset 0 0 18px rgba(0, 212, 255, 0.08);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.game-cell:hover:not([aria-disabled="true"]),
.game-cell:focus-visible:not([aria-disabled="true"]) {
  transform: translateY(-1px);
  border-color: rgba(0, 212, 255, 0.82);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.16), 0 14px 24px rgba(0, 0, 0, 0.28);
}

.game-cell[aria-disabled="true"] {
  cursor: default;
}

.game-cell-x {
  color: var(--accent-soft);
}

.game-cell-o {
  color: var(--accent);
}

.status-text {
  margin: 0;
  min-height: 0;
  font-size: 0;
  line-height: 0;
}

.game-reset {
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  border: 1px solid rgba(0, 212, 255, 0.36);
  border-radius: 999px;
  background: rgba(3, 8, 13, 0.72);
  color: var(--accent-soft);
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: inset 0 0 14px rgba(0, 212, 255, 0.08);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.game-reset:hover,
.game-reset:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(0, 212, 255, 0.72);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.14), 0 10px 18px rgba(0, 0, 0, 0.22);
}

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

.leaderboard-label {
  margin-bottom: 6px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.leaderboard-list {
  margin: 0;
  min-height: 0;
  padding-left: 20px;
}

.leaderboard-list li {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 14px;
}

@keyframes tap-feedback {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: inset 0 0 18px rgba(0, 212, 255, 0.08);
  }

  35% {
    transform: translateY(1px) scale(0.975);
    box-shadow: inset 0 0 24px rgba(0, 212, 255, 0.18);
  }

  70% {
    transform: translateY(-1px) scale(1.01);
    box-shadow: inset 0 0 22px rgba(124, 255, 212, 0.16);
  }

  100% {
    transform: translateY(0) scale(1);
    box-shadow: inset 0 0 18px rgba(0, 212, 255, 0.08);
  }
}

@keyframes error-shake {
  0% {
    transform: translateX(0);
    border-color: rgba(0, 212, 255, 0.55);
  }

  20% {
    transform: translateX(-5px);
  }

  40% {
    transform: translateX(5px);
  }

  60% {
    transform: translateX(-4px);
    border-color: rgba(124, 255, 212, 0.9);
  }

  80% {
    transform: translateX(4px);
  }

  100% {
    transform: translateX(0);
    border-color: rgba(0, 212, 255, 0.55);
  }
}

@keyframes score-updated {
  0% {
    transform: translateY(0);
    box-shadow: none;
  }

  35% {
    transform: translateY(-2px);
    box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.12), 0 0 22px rgba(0, 212, 255, 0.14);
  }

  100% {
    transform: translateY(0);
    box-shadow: none;
  }
}

.game-cell.is-tap-feedback {
  animation: tap-feedback 180ms ease-out;
}

.game-cell.is-error-shake {
  animation: error-shake 280ms ease;
}

.leaderboard-list.is-score-updated {
  animation: score-updated 460ms ease-out;
}

.lab-shell {
  width: min(calc(100% - 32px), 1080px);
  max-width: 1080px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 36px 0 64px;
  display: grid;
  place-items: center;
  box-sizing: border-box;
}

.lab-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 32px;
  display: grid;
  gap: 24px;
  box-sizing: border-box;
}

.lab-header {
  display: grid;
  gap: 10px;
}

.lab-mark {
  color: var(--accent-soft);
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.lab-shortcuts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.lab-shortcut-button {
  min-width: 64px;
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 999px;
  background: rgba(3, 8, 13, 0.72);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.lab-shortcut-button:hover,
.lab-shortcut-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(0, 212, 255, 0.64);
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.12), 0 10px 18px rgba(0, 0, 0, 0.2);
}

.lab-shortcut-button.is-active,
.lab-shortcut-button[aria-current="page"] {
  border-color: rgba(124, 255, 212, 0.42);
  background: rgba(8, 16, 22, 0.94);
  color: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(124, 255, 212, 0.12);
  cursor: default;
}

.lab-shortcut-button:disabled {
  opacity: 1;
}

.lab-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
}

.lab-node {
  position: relative;
  min-height: 132px;
  border: 1px solid rgba(0, 212, 255, 0.18);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(0, 212, 255, 0.06), transparent 70%),
    rgba(5, 10, 15, 0.82);
  overflow: hidden;
}

.lab-node::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(124, 255, 212, 0.16);
  border-radius: 12px;
}

.lab-node::after {
  content: "";
  position: absolute;
  width: 56%;
  aspect-ratio: 1 / 1;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(0, 212, 255, 0.26), transparent 70%);
  filter: blur(6px);
}

.lab-node-a::after {
  width: 48%;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(124, 255, 212, 0.28), transparent 72%);
}

.lab-node-b::after {
  width: 62%;
}

.lab-node-c::after {
  width: 44%;
  background: radial-gradient(circle, rgba(124, 255, 212, 0.2), transparent 72%);
}

.lab-node-d::after {
  width: 70%;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(0, 212, 255, 0.2), transparent 75%);
}

.lab-node-e::after {
  width: 38%;
}

.lab-node-f::after {
  width: 52%;
  background: linear-gradient(135deg, rgba(124, 255, 212, 0.24), transparent 78%);
}

.lab-pulse {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(0, 212, 255, 0.12), rgba(124, 255, 212, 0.46), rgba(0, 212, 255, 0.12));
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.14);
}

.lab-section {
  width: 100%;
  min-width: 0;
}

.wishbooth-admin {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  background: rgba(5, 10, 15, 0.74);
}

.wishbooth-admin-header {
  display: grid;
  gap: 8px;
}

.wishbooth-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.wishbooth-item {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(0, 212, 255, 0.14);
  border-radius: 16px;
  background: rgba(3, 8, 13, 0.76);
}

.wishbooth-item-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wishbooth-item-time {
  color: var(--muted);
  font-size: 13px;
}

.wishbooth-item-message {
  margin: 0;
  color: var(--text);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.wishbooth-delete {
  min-width: 88px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 154, 138, 0.24);
  border-radius: 999px;
  background: rgba(22, 8, 8, 0.72);
  color: #ffb0a2;
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.wishbooth-delete:hover,
.wishbooth-delete:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 154, 138, 0.56);
  box-shadow: 0 0 0 1px rgba(255, 154, 138, 0.12), 0 10px 18px rgba(0, 0, 0, 0.22);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 16px;
  width: 100%;
  min-width: 0;
}

.media-card {
  position: relative;
  min-width: 0;
}

.media-frame {
  position: relative;
  width: 100%;
  min-width: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgba(0, 212, 255, 0.14);
  border-radius: 18px;
  background: rgba(5, 10, 15, 0.88);
  box-shadow: inset 0 0 28px rgba(0, 212, 255, 0.04);
}

.media-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1);
  transition: transform 220ms ease;
}

.media-meta {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: flex-end;
  padding: 16px;
  background: linear-gradient(180deg, rgba(4, 7, 11, 0.04), rgba(4, 7, 11, 0.78));
  opacity: 0;
  transition: opacity 220ms ease;
  pointer-events: none;
  border-radius: 0 0 18px 18px;
}

.media-title {
  color: var(--text);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.media-card:hover .media-img,
.media-card:focus-within .media-img {
  transform: scale(1.05);
}

.media-card:hover .media-meta,
.media-card:focus-within .media-meta {
  opacity: 1;
}

.lab-access-denied .lab-content {
  display: none;
}

.lab-access-checking .lab-content,
.lab-access-checking .lab-denied {
  display: none;
}

.lab-access-granted .lab-denied {
  display: none;
}

.lab-denied {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.lab-denied-panel {
  width: min(100%, 420px);
  min-height: 260px;
  padding: 28px;
  display: grid;
  gap: 22px;
  place-items: center;
}

.lab-auth-copy {
  margin: 0;
  color: var(--muted);
  text-align: center;
}

.lab-denied-mark {
  width: min(160px, 48vw);
  aspect-ratio: 1 / 1;
  border-radius: 24px;
  border: 1px solid rgba(0, 212, 255, 0.22);
  background:
    linear-gradient(135deg, rgba(124, 255, 212, 0.08), transparent 72%),
    rgba(5, 10, 15, 0.84);
  box-shadow: inset 0 0 40px rgba(0, 212, 255, 0.08);
  position: relative;
}

.lab-denied-mark::before,
.lab-denied-mark::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 64%;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.82), transparent);
  box-shadow: 0 0 18px rgba(0, 212, 255, 0.26);
}

.lab-denied-mark::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.lab-denied-mark::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.lab-placeholder {
  min-height: 260px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(0, 212, 255, 0.26);
  border-radius: 20px;
  background:
    radial-gradient(circle at top, rgba(0, 212, 255, 0.12), transparent 52%),
    rgba(5, 10, 15, 0.68);
  text-align: center;
}

.lab-placeholder-copy {
  max-width: 420px;
}

.lab-placeholder-copy p:last-child {
  margin-bottom: 0;
}

.sudoku-shell {
  display: grid;
  gap: 18px;
}

.sudoku-header-copy {
  max-width: 620px;
}

.sudoku-status {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.sudoku-status.is-success {
  color: var(--accent-soft);
}

.sudoku-status.is-error {
  color: #ff9a8a;
}

.sudoku-timer {
  margin: -4px 0 0;
  color: var(--accent-soft);
  font-size: 14px;
  letter-spacing: 0.08em;
}

.sudoku-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 0;
  width: min(100%, 630px);
  border: 2px solid rgba(0, 212, 255, 0.44);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(5, 10, 15, 0.92);
  box-shadow: inset 0 0 26px rgba(0, 212, 255, 0.05);
}

.sudoku-cell {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(8, 13, 18, 0.94);
  color: var(--text);
  font: inherit;
  font-size: clamp(18px, 3vw, 28px);
  font-weight: 600;
  text-align: center;
  outline: none;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.sudoku-cell[data-col-boundary="true"] {
  border-right: 2px solid rgba(0, 212, 255, 0.34);
}

.sudoku-cell[data-row-boundary="true"] {
  border-bottom: 2px solid rgba(0, 212, 255, 0.34);
}

.sudoku-cell:focus-visible {
  position: relative;
  z-index: 1;
  border-color: rgba(124, 255, 212, 0.72);
  box-shadow: inset 0 0 0 1px rgba(124, 255, 212, 0.42);
  background: rgba(10, 18, 24, 0.98);
}

.sudoku-cell.is-given {
  background:
    linear-gradient(180deg, rgba(0, 212, 255, 0.12), transparent 72%),
    rgba(11, 20, 27, 0.98);
  color: var(--accent-soft);
  font-weight: 700;
}

.sudoku-cell.is-editable {
  color: var(--text);
}

.sudoku-cell.is-wrong {
  position: relative;
  z-index: 1;
  border-color: rgba(255, 84, 84, 0.94);
  background:
    linear-gradient(180deg, rgba(255, 84, 84, 0.22), transparent 76%),
    rgba(42, 10, 14, 0.98);
  color: #ffb0b0;
  box-shadow:
    inset 0 0 0 1px rgba(255, 84, 84, 0.52),
    0 0 18px rgba(255, 84, 84, 0.28);
}

.sudoku-cell.is-wrong-shake {
  animation: sudoku-wrong-shake 320ms ease;
}

.sudoku-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.sudoku-button {
  min-width: 108px;
  padding: 12px 18px;
  border: 1px solid rgba(0, 212, 255, 0.28);
  border-radius: 999px;
  background: rgba(3, 8, 13, 0.78);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

#sudoku-regenerate {
  border-color: rgba(124, 255, 212, 0.28);
  color: var(--accent-soft);
}

.sudoku-button:hover,
.sudoku-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(0, 212, 255, 0.7);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.14), 0 12px 18px rgba(0, 0, 0, 0.22);
}

.tetris-shell {
  gap: 26px;
}

.tetris-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 22px;
  align-items: start;
}

.tetris-board-panel,
.tetris-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  background: rgba(5, 10, 15, 0.74);
  box-shadow: inset 0 0 18px rgba(0, 212, 255, 0.03);
}

.tetris-board-panel::before,
.tetris-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent 38%);
}

.tetris-board-panel {
  padding: 22px;
  display: grid;
  gap: 16px;
  justify-items: center;
}

.tetris-board-stage {
  position: relative;
  width: min(100%, 300px);
}

.tetris-playing {
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.tetris-playing .lab-shell {
  min-height: 100svh;
  min-height: 100dvh;
  padding-top: 16px;
  padding-bottom: 24px;
  align-items: center;
}

.tetris-playing .tetris-layout {
  align-items: center;
}

.tetris-playing .tetris-board-stage,
.tetris-playing .tetris-mobile-controls,
.tetris-playing .tetris-control-button {
  touch-action: none;
}

.tetris-board {
  width: 100%;
  aspect-ratio: 1 / 2;
  border: 1px solid rgba(0, 212, 255, 0.18);
  border-radius: 18px;
  background: rgba(3, 8, 13, 0.86);
  box-shadow: inset 0 0 28px rgba(0, 212, 255, 0.08), 0 14px 28px rgba(0, 0, 0, 0.28);
}

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

.tetris-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 14px;
  padding: 22px;
  border-radius: 18px;
  background: rgba(4, 8, 12, 0.56);
  backdrop-filter: blur(4px);
  text-align: center;
}

.tetris-overlay-copy {
  max-width: 220px;
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

.tetris-status {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

.tetris-status.is-error {
  color: #ff9a8a;
}

.tetris-status.is-success {
  color: var(--accent-soft);
}

.tetris-controls,
.tetris-mobile-controls {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  justify-content: center;
}

.tetris-button,
.tetris-control-button {
  min-height: 44px;
  padding: 12px 18px;
  border: 1px solid rgba(0, 212, 255, 0.28);
  border-radius: 999px;
  background: rgba(3, 8, 13, 0.78);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.tetris-button:hover,
.tetris-button:focus-visible,
.tetris-control-button:hover,
.tetris-control-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(0, 212, 255, 0.7);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.14), 0 12px 18px rgba(0, 0, 0, 0.22);
}

.tetris-button-accent {
  border-color: rgba(124, 255, 212, 0.38);
  color: var(--accent-soft);
}

.tetris-overlay-button {
  min-width: 140px;
  min-height: 54px;
  font-size: 16px;
  letter-spacing: 0.12em;
}

.tetris-control-button {
  width: 64px;
  min-width: 64px;
  min-height: 64px;
  padding: 0;
  border-radius: 50%;
  font-size: 14px;
  letter-spacing: 0.08em;
}

.tetris-sidebar {
  display: grid;
  gap: 16px;
}

.tetris-card {
  padding: 20px;
  display: grid;
  gap: 14px;
}

.tetris-card-mark,
.tetris-stat-label,
.tetris-card-limit,
.tetris-rank {
  color: var(--accent-soft);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.tetris-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.tetris-stat {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(0, 212, 255, 0.14);
  border-radius: 16px;
  background: rgba(8, 13, 18, 0.86);
}

.tetris-stat strong {
  font-size: clamp(18px, 2.8vw, 28px);
}

.tetris-rule-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: var(--text);
}

.tetris-rule-note,
.tetris-leaderboard-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.tetris-leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.tetris-leaderboard-item,
.tetris-leaderboard-empty {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(0, 212, 255, 0.14);
  border-radius: 16px;
  background: rgba(8, 13, 18, 0.82);
}

.tetris-leaderboard-empty {
  grid-template-columns: 1fr;
  color: var(--muted);
  text-align: center;
}

.tetris-leaderboard-info {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.tetris-leaderboard-info strong {
  overflow-wrap: anywhere;
}

@keyframes sudoku-wrong-shake {
  0% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-4px);
  }

  40% {
    transform: translateX(4px);
  }

  60% {
    transform: translateX(-3px);
  }

  80% {
    transform: translateX(3px);
  }

  100% {
    transform: translateX(0);
  }
}

.architecture-showcase {
  gap: 28px;
  border-color: rgba(0, 212, 255, 0.16);
}

.architecture-hero {
  gap: 12px;
}

.language-toggle {
  display: inline-flex;
  gap: 8px;
  align-self: start;
}

.language-button {
  min-width: 86px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid rgba(0, 212, 255, 0.24);
  border-radius: 999px;
  background: rgba(3, 8, 13, 0.76);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.language-button:hover,
.language-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(0, 212, 255, 0.68);
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.14), 0 10px 18px rgba(0, 0, 0, 0.2);
}

.language-button.is-active {
  border-color: rgba(124, 255, 212, 0.48);
  color: var(--accent-soft);
  background: rgba(8, 16, 22, 0.94);
  box-shadow: inset 0 0 0 1px rgba(124, 255, 212, 0.12);
}

.architecture-kicker,
.architecture-label,
.architecture-card-mark,
.hierarchy-role {
  color: var(--accent-soft);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.architecture-hero-copy {
  max-width: 760px;
}

.architecture-section,
.architecture-card,
.hierarchy-card,
.reserved-block {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  background: rgba(5, 10, 15, 0.74);
  box-shadow: inset 0 0 18px rgba(0, 212, 255, 0.03);
}

.architecture-section {
  padding: 22px;
}

.architecture-section::before,
.architecture-card::before,
.hierarchy-card::before,
.reserved-block::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent 38%);
}

.architecture-section-head {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.architecture-section-head h2 {
  font-size: clamp(22px, 3vw, 30px);
}

.architecture-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.architecture-card {
  padding: 18px;
  display: grid;
  gap: 14px;
  min-width: 0;
}

.architecture-card h3 {
  font-size: 18px;
  line-height: 1.4;
}

.architecture-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  display: grid;
  gap: 8px;
}

.architecture-tree {
  margin: 0;
  padding: 20px;
  overflow: auto;
  border: 1px solid rgba(0, 212, 255, 0.14);
  border-radius: 16px;
  background: rgba(3, 8, 13, 0.82);
  color: var(--text);
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
  line-height: 1.8;
  white-space: pre;
}

.architecture-grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.sequence-track,
.validation-loop {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.lifecycle-stack {
  display: grid;
  gap: 14px;
}

.sequence-node,
.loop-node,
.future-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid rgba(0, 212, 255, 0.16);
  border-radius: 14px;
  background: rgba(8, 13, 18, 0.86);
  color: var(--text);
}

.sequence-node.is-accent,
.loop-node.is-accent {
  border-color: rgba(124, 255, 212, 0.42);
  color: var(--accent-soft);
}

.sequence-node.is-warning {
  border-color: rgba(255, 154, 138, 0.4);
  color: #ffb0a2;
}

.sequence-arrow,
.loop-arrow,
.hierarchy-arrow {
  color: rgba(0, 212, 255, 0.66);
  font-size: 18px;
}

.hierarchy-stack {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.hierarchy-card {
  width: min(100%, 360px);
  padding: 18px;
  display: grid;
  gap: 10px;
  text-align: center;
}

.hierarchy-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.validation-loop {
  display: grid;
  justify-items: start;
}

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

.reserved-block {
  min-height: 140px;
  padding: 18px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border-style: dashed;
}

.future-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.future-chip {
  color: var(--accent-soft);
  text-transform: lowercase;
}

.future-positioning {
  margin: 20px 0 0;
  color: var(--text);
  font-size: clamp(20px, 2.4vw, 28px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

footer {
  padding: 0 16px 26px;
  text-align: center;
  color: #6f7a80;
  font-size: 14px;
}

.agent-shell {
  width: min(calc(100% - 32px), 1120px);
}

.agent-panel {
  display: grid;
  gap: 22px;
}

.agent-toolbar,
.agent-columns {
  display: grid;
  gap: 16px;
}

.agent-toolbar {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.agent-section {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(153, 204, 255, 0.18);
  border-radius: 18px;
  background: rgba(4, 8, 16, 0.26);
}

.agent-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.agent-card {
  min-height: 72px;
  border: 1px solid rgba(121, 210, 255, 0.35);
  border-radius: 16px;
  background: rgba(9, 20, 32, 0.78);
  color: #f4fbff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.agent-card:hover,
.agent-card:focus-visible {
  border-color: rgba(180, 239, 255, 0.85);
  outline: none;
}

.agent-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.agent-subtitle {
  margin: 0 0 8px;
  color: #e9f7ff;
  font-size: 16px;
}

.agent-log {
  display: grid;
  gap: 10px;
}

.agent-log-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
}

.agent-log-item p {
  margin: 0;
  color: #f7fbff;
  overflow-wrap: anywhere;
}

.agent-log-item span {
  color: #8fa7b6;
  font-size: 12px;
}

@media (max-width: 980px) {
  .site-shell {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .hero-copy,
  #temporary-interactive-module {
    padding: 24px;
  }
}

@media (max-width: 680px) {
  .site-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 20px;
    gap: 18px;
  }

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

  .game-board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  h1 {
    font-size: clamp(34px, 10vw, 46px);
  }

  .lab-panel {
    padding: 24px;
  }

  .lab-shell {
    width: min(calc(100% - 20px), 1080px);
    padding-top: 24px;
    padding-bottom: 40px;
  }

  .lab-shortcuts {
    justify-content: flex-start;
  }

  .lab-grid {
    grid-template-columns: 1fr;
  }

  .media-grid {
    grid-template-columns: 1fr;
  }

  .sudoku-grid {
    width: 100%;
  }

  .sudoku-cell {
    font-size: clamp(16px, 5vw, 22px);
  }

  .tetris-layout,
  .tetris-stat-grid {
    grid-template-columns: 1fr;
  }

  .tetris-board-panel {
    padding: 18px;
  }

  .tetris-board {
    width: min(100%, 280px);
  }

  .tetris-playing .lab-shell {
    width: min(100vw - 16px, 1080px);
    padding-top: 12px;
    padding-bottom: 18px;
  }

  .tetris-control-button {
    width: 56px;
    min-width: 56px;
    min-height: 56px;
    font-size: 13px;
  }

  .tetris-overlay-copy {
    max-width: 210px;
    font-size: 13px;
  }

  .architecture-cards,
  .architecture-grid-two,
  .reserved-grid {
    grid-template-columns: 1fr;
  }

  .architecture-tree {
    font-size: 13px;
  }

  .agent-toolbar,
  .agent-columns {
    grid-template-columns: 1fr;
  }

  .site-version {
    left: max(10px, env(safe-area-inset-left));
    bottom: max(10px, env(safe-area-inset-bottom));
    font-size: 10px;
  }
}
