/* Retro palette: mustard, lime, olive, brown. */
:root {
  --mustard: #efad45;
  --mustard-2: #e59d33;
  --lime: #d8e04d;
  --olive: #5b5a1f;
  --olive-2: #707029;
  --poo: #7a5426;
  --poo-dark: #4a3112;
  --taupe: #6b5f57;
  --cream: #fff6e3;

  --bg: var(--mustard);
  --surface: var(--cream);
  --surface-2: #f6e6c4;
  --line: #e2c98f;
  --text: var(--poo-dark);
  --muted: #8a6a3f;
  --accent: var(--olive);
  --accent-ink: var(--lime);
  --danger: #c4452f;

  --display: Chicle, "Arial Narrow", Impact, sans-serif;
  --body: Montserrat, system-ui, -apple-system, "Segoe UI", sans-serif;
  --jp: "Noto Sans JP", "Hiragino Sans", sans-serif;

  --radius: 18px;
  --tabs-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 500 16px/1.45 var(--body);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, .app-name, .timer { font-family: var(--display); font-weight: 400; letter-spacing: .5px; }
[hidden] { display: none !important; }
.spaced { font-size: 11px; font-weight: 700; letter-spacing: 2.5px; text-transform: uppercase; }
[lang="ja"] { font-family: var(--jp); font-weight: 900; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
  background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { border-radius: 9px; }
.app-name { display: block; font-size: 30px; line-height: 1; color: var(--cream); text-shadow: 2px 2px 0 var(--poo); }
.jp-tag { display: block; font-size: 11px; color: var(--olive); letter-spacing: 2px; margin-top: 2px; }
.pro-badge {
  border: none; background: var(--olive); color: var(--lime);
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px;
}
.pro-badge.is-pro { background: var(--lime); color: var(--olive); }

main {
  max-width: 560px; margin: 0 auto;
  padding: 4px 16px calc(var(--tabs-h) + var(--safe-b) + 24px);
}
.view { display: none; }
.view.active { display: block; }

/* Record */
.record-stage { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 4px; }
.timer { font-size: 72px; line-height: .9; color: var(--poo-dark); font-variant-numeric: tabular-nums; }
.timer span { font-size: 36px; color: var(--poo); margin-left: 2px; }
.meter { width: 100%; max-width: 340px; height: 36px; margin: 6px 0 0; }

.burst-wrap { position: relative; width: 256px; height: 256px; display: grid; place-items: center; margin: -6px 0 -10px; }
.burst { position: absolute; inset: 0; width: 100%; height: 100%; fill: var(--olive); transition: fill .2s; }
.recording-active .burst { fill: var(--poo); animation: wobble 1.6s ease-in-out infinite; }
@keyframes wobble { 0%, 100% { transform: rotate(0) scale(1); } 50% { transform: rotate(6deg) scale(1.04); } }

.rec-btn {
  position: relative; width: 140px; height: 140px; border-radius: 50%;
  border: 6px solid var(--cream); background: var(--lime);
  display: grid; place-items: center;
  box-shadow: 0 6px 0 var(--poo-dark);
  transition: transform .12s ease, box-shadow .12s ease;
}
.rec-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--poo-dark); }
.rec-btn { overflow: hidden; background: #f2b9a0; }
.pucker { position: absolute; inset: 0; width: 100%; height: 100%; }
.creases { fill: none; stroke: #6e3426; stroke-width: 3.2; stroke-linecap: round; opacity: .8; transform-box: fill-box; transform-origin: 50% 50%; transition: transform .25s ease; }
.recording .creases { animation: clench .8s ease-in-out infinite; }
@keyframes clench { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(.82) rotate(-10deg); } }
.recording .pucker ellipse { animation: wink .8s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 50%; }
@keyframes wink { 0%, 100% { transform: scale(1); } 50% { transform: scale(.5); } }
.rec-ring { display: none; }
.rec-btn.recording { animation: glow 1.2s ease-out infinite; }
@keyframes glow {
  0% { box-shadow: 0 6px 0 var(--poo-dark), 0 0 0 0 rgba(196, 69, 47, .75); }
  100% { box-shadow: 0 6px 0 var(--poo-dark), 0 0 0 26px rgba(196, 69, 47, 0); }
}
.rec-hint { margin: 10px 0 2px; font-weight: 800; font-size: 17px; }
.rec-sub { margin: 0; color: var(--muted); font-size: 13px; max-width: 300px; }

.review-kicker { display: block; color: var(--mustard-2); font-size: 18px; margin-bottom: 2px; }
.review-tip {
  margin: -4px 0 12px; padding: 10px 14px; border-radius: 22px 26px 24px 18px;
  background: var(--poo); color: var(--mustard); font-weight: 700; font-size: 14px; line-height: 1.35;
}
.review-tip .spaced { color: var(--cream); margin-right: 4px; font-size: 10px; }

.sponsor-card {
  margin-top: 22px; padding: 16px; border-radius: var(--radius);
  background: var(--lime); color: var(--olive);
}
.sponsor-card strong { display: block; font-family: var(--display); font-weight: 400; font-size: 26px; line-height: 1; margin: 6px 0 4px; text-transform: uppercase; }
.sponsor-card p { margin: 0; font-size: 14px; }
.sponsor-label { font-size: 11px; text-transform: uppercase; letter-spacing: 2.5px; font-weight: 800; }

/* Lists */
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 12px; }
.view-head h1 { font-size: 42px; line-height: 1; margin: 0; color: var(--cream); text-shadow: 2px 2px 0 var(--poo); text-transform: uppercase; }
.count { color: var(--poo); font-size: 13px; font-weight: 700; }
.chips { display: flex; gap: 8px; margin-bottom: 12px; overflow-x: auto; }
.chip {
  border: 2px solid var(--poo); background: none; color: var(--poo);
  padding: 5px 14px; border-radius: 999px; font-size: 14px; font-weight: 700; white-space: nowrap;
}
.chip.active { background: var(--poo); color: var(--mustard); }

.track-list, .playlist-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.track {
  display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 10px;
  padding: 12px; border-radius: var(--radius); background: var(--surface);
  border: 3px solid transparent; box-shadow: 0 3px 0 var(--mustard-2);
}
.track.playing { border-color: var(--olive); }
.track-main { min-width: 0; }
.track-name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-meta { color: var(--muted); font-size: 13px; display: flex; gap: 8px; align-items: center; white-space: nowrap; overflow: hidden; }
.grade {
  color: var(--olive); background: var(--lime); font-weight: 800; font-size: 11px;
  text-transform: uppercase; letter-spacing: 1px; padding: 1px 7px; border-radius: 6px;
}
.wave { display: block; width: 100%; height: 28px; margin-top: 6px; }
.wave rect { fill: var(--line); }
.track.playing .wave rect { fill: var(--olive); }
.review-wave .wave rect { fill: var(--lime); }
.track-actions { display: flex; gap: 0; }

.play-btn {
  width: 48px; height: 48px; border-radius: 50%; border: none;
  background: var(--olive); color: var(--lime);
  display: grid; place-items: center;
}
.play-btn::before {
  content: ""; width: 0; height: 0; margin-left: 4px;
  border-left: 14px solid currentColor; border-top: 9px solid transparent; border-bottom: 9px solid transparent;
}
.play-btn.is-playing::before { width: 14px; height: 16px; margin: 0; border: none; border-left: 5px solid currentColor; border-right: 5px solid currentColor; }
.play-btn.big { width: 64px; height: 64px; }

.icon-btn {
  width: 34px; height: 40px; border-radius: 12px; border: none; background: none;
  color: var(--muted); display: grid; place-items: center;
}
.icon-btn svg, .tab svg, .action-item svg {
  width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon-btn.pinned { color: var(--mustard-2); }
.icon-btn.pinned svg { fill: currentColor; }

.playlist {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px; border-radius: var(--radius); background: var(--surface); border: none; width: 100%; text-align: left;
  box-shadow: 0 3px 0 var(--mustard-2);
}
.playlist strong { display: block; font-size: 17px; font-weight: 800; }
.playlist span { color: var(--muted); font-size: 13px; }
.back { display: inline-flex; align-items: center; gap: 4px; background: none; border: none; color: var(--poo); font-weight: 700; padding: 4px 0; }
.pl-meta { color: var(--poo); margin: -4px 0 12px; font-size: 14px; font-weight: 600; }

.empty { text-align: center; color: var(--poo); padding: 40px 0; font-weight: 600; }
.ad-slot {
  margin-top: 20px; height: 56px; border-radius: 12px; display: grid; place-items: center;
  border: 2px dashed var(--poo); color: var(--poo); font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
}

/* Buttons */
.btn {
  border: none; border-radius: 14px; padding: 14px 18px; font-weight: 800;
  background: var(--surface-2); color: var(--text);
}
.btn.small { padding: 8px 14px; font-size: 14px; border-radius: 12px; }
.btn.primary { background: var(--olive); color: var(--lime); box-shadow: 0 3px 0 var(--poo-dark); }
.btn.ghost { background: none; border: 2px solid var(--poo); color: var(--poo); }
.btn.full { width: 100%; }
.import-row { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.import-btn { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.how-link { background: none; border: none; color: var(--poo); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; padding: 8px 4px; }
.help-intro { margin: 0 0 12px; font-weight: 600; }
.help-steps { margin: 0 0 14px; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 10px; }
.help-steps li { counter-increment: step; position: relative; padding: 3px 0 0 42px; min-height: 30px; font-size: 15px; line-height: 1.4; }
.help-steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--olive); color: var(--lime); font-family: var(--display); font-size: 18px;
}
.help-steps b { color: var(--poo); }
.help-note { margin: 0 0 14px; padding: 10px 14px; border-radius: 14px; background: var(--lime); color: var(--olive); font-size: 14px; font-weight: 700; }
.help-close { margin-top: 8px; }
.track.just-saved { animation: flash 1.6s ease-out 1; }
@keyframes flash { 0%, 40% { border-color: var(--olive); box-shadow: 0 0 0 6px var(--lime), 0 3px 0 var(--mustard-2); } 100% { border-color: transparent; } }
.import-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--poo-dark);
}
.tab {
  background: none; border: none; color: #c9a877;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
}
.tab.active { color: var(--lime); }

/* Sheets */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 20; background: rgba(74, 49, 18, .55);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 560px; background: var(--cream);
  border-radius: 28px 28px 0 0; padding: 22px 16px calc(20px + var(--safe-b));
  max-height: 100dvh; overflow-y: auto; overscroll-behavior: contain;
  animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(40px); } to { transform: none; } }
.sheet h2 { margin: 0 0 12px; font-size: 38px; line-height: 1; text-transform: uppercase; color: var(--poo); }
.review-wave { background: var(--olive); border-radius: 14px; padding: 12px; }
.review-wave .wave { height: 64px; margin: 0; }
.review-meta { display: flex; align-items: center; gap: 14px; margin: 14px 0; }
.review-dur { font-family: var(--display); font-size: 40px; line-height: 1; }
.review-grade { display: inline-block; color: var(--olive); background: var(--lime); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; padding: 2px 8px; border-radius: 6px; margin-top: 4px; }
.field span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 6px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; }
.name-row { display: flex; gap: 8px; }
.name-row input {
  flex: 1; min-width: 0; font: inherit; font-size: 17px; font-weight: 700; color: var(--text);
  background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 12px;
}
.name-row input:focus { outline: none; border-color: var(--olive); }
.sheet-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 16px; }

.action-list { display: grid; gap: 4px; margin-bottom: 12px; }
.action-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: none; border: none; padding: 14px 8px; border-radius: 12px; font-size: 16px; font-weight: 700;
}
.action-item:active { background: var(--surface-2); }
.action-item.danger { color: var(--danger); }

.paywall { text-align: center; background: var(--lime); color: var(--olive); }
.paywall h2 { color: var(--olive); margin-bottom: 2px; }
.pw-kicker { display: block; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 2.5px; margin-bottom: 8px; }
.pw-pro { display: block; font-family: var(--display); font-size: 24px; color: var(--poo); margin-bottom: 8px; }
.paywall p { margin: 0 0 12px; }
.pw-list { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.pw-list li { background: rgba(255, 255, 255, .5); border-radius: 12px; padding: 10px; font-weight: 700; }
.paywall .btn.ghost { border-color: var(--olive); color: var(--olive); }
.pw-note { font-size: 12px; margin: 10px 0 !important; }

/* Toast */
.toast {
  position: fixed; left: 16px; right: 16px; top: calc(env(safe-area-inset-top, 0px) + 12px); z-index: 40;
  box-shadow: 0 6px 20px rgba(74, 49, 18, .35);
  max-width: 528px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--olive); color: var(--lime); border-radius: 14px; padding: 12px 14px; font-weight: 700;
}
.toast button { background: none; border: none; color: var(--cream); font-weight: 800; text-decoration: underline; }

/* Gut check */
.joke-card {
  display: block; width: 100%; border: none; text-align: center; margin-bottom: 18px;
  padding: 28px 26px 24px; color: var(--mustard); background: var(--poo);
  border-radius: 46% 54% 44% 56% / 38% 34% 66% 62%;
}
.joke-card .jp-kicker { display: block; color: var(--poo-dark); font-size: 22px; margin-bottom: 6px; }
.joke-card strong { display: block; font-family: var(--display); font-weight: 400; font-size: 28px; line-height: 1.05; text-transform: uppercase; }
.joke-card .spaced { display: block; color: var(--cream); margin-top: 12px; }
.country-pick { display: grid; gap: 6px; margin-bottom: 12px; }
.country-pick .spaced { color: var(--poo); }
.country-pick select {
  font: inherit; font-weight: 700; color: var(--text); background: var(--cream); border: 2px solid var(--poo);
  border-radius: 12px; padding: 12px 14px; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--poo) 50%), linear-gradient(135deg, var(--poo) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat;
}
.info-card {
  background: var(--cream); border-radius: var(--radius); padding: 18px 16px; margin-bottom: 14px;
  box-shadow: 0 3px 0 var(--mustard-2); display: grid; gap: 10px;
}
.info-card .spaced { color: var(--muted); }
.info-card h2 { margin: -4px 0 0; font-size: 34px; line-height: 1; text-transform: uppercase; color: var(--poo); }
.info-card p { margin: 0; }
.info-card .btn { text-align: center; text-decoration: none; display: block; }
.facts { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 15px; }
.facts li { padding-left: 16px; position: relative; }
.facts li::before { content: ""; position: absolute; left: 0; top: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--olive); }
.facts b { color: var(--poo); }
.info-card.warn { background: var(--lime); color: var(--olive); }
.info-card.warn h2 { color: var(--olive); }
.info-card.warn .spaced { color: var(--olive); }
.source-note { color: var(--poo); font-size: 12px; text-align: center; margin: 14px 0 0; }
.tab { font-size: 10px; letter-spacing: 1px; }

.how-link.inline { padding: 0; font-size: inherit; }
.legal-links { text-align: center; font-size: 13px; font-weight: 700; margin: 8px 0 0; }
.legal-links a, .pw-note a, .help-note a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
