:root {
  color-scheme: light;
  --ink: #24163a;
  --ink-soft: #6f5c87;
  --paper: #fffdf8;
  --purple: #5b2ca0;
  --purple-dark: #3f1c79;
  --lime: #b5ef69;
  --orange: #ff9d45;
  --aqua: #52d4ce;
  --pink: #ff76a8;
  --line: #e8def2;
  --shadow: 0 16px 40px rgba(50, 26, 82, 0.16);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: ui-rounded, "Avenir Next Rounded", "Trebuchet MS", system-ui, sans-serif;
  font-size: 16px;
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
button:focus-visible, a:focus-visible { outline: 4px solid var(--orange); outline-offset: 3px; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) clamp(18px, 4vw, 52px) 14px;
  background: rgba(255, 253, 248, 0.94);
  border-bottom: 1px solid rgba(91, 44, 160, 0.1);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 900; font-size: 1.2rem; }
.brand-badge { display: grid; place-items: center; width: 38px; height: 38px; color: white; background: var(--purple); border-radius: 12px 12px 18px 18px; transform: rotate(-3deg); }
.mode-switch { display: flex; gap: 8px; padding: 4px; background: #f0e8f8; border-radius: 18px; }
.mode-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; color: var(--ink-soft); background: transparent; border: 0; border-radius: 14px; font-weight: 900; cursor: pointer; }
.mode-button > span:first-child { font-size: 1.2rem; }
.mode-button.is-active { color: white; background: var(--purple); box-shadow: 0 4px 0 var(--purple-dark); }
.install-button, .primary-button { min-height: 48px; border: 0; border-radius: 16px; padding: 0 20px; color: white; background: var(--purple); font-weight: 900; cursor: pointer; box-shadow: 0 8px 0 var(--purple-dark); }
.install-button:active, .primary-button:active { transform: translateY(4px); box-shadow: 0 4px 0 var(--purple-dark); }

main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.spotlight {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(340px, 1.15fr);
  align-items: center;
  gap: clamp(24px, 5vw, 70px);
  min-height: 470px;
  margin: 24px 0 46px;
  padding: clamp(28px, 6vw, 68px);
  overflow: hidden;
  background: #efe4ff;
  border: 3px solid var(--ink);
  border-radius: 38px;
  box-shadow: 0 10px 0 var(--ink);
}
.spotlight::before, .spotlight::after { content: ""; position: absolute; width: 140px; height: 140px; border: 28px solid rgba(91, 44, 160, 0.12); border-radius: 50%; }
.spotlight::before { left: -80px; bottom: -60px; }
.spotlight::after { right: 35%; top: -100px; }
.spotlight-copy { position: relative; z-index: 2; }
.eyebrow { display: inline-block; color: var(--purple); font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.82rem; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 620px; margin-bottom: 14px; font-size: clamp(2.7rem, 7vw, 5.9rem); line-height: 0.9; letter-spacing: -0.06em; }
.spotlight p { max-width: 480px; margin-bottom: 28px; color: var(--ink-soft); font-size: clamp(1.1rem, 2vw, 1.35rem); line-height: 1.45; font-weight: 650; }
.spotlight-art { position: relative; min-width: 0; transform: rotate(2deg); }
.spotlight-art img { display: block; width: 100%; aspect-ratio: 16/11; object-fit: cover; border: 3px solid var(--ink); border-radius: 28px; box-shadow: var(--shadow); }
.spotlight-art img { object-fit: contain; padding: 18px; background: #dff7f5; }
.note { position: absolute; display: grid; place-items: center; width: 58px; height: 58px; color: var(--ink); background: var(--lime); border: 3px solid var(--ink); border-radius: 50%; font-size: 2rem; font-weight: 900; }
.note-one { left: -20px; top: -20px; transform: rotate(-12deg); }
.note-two { right: -18px; bottom: -22px; background: var(--orange); transform: rotate(10deg); }

.browse { padding-bottom: 80px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
h2 { margin-bottom: 0; font-size: clamp(2rem, 5vw, 3.7rem); line-height: 1; letter-spacing: -0.05em; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px; }
.chip { min-height: 44px; padding: 0 18px; color: var(--ink); background: white; border: 2px solid var(--line); border-radius: 999px; font-weight: 850; white-space: nowrap; cursor: pointer; }
.chip.is-active { color: white; background: var(--ink); border-color: var(--ink); }
.monster-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.monster-card { display: grid; grid-template-columns: 170px 1fr auto; align-items: center; gap: 20px; min-width: 0; padding: 16px; color: var(--ink); text-align: left; background: white; border: 2px solid var(--line); border-radius: 26px; box-shadow: 0 6px 0 #e8def2; cursor: pointer; transition: transform 160ms ease, box-shadow 160ms ease; }
.monster-card:hover { transform: translateY(-4px) rotate(-0.5deg); box-shadow: 0 11px 0 #e8def2; }
.monster-card[hidden] { display: none; }
.card-image { display: grid; place-items: center; width: 100%; aspect-ratio: 4/3; overflow: hidden; background: #dff7f5; border-radius: 18px; }
.card-image img { width: 100%; height: 100%; padding: 6px; object-fit: contain; }
.pompom-card { background: #ffe2ee; }
.pompom-card img { object-fit: contain; padding: 6px; }
.thumpies-preview { color: white; background: var(--purple); border: 8px solid var(--lime); }
.thumpies-preview span { font-weight: 1000; font-size: 1.3rem; transform: rotate(-7deg); }
.card-copy { min-width: 0; }
.card-copy strong { display: block; margin-bottom: 6px; font-size: clamp(1.35rem, 3vw, 2rem); }
.card-copy small { display: block; color: var(--ink-soft); font-size: 0.95rem; line-height: 1.35; }
.arrow { display: grid; place-items: center; width: 44px; height: 44px; background: var(--lime); border-radius: 50%; font-size: 1.5rem; font-weight: 900; }

.monster-dialog { width: min(980px, calc(100% - 20px)); max-height: min(900px, calc(100dvh - 20px)); padding: 0; border: 0; border-radius: 30px; background: transparent; }
.monster-dialog::backdrop { background: rgba(29, 17, 47, 0.72); backdrop-filter: blur(6px); }
.dialog-shell { position: relative; overflow: auto; max-height: min(900px, calc(100dvh - 20px)); padding: 0 clamp(22px, 5vw, 48px) clamp(22px, 5vw, 48px); background: var(--paper); border: 3px solid var(--ink); border-radius: 30px; }
.dialog-toolbar { position: sticky; z-index: 10; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 76px; margin: 0 clamp(-48px, -5vw, -22px) 18px; padding: 10px clamp(18px, 4vw, 34px); background: rgba(255, 253, 248, 0.97); border-bottom: 2px solid var(--line); backdrop-filter: blur(16px); }
.dialog-toolbar > span { font-weight: 900; color: var(--ink-soft); }
.close-button { display: grid; place-items: center; width: 54px; height: 54px; color: white; background: var(--ink); border: 0; border-radius: 50%; font-size: 2.2rem; line-height: 1; cursor: pointer; }
.detail-hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr); align-items: center; gap: 32px; }
.detail-hero img { width: 100%; max-height: 390px; object-fit: contain; background: #efe4ff; border-radius: 24px; }
.detail-hero h2 { margin: 8px 0 14px; }
.detail-hero p { color: var(--ink-soft); font-size: 1.08rem; line-height: 1.5; }
.fact-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; margin: 4px 4px 4px 0; padding: 0 14px; background: #edfbdc; border-radius: 999px; font-weight: 850; }
.sound-button { display: inline-flex; align-items: center; gap: 12px; min-height: 58px; margin-top: 20px; padding: 0 22px; color: white; background: var(--purple); border: 0; border-radius: 18px; box-shadow: 0 7px 0 var(--purple-dark); font-size: 1.05rem; font-weight: 900; cursor: pointer; }
.sound-button:active { transform: translateY(3px); box-shadow: 0 4px 0 var(--purple-dark); }
.sound-button.is-playing { color: var(--ink); background: var(--lime); box-shadow: 0 7px 0 #6c9f31; }
.sound-icon { display: grid; place-items: center; width: 34px; height: 34px; background: rgba(255,255,255,0.2); border-radius: 50%; font-size: 1.2rem; }
.detail-section { margin-top: 34px; }
.detail-section h3 { margin-bottom: 14px; font-size: 1.5rem; }
.costume-rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(170px, 32%); gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 2px 18px; }
.costume-card { scroll-snap-align: start; overflow: hidden; background: white; border: 2px solid var(--line); border-radius: 20px; }
.costume-card img { width: 100%; aspect-ratio: 1/1; object-fit: contain; background: #f3edfb; }
.costume-card span { display: block; padding: 12px; font-weight: 850; }
.recipe { display: flex; align-items: center; gap: 12px; padding: 16px; background: #f3edfb; border-radius: 20px; font-size: 1.05rem; font-weight: 850; }
.recipe .symbol { display: grid; place-items: center; flex: 0 0 42px; height: 42px; background: white; border-radius: 50%; font-size: 1.4rem; }
.small-note { color: var(--ink-soft); line-height: 1.5; }
.install-steps { display: grid; gap: 14px; margin: 26px 0; padding: 0; list-style: none; counter-reset: steps; }
.install-steps li { display: grid; grid-template-columns: 46px 1fr; align-items: center; gap: 14px; min-height: 62px; padding: 10px 14px 10px 10px; background: #f3edfb; border-radius: 18px; font-weight: 800; line-height: 1.4; counter-increment: steps; }
.install-steps li::before { content: counter(steps); display: grid; place-items: center; width: 42px; height: 42px; color: white; background: var(--purple); border-radius: 50%; font-size: 1.2rem; font-weight: 900; }
.source-note { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 0.82rem; line-height: 1.45; }

.view-panel[hidden] { display: none; }
.song-view { padding: clamp(24px, 5vw, 52px) 0 70px; }
.song-heading { max-width: 840px; margin: 0 auto 26px; text-align: center; }
.song-heading h1 { max-width: none; margin: 8px 0 12px; font-size: clamp(2.5rem, 7vw, 5.2rem); }
.song-heading p { margin-bottom: 0; color: var(--ink-soft); font-size: 1.1rem; font-weight: 750; }
.song-player { min-height: 210px; margin-bottom: 26px; overflow: hidden; background: #efe4ff; border: 3px solid var(--ink); border-radius: 30px; box-shadow: 0 8px 0 var(--ink); }
.song-player-placeholder { display: grid; place-items: center; align-content: center; min-height: 210px; padding: 24px; text-align: center; }
.song-player-placeholder > span { display: grid; place-items: center; width: 68px; height: 68px; margin-bottom: 12px; background: var(--lime); border: 3px solid var(--ink); border-radius: 50%; font-size: 2.2rem; }
.song-player-placeholder strong { font-size: clamp(1.45rem, 4vw, 2rem); }
.song-player-placeholder small { margin-top: 4px; color: var(--ink-soft); font-size: 0.96rem; font-weight: 700; }
.song-player-stage { padding: clamp(14px, 3vw, 24px); }
.song-player-title { display: grid; grid-template-columns: 72px 1fr auto; align-items: center; gap: 14px; margin-bottom: 16px; }
.song-player-title img { width: 72px; height: 72px; padding: 5px; object-fit: contain; background: white; border: 2px solid var(--ink); border-radius: 18px; }
.song-player-title strong { display: block; margin-top: 2px; font-size: clamp(1.5rem, 4vw, 2.25rem); }
.song-stop { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 104px; min-height: 50px; padding: 0 18px; color: white; background: var(--ink); border: 0; border-radius: 16px; font-weight: 900; cursor: pointer; }
.video-frame { overflow: hidden; aspect-ratio: 16 / 9; background: #160d24; border: 3px solid var(--ink); border-radius: 22px; }
.video-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.island-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.island-card { display: grid; grid-template-rows: minmax(180px, 1fr) auto; min-width: 0; overflow: hidden; padding: 0; color: var(--ink); text-align: left; background: white; border: 3px solid var(--ink); border-radius: 26px; box-shadow: 0 7px 0 var(--ink); cursor: pointer; transition: transform 160ms ease, box-shadow 160ms ease; }
.island-card:hover { transform: translateY(-4px); box-shadow: 0 11px 0 var(--ink); }
.island-card:active { transform: translateY(4px); box-shadow: 0 3px 0 var(--ink); }
.island-card.is-playing { outline: 6px solid var(--lime); outline-offset: 3px; }
.island-card img { width: 100%; height: 100%; min-height: 180px; padding: 14px; object-fit: contain; background: #dff7f5; }
.island-card.cold img { background: #e6f4ff; }
.island-card.air img { background: #fff2d9; }
.island-card.water img { background: #d9f2ff; }
.island-card.earth img { background: #ffe5d5; }
.island-card > span { display: block; padding: 16px; }
.island-card strong { display: block; margin-bottom: 5px; font-size: clamp(1.25rem, 3vw, 1.65rem); }
.island-card small { display: flex; align-items: center; gap: 6px; color: var(--purple); font-size: 0.92rem; font-weight: 900; }
.song-source { text-align: center; }

@media (max-width: 800px) {
  main { width: min(100% - 20px, 680px); }
  .topbar { flex-wrap: wrap; gap: 10px; padding-inline: 14px; }
  .brand { font-size: 1.05rem; }
  .mode-switch { width: 100%; }
  .mode-button { flex: 1; min-width: 0; padding-inline: 10px; }
  .spotlight { grid-template-columns: 1fr; min-height: 0; margin-top: 10px; padding: 26px; border-radius: 28px; box-shadow: 0 7px 0 var(--ink); }
  .spotlight-art { order: -1; }
  .spotlight-art img { aspect-ratio: 16/10; }
  .section-heading { align-items: start; flex-direction: column; }
  .chips { width: 100%; }
  .monster-grid { grid-template-columns: 1fr; }
  .monster-card { grid-template-columns: 118px 1fr auto; gap: 14px; }
  .detail-hero { grid-template-columns: 1fr; }
  .detail-hero img { max-height: 320px; }
  .costume-rail { grid-auto-columns: minmax(160px, 70%); }
  .song-view { padding-top: 22px; }
  .island-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
}

@media (max-width: 430px) {
  h1 { font-size: 2.7rem; }
  .spotlight { padding: 20px; }
  .monster-card { grid-template-columns: 96px 1fr; }
  .arrow { display: none; }
  .card-copy small { font-size: 0.84rem; }
  .monster-dialog { width: 100%; max-width: none; max-height: 100dvh; margin: 0; border-radius: 0; }
  .dialog-shell { max-height: 100dvh; padding-right: 16px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); padding-left: 16px; border-width: 0; border-radius: 0; }
  .dialog-toolbar { min-height: calc(70px + env(safe-area-inset-top)); margin: 0 -16px 18px; padding: max(10px, env(safe-area-inset-top)) 14px 10px 18px; }
  .close-button { width: 58px; height: 58px; flex: 0 0 58px; }
  .song-heading h1 { font-size: 2.7rem; }
  .song-player { min-height: 170px; border-radius: 24px; box-shadow: 0 6px 0 var(--ink); }
  .song-player-placeholder { min-height: 170px; }
  .song-player-title { grid-template-columns: 58px 1fr; }
  .song-player-title img { width: 58px; height: 58px; border-radius: 14px; }
  .song-stop { grid-column: 1 / -1; width: 100%; }
  .video-frame { border-radius: 16px; }
  .island-grid { grid-template-columns: 1fr; }
  .island-card { grid-template-columns: 122px 1fr; grid-template-rows: 1fr; min-height: 128px; }
  .island-card img { min-height: 128px; padding: 8px; }
  .island-card > span { display: flex; flex-direction: column; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* Picture-first filters match the guide's playful controls. */
.filter-controls { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: flex-end; }
.filter-controls .chips { width: auto; overflow: visible; flex-wrap: wrap; }
.icon-chip { display: inline-grid; place-items: center; width: 52px; min-width: 52px; height: 52px; padding: 0; font-size: 1.7rem; border-radius: 17px; }
.icon-chip.is-active { outline: 3px solid var(--lime); outline-offset: 1px; }
.monster-card[data-category="fire"] .card-image { background: #ffe8cf; }
.filter-empty { padding: 24px; text-align: center; color: var(--ink-soft); }
@media (max-width: 800px) { .filter-controls { justify-content: flex-start; width: 100%; } }
