:root {
  --bg-1: #1b1230;
  --bg-2: #2a1a4a;
  --card: #372457;
  --card-hi: #45306b;
  --accent: #b57aff;
  --accent-2: #ff7ad9;
  --gold: #ffd166;
  --text: #f3ecff;
  --text-dim: #b9a8d8;
  --shadow: rgba(0, 0, 0, 0.45);
}

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

html {
  touch-action: manipulation;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(255, 122, 217, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(181, 122, 255, 0.15), transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg-1) 55%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.4s ease;
}

body.theme-sisi {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(255, 107, 107, 0.16), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(255, 209, 102, 0.12), transparent 60%),
    linear-gradient(180deg, #3a1a24, #201017 55%);
  background-attachment: fixed;
}

.header {
  text-align: center;
  padding: max(env(safe-area-inset-top), 12px) 16px 10px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(20, 12, 36, 0.92), rgba(20, 12, 36, 0.75) 75%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.header h1 {
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(92deg, var(--accent) 10%, var(--accent-2) 55%, var(--gold) 95%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  padding-top: 6px;
}

.tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 10px auto 4px;
}

.tab {
  appearance: none;
  border: 1px solid rgba(181, 122, 255, 0.35);
  background: rgba(55, 36, 87, 0.65);
  color: var(--text-dim);
  font: inherit;
  font-weight: 700;
  font-size: clamp(0.85rem, 3.5vw, 1rem);
  padding: 10px clamp(12px, 4vw, 22px);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(181, 122, 255, 0.4);
}

body.theme-sisi .tab.active {
  background: linear-gradient(135deg, #ff5f5f, #ffb347);
  box-shadow: 0 4px 14px rgba(255, 107, 107, 0.4);
}

.tagline {
  color: var(--text-dim);
  margin-top: 6px;
  font-size: 0.85rem;
}

.boards {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.boards::-webkit-scrollbar {
  display: none;
}

.board {
  min-width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  padding: 0 16px;
}

.board-sisi {
  --accent: #ffb347;
  --accent-2: #ff5f5f;
  --card: #4a2430;
  --card-hi: #5c2f3c;
}

.board-asylum {
  --accent: #6fe3b0;
  --accent-2: #3aa07a;
  --card: #16302a;
  --card-hi: #1f4038;
}

body.theme-asylum {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(111, 227, 176, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(58, 160, 122, 0.10), transparent 60%),
    linear-gradient(180deg, #0f2420, #0a1512 55%);
  background-attachment: fixed;
}

body.theme-asylum .tab.active {
  background: linear-gradient(135deg, #3aa07a, #6fe3b0);
  box-shadow: 0 4px 14px rgba(111, 227, 176, 0.35);
}

body.theme-asylum .fab {
  background: linear-gradient(150deg, #3aa07a, #6fe3b0);
  box-shadow: 0 8px 24px rgba(111, 227, 176, 0.35);
}

.board-asylum .grid-featured .sound-btn {
  background: linear-gradient(160deg, #1f4a3e, #142e27);
  border-color: rgba(111, 227, 176, 0.35);
}

.board-asylum .sound-btn.playing {
  box-shadow: 0 0 0 2px rgba(111, 227, 176, 0.6), 0 8px 24px var(--shadow);
}

.board-ganon {
  --accent: #ffb020;
  --accent-2: #e03a2f;
  --card: #3a1616;
  --card-hi: #4d1f1f;
}

body.theme-ganon {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(224, 58, 47, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(255, 176, 32, 0.12), transparent 60%),
    linear-gradient(180deg, #2a0f0f, #140808 55%);
  background-attachment: fixed;
}

body.theme-ganon .tab.active {
  background: linear-gradient(135deg, #e03a2f, #ffb020);
  box-shadow: 0 4px 14px rgba(224, 58, 47, 0.4);
}

body.theme-ganon .fab {
  background: linear-gradient(150deg, #e03a2f, #ffb020);
  box-shadow: 0 8px 24px rgba(224, 58, 47, 0.4);
}

.board-ganon .grid-featured .sound-btn {
  background: linear-gradient(160deg, #5a1d1d, #3a1212);
  border-color: rgba(255, 176, 32, 0.45);
}

.board-ganon .sound-btn.playing {
  box-shadow: 0 0 0 2px rgba(255, 176, 32, 0.6), 0 8px 24px var(--shadow);
}

.sound-btn.missing {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.6);
}

.board-note {
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.5;
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
}

.board-note code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.8rem;
}

.board-sisi .sound-btn {
  border-color: rgba(255, 179, 71, 0.25);
}

.board .section:first-child {
  margin-top: 14px;
}

.section {
  margin-top: 26px;
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 12px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.grid-featured .sound-btn {
  background: linear-gradient(160deg, #4a2a7a, #35205c);
  border-color: rgba(255, 209, 102, 0.35);
}

.board-sisi .grid-featured .sound-btn {
  background: linear-gradient(160deg, #6b2a3a, #4a1f2c);
  border-color: rgba(255, 209, 102, 0.45);
}

.sound-btn {
  appearance: none;
  border: 1px solid rgba(181, 122, 255, 0.25);
  border-radius: 18px;
  background: linear-gradient(160deg, var(--card-hi), var(--card));
  color: var(--text);
  min-height: 92px;
  padding: 14px 10px;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 6px 16px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transition: transform 0.09s ease, box-shadow 0.09s ease, border-color 0.2s ease;
}

.sound-btn .emoji {
  font-size: 1.9rem;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35));
}

.sound-btn .label {
  text-align: center;
}

.sound-btn .pinyin {
  font-size: 0.8rem;
  font-weight: 500;
  font-style: italic;
  color: var(--accent);
  text-align: center;
  margin-top: -4px;
}

.sound-btn .en {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-dim);
  text-align: center;
  margin-top: -4px;
}

.sound-btn:active {
  transform: scale(0.94);
  box-shadow: 0 2px 8px var(--shadow);
}

@media (hover: hover) {
  .sound-btn:hover {
    border-color: var(--accent);
    box-shadow: 0 8px 22px var(--shadow), 0 0 0 1px rgba(181, 122, 255, 0.35);
  }
}

.sound-btn.playing {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px rgba(255, 122, 217, 0.55), 0 8px 24px var(--shadow);
  animation: pulse 0.5s ease infinite alternate;
}

.board-sisi .sound-btn.playing {
  box-shadow: 0 0 0 2px rgba(255, 179, 71, 0.6), 0 8px 24px var(--shadow);
}

@keyframes pulse {
  from { transform: scale(1); }
  to { transform: scale(1.04); }
}

.fab {
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  font-size: 1.8rem;
  background: linear-gradient(150deg, var(--accent-2), var(--accent));
  color: #fff;
  box-shadow: 0 8px 24px rgba(181, 122, 255, 0.45);
  cursor: pointer;
  transition: transform 0.1s ease;
  z-index: 10;
}

body.theme-sisi .fab {
  background: linear-gradient(150deg, #ff5f5f, #ffb347);
  box-shadow: 0 8px 24px rgba(255, 107, 107, 0.45);
}

.fab:active {
  transform: scale(0.9) rotate(20deg);
}

.footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-top: 40px;
  opacity: 0.8;
}

@media (max-width: 420px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .sound-btn {
    min-height: 84px;
    font-size: 0.92rem;
  }
}
