:root {
  --bg: #081c16;
  --bg2: #0c2a20;
  --emerald: #1fa37a;
  --emerald-dim: #147a5a;
  --koa: #c8a45a;
  --koa-dim: #8b6a2b;
  --cream: #f0e6d2;
  --muted: #8aa399;
  --danger: #e8b86d;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

body {
  min-height: 100dvh;
  min-height: 100vh;
}

.app {
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding:
    calc(12px + var(--safe-top))
    calc(16px + var(--safe-right))
    calc(12px + var(--safe-bot))
    calc(16px + var(--safe-left));
  background:
    radial-gradient(ellipse 80% 50% at 50% 35%, rgba(31, 163, 122, 0.14), transparent 60%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(139, 106, 43, 0.08), transparent 50%),
    linear-gradient(180deg, #0a221a 0%, var(--bg) 45%, #061410 100%);
}

.top {
  text-align: center;
  padding: 4px 0 8px;
  flex-shrink: 0;
}

.logo {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--cream);
  text-transform: uppercase;
}

.tagline {
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 8px 0 4px;
  flex-shrink: 0;
}

.mode {
  appearance: none;
  border: 1.5px solid rgba(200, 164, 90, 0.35);
  background: rgba(12, 42, 32, 0.7);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 12px 4px;
  border-radius: 12px;
  min-height: 48px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
  -webkit-touch-callout: none;
}

.mode:active { transform: scale(0.97); }

.mode.active {
  background: linear-gradient(180deg, rgba(31, 163, 122, 0.35), rgba(20, 122, 90, 0.25));
  border-color: var(--emerald);
  color: var(--cream);
  box-shadow: 0 0 0 1px rgba(31, 163, 122, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
}

.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 8px 0;
}

.blow {
  position: relative;
  width: min(78vw, 340px);
  aspect-ratio: 1;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  outline: none;
  -webkit-touch-callout: none;
}

.blow:focus-visible {
  box-shadow: 0 0 0 3px var(--koa);
}

.conch {
  width: 88%;
  height: 88%;
  object-fit: contain;
  border-radius: 50%;
  position: relative;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.45));
  transition: transform 0.2s ease, filter 0.2s ease;
}

.glow {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(31, 163, 122, 0.35), transparent 65%);
  z-index: 1;
  opacity: 0.55;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}

.ripple, .ripple.r2 {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(31, 163, 122, 0.55);
  z-index: 0;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.85);
}

.hint {
  position: absolute;
  bottom: 6%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cream);
  background: rgba(8, 28, 22, 0.72);
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(200, 164, 90, 0.35);
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.2s;
}

/* Sounding state */
.blow.sounding .conch {
  transform: scale(1.04);
  filter: drop-shadow(0 0 28px rgba(31, 163, 122, 0.55)) drop-shadow(0 8px 24px rgba(0, 0, 0, 0.45));
}
.blow.sounding .glow {
  opacity: 1;
  transform: scale(1.08);
  background: radial-gradient(circle, rgba(31, 163, 122, 0.55), rgba(200, 164, 90, 0.15), transparent 70%);
}
.blow.sounding .ripple {
  animation: pulse-ring 1.4s ease-out infinite;
}
.blow.sounding .ripple.r2 {
  animation: pulse-ring 1.4s ease-out 0.45s infinite;
}
.blow.sounding .hint {
  opacity: 0;
  pointer-events: none;
}

@keyframes pulse-ring {
  0%   { opacity: 0.7; transform: scale(0.9); }
  100% { opacity: 0; transform: scale(1.28); }
}

.blow.pressed .conch { transform: scale(0.97); }

.foot {
  text-align: center;
  flex-shrink: 0;
  padding-top: 8px;
}

.tai {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}
.tai strong { color: var(--koa); font-weight: 700; }

.meta {
  margin-top: 4px;
  font-size: 0.68rem;
  color: rgba(138, 163, 153, 0.75);
}

@media (max-height: 640px) {
  .logo { font-size: 1.4rem; }
  .modes { gap: 4px; }
  .mode { padding: 10px 2px; font-size: 0.72rem; min-height: 44px; }
  .blow { width: min(68vw, 280px); }
}

@media (min-width: 768px) {
  .blow { width: min(50vw, 380px); }
  .modes { max-width: 520px; margin-left: auto; margin-right: auto; }
}

/* Play style: Solo | Leader | Wave */
.playstyles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 4px 0 8px;
  flex-shrink: 0;
}
.pstyle {
  appearance: none;
  border: 1.5px solid rgba(200, 164, 90, 0.3);
  background: rgba(8, 28, 22, 0.6);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 11px 4px;
  border-radius: 12px;
  min-height: 44px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pstyle.active {
  background: linear-gradient(180deg, rgba(200, 164, 90, 0.28), rgba(139, 106, 43, 0.18));
  border-color: var(--koa);
  color: var(--cream);
  box-shadow: 0 0 0 1px rgba(200, 164, 90, 0.25);
}

.hidden { display: none !important; }

.group-panel {
  flex-shrink: 0;
  margin: 0 0 6px;
  padding: 10px 10px 8px;
  border-radius: 14px;
  background: rgba(12, 42, 32, 0.55);
  border: 1px solid rgba(31, 163, 122, 0.2);
}
.room-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  align-items: center;
}
.room-input {
  appearance: none;
  border: 1.5px solid rgba(200, 164, 90, 0.4);
  background: rgba(6, 20, 16, 0.85);
  color: var(--cream);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
  padding: 10px 8px;
  border-radius: 10px;
  min-height: 44px;
  outline: none;
  min-width: 0;
  width: 100%;
}
.room-input:focus { border-color: var(--emerald); }
.room-btn {
  appearance: none;
  border: 1.5px solid rgba(31, 163, 122, 0.45);
  background: rgba(31, 163, 122, 0.18);
  color: var(--cream);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 10px 12px;
  border-radius: 10px;
  min-height: 44px;
  cursor: pointer;
}
.room-btn:active { transform: scale(0.97); }
.group-meta {
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.35;
}
.section-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.sec-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.sections { display: flex; gap: 6px; }
.sec {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1.5px solid rgba(200, 164, 90, 0.35);
  background: rgba(8, 28, 22, 0.7);
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}
.sec.active {
  background: rgba(31, 163, 122, 0.35);
  border-color: var(--emerald);
  color: var(--cream);
}


/* Rotating conch (9 photo views crossfading) */
.conch.spin {
  overflow: hidden;
  background: #0d2a22;
  --spin: 4.5s;
}
.conch.spin img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  animation: spin-frame var(--spin) linear infinite;
  animation-delay: calc(var(--i) * var(--spin) / 9 - var(--spin));
  pointer-events: none;
  -webkit-user-drag: none;
}

@keyframes spin-frame {
  0%      { opacity: 0; }
  3.5%    { opacity: 1; }
  11.11%  { opacity: 1; }
  14.6%   { opacity: 0; }
  100%    { opacity: 0; }
}
.blow.sounding .conch.spin { --spin: 1.8s; }
@media (prefers-reduced-motion: reduce) {
  .conch.spin img { animation: none; }
}

/* Paid unlock (only shown when PAYWALL.enabled in app.js) */
.mode.locked::after, .pstyle.locked::after { content: ' 🔒'; font-size: 0.8em; opacity: 0.8; }
