@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
:root{
  --bg:#0d1310;
  --bg2:#121a16;
  --card:#171f1b;
  --card2:#1d2822;
  --text:#edf7ef;
  --muted:#97a79d;
  --line:rgba(255,255,255,.08);
  --green:#8ff08f;
  --green2:#5fd16a;
  --green3:#234129;
  --success:#b5ffba;
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%}
body{
  font-family:Inter,system-ui,sans-serif;
  background:radial-gradient(circle at top left, rgba(111,206,119,.14), transparent 34%), radial-gradient(circle at bottom right, rgba(124,240,142,.10), transparent 28%), linear-gradient(180deg,var(--bg),#0b100d);
  color:var(--text);
}
button,input{font:inherit}
button{cursor:pointer}
button,input,a{transition:.18s ease}
button:focus-visible,input:focus-visible,a:focus-visible{outline:2px solid var(--green);outline-offset:2px}
.glow{position:fixed;pointer-events:none;border-radius:50%;filter:blur(90px);z-index:-1;opacity:.3}
.glow-one{width:320px;height:320px;background:#3ca64b;top:-70px;left:-100px}
.glow-two{width:360px;height:360px;background:#1d5e29;right:-120px;bottom:-80px}
.app-shell{max-width:720px;margin:0 auto;padding:22px 18px 40px}
.topbar{display:flex;align-items:center;justify-content:space-between;margin-bottom:18px}
.brand{margin:0;font-size:40px;letter-spacing:-1.8px;font-weight:800;text-transform:lowercase}
.top-meta{font-size:14px;color:var(--muted)}
.game-card{background:linear-gradient(180deg,rgba(255,255,255,.03),rgba(255,255,255,.015));border:1px solid var(--line);border-radius:28px;padding:18px;backdrop-filter:blur(10px);box-shadow:0 18px 60px rgba(0,0,0,.25)}
.stats-row{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}
.stat-pill{background:var(--card);border:1px solid var(--line);border-radius:18px;padding:10px 12px;display:flex;flex-direction:column;gap:4px}
.stat-pill span{font-size:11px;text-transform:uppercase;letter-spacing:.12em;color:var(--muted)}
.stat-pill strong{font-size:18px;font-weight:700}
.status-line,.bottom-line{display:flex;justify-content:center;align-items:center;gap:10px;color:var(--muted);font-size:13px;margin-top:14px}
.status-dot{width:6px;height:6px;border-radius:50%;background:var(--green);box-shadow:0 0 12px rgba(143,240,143,.7)}
.center-area{display:flex;flex-direction:column;align-items:center;padding:20px 6px 8px}
.art-wrap{display:grid;place-items:center;margin:2px 0 18px}
.record-art{position:relative;width:170px;height:170px;border-radius:50%;background:radial-gradient(circle at 35% 32%, rgba(255,255,255,.08), transparent 16%),linear-gradient(145deg,#1d2721,#0f1512);border:1px solid rgba(255,255,255,.06);box-shadow:inset 0 0 0 1px rgba(255,255,255,.03), 0 20px 40px rgba(0,0,0,.28)}
.record-rings{position:absolute;inset:13px;border-radius:50%;border:1px solid rgba(255,255,255,.06);box-shadow:inset 0 0 0 18px rgba(255,255,255,.015), inset 0 0 0 34px rgba(255,255,255,.012), inset 0 0 0 52px rgba(255,255,255,.01)}
.record-label{position:absolute;inset:0;display:grid;place-items:center}
.record-label span{display:grid;place-items:center;width:56px;height:56px;border-radius:50%;background:linear-gradient(180deg,var(--green),var(--green2));color:#0e160f;font-size:26px;font-weight:800;box-shadow:0 0 30px rgba(143,240,143,.25)}
.record-art.playing{animation:spin 3.2s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.waveform{display:flex;align-items:flex-end;justify-content:center;gap:4px;height:56px;width:min(420px,100%);margin-bottom:14px;opacity:.88}
.waveform span{display:block;width:8px;height:calc(var(--h)*1%);min-height:10px;border-radius:999px;background:linear-gradient(180deg,rgba(143,240,143,.9),rgba(143,240,143,.25));transform-origin:bottom center;transition:transform .18s ease,opacity .18s ease}
.waveform.is-playing span{animation:bounce .9s ease-in-out infinite alternate}
.waveform.is-playing span:nth-child(odd){animation-duration:1.1s}
@keyframes bounce{from{transform:scaleY(.72)}to{transform:scaleY(1.14)}}
.timeline{width:min(520px,100%);height:10px;border-radius:999px;background:#232c27;border:1px solid rgba(255,255,255,.05);overflow:hidden;margin-bottom:18px}
.clip-fill{height:100%;width:0;background:linear-gradient(90deg,var(--green2),var(--green));border-radius:999px}
.play-button{display:flex;align-items:center;justify-content:center;gap:10px;border:none;border-radius:999px;background:linear-gradient(180deg,var(--green2),#53bf5f);color:#081108;font-weight:800;font-size:18px;padding:16px 28px;min-width:150px;box-shadow:0 12px 24px rgba(95,209,106,.22);margin-bottom:18px}
.play-button:hover{transform:translateY(-1px)}
.play-button:disabled{opacity:.5;cursor:not-allowed;transform:none}
.input-wrap{width:min(560px,100%)}
.guess-field{display:flex;gap:10px}
.guess-field input{flex:1;min-width:0;background:var(--card);border:1px solid var(--line);border-radius:18px;padding:16px 18px;color:var(--text);font-size:17px}
.guess-field input::placeholder{color:#7f8f85}
.guess-button,.skip-button,.next-button{border:none;border-radius:18px;font-weight:700}
.guess-button{background:#eef8ef;color:#102012;padding:0 18px;min-width:88px}
.skip-button,.next-button{background:#222d26;color:var(--text);padding:14px 18px}
.skip-button{display:block;width:100%;margin-top:10px}
.guess-button:hover,.skip-button:hover,.next-button:hover{filter:brightness(1.04)}
.feedback{min-height:24px;margin-top:16px;text-align:center;color:var(--muted);font-size:14px}
.feedback.success{color:var(--success)}
.reveal{margin-top:10px;text-align:center}
.reveal-kicker{font-size:12px;text-transform:uppercase;letter-spacing:.18em;color:var(--muted);margin-bottom:8px}
.reveal h2{margin:0;font-size:28px;line-height:1.12}
.reveal p{margin:8px 0 16px;color:var(--muted);font-size:16px}
.reveal a{display:none}
.suggestions{display:grid;gap:8px;margin-top:10px}
.suggestion{display:flex;justify-content:space-between;align-items:center;text-align:left;width:100%;background:#141c17;border:1px solid var(--line);border-radius:16px;padding:11px 14px;color:var(--text)}
.suggestion strong{display:block;font-size:14px}
.suggestion small{display:block;font-size:12px;color:var(--muted);margin-top:2px}
.embed-container{position:absolute;left:-99999px;top:auto;width:1px;height:1px;overflow:hidden;opacity:0}
@media (max-width:640px){
  .app-shell{padding:16px 12px 28px}
  .brand{font-size:34px}
  .game-card{padding:14px}
  .stats-row{grid-template-columns:repeat(2,1fr)}
  .record-art{width:148px;height:148px}
  .guess-field{flex-direction:column}
  .guess-button{height:52px}
}
/* Audio revisions: do not let display:grid override the hidden attribute. */
[hidden] { display: none !important; }
.reveal a:not([hidden]) {
  display: inline-block;
  margin: 2px 0 16px;
  color: var(--green);
  text-decoration: none;
  font-size: 13px;
}
.embed-container {
  position: absolute;
  top: 0;
  left: 0;
  width: min(100%, 620px);
  height: 166px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}
.embed-container.show-embed {
  position: relative;
  z-index: 1;
  opacity: 1;
  pointer-events: auto;
  height: 166px;
  margin-top: 10px;
  border-radius: 12px;
}
.embed-container iframe { display: block; border: 0; }

/* Avadle — five visible guess attempts, Songless-style feedback. */
.sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
.topbar{justify-content:center;margin:0 0 22px}
.brand{font-size:clamp(44px,8vw,66px);letter-spacing:-3px}
.stats-row{margin-bottom:14px}
.guess-history{display:grid;gap:7px;margin:12px 0 18px}
.guess-row{height:43px;border:1px solid rgba(214,235,220,.1);background:#131b16;border-radius:10px;display:flex;align-items:center;gap:12px;padding:0 16px;font-weight:650;min-width:0}
.guess-row.empty{background:rgba(15,21,17,.4);border-color:rgba(214,235,220,.11)}
.guess-row.incorrect{background:#b8393d;color:#fff;border-color:#b8393d}
.guess-row.same-artist{background:#e7cc27;color:#191c10;border-color:#e7cc27}
.guess-row.correct{background:#61be55;color:#091307;border-color:#61be55}
.guess-row.skipped{background:#303934;color:#cdd8d0;border-color:#3b443d}
.guess-row-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:0 1 auto}
.guess-row-artist{opacity:.82;font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-left:auto;text-align:right;font-weight:500;flex:0 1 auto}
.center-area{padding-top:4px}
.art-wrap{margin:0 0 8px}
.record-art{width:126px;height:126px}
.record-label span{width:48px;height:48px;font-size:22px}
.waveform{height:44px;margin-bottom:10px}
.timeline{position:relative;overflow:hidden;background:#29342d;border-radius:7px;height:12px;margin-bottom:17px}
.clip-fill{z-index:1;position:absolute;top:0;bottom:0;left:0}
.timeline-ticks{pointer-events:none;position:absolute;inset:0;z-index:2;background:linear-gradient(to right, transparent calc(20% - 1px), #0d1310 calc(20% - 1px), #0d1310 calc(20% + 1px), transparent calc(20% + 1px), transparent calc(40% - 1px), #0d1310 calc(40% - 1px), #0d1310 calc(40% + 1px), transparent calc(40% + 1px), transparent calc(60% - 1px), #0d1310 calc(60% - 1px), #0d1310 calc(60% + 1px), transparent calc(60% + 1px), transparent calc(80% - 1px), #0d1310 calc(80% - 1px), #0d1310 calc(80% + 1px), transparent calc(80% + 1px))}
@media (max-width:640px){
 .guess-history{gap:6px;margin-top:10px}
 .guess-row{height:44px;padding:0 11px;font-size:13px}
 .guess-row-artist{max-width:43%;font-size:11px}
 .record-art{width:108px;height:108px}
 .brand{font-size:45px}
 .topbar{margin-bottom:14px}
}

/* Avadle v3 — slightly smaller desktop scale, restored personal header. */
@media (min-width:641px) {
  .app-shell { zoom: .90; }
}
.topbar {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 16px;
}
.brand {
  font-size: clamp(38px, 7vw, 60px);
  letter-spacing: -2.6px;
  text-transform: none;
}
.top-meta {
  flex: 0 0 auto;
  color: #a7bdad;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.2px;
}
/* All five stage boundaries are proportional to elapsed song time:
   0.5s = 3.125%, 1s = 6.25%, 2s = 12.5%, 8s = 50%, 16s = 100%. */
.timeline {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  height: 12px;
  width: min(520px, 100%);
  background: #27322b;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.07);
}
.clip-cap {
  position: absolute;
  z-index: 1;
  inset: 0 auto 0 0;
  width: var(--clip-width, 3.125%);
  background: rgba(143,240,143,.25);
  border-radius: 999px;
  transition: width .18s ease;
}
.clip-fill {
  z-index: 2;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  max-width: var(--clip-width, 3.125%);
  background: linear-gradient(90deg, #52c961, #96ff98);
  transition: width .05s linear;
  border-radius: 999px;
}
.timeline-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background: none;
}
.timeline-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(7,21,10,.7);
  transform: translateX(-.5px);
}
@media (max-width:640px) {
  .topbar { justify-content: space-between; margin-bottom: 14px; }
  .brand { font-size: 39px; letter-spacing: -1.9px; }
  .top-meta { font-size: 13px; }
}


/* Audio-only stability update. Preserve the visible Avadle layout unchanged.
   Some browsers throttle iframes positioned offscreen, display:none, or
   opacity:0. Mount SoundCloud in a full-sized, in-viewport layer and cover its
   spoilers with an opaque layer instead. Never show a grey embed on reveal. */
.game-card { position: relative; isolation: isolate; }
.game-card > .stats-row,
.game-card > .guess-history,
.game-card > .center-area { position: relative; z-index: 3; }
.embed-container, .embed-container.show-embed {
  position: absolute;
  z-index: 1;
  top: 110px;
  left: 18px;
  width: calc(100% - 36px);
  height: 166px;
  overflow: hidden;
  opacity: 1;
  pointer-events: none;
  margin: 0;
  border-radius: 12px;
}
.embed-container iframe { display:block; width:100%; height:166px; border:0; }
.embed-container::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  background: #101812;
  pointer-events: none;
}

/* SoundCloud repair v5 — show the real iframe only when a song stalls. */
.audio-recovery { display:flex; gap:9px; width:min(560px,100%); margin:4px auto 13px; }
.audio-recovery button { flex:1; border:1px solid rgba(152,239,160,.2); background:#202c24; color:#def4e1; padding:12px; border-radius:14px; font-size:13px; font-weight:650; cursor:pointer; }
.audio-recovery button:hover { background:#293c2d; }
.embed-container.show-embed {
  position:relative !important; z-index:4 !important; top:auto !important;
  left:auto !important; width:100% !important; height:166px !important;
  pointer-events:auto !important; margin-top:10px !important;
}
.embed-container.show-embed::after { display:none; }
@media (max-width:460px){ .audio-recovery { flex-direction:column; } }

/* Avadle 12: dancing frog icon, unchanged layout. */
.record-art,.record-art.playing { animation:none!important; overflow:hidden; }
.record-label { inset:0; overflow:hidden; border-radius:50%; }
.frog-dance,.frog-still { width:100%;height:100%;object-fit:cover;display:block; border-radius:50%; }
.frog-still { display:none; }
#art-mark[hidden] { display:none!important; }
#reveal-source { display:none!important; }
@media (prefers-reduced-motion: reduce) {
  .frog-dance { display:none; }
  .frog-still { display:block; }
}

/* v13: Keep the game clean even when SoundCloud delays or refuses audio. */
.audio-recovery, #audio-recovery, #reveal-source { display:none!important; }
.embed-container, .embed-container.show-embed {
  position:absolute!important; z-index:1!important; top:110px!important;
  left:18px!important; width:calc(100% - 36px)!important;
  height:166px!important; overflow:hidden!important;
  opacity:1!important; pointer-events:none!important; margin:0!important;
}
.embed-container::after, .embed-container.show-embed::after { content:""; display:block!important; position:absolute;z-index:10;inset:0;background:#101812;pointer-events:none; }
.frog-dance { object-fit:contain; background:#0d1310; }
.record-label .frog-still { display:flex;position:absolute;inset:0;width:100%;height:100%;border-radius:50%;font-size:74px;align-items:center;justify-content:center;background:transparent;box-shadow:none;color:inherit; }
.frog-still:not([hidden]) { display:flex; }
.frog-dance { position:relative; z-index:2; }
.frog-dance[hidden] { display:none!important; }
@media (prefers-reduced-motion:reduce){.frog-dance{display:none!important}.frog-still{display:flex!important}}


/* Avadle 18 — unified, smooth background and mobile-first history. */
:root { --player-surface: #111b15; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 95% 52% at 44% 6%, rgba(53,112,64,.20), transparent 80%),
    linear-gradient(155deg, #111b15 0%, #0d1510 45%, #0c120e 100%);
  background-attachment: fixed;
}
.glow { display:none; }
.game-card { background:var(--player-surface); box-shadow:0 20px 70px rgba(0,0,0,.18); }
/* Mask the third-party player using a continuous surface, not a separate
   rectangular patch visible behind the five empty attempt rows. */
.game-card::before {
  content:'';position:absolute;inset:0;z-index:2;
  border-radius:inherit;background:var(--player-surface);
  pointer-events:none;
}
.game-card > .stats-row, .game-card > .guess-history, .game-card > .center-area {
  position:relative;z-index:3;
}
.embed-container::after,.embed-container.show-embed::after { display:none !important; }

@media (max-width:640px) {
  body { background:
    radial-gradient(ellipse 105% 44% at 42% 0%,rgba(47,115,66,.18),transparent 78%),
    linear-gradient(180deg,#112018 0%,#0f1913 38%,#0c130f 100%);
    background-attachment:fixed;
  }
  .app-shell { padding:20px 14px max(36px,env(safe-area-inset-bottom)); }
  .game-card {
    --player-surface:#111c16;
    border:1px solid rgba(170,229,181,.07);
    border-radius:26px;
    box-shadow:0 16px 45px rgba(0,0,0,.12);
    padding:14px 14px 20px;
  }
  /* Empty slots should not occupy a huge black rectangle above the frog. */
  .guess-history:not(.has-attempts) { display:none; }
  .guess-history.has-attempts { gap:7px;margin:8px 0 12px; }
  .guess-history .guess-row.empty { display:none; }
  .guess-row:not(.empty) { height:auto; min-height:40px; border-radius:14px; }
  .center-area { padding-top:16px; }
  .stat-pill { background:rgba(22,34,27,.88);border-color:rgba(174,228,187,.07); }
  .topbar { padding:0 3px; }
}
