/* EGGFART v2 — gas cloud edition */

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

:root {
  --cream: #f6f3e9;
  --ink: #2a2520;
  --ink-soft: #6b6355;
  --accent: #8b9a3c;
  --card-bg: rgba(255, 255, 255, 0.72);
  --card-border: rgba(42, 37, 32, 0.08);
  --shadow: 0 2px 12px rgba(42, 37, 32, 0.06);
  --radius: 16px;
  --font: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

#gas-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ---------- header ---------- */
.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--ink);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.wordmark-egg {
  font-size: 1.5rem;
  display: inline-block;
}

.wordmark-dot {
  color: var(--accent);
}

.header-note {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

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

.credits-trigger {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--ink-soft);
  background: none;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.credits-trigger:hover {
  background: var(--card-bg);
  border-color: var(--ink-soft);
}

/* ---------- layout ---------- */
.page-shell {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 3rem;
  min-height: calc(100vh - 80px);
}

/* ---------- hero ---------- */
.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding: 2rem 0 1rem;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--ink-soft);
  margin-bottom: 0.75rem;
}

.eyebrow-mark {
  color: var(--accent);
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
}

.hero h1 em {
  font-style: italic;
  color: var(--accent);
}

.hero-side {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1rem;
}

.hero-description {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.random-button {
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--cream);
  background: var(--ink);
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.random-button:hover {
  background: var(--accent);
  transform: scale(1.03);
}

.random-button:active {
  transform: scale(0.97);
}

.random-icon {
  font-size: 1.1rem;
}

/* ---------- sound section ---------- */
.sound-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.section-eyebrow {
  margin-bottom: 0.4rem;
}

.section-heading h2 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.heading-period {
  color: var(--accent);
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
}

.volume-icon {
  font-size: 1rem;
}

.volume-control input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 4px;
  border-radius: 2px;
  background: var(--card-border);
  outline: none;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.volume-control input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

/* ---------- board ---------- */
.board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.pad {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-align: left;
  font-family: var(--font);
  overflow: hidden;
}

.pad::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(139, 154, 60, 0.06) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.pad:hover::before {
  opacity: 1;
}

.pad:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: rgba(139, 154, 60, 0.2);
}

.pad:active, .pad.hit {
  transform: scale(0.97);
}

.pad-emoji {
  font-size: 1.75rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.pad-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  position: relative;
  z-index: 1;
  min-width: 0;
}

.pad-name {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pad-note {
  font-size: 0.7rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pad-key {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: rgba(42, 37, 32, 0.05);
  border-radius: 4px;
  padding: 0.2rem 0.4rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.pad-meter {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.pad-meter i {
  display: block;
  width: 3px;
  border-radius: 1px;
  background: var(--accent);
  opacity: 0.5;
  animation: meter 0.8s ease-in-out infinite alternate;
}

.pad-meter i:nth-child(1) { animation-delay: 0s; }
.pad-meter i:nth-child(2) { animation-delay: 0.1s; }
.pad-meter i:nth-child(3) { animation-delay: 0.2s; }
.pad-meter i:nth-child(4) { animation-delay: 0.15s; }
.pad-meter i:nth-child(5) { animation-delay: 0.05s; }
.pad-meter i:nth-child(6) { animation-delay: 0.25s; }
.pad-meter i:nth-child(7) { animation-delay: 0.3s; }
.pad-meter i:nth-child(8) { animation-delay: 0.12s; }
.pad-meter i:nth-child(9) { animation-delay: 0.18s; }

@keyframes meter {
  from { transform: scaleY(0.4); }
  to { transform: scaleY(1); }
}

.pad-play {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%) scale(0);
  font-size: 1.25rem;
  opacity: 0;
  transition: all 0.15s ease;
  z-index: 1;
}

.pad:hover .pad-play {
  transform: translateY(-50%) scale(1);
  opacity: 1;
}

/* ---------- keyboard note ---------- */
.keyboard-note {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--ink-soft);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.keyboard-icon {
  font-size: 1rem;
}

kbd {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 600;
  background: rgba(42, 37, 32, 0.06);
  border-radius: 4px;
  padding: 0.15rem 0.35rem;
}

.keyboard-sep {
  opacity: 0.4;
}

/* ---------- footer ---------- */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--card-border);
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.footer-brand {
  font-weight: 800;
  color: var(--ink);
}

.footer-disclaimer {
  font-family: var(--mono);
  font-size: 0.65rem;
}

.counter-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.65rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
}

.counter-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- fx particles ---------- */
.fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.particle {
  position: absolute;
  pointer-events: none;
  animation: particle-fly var(--dur, 0.8s) ease-out forwards;
}

@keyframes particle-fly {
  0% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(0.5);
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx, 0), var(--dy, -100px)) rotate(var(--rot, 180deg)) scale(1.2);
  }
}

/* ---------- dialog ---------- */
.credits-dialog {
  border: none;
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 560px;
  width: 90vw;
  background: var(--cream);
  box-shadow: 0 24px 64px rgba(42, 37, 32, 0.15);
}

.credits-dialog::backdrop {
  background: rgba(42, 37, 32, 0.3);
  backdrop-filter: blur(4px);
}

.dialog-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.dialog-close {
  font-size: 1.25rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-soft);
  padding: 0.25rem;
  line-height: 1;
}

.dialog-close:hover {
  color: var(--ink);
}

.credits-dialog h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.credit-note {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-bottom: 1.25rem;
}

.credit-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.credit-list li {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.credit-list .clic {
  font-weight: 700;
  color: var(--ink);
}

.credit-list a {
  color: var(--accent);
  text-decoration: none;
}

.credit-list a:hover {
  text-decoration: underline;
}

/* ---------- body shake ---------- */
body.shake {
  animation: body-shake 0.3s ease;
}

@keyframes body-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

/* ---------- egg wobble ---------- */
.egg.wobble {
  animation: egg-wobble 0.5s ease;
}

@keyframes egg-wobble {
  0%, 100% { transform: rotate(0deg); }
  15% { transform: rotate(-12deg) scale(1.1, 0.9); }
  30% { transform: rotate(10deg) scale(0.95, 1.05); }
  45% { transform: rotate(-8deg) scale(1.05, 0.95); }
  60% { transform: rotate(5deg); }
  75% { transform: rotate(-3deg); }
}

/* ---------- responsive ---------- */
@media (max-width: 768px) {
  .site-header {
    padding: 1rem;
  }

  .header-note {
    display: none;
  }

  .page-shell {
    padding: 0 1rem 3rem;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-side {
    text-align: left;
    align-items: flex-start;
  }

  .board {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .pad-meter {
    display: none;
  }

  .site-footer {
    flex-direction: column;
    text-align: center;
  }
}

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

  .pad-meter i {
    animation: none;
    transform: scaleY(1);
  }
}
