:root {
  --sky-top: #0284c7;
  --sky-bottom: #38bdf8;
  --bubble-glow: rgba(255, 255, 255, 0.45);
  --gold: #fbbf24;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "Lexend", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--body);
  background: #0f172a;
  color: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header */
header {
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 2px solid #334155;
  padding: 0.6rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #fff;
  text-decoration: none;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

.brand h1 {
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 800;
  color: #38bdf8;
  letter-spacing: -0.02em;
}

.brand p {
  font-size: 0.72rem;
  color: #9ca3af;
}

.controls-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

select {
  font-family: var(--body);
  font-size: 0.85rem;
  font-weight: 600;
  background: #1e293b;
  color: #fff;
  border: 1px solid #475569;
  border-radius: 8px;
  padding: 0.4rem 1.8rem 0.4rem 0.8rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%239ca3af%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.4-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem top 50%;
  background-size: 0.65rem auto;
}

.btn-header {
  background: #1e293b;
  border: 1px solid #475569;
  color: #fff;
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.2s;
}
.btn-header:hover { background: #334155; border-color: #38bdf8; }

/* Main Arena */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
  padding: 0.8rem 1rem;
}

/* Prompt Banner */
.prompt-banner {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 3px solid #334155;
  border-radius: 18px;
  padding: 0.9rem 1.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.btn-hear-sound {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border: 2px solid #38bdf8;
  color: #fff;
  font-family: var(--body);
  font-size: 1rem;
  font-weight: 800;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.btn-hear-sound:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.6);
}

.prompt-center {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.prompt-sub {
  font-size: 0.85rem;
  color: #94a3b8;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.target-letter-badge {
  font-family: var(--display);
  font-size: 2.8rem;
  font-weight: 800;
  color: #fbbf24;
  text-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
  letter-spacing: 0.05em;
  background: rgba(251, 191, 36, 0.12);
  padding: 0.1rem 1.6rem;
  border-radius: 16px;
  border: 2px solid rgba(251, 191, 36, 0.4);
}

.score-card {
  text-align: right;
}

.score-label {
  font-size: 0.75rem;
  color: #9ca3af;
  text-transform: uppercase;
  font-weight: 700;
}

.score-num {
  font-family: var(--display);
  font-size: 1.8rem;
  font-weight: 900;
  color: #fbbf24;
}

/* Sky Canvas */
.sky-container {
  position: relative;
  width: 100%;
  height: 480px;
  background: linear-gradient(180deg, #0284c7 0%, #38bdf8 55%, #bae6fd 100%);
  border-radius: 18px;
  border: 2px solid #334155;
  overflow: hidden;
  box-shadow: 0 15px 35px rgba(0,0,0,0.6);
  cursor: pointer;
}

#bubble-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal-card {
  background: #1e293b;
  border: 2px solid #334155;
  border-radius: 20px;
  max-width: 440px;
  width: 100%;
  padding: 2.2rem;
  text-align: center;
  box-shadow: 0 25px 50px rgba(0,0,0,0.6);
}

.modal-card h2 {
  font-family: var(--display);
  font-size: 2rem;
  color: #38bdf8;
  margin-bottom: 0.5rem;
}

.modal-btn {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.8rem 2rem;
  font-family: var(--body);
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.4);
  transition: transform 0.2s;
  margin-top: 1.2rem;
}
.modal-btn:hover { transform: scale(1.05); }

