/* ================================================================
   SENSORY — Global Styles
   Ultra-minimalist dark brutalist theme
   ================================================================ */

:root {
  --bg: #0A0A0A;
  --surface: #111111;
  --surface-hover: #1A1A1A;
  --border: #222222;
  --border-hover: #444444;
  --text: #FFFFFF;
  --text-secondary: #666666;
  --text-tertiary: #444444;
  --accent: #FFFFFF;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition: 200ms var(--ease);
  --max-width: 1120px;
  --game-card-max: 480px;
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--text); }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  font-size: inherit;
}

input[type="text"],
input[type="password"] {
  font-family: inherit;
  font-size: 1rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}
input[type="text"]:focus,
input[type="password"]:focus {
  border-color: var(--text-secondary);
}

/* ================================================================
   LAYOUT
   ================================================================ */

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  flex: 1;
}
.screen.active {
  display: flex;
  flex-direction: column;
}

/* ================================================================
   HEADER
   ================================================================ */

#header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(10, 10, 10, 0.85);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.logo:hover { color: var(--text); }

.logo-tld {
  color: var(--text-tertiary);
  font-weight: 400;
}

.header-nav {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background var(--transition);
  color: var(--text-secondary);
}
.icon-btn:hover {
  background: var(--surface);
  color: var(--text);
}

/* Ko-fi button */
.kofi-icon {
  width: 16px;
  height: 16px;
  fill: #ff6b6b;
  flex-shrink: 0;
}
.kofi-btn:hover .kofi-icon {
  fill: #ff8a8a;
}
.kofi-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  background: rgba(255, 95, 95, 0.12);
  border: 1px solid rgba(255, 95, 95, 0.25);
  color: #ff6b6b;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: all var(--transition);
  text-decoration: none;
}
.kofi-btn:hover {
  background: rgba(255, 95, 95, 0.22);
  border-color: rgba(255, 95, 95, 0.5);
  color: #ff8a8a;
  transform: scale(1.04);
}
.kofi-text {
  display: inline-block;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ================================================================
   HERO
   ================================================================ */

.hero {
  padding: 80px 24px 60px;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}

.hero-title {
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 16px;
}

.hero-sub {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 400;
  max-width: 540px;
  line-height: 1.55;
}

/* ================================================================
   CATEGORIES & GAME GRID
   ================================================================ */

.category-section {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  padding: 0 24px 48px;
}

.category-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-tertiary);
  margin-bottom: 16px;
  padding-left: 4px;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

/* ================================================================
   GAME CARD
   ================================================================ */

.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--transition), transform 200ms var(--ease);
  display: flex;
  flex-direction: column;
  position: relative;
}
.game-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}
.game-card:active {
  transform: translateY(0) scale(0.98);
}

.card-preview {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.card-subtitle {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.card-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
  flex: 1;
}

.card-footer {
  padding: 0 16px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-best {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-tertiary);
}
.card-best span {
  color: var(--text-secondary);
}

.card-play-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition);
}
.game-card:hover .card-play-icon {
  background: var(--text);
  border-color: var(--text);
}
.game-card:hover .card-play-icon svg {
  color: var(--bg);
}

/* Card preview art */
.preview-color { background: conic-gradient(from 0deg, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); opacity: 0.4; width: 100%; height: 100%; filter: blur(30px); }
.preview-scale { width: 60px; height: 40px; border: 2px solid rgba(255,255,255,0.3); transition: all 1s; }
.preview-degree { position: relative; width: 80px; height: 80px; }
.preview-degree::before, .preview-degree::after { content:''; position: absolute; background: rgba(255,255,255,0.3); }
.preview-degree::before { width: 80px; height: 2px; top: 50%; left: 0; }
.preview-degree::after { width: 60px; height: 2px; top: 50%; left: 50%; transform-origin: left center; transform: rotate(-45deg); }
.preview-kerning { font-size: 1.4rem; font-weight: 300; letter-spacing: 0.3em; color: rgba(255,255,255,0.3); }
.preview-opacity { width: 50px; height: 50px; background: rgba(255,255,255,0.25); }
.preview-bezier { position: relative; }
.preview-bezier svg { width: 100px; height: 60px; }
.preview-blur { width: 60px; height: 60px; border-radius: 50%; background: rgba(255,255,255,0.3); filter: blur(8px); }
.preview-radius { width: 50px; height: 50px; background: rgba(255,255,255,0.15); border-radius: 14px; border: 2px solid rgba(255,255,255,0.3); }
.preview-align { position: relative; width: 80px; height: 80px; border: 1px solid rgba(255,255,255,0.1); border-radius: 4px; }
.preview-align::after { content:''; position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #ff4444; top: 30%; left: 60%; }
.preview-tone svg { width: 100px; height: 40px; }
.preview-pace { display: flex; gap: 8px; align-items: center; }
.preview-pace span { width: 12px; height: 12px; border-radius: 50%; background: rgba(255,255,255,0.2); }
.preview-pace span:nth-child(2) { width: 16px; height: 16px; background: rgba(255,255,255,0.4); }
.preview-pan { font-size: 0.7rem; color: rgba(255,255,255,0.3); display: flex; gap: 24px; font-weight: 700; }
.preview-eq { display: flex; gap: 6px; align-items: flex-end; height: 50px; }
.preview-eq span { width: 8px; background: rgba(255,255,255,0.2); border-radius: 2px; }
.preview-span { font-family: var(--mono); font-size: 1.8rem; font-weight: 700; color: rgba(255,255,255,0.15); }
.preview-velocity { position: relative; width: 80px; height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; }
.preview-velocity::after { content:''; position: absolute; right: 0; top: -3px; width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,0.3); }
.preview-bounce { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.preview-bounce span { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,0.25); }

/* New game previews */
.preview-gradient { width: 100%; height: 100%; background: linear-gradient(90deg, #ff6b6b, #ffd93d); opacity: 0.4; }
.preview-rotation { width: 50px; height: 34px; background: rgba(255,255,255,0.25); border-radius: 6px; transform: rotate(25deg); }
.preview-shadow { width: 50px; height: 50px; background: rgba(255,255,255,0.3); border-radius: 10px; box-shadow: 4px 6px 16px rgba(0,0,0,0.5); }
.preview-pitch svg { width: 100px; height: 40px; }

/* New spatial/design game previews */
.preview-horizon { width: 100%; height: 100%; background: linear-gradient(to bottom, #2d1b69 45%, #1a3a2a 45%); opacity: 0.4; transform: rotate(8deg) scale(1.2); }
.preview-division { width: 100%; height: 100%; background: linear-gradient(to right, rgba(100,150,255,0.3) 60%, rgba(255,150,100,0.3) 60%); }
.preview-centroid { position: relative; width: 80px; height: 80px; }
.preview-centroid::before { content: ''; position: absolute; inset: 10%; background: rgba(255,255,255,0.1); clip-path: polygon(50% 5%, 90% 35%, 80% 85%, 20% 85%, 10% 35%); }
.preview-centroid::after { content: ''; position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #ff4444; top: 45%; left: 48%; }
.preview-orientation { width: 60px; height: 60px; transform-style: preserve-3d; transform: rotateX(-20deg) rotateY(30deg); }
.preview-orientation::before { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.25); }
.preview-linespacing { font-size: 0.5rem; color: rgba(255,255,255,0.25); line-height: 2.2; max-width: 100px; text-align: left; padding: 12px; }
.preview-exposure { width: 100%; height: 100%; background: radial-gradient(circle at 40% 40%, rgba(255,255,255,0.3), rgba(0,0,0,0.3)); }

/* ================================================================
   GAME SCREEN
   ================================================================ */

#screen-game {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  flex-direction: column;
}
#screen-game.active {
  display: flex;
  animation: fadeIn 300ms var(--ease);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.game-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  position: relative;
  z-index: 10;
}

.game-header-brand {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.game-round-indicator {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.game-title-small {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-left: auto;
  font-weight: 500;
}

#game-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 24px 24px;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

/* ================================================================
   GAME PHASES
   ================================================================ */

.game-card-inner {
  width: 100%;
  max-width: var(--game-card-max);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  animation: cardIn 400ms var(--ease-bounce);
}

@keyframes cardIn {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Intro phase */
.game-intro {
  text-align: center;
  padding: 40px 24px;
  animation: phaseIn 350ms var(--ease);
}

.game-intro h2 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.game-intro .game-type {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  margin-bottom: 24px;
}

.game-intro p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 360px;
  margin: 0 auto 32px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 100px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition);
  border: 1px solid var(--border);
}

.btn-primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.btn-primary:hover {
  background: #e0e0e0;
}

.btn-secondary {
  background: transparent;
  color: var(--text);
}
.btn-secondary:hover {
  background: var(--surface);
  border-color: var(--border-hover);
}

/* Memorize phase */
.memorize-phase {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.memorize-display {
  width: 100%;
  max-width: var(--game-card-max);
  aspect-ratio: 1;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  animation: cardIn 400ms var(--ease-bounce);
}

.memorize-countdown {
  position: absolute;
  top: 16px;
  right: 20px;
  font-family: var(--mono);
  font-size: 3rem;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  text-shadow: 0 2px 12px rgba(0,0,0,0.7), 0 0 40px rgba(0,0,0,0.4);
  line-height: 1;
  z-index: 5;
  display: flex;
  align-items: baseline;
}

.memorize-countdown .countdown-decimal {
  font-size: 1.8rem;
  font-weight: 400;
}

.memorize-label {
  position: absolute;
  bottom: 20px;
  right: 20px;
  font-size: 0.7rem;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  text-shadow: 0 1px 8px rgba(0,0,0,0.6), 0 0 20px rgba(0,0,0,0.3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.memorize-round-label {
  position: absolute;
  top: 16px;
  left: 20px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: rgba(255,255,255,0.7);
  text-shadow: 0 1px 8px rgba(0,0,0,0.6), 0 0 20px rgba(0,0,0,0.3);
}

/* Input phase */
.input-phase {
  width: 100%;
  max-width: var(--game-card-max);
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: phaseIn 350ms var(--ease);
}

@keyframes phaseIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.input-preview {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-label span:first-child {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.slider-label .slider-value {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-tertiary);
  min-width: 40px;
  text-align: right;
}

/* Custom slider */
.custom-slider {
  position: relative;
  height: 44px;
  display: flex;
  align-items: center;
  touch-action: none;
  cursor: pointer;
}

.slider-track {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--surface);
  position: relative;
  overflow: visible;
}

.slider-track-fill {
  height: 100%;
  border-radius: 4px;
  position: absolute;
  left: 0;
  top: 0;
}

.slider-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--text);
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  transition: transform 100ms var(--ease);
  z-index: 2;
}

.slider-thumb:hover,
.slider-thumb.dragging {
  transform: translate(-50%, -50%) scale(1.15);
}

.slider-track.hue-track {
  background: linear-gradient(to right,
    hsl(0,100%,50%), hsl(60,100%,50%), hsl(120,100%,50%),
    hsl(180,100%,50%), hsl(240,100%,50%), hsl(300,100%,50%), hsl(360,100%,50%)
  );
}

/* Submit button */
.submit-row {
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.btn-submit {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 150ms var(--ease), background 150ms;
  border: none;
}
.btn-submit:hover {
  transform: scale(1.08);
}
.btn-submit:active {
  transform: scale(0.95);
}

/* ================================================================
   RESULT PHASE
   ================================================================ */

.result-phase {
  width: 100%;
  max-width: var(--game-card-max);
  animation: cardIn 400ms var(--ease-bounce);
}

.result-card {
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 350ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 350ms ease;
}
.result-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

.result-top {
  padding: 24px;
  position: relative;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: filter 350ms ease;
}
.result-card:hover .result-top {
  filter: brightness(1.08);
}

.result-round {
  font-family: var(--mono);
  font-size: 0.75rem;
  opacity: 0.4;
}

.result-score-area {
  text-align: right;
}

.result-score {
  font-family: var(--mono);
  font-size: 4.5rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  transition: transform 350ms cubic-bezier(0.22, 1, 0.36, 1);
}
.result-card:hover .result-score {
  transform: scale(1.05);
}

.result-message {
  font-size: 0.85rem;
  font-weight: 500;
  max-width: 200px;
  margin-left: auto;
  text-align: right;
  opacity: 0.7;
  margin-top: 4px;
}

.result-your-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.35;
}

.result-your-value {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  opacity: 0.6;
}

.result-bottom {
  padding: 24px;
  position: relative;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  transition: filter 350ms ease;
}
.result-card:hover .result-bottom {
  filter: brightness(1.08);
}

.result-original-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.35;
}

.result-original-value {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  opacity: 0.6;
}

.wheel-tools {
  background: #101012;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wheel-roast {
  font-size: 0.78rem;
  line-height: 1.4;
  color: rgba(255,255,255,0.9);
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
}

.wheel-roast-pop {
  animation: wheelRoastPop 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes wheelRoastPop {
  0% { transform: translateY(4px); opacity: 0.35; }
  100% { transform: translateY(0); opacity: 1; }
}

.wheel-tools-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}

.wheel-size-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 110px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.6);
}

.wheel-size-wrap input,
.wheel-size-wrap select {
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0 10px;
}

.wheel-tools .btn {
  height: 34px;
  padding: 0 14px;
  font-size: 0.72rem;
}

.result-next-wrap {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.result-next-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: transform 150ms var(--ease), background 150ms;
  position: relative;
}
.result-next-btn:hover { transform: scale(1.1); }
.result-next-btn .next-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.result-next-btn .next-arrow {
  position: relative;
  z-index: 1;
}

/* ================================================================
   SUMMARY PHASE
   ================================================================ */

.summary-phase {
  width: 100%;
  max-width: var(--game-card-max);
  animation: cardIn 400ms var(--ease-bounce);
}

.summary-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  padding: 32px 24px;
}

.summary-rank {
  font-family: var(--mono);
  font-size: 0.85rem;
  margin-bottom: 4px;
}
.summary-rank .rank-num {
  color: #f0c040;
}

.summary-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.summary-total-score {
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 700;
}

.summary-total-max {
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--text-secondary);
}

.summary-msg {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.summary-rounds {
  display: flex;
  gap: 6px;
  margin-bottom: 32px;
}

.summary-round-block {
  flex: 1;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 8px;
  transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 300ms ease, filter 300ms ease;
  cursor: default;
}
.summary-round-block:hover {
  transform: translateY(-6px) scale(1.08);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  filter: brightness(1.12);
  z-index: 2;
}

.summary-round-score {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.summary-round-block .triangle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
}

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

.summary-actions .btn {
  flex: 1;
}

/* ================================================================
   PROFILE / AUTH
   ================================================================ */

.profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.profile-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

#profile-content,
#leaderboard-content {
  padding: 24px;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.auth-form h3 {
  font-size: 1.4rem;
  font-weight: 700;
}

.auth-form p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.auth-toggle {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 8px;
}
.auth-toggle a {
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.profile-username {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-stat {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.profile-scores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.profile-score-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.profile-score-item .psi-game {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.profile-score-item .psi-score {
  font-family: var(--mono);
  font-size: 1.2rem;
  font-weight: 700;
}

/* Friends */
.friends-section {
  margin-top: 24px;
}

.friends-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.friend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.friend-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.friend-score {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.add-friend-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.add-friend-row input {
  flex: 1;
}

/* ================================================================
   LEADERBOARD
   ================================================================ */

.lb-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.lb-tab {
  padding: 8px 16px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition);
}
.lb-tab.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.lb-tab:hover:not(.active) {
  border-color: var(--border-hover);
}

.lb-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.lb-rank {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-tertiary);
  min-width: 32px;
}

.lb-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.9rem;
}

.lb-score {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 700;
}

/* ================================================================
   GAME-SPECIFIC STYLES
   ================================================================ */

/* Interactive canvas areas */
.game-canvas {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: var(--surface);
  position: relative;
  overflow: hidden;
  touch-action: none;
  cursor: crosshair;
}

/* Vertical slider (for EQ) */
.vertical-slider-group {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: flex-end;
  height: 200px;
  padding: 16px;
}

.vertical-slider {
  width: 44px;
  height: 100%;
  position: relative;
  touch-action: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.vertical-slider .v-track {
  width: 8px;
  flex: 1;
  border-radius: 4px;
  background: var(--border);
  position: relative;
}

.vertical-slider .v-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--text);
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  z-index: 2;
}

.vertical-slider .v-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* Tap button (Pace, Span) */
.tap-btn {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 80ms, background 80ms, border-color 80ms;
  touch-action: manipulation;
  user-select: none;
}
.tap-btn:active, .tap-btn.pressed {
  transform: scale(0.93);
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* Hold button (Span) */
.hold-btn {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--border);
  font-size: 1.2rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 80ms;
  touch-action: manipulation;
  user-select: none;
}
.hold-btn.holding {
  border-color: var(--text);
  color: var(--text);
  background: var(--surface-hover);
}

/* Rotary dial (Degree) */
.rotary-dial {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 2px solid var(--border);
  position: relative;
  touch-action: none;
  cursor: grab;
}
.rotary-dial:active { cursor: grabbing; }

.rotary-line {
  position: absolute;
  width: 50%;
  height: 2px;
  top: 50%;
  left: 50%;
  transform-origin: left center;
  transform: translateY(-50%);
}
.rotary-line-fixed { background: var(--text-tertiary); }
.rotary-line-movable { background: var(--text); }

.rotary-center {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

/* Physics canvas */
.physics-canvas {
  width: 100%;
  aspect-ratio: 3/4;
  max-height: 300px;
  border-radius: var(--radius);
  background: var(--surface);
  position: relative;
  overflow: hidden;
}

.physics-ball {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text);
  position: absolute;
  transform: translate(-50%, 0);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  z-index: 2;
}

.physics-floor {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border-hover);
}

/* Velocity track */
.velocity-track {
  width: 100%;
  height: 60px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  position: relative;
  overflow: hidden;
}

.velocity-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text);
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
}

/* Bezier canvas */
.bezier-canvas {
  width: 100%;
  aspect-ratio: 2/1;
  border-radius: var(--radius);
  background: var(--surface);
  position: relative;
  overflow: visible;
}

.bezier-canvas svg {
  width: 100%;
  height: 100%;
}

.bezier-handle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--text);
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: grab;
  touch-action: none;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.bezier-handle:active { cursor: grabbing; }

/* Scale handles */
.scale-canvas {
  width: 100%;
  aspect-ratio: 1;
  max-height: 350px;
  border-radius: var(--radius);
  background: var(--surface);
  position: relative;
  touch-action: none;
}

.scale-rect {
  position: absolute;
  border: 2px solid var(--text);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.scale-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--text);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: nwse-resize;
  touch-action: none;
  z-index: 5;
}

/* ================================================================
   TOAST
   ================================================================ */

#toast-container {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 0.85rem;
  font-weight: 500;
  animation: toastIn 300ms var(--ease), toastOut 300ms var(--ease) 2700ms forwards;
  pointer-events: auto;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ================================================================
   FOOTER
   ================================================================ */

.site-footer {
  padding: 40px 24px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.footer-sep { opacity: 0.3; }

.site-footer a {
  color: var(--text-tertiary);
}
.site-footer a:hover {
  color: var(--text-secondary);
}

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

@media (max-width: 640px) {
  .hero {
    padding: 48px 20px 40px;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-sub {
    font-size: 0.85rem;
    max-width: 100%;
  }

  .category-section {
    padding: 0 16px 32px;
  }

  .game-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .game-card {
    flex-direction: row;
  }

  .card-preview {
    width: 100px;
    height: auto;
    min-height: 100px;
    flex-shrink: 0;
  }

  .card-body {
    padding: 12px 14px;
  }

  .card-footer {
    display: none;
  }

  .game-header {
    padding: 12px 16px;
    gap: 8px;
  }

  .game-header-brand {
    font-size: 0.8rem;
  }

  #game-container {
    padding: 0 12px 12px;
  }

  .result-score {
    font-size: 3.5rem;
  }

  .memorize-display {
    aspect-ratio: auto;
    min-height: 280px;
  }

  .game-intro h2 {
    font-size: 1.8rem;
  }

  .game-intro p {
    font-size: 0.85rem;
  }

  .input-preview {
    aspect-ratio: 1;
  }

  .slider-thumb, .v-thumb {
    width: 28px;
    height: 28px;
  }

  .slider-track {
    height: 10px;
  }

  .tap-btn {
    width: 140px;
    height: 140px;
  }

  .hold-btn {
    width: 160px;
    height: 160px;
  }

  .rotary-dial {
    width: 160px;
    height: 160px;
  }

  .vertical-slider-group {
    gap: 14px;
    height: 180px;
  }

  .btn {
    padding: 10px 22px;
    font-size: 0.85rem;
  }

  .summary-rounds {
    gap: 4px;
  }

  .summary-round-block {
    padding: 6px;
  }

  .summary-round-score {
    font-size: 0.65rem;
  }
}

@media (max-width: 380px) {
  .hero-title {
    font-size: 1.6rem;
  }

  .hero-sub {
    font-size: 0.8rem;
  }

  .game-header-brand {
    display: none;
  }

  .memorize-display {
    min-height: 240px;
  }
}

@media (min-width: 1200px) {
  .game-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ================================================================
   UTILITY
   ================================================================ */

.mono { font-family: var(--mono); }
.text-secondary { color: var(--text-secondary); }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.hidden { display: none !important; }

/* Pulse animation for pace game */
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.3); opacity: 1; }
}

.pulsing {
  animation: pulse var(--pulse-duration, 1s) ease-in-out infinite;
}

/* Flash for span game */
@keyframes flash {
  0%, 100% { opacity: 0; }
  5%, 95% { opacity: 1; }
}

/* Checkerboard for opacity game */
.checkerboard {
  background-image:
    linear-gradient(45deg, #222 25%, transparent 25%),
    linear-gradient(-45deg, #222 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #222 75%),
    linear-gradient(-45deg, transparent 75%, #222 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
