/* =====================================================================
   Vinzz Piano Tiles - Design System v2 "Pastel Kartun"
   Target: anak-anak. Cerah, bulat, tebal, memantul, tetap rapi & terbaca.
   Font di-bundle lokal (Fredoka + Nunito) dengan fallback system font.
   ===================================================================== */

@font-face {
  font-family: "Fredoka var";
  src: url("../fonts/fredoka-var-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Nunito var";
  src: url("../fonts/nunito-var-latin.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Langit latar */
  --sky-top: #bfe9ff;
  --sky-mid: #d9d3ff;
  --sky-bottom: #ffe3f1;

  /* Permukaan */
  --surface: #ffffff;
  --surface-2: #f7f5ff;
  --surface-3: #efeaff;
  --surface-hover: #f2eeff;
  --line: #e7e1f8;
  --line-strong: #d3caf1;

  /* Tinta (teks) */
  --ink: #2b2356;
  --ink-2: #4b437b;
  --muted: #6b6496;
  --faint: #a8a2c8;

  /* Warna permen */
  --yellow: #ffcb2f;
  --yellow-deep: #e5a500;
  --yellow-soft: #fff4cf;
  --pink: #ff6fae;
  --pink-deep: #dc4a8b;
  --pink-soft: #ffe1ef;
  --mint: #2fd49d;
  --mint-deep: #17a578;
  --mint-soft: #d9f8ec;
  --sky: #3fb3ff;
  --sky-deep: #1a8ad8;
  --sky-soft: #dcf1ff;
  --grape: #8a6bff;
  --grape-deep: #6a4be6;
  --grape-soft: #ebe5ff;
  --orange: #ff9b3d;
  --orange-deep: #de7613;
  --orange-soft: #ffead6;
  --red: #ff5a6b;
  --red-deep: #d93a4c;
  --red-soft: #ffe3e6;

  /* Alias semantik (kompatibel dengan komponen v1) */
  --bg: #eef3ff;
  --bg-elev: var(--surface);
  --bg-elev-2: var(--surface-2);
  --bg-elev-3: var(--surface-3);
  --bg-hover: var(--surface-hover);
  --text: var(--ink);
  --text-dim: var(--ink-2);
  --accent: var(--grape);
  --accent-strong: var(--grape-deep);
  --accent-ink: #ffffff;
  --accent-soft: rgba(138, 107, 255, 0.14);
  --accent-line: rgba(138, 107, 255, 0.4);
  --success: var(--mint-deep);
  --warning: var(--orange-deep);
  --danger: var(--red);
  --info: var(--sky-deep);
  --perfect: var(--yellow);
  --great: var(--mint);
  --good: var(--sky);
  --miss: var(--red);

  /* Difficulty */
  --easy: var(--mint);
  --normal: var(--sky);
  --hard: var(--orange);
  --expert: var(--pink);

  /* Bentuk */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  --shadow-sm: 0 2px 0 rgba(43, 35, 86, 0.06);
  --shadow: 0 10px 26px rgba(98, 76, 196, 0.14);
  --shadow-lg: 0 26px 60px rgba(98, 76, 196, 0.24);
  --inset-top: inset 0 2px 0 rgba(255, 255, 255, 0.7);

  --font-display: "Fredoka var", "Baloo 2", "Comic Neue", ui-rounded, "Segoe UI Rounded", system-ui, sans-serif;
  --font-sans: "Nunito var", ui-rounded, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --nav-h: 70px;
  --container: 1180px;
  --gutter: clamp(16px, 4vw, 32px);
}

/* ---------------------------------------------------------------------
   Reset & dasar
   ------------------------------------------------------------------- */

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

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--sky-top);
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.55;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 52%, var(--sky-bottom) 100%) fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Awan dekoratif (tanpa gambar) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60px 36px at 12% 18%, rgba(255, 255, 255, 0.85) 60%, transparent 62%),
    radial-gradient(90px 46px at 16% 20%, rgba(255, 255, 255, 0.85) 60%, transparent 62%),
    radial-gradient(70px 40px at 84% 12%, rgba(255, 255, 255, 0.8) 60%, transparent 62%),
    radial-gradient(110px 52px at 89% 14%, rgba(255, 255, 255, 0.8) 60%, transparent 62%),
    radial-gradient(80px 42px at 72% 78%, rgba(255, 255, 255, 0.55) 60%, transparent 62%),
    radial-gradient(120px 56px at 77% 80%, rgba(255, 255, 255, 0.55) 60%, transparent 62%),
    radial-gradient(4px 4px at 30% 40%, rgba(255, 255, 255, 0.9) 70%, transparent 72%),
    radial-gradient(3px 3px at 62% 30%, rgba(255, 255, 255, 0.9) 70%, transparent 72%),
    radial-gradient(5px 5px at 45% 65%, rgba(255, 255, 255, 0.8) 70%, transparent 72%);
}

main { flex: 1 0 auto; }

img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }

a { color: var(--grape-deep); text-decoration: none; }
a:hover { color: var(--pink-deep); }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

h1, h2, h3, h4 { margin: 0; line-height: 1.12; letter-spacing: -0.01em; font-family: var(--font-display); font-weight: 650; color: var(--ink); }
p { margin: 0; }

::selection { background: var(--yellow); color: var(--ink); }

:focus-visible {
  outline: 3px solid var(--grape);
  outline-offset: 3px;
  border-radius: 10px;
}

.icon { flex: none; }
.icon-fill { fill: currentColor; }

.skip-link {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 1000;
  padding: 10px 18px;
  background: var(--yellow);
  color: var(--ink);
  border-radius: 14px;
  font-family: var(--font-display);
}
.skip-link:focus { top: 12px; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------------
   Tipografi
   ------------------------------------------------------------------- */

.display { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; line-height: 0.95; }
.h1 { font-size: clamp(32px, 4.6vw, 50px); }
.h2 { font-size: clamp(25px, 3.2vw, 34px); }
.h3 { font-size: 21px; }
.h4 { font-size: 17px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grape-deep);
}
.muted { color: var(--muted); }
.dim { color: var(--ink-2); }
.mono { font-family: var(--font-mono); }
.num { font-variant-numeric: tabular-nums; }
.text-success { color: var(--mint-deep); }
.text-danger { color: var(--red-deep); }
.text-warning { color: var(--orange-deep); }
.text-accent { color: var(--grape-deep); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.kbd {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 9px;
  background: var(--surface);
  border: 2px solid var(--line-strong);
  box-shadow: 0 3px 0 var(--line-strong);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
}

/* ---------------------------------------------------------------------
   Layout
   ------------------------------------------------------------------- */

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.container-narrow { max-width: 780px; }
.container-tight { max-width: 470px; }
.section { padding-top: clamp(26px, 5vw, 52px); padding-bottom: clamp(40px, 6vw, 72px); }

.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 26px; }
.page-header .eyebrow { margin-bottom: 8px; }
.page-header p.muted { margin-top: 8px; max-width: 580px; }

.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(24px, 2.8vw, 30px); }
.section-head .eyebrow { margin-bottom: 6px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 22px; }
.toolbar .input-group { flex: 1 1 260px; max-width: 400px; }

/* ---------------------------------------------------------------------
   Navbar
   ------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  padding: 8px 0;
}
.nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 22px;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 22px;
  box-shadow: 0 8px 24px rgba(98, 76, 196, 0.12);
  padding-left: 14px;
  padding-right: 10px;
  max-width: calc(var(--container) - 2 * var(--gutter));
  width: calc(100% - 2 * var(--gutter));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  white-space: nowrap;
}
.brand:hover { color: var(--ink); }
.brand-logo { height: 34px; width: auto; }
.brand-mascot { width: 36px; height: 40px; object-fit: contain; }

/* Brand mark: 4 tuts dengan tile warna-warni */
.brand-mark {
  display: inline-grid;
  grid-template-columns: repeat(4, 7px);
  gap: 3px;
  align-items: end;
  height: 30px;
  padding: 4px 5px;
  border-radius: 10px;
  background: var(--surface-3);
}
.brand-mark i { position: relative; display: block; width: 7px; height: 100%; border-radius: 3px; background: #fff; }
.brand-mark i::after { content: ""; position: absolute; left: 0; right: 0; height: 9px; border-radius: 3px; background: var(--ink); }
.brand-mark i:nth-child(1)::after { top: 12px; background: var(--pink); }
.brand-mark i:nth-child(2)::after { top: 2px; background: var(--ink); }
.brand-mark i:nth-child(3)::after { top: 8px; background: var(--sky); }
.brand-mark i:nth-child(4)::after { top: 0; background: var(--yellow); }
.brand-mark-sm { transform: scale(0.85); transform-origin: left center; }

.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease), transform 0.2s var(--bounce);
}
.nav-link:hover { color: var(--ink); background: var(--surface-3); }
.nav-link.is-active { color: #fff; background: var(--grape); box-shadow: 0 4px 0 var(--grape-deep); }
.nav-link.is-active .icon { color: #fff; }
.nav-mobile-auth { display: none; }
.nav-logout-form { margin: 0; }

.nav-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav-actions .nav-toggle { display: none; }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  padding: 0 12px 0 5px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 2px solid var(--line);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
}
.user-chip:hover { border-color: var(--line-strong); background: #fff; }
.user-chip .icon { color: var(--muted); }
.user-chip-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 880px) {
  .nav-actions .nav-toggle { display: inline-grid; }
  .nav-actions .nav-auth { display: none; }
  .user-chip-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .nav-inner { gap: 10px; }
  .nav-links {
    position: fixed;
    top: calc(var(--nav-h) + 4px);
    left: var(--gutter);
    right: var(--gutter);
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 12px;
    background: #fff;
    border-radius: 22px;
    box-shadow: var(--shadow-lg);
    transform: translateY(-10px) scale(0.98);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s var(--ease), transform 0.25s var(--bounce), visibility 0.2s;
  }
  .site-header.is-open .nav-links { transform: none; opacity: 1; visibility: visible; }
  .nav-link { height: 50px; font-size: 17px; width: 100%; }
  .nav-mobile-auth { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; padding-top: 10px; border-top: 2px dashed var(--line); }
}

/* ---------------------------------------------------------------------
   Dropdown
   ------------------------------------------------------------------- */

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 220px;
  padding: 8px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.96);
  transform-origin: top right;
  transition: opacity 0.16s var(--ease), transform 0.22s var(--bounce), visibility 0.16s;
  z-index: 60;
}
.dropdown.is-open .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown-menu form { margin: 0; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 15px;
  text-align: left;
}
.dropdown-item .icon { color: var(--grape); }
.dropdown-item:hover, .dropdown-item:focus-visible { background: var(--surface-3); color: var(--ink); }
.dropdown-item:disabled { opacity: 0.45; pointer-events: none; }
.dropdown-sep { height: 2px; margin: 6px 4px; background: var(--line); border-radius: 2px; }

/* ---------------------------------------------------------------------
   Tombol chunky
   ------------------------------------------------------------------- */

.btn {
  --btn-bg: #ffffff;
  --btn-fg: var(--ink);
  --btn-edge: var(--line-strong);
  --btn-border: var(--line);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  border-radius: 16px;
  border: 2px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
  box-shadow: 0 4px 0 var(--btn-edge);
  transform: translateY(0);
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease), background-color 0.15s var(--ease), filter 0.15s var(--ease);
}
.btn:hover { color: var(--btn-fg); filter: brightness(1.03); transform: translateY(-1px); box-shadow: 0 5px 0 var(--btn-edge); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--btn-edge); }
.btn:disabled, .btn.is-disabled { opacity: 0.5; pointer-events: none; }

.btn-primary { --btn-bg: var(--yellow); --btn-fg: var(--ink); --btn-edge: var(--yellow-deep); --btn-border: var(--yellow); }
.btn-secondary { --btn-bg: #ffffff; --btn-fg: var(--ink); --btn-edge: var(--line-strong); --btn-border: var(--line); }
.btn-light { --btn-bg: #ffffff; --btn-fg: var(--ink); --btn-edge: var(--line-strong); --btn-border: #fff; }
.btn-grape { --btn-bg: var(--grape); --btn-fg: #fff; --btn-edge: var(--grape-deep); --btn-border: var(--grape); }
.btn-pink { --btn-bg: var(--pink); --btn-fg: #fff; --btn-edge: var(--pink-deep); --btn-border: var(--pink); }
.btn-sky { --btn-bg: var(--sky); --btn-fg: #fff; --btn-edge: var(--sky-deep); --btn-border: var(--sky); }
.btn-mint, .btn-success { --btn-bg: var(--mint); --btn-fg: #fff; --btn-edge: var(--mint-deep); --btn-border: var(--mint); }
.btn-orange { --btn-bg: var(--orange); --btn-fg: #fff; --btn-edge: var(--orange-deep); --btn-border: var(--orange); }
.btn-danger { --btn-bg: var(--red); --btn-fg: #fff; --btn-edge: var(--red-deep); --btn-border: var(--red); }
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--ink-2); --btn-edge: transparent; --btn-border: transparent; box-shadow: none; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.7); color: var(--ink); box-shadow: none; }
.btn-ghost:active { box-shadow: none; }

.btn-sm { height: 38px; padding: 0 14px; font-size: 15px; border-radius: 13px; gap: 6px; box-shadow: 0 3px 0 var(--btn-edge); }
.btn-xs { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 10px; gap: 5px; box-shadow: 0 2px 0 var(--btn-edge); }
.btn-lg { height: 56px; padding: 0 28px; font-size: 19px; border-radius: 20px; box-shadow: 0 5px 0 var(--btn-edge); }
.btn-xl { height: 66px; padding: 0 36px; font-size: 22px; border-radius: 24px; letter-spacing: 0.04em; box-shadow: 0 6px 0 var(--btn-edge); }
.btn-block { width: 100%; }
.btn-icon { width: 46px; padding: 0; }
.btn-icon.btn-sm { width: 38px; }
.btn-icon.btn-xs { width: 30px; }
.btn-round { border-radius: 999px; }

.link-button { padding: 0; border: 0; background: none; color: inherit; font: inherit; }
.link-button:hover { color: var(--grape-deep); }

.btn .spinner { width: 18px; height: 18px; border-width: 3px; }
.btn.is-loading { pointer-events: none; }

/* ---------------------------------------------------------------------
   Form
   ------------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--ink-2); }
.field-label .req { color: var(--pink-deep); margin-left: 2px; }
.field-hint { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.field-error { font-size: 13.5px; color: var(--red-deep); font-weight: 700; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 560px) { .field-row { grid-template-columns: minmax(0, 1fr); } }

.input, .select, .textarea {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border-radius: 16px;
  border: 2px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  outline: none;
  box-shadow: inset 0 3px 0 var(--surface-2);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); font-weight: 600; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--grape); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--grape); box-shadow: 0 0 0 4px var(--accent-soft); }
.input.is-invalid { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.input-sm, .select.input-sm { height: 40px; font-size: 15px; border-radius: 12px; padding: 0 12px; }
.select.input-sm { padding-right: 38px; }
.textarea { height: auto; min-height: 104px; padding: 12px 16px; resize: vertical; }
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236a4be6' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-left: 46px; }
.input-group > .icon { position: absolute; left: 16px; color: var(--grape); pointer-events: none; }
.input-group .input-action { position: absolute; right: 6px; }

.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 15px; color: var(--ink-2); }
.check input { width: 20px; height: 20px; accent-color: var(--grape); }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; user-select: none; }
.switch-text { display: flex; flex-direction: column; gap: 2px; }
.switch-title { font-family: var(--font-display); font-weight: 600; font-size: 16px; color: var(--ink); }
.switch-desc { font-size: 13.5px; color: var(--muted); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  flex: none;
  position: relative;
  width: 54px;
  height: 32px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 2px solid var(--line-strong);
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 0 rgba(43, 35, 86, 0.18);
  transition: transform 0.25s var(--bounce);
}
.switch input:checked + .switch-track { background: var(--mint); border-color: var(--mint-deep); }
.switch input:checked + .switch-track::after { transform: translateX(22px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--grape); outline-offset: 2px; }

.range { -webkit-appearance: none; appearance: none; width: 100%; height: 30px; background: transparent; --fill: 50%; }
.range::-webkit-slider-runnable-track { height: 12px; border-radius: 999px; background: linear-gradient(to right, var(--grape) 0 var(--fill), var(--surface-3) var(--fill) 100%); }
.range::-moz-range-track { height: 12px; border-radius: 999px; background: var(--surface-3); }
.range::-moz-range-progress { height: 12px; border-radius: 999px; background: var(--grape); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--yellow);
  border: 4px solid #fff;
  box-shadow: 0 3px 0 var(--yellow-deep), 0 4px 10px rgba(43, 35, 86, 0.2);
}
.range::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--yellow); border: 4px solid #fff; box-shadow: 0 3px 0 var(--yellow-deep); }
.range:focus-visible { outline: none; }
.range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 5px var(--accent-soft), 0 3px 0 var(--yellow-deep); }
.range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 5px var(--accent-soft), 0 3px 0 var(--yellow-deep); }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row .range { flex: 1; }
.range-value { min-width: 70px; text-align: right; font-family: var(--font-display); font-size: 15px; color: var(--ink); }

.dropzone {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 20px;
  border: 3px dashed var(--line-strong);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease), transform 0.2s var(--bounce);
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--grape); background: var(--grape-soft); transform: scale(1.01); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone-icon { flex: none; display: grid; place-items: center; width: 50px; height: 50px; border-radius: 16px; background: #fff; color: var(--grape); box-shadow: 0 3px 0 var(--line-strong); }
.dropzone-title { font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.dropzone-meta { font-size: 13.5px; color: var(--muted); }
.dropzone.has-file { border-style: solid; border-color: var(--mint); background: var(--mint-soft); }

.segmented { display: inline-flex; padding: 4px; gap: 4px; border-radius: 16px; background: var(--surface-3); border: 2px solid var(--line); }
.segmented button, .segmented label {
  height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.segmented button:hover, .segmented label:hover { color: var(--ink); }
.segmented .is-active, .segmented input:checked + span { background: #fff; color: var(--grape-deep); box-shadow: 0 3px 0 var(--line-strong); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label { padding: 0; }
.segmented label span { display: inline-flex; align-items: center; height: 100%; padding: 0 14px; border-radius: 12px; }

/* ---------------------------------------------------------------------
   Card, badge, chip
   ------------------------------------------------------------------- */

.card { background: #fff; border: 2px solid rgba(255, 255, 255, 0.9); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-body { padding: clamp(18px, 3vw, 28px); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px clamp(18px, 3vw, 28px); border-bottom: 2px dashed var(--line); }
.card-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: var(--surface-3);
  color: var(--ink-2);
  white-space: nowrap;
}
.badge-success { color: var(--mint-deep); background: var(--mint-soft); }
.badge-warning { color: var(--orange-deep); background: var(--orange-soft); }
.badge-danger { color: var(--red-deep); background: var(--red-soft); }
.badge-info { color: var(--sky-deep); background: var(--sky-soft); }
.badge-accent { color: var(--grape-deep); background: var(--grape-soft); }
.badge-yellow { color: #8a6200; background: var(--yellow-soft); }
.badge-pink { color: var(--pink-deep); background: var(--pink-soft); }

.diff-badge {
  --diff: var(--sky);
  --diff-deep: var(--sky-deep);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--diff);
  box-shadow: 0 3px 0 var(--diff-deep);
  white-space: nowrap;
}
.diff-level { padding-left: 7px; border-left: 2px solid rgba(255, 255, 255, 0.5); letter-spacing: 0; }
.diff-easy { --diff: var(--mint); --diff-deep: var(--mint-deep); }
.diff-normal { --diff: var(--sky); --diff-deep: var(--sky-deep); }
.diff-hard { --diff: var(--orange); --diff-deep: var(--orange-deep); }
.diff-expert { --diff: var(--pink); --diff-deep: var(--pink-deep); }

.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 3px 0 var(--line);
  transition: transform 0.2s var(--bounce), background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.chip:hover { color: var(--ink); transform: translateY(-2px); }
.chip.is-active, .chip[aria-pressed="true"] { background: var(--grape); border-color: var(--grape); color: #fff; box-shadow: 0 3px 0 var(--grape-deep); }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }

/* Bintang & mahkota */
.stars { display: inline-flex; align-items: center; gap: 2px; color: var(--yellow); }
.stars .icon { filter: drop-shadow(0 2px 0 var(--yellow-deep)); }
.stars .is-empty { color: #e4def5; filter: none; }
.crowns { display: inline-flex; align-items: center; gap: 2px; color: var(--orange); }
.crowns .icon { filter: drop-shadow(0 2px 0 var(--orange-deep)); }
.crowns .is-empty { color: #e4def5; filter: none; }

/* Kartu mode permainan */
.mode-card {
  --mode: var(--grape);
  --mode-deep: var(--grape-deep);
  --mode-soft: var(--grape-soft);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  border-radius: 24px;
  background: #fff;
  border: 3px solid var(--mode-soft);
  box-shadow: 0 6px 0 var(--mode-soft), var(--shadow);
  color: var(--ink);
  text-align: left;
  transition: transform 0.25s var(--bounce), box-shadow 0.2s var(--ease);
}
.mode-card:hover { transform: translateY(-4px) rotate(-0.6deg); color: var(--ink); }
.mode-card.is-active { border-color: var(--mode); box-shadow: 0 6px 0 var(--mode-deep), var(--shadow); }
.mode-card-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 18px; background: var(--mode); color: #fff; box-shadow: 0 4px 0 var(--mode-deep); }
.mode-card h3 { font-size: 20px; }
.mode-card p { font-size: 14px; color: var(--muted); }
.mode-song { --mode: var(--pink); --mode-deep: var(--pink-deep); --mode-soft: var(--pink-soft); }
.mode-arcade { --mode: var(--sky); --mode-deep: var(--sky-deep); --mode-soft: var(--sky-soft); }
.mode-zen { --mode: var(--mint); --mode-deep: var(--mint-deep); --mode-soft: var(--mint-soft); }
.mode-rush { --mode: var(--orange); --mode-deep: var(--orange-deep); --mode-soft: var(--orange-soft); }

/* Maskot */
.mascot { display: block; width: 120px; height: auto; }
.mascot-bounce { animation: mascot-bounce 2.4s var(--ease) infinite; transform-origin: bottom center; }
@keyframes mascot-bounce {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  40% { transform: translateY(-10px) scale(0.98, 1.03); }
  60% { transform: translateY(0) scale(1.03, 0.97); }
}

/* ---------------------------------------------------------------------
   Avatar
   ------------------------------------------------------------------- */

.avatar { flex: none; display: inline-grid; place-items: center; overflow: hidden; border-radius: 50%; background: var(--surface-3); border: 3px solid #fff; box-shadow: 0 2px 0 var(--line-strong); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-initials { --avatar-hue: 260; background: hsl(var(--avatar-hue) 85% 78%); color: hsl(var(--avatar-hue) 55% 26%); font-weight: 700; font-family: var(--font-display); }

/* ---------------------------------------------------------------------
   Song card & grid
   ------------------------------------------------------------------- */

.song-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
@media (max-width: 520px) { .song-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }

.song-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 10px;
  border-radius: 26px;
  background: #fff;
  border: 2px solid #fff;
  box-shadow: 0 6px 0 var(--line), var(--shadow);
  transition: transform 0.28s var(--bounce), box-shadow 0.2s var(--ease);
}
.song-card:hover { transform: translateY(-6px) rotate(-0.8deg); box-shadow: 0 8px 0 var(--line-strong), var(--shadow-lg); }
.song-card-cover { position: relative; aspect-ratio: 1 / 1; border-radius: 20px; overflow: hidden; background: var(--surface-3); }
.song-card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease-out); }
.song-card:hover .song-card-cover img { transform: scale(1.06); }
.song-card-play {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--ink);
  border: 3px solid #fff;
  box-shadow: 0 4px 0 var(--yellow-deep);
  transition: transform 0.25s var(--bounce);
}
.song-card-play:hover { transform: scale(1.12); color: var(--ink); }
.song-card-play .icon { fill: currentColor; margin-left: 3px; }
.song-card-flags { position: absolute; left: 10px; top: 10px; z-index: 2; display: flex; gap: 6px; flex-wrap: wrap; }
.song-card-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 6px 6px; flex: 1; }
.song-card-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-card-title::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.song-card-artist { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; font-size: 13.5px; color: var(--muted); }
.song-card-diffs { display: flex; gap: 4px; }
.song-card-diffs span { width: 16px; height: 8px; border-radius: 4px; background: var(--surface-3); }
.song-card-diffs span.on-easy { background: var(--easy); }
.song-card-diffs span.on-normal { background: var(--normal); }
.song-card-diffs span.on-hard { background: var(--hard); }
.song-card-diffs span.on-expert { background: var(--expert); }
.song-card-best { font-family: var(--font-display); font-size: 14px; color: var(--grape-deep); }
@media (max-width: 520px) {
  .song-card { padding: 7px; border-radius: 20px; }
  .song-card-cover { border-radius: 15px; }
  .song-card-title { font-size: 15.5px; }
  .song-card-play { width: 42px; height: 42px; }
}

.cover-placeholder {
  --hue: 260;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.55) 0 18%, transparent 19%),
    radial-gradient(circle at 75% 70%, rgba(255, 255, 255, 0.35) 0 12%, transparent 13%),
    hsl(var(--hue) 90% 80%);
  color: hsl(var(--hue) 55% 30%);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(30px, 5vw, 48px);
}

/* ---------------------------------------------------------------------
   Tabel
   ------------------------------------------------------------------- */

.table-wrap { width: 100%; overflow-x: auto; border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow); border: 2px solid #fff; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-family: var(--font-display); font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--grape-deep); padding: 14px 16px; background: var(--surface-2); white-space: nowrap; }
.table td { padding: 13px 16px; border-top: 2px solid var(--surface-2); vertical-align: middle; }
.table tbody tr { transition: background-color 0.12s var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }
.table .col-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .col-actions { text-align: right; white-space: nowrap; }
.table .cell-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.table .cell-user a { color: var(--ink); font-family: var(--font-display); font-weight: 600; }

.rank { display: inline-grid; place-items: center; min-width: 36px; height: 36px; padding: 0 8px; border-radius: 12px; font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--ink-2); background: var(--surface-3); }
.rank-1 { color: #6b4b00; background: var(--yellow); box-shadow: 0 3px 0 var(--yellow-deep); }
.rank-2 { color: #33405c; background: #dfe6f3; box-shadow: 0 3px 0 #b8c3d8; }
.rank-3 { color: #6b3813; background: #ffc79a; box-shadow: 0 3px 0 #e59a5f; }

.grade { display: inline-grid; place-items: center; min-width: 34px; height: 30px; padding: 0 8px; border-radius: 10px; font-family: var(--font-display); font-weight: 700; font-size: 15px; background: var(--surface-3); color: var(--ink-2); }
.grade-SS, .grade-S { color: #6b4b00; background: var(--yellow); }
.grade-A { color: #fff; background: var(--mint); }
.grade-B { color: #fff; background: var(--sky); }
.grade-C { color: #fff; background: var(--orange); }
.grade-D { color: #fff; background: var(--red); }

/* ---------------------------------------------------------------------
   Paginasi, empty, loading
   ------------------------------------------------------------------- */

.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 28px; flex-wrap: wrap; }
.pagination .btn { min-width: 42px; }
.pagination .is-current { --btn-bg: var(--grape); --btn-fg: #fff; --btn-edge: var(--grape-deep); --btn-border: var(--grape); }
.pagination-info { font-size: 14px; color: var(--muted); margin: 0 6px; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: clamp(36px, 7vw, 64px) 20px;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.7);
  border: 3px dashed #fff;
}
.empty-icon { display: grid; place-items: center; width: 70px; height: 70px; margin-bottom: 6px; border-radius: 24px; background: #fff; color: var(--grape); box-shadow: 0 5px 0 var(--line-strong); }
.empty-state h2, .empty-state h3 { font-size: 22px; }
.empty-state p { max-width: 400px; color: var(--muted); }
.empty-actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; justify-content: center; }
.error-state { display: grid; place-items: center; min-height: 60vh; }
.error-state .empty-state { max-width: 520px; width: 100%; }

.spinner { display: inline-block; width: 26px; height: 26px; border-radius: 50%; border: 4px solid var(--grape-soft); border-top-color: var(--grape); animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 56px 20px; color: var(--muted); font-family: var(--font-display); font-size: 16px; }

.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: 12px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton-card { border-radius: 26px; overflow: hidden; background: #fff; padding: 10px; box-shadow: var(--shadow); }
.skeleton-card .skeleton-cover { aspect-ratio: 1 / 1; border-radius: 20px; }
.skeleton-card .skeleton-lines { padding: 12px 6px 6px; display: flex; flex-direction: column; gap: 8px; }
.skeleton-line { height: 14px; }

.progress { position: relative; height: 12px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress-bar { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: var(--mint); transition: width 0.2s var(--ease); }

.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 18px; background: var(--sky-soft); color: var(--ink-2); font-size: 15px; }
.notice .icon { margin-top: 2px; color: var(--sky-deep); }
.notice strong { color: var(--ink); }
.notice-warning { background: var(--orange-soft); }
.notice-warning .icon { color: var(--orange-deep); }
.notice-danger { background: var(--red-soft); }
.notice-danger .icon { color: var(--red-deep); }
.notice-success { background: var(--mint-soft); }
.notice-success .icon { color: var(--mint-deep); }

/* ---------------------------------------------------------------------
   Stat
   ------------------------------------------------------------------- */

.stat-card { position: relative; padding: 18px 20px; border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.stat-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--stat-color, var(--grape)); }
.stat-label { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--muted); }
.stat-label .icon { color: var(--stat-color, var(--grape)); }
.stat-value { margin-top: 8px; font-family: var(--font-display); font-size: clamp(26px, 3vw, 34px); font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-sub { margin-top: 2px; font-size: 13.5px; color: var(--muted); }

/* ---------------------------------------------------------------------
   Toast
   ------------------------------------------------------------------- */

.toast-stack { position: fixed; z-index: 1000; right: 18px; bottom: 18px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; pointer-events: none; max-width: calc(100vw - 36px); }
@media (max-width: 560px) {
  .toast-stack { left: 12px; right: 12px; bottom: 12px; align-items: stretch; max-width: none; }
  body.modal-open .toast-stack { top: 12px; bottom: auto; }
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
  max-width: 420px;
  padding: 10px 10px 10px 10px;
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 15.5px;
  color: var(--ink);
  animation: toast-in 0.4s var(--bounce);
}
.toast.is-leaving { animation: toast-out 0.2s var(--ease) forwards; }
.toast-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 12px; background: var(--sky-soft); color: var(--sky-deep); }
.toast-success .toast-icon { background: var(--mint-soft); color: var(--mint-deep); }
.toast-error .toast-icon { background: var(--red-soft); color: var(--red-deep); }
.toast-warning .toast-icon { background: var(--orange-soft); color: var(--orange-deep); }
.toast-message { flex: 1; line-height: 1.35; }
.toast-close { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); }
.toast-close:hover { background: var(--surface-3); color: var(--ink); }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.9); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(0.96); } }

/* ---------------------------------------------------------------------
   Modal
   ------------------------------------------------------------------- */

.modal-backdrop { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 16px; background: rgba(43, 35, 86, 0.42); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fade-in 0.2s var(--ease); overflow-y: auto; }
.modal-backdrop.is-leaving { animation: fade-out 0.18s var(--ease) forwards; }
.modal { position: relative; width: 100%; max-width: 500px; max-height: calc(100svh - 32px); display: flex; flex-direction: column; border-radius: var(--radius-xl); background: #fff; box-shadow: var(--shadow-lg); animation: modal-in 0.42s var(--bounce); }
.modal-backdrop.is-leaving .modal { animation: modal-out 0.18s var(--ease) forwards; }
.modal-lg { max-width: 700px; }
.modal-xl { max-width: 900px; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px 26px 0; }
.modal-title { font-size: 23px; font-weight: 650; }
.modal-subtitle { font-size: 14.5px; color: var(--muted); margin-top: 4px; }
.modal-body { padding: 18px 26px; overflow-y: auto; color: var(--ink-2); }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 26px 24px; flex-wrap: wrap; }
@media (max-width: 560px) {
  .modal-backdrop { align-items: end; padding: 0; }
  .modal { max-width: 100%; border-radius: 28px 28px 0 0; max-height: 92svh; animation: sheet-in 0.36s var(--ease-out); }
  .modal-footer .btn { flex: 1; }
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(18px) scale(0.92); } }
@keyframes modal-out { to { opacity: 0; transform: translateY(8px) scale(0.96); } }
@keyframes sheet-in { from { transform: translateY(60px); opacity: 0; } }
body.modal-open { overflow: hidden; }

.tabs { display: flex; gap: 6px; padding: 4px; border-radius: 18px; background: var(--surface-3); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 14px; border: 0; border-radius: 14px; background: transparent; color: var(--ink-2); font-family: var(--font-display); font-weight: 600; font-size: 15px; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.is-active { background: #fff; color: var(--grape-deep); box-shadow: 0 3px 0 var(--line-strong); }

/* ---------------------------------------------------------------------
   Settings modal & kalibrasi
   ------------------------------------------------------------------- */

.settings-panel { display: none; padding-top: 18px; }
.settings-panel.is-active { display: flex; flex-direction: column; gap: 20px; }
.settings-group { display: flex; flex-direction: column; gap: 10px; }
.settings-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.settings-group-title { font-family: var(--font-display); font-weight: 600; font-size: 17px; color: var(--ink); }
.settings-group-desc { font-size: 13.5px; color: var(--muted); }
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; }
.keybind-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.keybind-slot { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px 10px; border-radius: 18px; border: 2px solid var(--line); background: var(--surface-2); color: var(--muted); font-family: var(--font-display); font-size: 12px; font-weight: 600; }
.keybind-slot .kbd { min-width: 44px; height: 38px; font-size: 17px; }
.keybind-slot.is-listening { border-color: var(--grape); background: var(--grape-soft); color: var(--grape-deep); }
.keybind-slot.is-listening .kbd { animation: pulse 1s var(--ease) infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }

.speed-preview { position: relative; height: 70px; border-radius: 16px; background: var(--surface-2); border: 2px solid var(--line); overflow: hidden; }
.speed-preview i { position: absolute; top: 0; left: 0; width: 25%; height: 16px; border-radius: 5px; background: var(--ink); animation: speed-fall var(--speed-dur, 1.6s) linear infinite; }
.speed-preview i:nth-child(2) { left: 50%; animation-delay: calc(var(--speed-dur, 1.6s) * -0.5); }
@keyframes speed-fall { from { transform: translateY(-18px); } to { transform: translateY(72px); } }

.calib-stage { display: grid; place-items: center; gap: 14px; padding: 22px 12px; border-radius: 22px; background: var(--surface-2); text-align: center; }
.calib-beat { width: 110px; height: 110px; border-radius: 50%; border: 4px solid #fff; background: var(--yellow); box-shadow: 0 6px 0 var(--yellow-deep); display: grid; place-items: center; color: var(--ink); transition: transform 0.08s var(--ease); }
.calib-beat.is-flash { transform: scale(1.1); background: var(--pink); color: #fff; box-shadow: 0 6px 0 var(--pink-deep); }
.calib-result { font-family: var(--font-display); font-size: 15px; color: var(--ink-2); min-height: 22px; }

/* ---------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------- */

.site-footer { margin-top: auto; padding: 26px 0 34px; color: var(--ink-2); font-size: 14.5px; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 28px; }
.footer-brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; color: var(--ink); }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; font-family: var(--font-display); }
.footer-links a, .footer-links .link-button { color: var(--ink-2); }
.footer-links a:hover, .footer-links .link-button:hover { color: var(--grape-deep); }
.footer-note { width: 100%; font-size: 13.5px; color: var(--muted); }

/* ---------------------------------------------------------------------
   Auth
   ------------------------------------------------------------------- */

.auth-shell { display: grid; place-items: center; padding: clamp(24px, 6vw, 72px) var(--gutter); flex: 1; }
.auth-card { width: 100%; max-width: 440px; }
.auth-head { text-align: center; margin-bottom: 24px; }
.auth-head .brand-mark { margin: 0 auto 16px; transform: scale(1.5); }
.auth-head h1 { font-size: 30px; }
.auth-head p { margin-top: 8px; color: var(--muted); }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-foot { margin-top: 20px; text-align: center; color: var(--muted); font-size: 15px; }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14.5px; }

/* ---------------------------------------------------------------------
   Konfeti (dipakai hasil permainan & perayaan)
   ------------------------------------------------------------------- */

.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 3px; opacity: 0.95; animation: confetti-fall var(--dur, 2.4s) var(--delay, 0s) linear forwards; }
@keyframes confetti-fall {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); }
  100% { transform: translate3d(var(--dx, 30px), 110vh, 0) rotate(var(--rot, 540deg)); }
}

/* ---------------------------------------------------------------------
   Kontras teks (WCAG AA 4.5:1) untuk semua halaman.
   Token tinta gelap untuk teks di atas latar lembut & tombol berwarna.
   ------------------------------------------------------------------- */

:root {
  --text-sub: #5d568a;
  --grape-ink: #5536cc;
  --sky-ink: #0b69a8;
  --pink-ink: #b02a68;
  --mint-ink: #0b7453;
  --orange-ink: #9c4d05;
  --red-ink: #b0202f;
}
.mode-song { --mode-ink: var(--pink-ink); }
.mode-arcade { --mode-ink: var(--sky-ink); }
.mode-zen { --mode-ink: var(--mint-ink); }
.mode-rush { --mode-ink: var(--orange-ink); }

.muted, .song-card-artist, .field-hint, .empty-state p, .stat-label, .stat-sub, .dropzone-meta,
.switch-desc, .modal-subtitle, .pagination-info, .loading-state { color: var(--text-sub); }
.eyebrow { color: var(--grape-ink); }
.badge-success { color: var(--mint-ink); }
.badge-warning { color: var(--orange-ink); }
.badge-info { color: var(--sky-ink); }
.badge-danger { color: var(--red-ink); }
.badge-pink { color: var(--pink-ink); }
.badge-accent { color: var(--grape-ink); }
.diff-badge { color: var(--ink); }
.diff-level { border-left-color: rgba(43, 35, 86, 0.28); }
.btn-grape { --btn-bg: var(--grape-deep); --btn-edge: #4f33c4; --btn-border: var(--grape-deep); }
.btn-sky, .btn-mint, .btn-success, .btn-orange, .btn-pink { --btn-fg: var(--ink); }
.btn-danger { --btn-bg: var(--red-deep); --btn-edge: #b0202f; --btn-border: var(--red-deep); }
.chip.is-active, .chip[aria-pressed="true"] { background: var(--grape-deep); border-color: var(--grape-deep); box-shadow: 0 3px 0 #4f33c4; }
.nav-link.is-active { background: var(--grape-deep); box-shadow: 0 4px 0 #4f33c4; }
.pagination .is-current { --btn-bg: var(--grape-deep); --btn-edge: #4f33c4; --btn-border: var(--grape-deep); }

/* Target sentuh minimal 44px di perangkat sentuh (tampilan desktop tidak berubah).
   Halaman bare (game & editor) punya toolbar padat sendiri sehingga tidak disentuh di sini. */
@media (pointer: coarse) {
  .footer-links { gap: 0 20px; }
  .footer-links a, .footer-links .link-button { display: inline-flex; align-items: center; min-height: 44px; }
  .song-card-play { width: 46px; height: 46px; }
  body:not(.layout-bare) .chip { height: 44px; }
  body:not(.layout-bare) .btn-sm { height: 44px; }
  body:not(.layout-bare) .btn-icon.btn-sm { width: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
