/* Can You Click It? — shared styles v=003 */

:root {
  --cream:   #FFF8F0;
  --coral:   #FF6B8A;
  --mint:    #7DD4C0;
  --purple:  #6B35A3;
  --charcoal:#2D2D2D;
  --yellow:  #FFD166;
  --white:   #FFFFFF;
  --shadow:  0 4px 20px rgba(0,0,0,0.08);
  --radius:  16px;
  --font-head: 'Fredoka One', cursive;
  --font-body: 'Nunito', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--charcoal);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ── HEADER ── */

header {
  background: var(--white);
  border-bottom: 2px solid rgba(0,0,0,0.06);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.logo {
  font-family: var(--font-head);
  font-size: 1.4rem;
  color: var(--purple);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.logo span { color: var(--coral); }

nav { display: flex; gap: 6px; }

nav a {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--charcoal);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 20px;
  transition: background 0.15s, color 0.15s;
}

nav a:hover, nav a.active {
  background: var(--cream);
  color: var(--purple);
}

/* ── LAYOUT ── */

.page-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
  width: 100%;
  flex: 1;
}

.game-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

.game-main { min-width: 0; }

.game-sidebar {
  position: sticky;
  top: 80px;
}

/* ── PAGE HEADINGS ── */

.page-title {
  font-family: var(--font-head);
  font-size: 2.2rem;
  color: var(--charcoal);
  margin-bottom: 6px;
  line-height: 1.1;
}

.page-subtitle {
  font-size: 1rem;
  color: #666;
  margin-bottom: 24px;
}

/* ── MODE SELECTOR ── */

.mode-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.mode-btn {
  font-family: var(--font-head);
  font-size: 1rem;
  border: 2px solid transparent;
  background: var(--white);
  color: #888;
  padding: 8px 22px;
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow);
}

.mode-btn:hover {
  border-color: var(--purple);
  color: var(--purple);
}

.mode-btn.active {
  background: var(--purple);
  color: var(--white);
  border-color: var(--purple);
}

/* ── CLICK AREA ── */

.click-area {
  background: linear-gradient(135deg, var(--coral) 0%, #FF8FA3 100%);
  border-radius: var(--radius);
  min-height: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(255,107,138,0.35);
  transition: box-shadow 0.1s;
  -webkit-tap-highlight-color: transparent;
  margin-bottom: 16px;
}

.click-area:active {
  box-shadow: 0 4px 16px rgba(255,107,138,0.2);
}

/* State: done — mint flash → purple */
.click-area[data-state="done"] {
  cursor: default;
  animation: score-reveal-bg 0.55s ease-out forwards;
  box-shadow: 0 8px 32px rgba(107,53,163,0.35);
}

/* Visibility by state */
.click-area[data-state="idle"]    .idle-msg      { display: flex; }
.click-area[data-state="idle"]    .running-stats { display: none;  }
.click-area[data-state="idle"]    .score-screen  { display: none;  }

.click-area[data-state="running"] .idle-msg      { display: none;  }
.click-area[data-state="running"] .running-stats { display: flex;  }
.click-area[data-state="running"] .score-screen  { display: none;  }

.click-area[data-state="done"]    .idle-msg      { display: none;  }
.click-area[data-state="done"]    .running-stats { display: none;  }
.click-area[data-state="done"]    .score-screen  { display: flex;  }

/* Idle message */
.idle-msg {
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 24px;
}

.click-icon {
  font-size: 3.5rem;
  animation: pulse 1.6s ease-in-out infinite;
}

.click-label {
  font-family: var(--font-head);
  font-size: 2rem;
  color: var(--white);
  line-height: 1;
}

.click-hint {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.75);
}

/* Running stats */
.running-stats {
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 24px;
}

.timer-display {
  font-family: var(--font-head);
  font-size: 5.5rem;
  color: var(--white);
  line-height: 1;
  min-width: 3ch;
  text-align: center;
}

.timer-display.urgent {
  animation: pulse-urgent 0.5s ease-in-out infinite;
}

.live-click-count {
  font-family: var(--font-head);
  font-size: 2.8rem;
  color: rgba(255,255,255,0.95);
  line-height: 1;
  margin-top: 4px;
}

.live-click-label {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.65);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.live-cps {
  font-family: var(--font-head);
  font-size: 1.2rem;
  color: rgba(255,255,255,0.85);
  margin-top: 4px;
}

/* Score screen */
.score-screen {
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
  width: 100%;
}

.rank-badge {
  font-family: var(--font-head);
  font-size: 0.78rem;
  color: var(--purple);
  background: rgba(255,255,255,0.92);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 16px;
  border-radius: 20px;
  margin-bottom: 2px;
}

.rank-emoji {
  font-size: 3rem;
  line-height: 1;
  margin: 2px 0;
}

.rank-label {
  font-family: var(--font-head);
  font-size: 3.2rem;
  color: var(--yellow);
  line-height: 1;
}

.score-cps {
  font-family: var(--font-head);
  font-size: 2rem;
  color: var(--white);
}

.score-clicks {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.75);
}

.rank-taunt {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.88);
  font-style: italic;
  max-width: 280px;
  text-align: center;
  line-height: 1.4;
  margin: 0 0 2px;
}

.score-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-retry {
  font-family: var(--font-head);
  font-size: 1rem;
  background: var(--yellow);
  color: var(--charcoal);
  border: none;
  padding: 10px 24px;
  border-radius: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: transform 0.1s, box-shadow 0.1s;
}

.btn-retry:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.btn-share {
  font-family: var(--font-head);
  font-size: 1rem;
  background: rgba(255,255,255,0.18);
  color: var(--white);
  border: 2px solid rgba(255,255,255,0.4);
  padding: 10px 24px;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-share:hover { background: rgba(255,255,255,0.28); }

.share-copied {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.75);
  min-height: 18px;
}

/* Score reveal stagger */
.click-area[data-state="done"] .rank-badge     { animation: score-fade-up 0.3s ease-out both; animation-delay: 0.05s; }
.click-area[data-state="done"] .rank-emoji      { animation: rank-up 0.5s cubic-bezier(0.175,0.885,0.32,1.275) both; animation-delay: 0.1s; }
.click-area[data-state="done"] .rank-label      { animation: score-fade-up 0.3s ease-out both; animation-delay: 0.22s; }
.click-area[data-state="done"] .score-cps,
.click-area[data-state="done"] .score-avg       { animation: score-fade-up 0.3s ease-out both; animation-delay: 0.3s; }
.click-area[data-state="done"] .rank-taunt      { animation: score-fade-up 0.3s ease-out both; animation-delay: 0.35s; }
.click-area[data-state="done"] .score-clicks    { animation: score-fade-up 0.3s ease-out both; animation-delay: 0.35s; }
.click-area[data-state="done"] .attempt-history { animation: score-fade-up 0.3s ease-out both; animation-delay: 0.35s; }
.click-area[data-state="done"] .score-actions   { animation: score-fade-up 0.3s ease-out both; animation-delay: 0.42s; }

/* Click ripple */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.28);
  transform: scale(0);
  animation: ripple-anim 0.45s ease-out forwards;
  pointer-events: none;
}

/* ── STATS BAR ── */

.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: 12px;
  padding: 14px 16px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-value {
  font-family: var(--font-head);
  font-size: 1.8rem;
  color: var(--charcoal);
  line-height: 1;
}

.stat-label {
  font-size: 0.72rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* ── ADS ── */

.ad-unit {
  background: #f0f0ee;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ad-sidebar {
  width: 300px;
  height: 600px;
}

.ad-footer-sticky {
  display: none;
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  height: 50px;
  z-index: 40;
  background: var(--white);
  border-top: 1px solid rgba(0,0,0,0.08);
  border-radius: 0;
  align-items: center;
  justify-content: center;
}

/* ── PAGE INTRO ── */

.page-intro {
  font-size: 0.95rem;
  color: #555;
  line-height: 1.65;
  max-width: 680px;
  margin-bottom: 24px;
}

/* ── REACTION TIME STATES ── */

/* Default: hide RT-specific divs */
.ready-msg, .flash-msg, .too-soon-msg, .attempt-result-msg { display: none; }

/* Backgrounds */
.click-area[data-state="ready"] {
  background: linear-gradient(135deg, #2e1a4e 0%, #4a2878 100%);
  box-shadow: 0 8px 32px rgba(46,26,78,0.45);
  cursor: default;
}

.click-area[data-state="flash"] {
  background: linear-gradient(135deg, #2db89a 0%, var(--mint) 100%);
  box-shadow: 0 8px 32px rgba(45,184,154,0.5);
}

.click-area[data-state="too-soon"] {
  background: linear-gradient(135deg, #c0392b 0%, #e05a4d 100%);
  box-shadow: 0 8px 32px rgba(192,57,43,0.4);
  cursor: default;
}

.click-area[data-state="attempt-result"] {
  background: linear-gradient(135deg, #2db89a 0%, var(--mint) 100%);
  box-shadow: 0 8px 32px rgba(45,184,154,0.4);
  cursor: default;
}

/* Visibility per state */
.click-area[data-state="ready"]         .idle-msg           { display: none;  }
.click-area[data-state="ready"]         .ready-msg          { display: flex;  }
.click-area[data-state="ready"]         .score-screen       { display: none;  }

.click-area[data-state="flash"]         .idle-msg           { display: none;  }
.click-area[data-state="flash"]         .flash-msg          { display: flex;  }
.click-area[data-state="flash"]         .score-screen       { display: none;  }

.click-area[data-state="too-soon"]      .idle-msg           { display: none;  }
.click-area[data-state="too-soon"]      .too-soon-msg       { display: flex;  }
.click-area[data-state="too-soon"]      .score-screen       { display: none;  }

.click-area[data-state="attempt-result"] .idle-msg          { display: none;  }
.click-area[data-state="attempt-result"] .attempt-result-msg { display: flex; }
.click-area[data-state="attempt-result"] .score-screen      { display: none;  }

/* RT content styles */
.ready-msg, .flash-msg, .too-soon-msg, .attempt-result-msg {
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 24px;
}

.rt-icon { font-size: 3rem; }

.rt-wait-label {
  font-family: var(--font-head);
  font-size: 2rem;
  color: rgba(255,255,255,0.9);
  line-height: 1;
}

.rt-dont-click {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.6);
}

.round-indicator {
  font-family: var(--font-head);
  font-size: 0.9rem;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}

.rt-flash-label {
  font-family: var(--font-head);
  font-size: 4.5rem;
  color: var(--white);
  line-height: 1;
  animation: pulse 0.4s ease-in-out infinite;
}

.rt-too-soon-label {
  font-family: var(--font-head);
  font-size: 2.2rem;
  color: var(--white);
  line-height: 1;
}

.rt-too-soon-hint {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.75);
  line-height: 1.6;
}

.attempt-ms {
  font-family: var(--font-head);
  font-size: 4rem;
  color: var(--white);
  line-height: 1;
}

.attempt-rank-label {
  font-family: var(--font-head);
  font-size: 1.4rem;
  color: rgba(255,255,255,0.9);
}

.attempt-count-label {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Attempt history in score screen */
.attempt-history {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 4px 0;
}

.attempt-pill {
  font-family: var(--font-head);
  font-size: 0.85rem;
  background: rgba(255,255,255,0.18);
  color: var(--white);
  padding: 4px 12px;
  border-radius: 12px;
}

/* ── SEO SECTION ── */

.seo-section {
  margin-top: 32px;
  padding-top: 32px;
  border-top: 1px solid rgba(0,0,0,0.08);
  opacity: 0.45;
}

.seo-section h2 {
  font-family: var(--font-head);
  font-size: 1.05rem;
  margin-bottom: 8px;
  color: var(--charcoal);
}

.seo-section p {
  font-size: 0.85rem;
  line-height: 1.75;
  color: #555;
  max-width: 680px;
}

/* ── HOMEPAGE ── */

.hero {
  text-align: center;
  padding: 52px 0 44px;
}

.hero h1 {
  font-family: var(--font-head);
  font-size: 3.8rem;
  color: var(--charcoal);
  line-height: 1.05;
  margin-bottom: 16px;
}

.hero h1 span { color: var(--coral); }

.hero p {
  font-size: 1.15rem;
  color: #555;
  max-width: 520px;
  margin: 0 auto 28px;
  line-height: 1.6;
}

.badge-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.badge {
  font-family: var(--font-head);
  font-size: 0.85rem;
  padding: 5px 14px;
  border-radius: 20px;
  background: var(--white);
  color: var(--purple);
  box-shadow: var(--shadow);
}

.tests-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
}

.test-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  text-decoration: none;
  color: var(--charcoal);
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
  display: block;
  position: relative;
  overflow: hidden;
}

.test-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--card-accent, var(--coral));
}

.test-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}

.test-card .card-icon {
  font-size: 2.4rem;
  margin-bottom: 12px;
  display: block;
}

.test-card h2 {
  font-family: var(--font-head);
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.test-card p {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.55;
  margin-bottom: 16px;
}

.card-cta {
  font-family: var(--font-head);
  font-size: 0.95rem;
  color: var(--card-accent, var(--coral));
}

.test-card.coming-soon {
  opacity: 0.5;
  pointer-events: none;
}

.coming-soon-tag {
  font-family: var(--font-head);
  font-size: 0.72rem;
  background: var(--cream);
  color: #999;
  padding: 3px 10px;
  border-radius: 10px;
  position: absolute;
  top: 16px;
  right: 16px;
}

/* ── FOOTER ── */

footer {
  background: var(--white);
  border-top: 1px solid rgba(0,0,0,0.06);
  padding: 20px 24px;
  text-align: center;
  font-size: 0.85rem;
  color: #888;
}

footer a {
  color: #888;
  text-decoration: none;
}

footer a:hover { color: var(--purple); }

.footer-feedback {
  color: var(--mint);
  font-size: 0.8rem;
  margin-left: 4px;
}

/* ── SPACEBAR KEY ── */

.spacebar-key {
  width: 260px;
  height: 72px;
  background: rgba(255,255,255,0.18);
  border: 3px solid rgba(255,255,255,0.45);
  border-bottom-width: 6px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-size: 1.3rem;
  color: var(--white);
  transition: transform 0.06s, background 0.06s, border-bottom-width 0.06s;
  margin: 4px 0;
  letter-spacing: 0.1em;
}

.spacebar-key.pressed {
  transform: translateY(3px);
  background: rgba(255,255,255,0.3);
  border-bottom-width: 3px;
}

/* ── ANIMATIONS ── */

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes pulse-urgent {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@keyframes ripple-anim {
  to { transform: scale(5); opacity: 0; }
}

@keyframes rank-up {
  0%   { transform: scale(0.4) rotate(-8deg); opacity: 0; }
  60%  { transform: scale(1.18) rotate(3deg);  opacity: 1; }
  100% { transform: scale(1)   rotate(0deg); opacity: 1; }
}

@keyframes score-fade-up {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

@keyframes score-reveal-bg {
  0%   { background: linear-gradient(135deg, var(--mint) 0%, #2db89a 100%); }
  100% { background: linear-gradient(135deg, var(--purple) 0%, #8B55C3 100%); }
}

/* ── RESPONSIVE ── */

@media (max-width: 900px) {
  .game-layout {
    grid-template-columns: 1fr;
  }
  .game-sidebar {
    display: none;
  }
  .ad-footer-sticky {
    display: flex;
  }
  body {
    padding-bottom: 58px;
  }
}

@media (max-width: 600px) {
  .page-wrap { padding: 20px 16px; }
  .hero h1   { font-size: 2.8rem; }
  .page-title { font-size: 1.8rem; }
  .timer-display { font-size: 4rem; }
  .rank-label { font-size: 2.4rem; }
}
