/* =================================================================
   Sympatiq Catch — main stylesheet
   Design system: dark luxe boutique + arcade vitality
   ================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700;9..144,900&family=DM+Sans:wght@400;500;700&display=swap');

:root {
  /* Brand palette */
  --c-bg-deep: #1A1817;
  --c-bg-panel: #252220;
  --c-bg-elevated: #2D2A28;
  --c-primary: #20BFB5;
  --c-primary-light: #4DD4CB;
  --c-primary-dark: #0F7A72;
  --c-accent: #F5C842;
  --c-accent-warm: #E8B530;
  --c-cream: #F5F1EC;
  --c-text: #F5F1EC;
  --c-text-muted: #A8A29E;
  --c-text-subtle: #6B6664;
  --c-danger: #E84A4A;
  --c-success: #20BFB5;

  /* Spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;

  /* Typography */
  --f-display: 'Fraunces', 'Georgia', serif;
  --f-body: 'DM Sans', 'Helvetica Neue', sans-serif;

  /* Shadows */
  --shadow-glow-primary: 0 0 32px rgba(32, 191, 181, 0.35), 0 0 80px rgba(32, 191, 181, 0.15);
  --shadow-glow-accent: 0 0 24px rgba(245, 200, 66, 0.4);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-card-elevated: 0 16px 48px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(0, 0, 0, 0.3);

  /* Radii */
  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 20px;
  --r-xl: 32px;
  --r-full: 9999px;

  /* Transitions */
  --t-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  height: 100%;
  background: var(--c-bg-deep);
  color: var(--c-text);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  background: radial-gradient(ellipse at top, #2A2624 0%, #1A1817 60%, #0F0D0C 100%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Decorative noise texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Decorative ambient glow */
body::after {
  content: '';
  position: fixed;
  top: -10%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(circle, rgba(32, 191, 181, 0.08) 0%, transparent 60%);
  filter: blur(60px);
}

a {
  color: var(--c-primary);
  text-decoration: none;
  transition: color var(--t-fast);
}

a:hover {
  color: var(--c-primary-light);
}

/* =========================
   Layout
   ========================= */

.site {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-header {
  padding: var(--s-5) var(--s-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(245, 241, 236, 0.06);
}

.site-header .logo img {
  height: 56px;
  width: auto;
  display: block;
}

.site-header nav {
  display: flex;
  gap: var(--s-5);
}

.site-header nav a {
  font-family: var(--f-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-text-muted);
}

.site-header nav a:hover {
  color: var(--c-primary);
}

.site-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s-6) var(--s-4);
  min-height: 0;
}

.site-footer {
  padding: var(--s-5) var(--s-6);
  border-top: 1px solid rgba(245, 241, 236, 0.06);
  text-align: center;
  font-size: 12px;
  color: var(--c-text-subtle);
  letter-spacing: 0.04em;
}

.site-footer a {
  color: var(--c-text-muted);
  margin: 0 var(--s-3);
}

/* =========================
   Hero / Intro
   ========================= */

.hero {
  text-align: center;
  max-width: 720px;
  margin-bottom: var(--s-7);
}

.hero .eyebrow {
  font-family: var(--f-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--c-primary);
  margin-bottom: var(--s-4);
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid rgba(32, 191, 181, 0.25);
  border-radius: var(--r-full);
  background: rgba(32, 191, 181, 0.05);
}

.hero h1 {
  font-family: var(--f-display);
  font-size: clamp(40px, 7vw, 72px);
  font-weight: 700;
  font-variation-settings: 'opsz' 96;
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: var(--s-4);
}

.hero h1 em {
  font-style: italic;
  color: var(--c-primary);
  font-variation-settings: 'opsz' 144;
}

.hero p {
  font-size: 17px;
  color: var(--c-text-muted);
  max-width: 540px;
  margin: 0 auto var(--s-5);
}

/* =========================
   Game container
   ========================= */

#game-wrapper {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card-elevated), 0 0 0 1px rgba(32, 191, 181, 0.15);
  background: var(--c-bg-panel);
}

#game-wrapper.is-mobile {
  max-width: 420px;
}

#game {
  width: 100%;
  display: block;
  /* Phaser will set its own canvas size */
}

#game canvas {
  display: block;
  width: 100% !important;
  height: auto !important;
}

/* =========================
   Buttons
   ========================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 14px 32px;
  font-family: var(--f-body);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: none;
  border-radius: var(--r-full);
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--c-primary);
  color: var(--c-bg-deep);
  box-shadow: var(--shadow-glow-primary);
}

.btn-primary:hover {
  background: var(--c-primary-light);
  transform: translateY(-2px);
  box-shadow: 0 0 40px rgba(32, 191, 181, 0.5), 0 0 100px rgba(32, 191, 181, 0.2);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  color: var(--c-text);
  border: 1px solid rgba(245, 241, 236, 0.2);
}

.btn-ghost:hover {
  border-color: var(--c-primary);
  color: var(--c-primary);
  background: rgba(32, 191, 181, 0.05);
}

.btn-large {
  padding: 18px 48px;
  font-size: 16px;
}

/* =========================
   Tutorial cards
   ========================= */

.tutorial {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-4);
  max-width: 720px;
  margin: var(--s-6) auto;
}

.tut-card {
  padding: var(--s-5);
  background: var(--c-bg-panel);
  border: 1px solid rgba(245, 241, 236, 0.06);
  border-radius: var(--r-md);
  text-align: center;
  transition: border-color var(--t-base), transform var(--t-base);
}

.tut-card:hover {
  border-color: rgba(32, 191, 181, 0.3);
  transform: translateY(-2px);
}

.tut-card .ico {
  font-size: 32px;
  margin-bottom: var(--s-2);
  display: block;
}

.tut-card h3 {
  font-family: var(--f-display);
  font-size: 18px;
  font-weight: 600;
  font-style: italic;
  margin-bottom: 4px;
}

.tut-card p {
  font-size: 13px;
  color: var(--c-text-muted);
}

@media (max-width: 640px) {
  .tutorial { grid-template-columns: 1fr; }
}

/* =========================
   Game Over modal
   ========================= */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 9, 8, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
  animation: fadeIn var(--t-base);
}

.modal-backdrop.show {
  display: flex;
}

.modal {
  background: var(--c-bg-panel);
  border: 1px solid rgba(32, 191, 181, 0.2);
  border-radius: var(--r-lg);
  max-width: 520px;
  width: 100%;
  padding: var(--s-7) var(--s-6);
  box-shadow: var(--shadow-card-elevated);
  position: relative;
  animation: scaleIn var(--t-slow);
}

.modal h2 {
  font-family: var(--f-display);
  font-size: 36px;
  font-weight: 700;
  font-style: italic;
  text-align: center;
  margin-bottom: var(--s-2);
  font-variation-settings: 'opsz' 144;
}

.modal .subtitle {
  text-align: center;
  color: var(--c-text-muted);
  font-size: 14px;
  margin-bottom: var(--s-5);
}

.score-display {
  text-align: center;
  padding: var(--s-5);
  background: var(--c-bg-deep);
  border-radius: var(--r-md);
  margin-bottom: var(--s-5);
  border: 1px solid rgba(32, 191, 181, 0.15);
}

.score-display .label {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--c-text-muted);
  margin-bottom: var(--s-2);
}

.score-display .value {
  font-family: var(--f-display);
  font-size: 64px;
  font-weight: 700;
  color: var(--c-primary);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variation-settings: 'opsz' 144;
}

.score-display .stats {
  display: flex;
  justify-content: center;
  gap: var(--s-5);
  margin-top: var(--s-3);
  font-size: 13px;
  color: var(--c-text-muted);
}

.score-display .stats span strong {
  color: var(--c-cream);
  font-weight: 600;
}

/* =========================
   Forms
   ========================= */

.form-group {
  margin-bottom: var(--s-4);
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-text-muted);
  margin-bottom: var(--s-2);
}

.form-group input[type="text"],
.form-group input[type="email"] {
  width: 100%;
  padding: 14px 16px;
  background: var(--c-bg-deep);
  border: 1px solid rgba(245, 241, 236, 0.1);
  border-radius: var(--r-md);
  color: var(--c-text);
  font-family: var(--f-body);
  font-size: 15px;
  transition: border-color var(--t-fast), background var(--t-fast);
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus {
  outline: none;
  border-color: var(--c-primary);
  background: var(--c-bg-elevated);
  box-shadow: 0 0 0 3px rgba(32, 191, 181, 0.15);
}

.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
  padding: var(--s-3);
  background: var(--c-bg-deep);
  border-radius: var(--r-md);
  border: 1px solid rgba(245, 241, 236, 0.06);
}

.checkbox-group input[type="checkbox"] {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--c-primary);
  cursor: pointer;
}

.checkbox-group label {
  font-size: 12px;
  color: var(--c-text-muted);
  line-height: 1.5;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  margin: 0;
}

.checkbox-group label a {
  color: var(--c-primary);
  text-decoration: underline;
}

.btn-row {
  display: flex;
  gap: var(--s-3);
  flex-wrap: wrap;
}

.btn-row .btn {
  flex: 1;
  min-width: 140px;
}

.email-section {
  margin-top: var(--s-5);
  padding-top: var(--s-5);
  border-top: 1px dashed rgba(245, 241, 236, 0.1);
}

.email-section h3 {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 22px;
  margin-bottom: var(--s-2);
  text-align: center;
}

.email-section .desc {
  text-align: center;
  font-size: 13px;
  color: var(--c-text-muted);
  margin-bottom: var(--s-4);
}

.field-error {
  color: var(--c-danger);
  font-size: 12px;
  margin-top: 4px;
  display: none;
}

.field-error.show {
  display: block;
}

/* =========================
   Ranking
   ========================= */

.ranking {
  margin-top: var(--s-7);
  max-width: 520px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.ranking h2 {
  font-family: var(--f-display);
  font-size: 28px;
  font-style: italic;
  text-align: center;
  margin-bottom: var(--s-5);
  font-variation-settings: 'opsz' 144;
}

.ranking-list {
  list-style: none;
  background: var(--c-bg-panel);
  border-radius: var(--r-md);
  border: 1px solid rgba(245, 241, 236, 0.06);
  overflow: hidden;
}

.ranking-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid rgba(245, 241, 236, 0.04);
  transition: background var(--t-fast);
}

.ranking-row:last-child {
  border-bottom: none;
}

.ranking-row:hover {
  background: rgba(32, 191, 181, 0.03);
}

.ranking-row.is-current-player {
  background: rgba(32, 191, 181, 0.1);
  border-left: 3px solid var(--c-primary);
}

.ranking-row .rank {
  font-family: var(--f-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--c-text-muted);
  text-align: center;
}

.ranking-row.top-3 .rank {
  color: var(--c-accent);
  font-size: 26px;
}

.ranking-row.top-1 .rank {
  color: var(--c-accent);
  text-shadow: 0 0 16px rgba(245, 200, 66, 0.6);
}

.ranking-row .nick {
  font-weight: 500;
  font-size: 15px;
}

.ranking-row .score {
  font-family: var(--f-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--c-primary);
  font-variation-settings: 'opsz' 96;
}

.ranking-empty {
  padding: var(--s-6);
  text-align: center;
  color: var(--c-text-muted);
  font-size: 14px;
}

/* =========================
   Toasts
   ========================= */

.toast-stack {
  position: fixed;
  bottom: var(--s-5);
  right: var(--s-5);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.toast {
  padding: var(--s-3) var(--s-4);
  background: var(--c-bg-elevated);
  border: 1px solid rgba(32, 191, 181, 0.3);
  border-radius: var(--r-md);
  font-size: 14px;
  box-shadow: var(--shadow-card);
  animation: slideInRight var(--t-base);
  max-width: 320px;
}

.toast.error {
  border-color: rgba(232, 74, 74, 0.4);
}

.toast.success {
  border-color: rgba(32, 191, 181, 0.4);
}

/* =========================
   Animations
   ========================= */

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

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.fade-in {
  animation: fadeIn var(--t-slow);
}

/* =========================
   Legal pages typography
   ========================= */

.prose {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--s-7) var(--s-4);
}

.prose h1 {
  font-family: var(--f-display);
  font-size: 42px;
  font-weight: 700;
  font-style: italic;
  margin-bottom: var(--s-5);
  font-variation-settings: 'opsz' 144;
}

.prose h2 {
  font-family: var(--f-display);
  font-size: 24px;
  font-weight: 600;
  margin-top: var(--s-6);
  margin-bottom: var(--s-3);
}

.prose p, .prose li {
  color: var(--c-text-muted);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: var(--s-3);
}

.prose ul, .prose ol {
  padding-left: var(--s-5);
  margin-bottom: var(--s-4);
}

.prose strong {
  color: var(--c-cream);
  font-weight: 600;
}

/* =========================
   Responsive
   ========================= */

@media (max-width: 640px) {
  .site-header {
    padding: var(--s-3) var(--s-4);
  }
  .site-header .logo img {
    height: 44px;
  }
  .site-header nav {
    gap: var(--s-3);
  }
  .site-header nav a {
    font-size: 11px;
  }
  .modal {
    padding: var(--s-5) var(--s-4);
  }
  .modal h2 {
    font-size: 28px;
  }
  .score-display .value {
    font-size: 52px;
  }
  .btn-row {
    flex-direction: column;
  }
  .btn-row .btn {
    width: 100%;
  }
}
