/* ════════════════════════════════════════════════════
   DESIGN TOKENS
════════════════════════════════════════════════════ */
:root {
  --gold: #d4af37;
  --gold-dim: #8a6e1a;
  --gold-bright: #f0cc55;
  --crimson: #c0392b;
  --neon-green: #39ff14;
  --neon-blue: #00cfff;
  --neon-purple: #bc13fe;
  --neon-amber: #ffbf00;
  --neon-red: #ff4444;
  --neon-pink: #e94560;
  --deep: #04030a;
  --surface: rgba(8, 5, 20, 0.94);
  --border-gold: rgba(212, 175, 55, 0.3);
  --border-dim: rgba(212, 175, 55, 0.1);
  --text: #c0b8d0;
  --tmid: #4a3a60;
}

body.theme-light {
  --gold: #8f6a18;
  --gold-dim: #6f5a24;
  --gold-bright: #b98628;
  --crimson: #9f332d;
  --neon-green: #247345;
  --neon-blue: #276f91;
  --neon-purple: #67518f;
  --neon-amber: #a66f12;
  --neon-red: #ad3f3b;
  --neon-pink: #a84463;
  --deep: #f3eadb;
  --surface: rgba(255, 250, 239, .94);
  --border-gold: rgba(143, 106, 24, .28);
  --border-dim: rgba(143, 106, 24, .15);
  --text: #2e2638;
  --tmid: #66586d;
}

/* ════════════════════════════════════════════════════
   RESET & BASE
════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { 
  font-size: 16px; 
  height: 100%;
}

body {
  background: var(--deep);
  color: var(--text);
  font-family: 'Special Elite', cursive;
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5; /* แก้ตัวอักษรลอยด้วยการคุม line-height */
  -webkit-font-smoothing: antialiased;
}

body.theme-light::after {
  opacity: .018;
}

body.theme-light #bg-canvas {
  opacity: .05;
}

/* ════════════════════════════════════════════════════
   PARTICLE & OVERLAY
════════════════════════════════════════════════════ */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: .15;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: .035;
  z-index: 1;
  pointer-events: none;
}

/* ════════════════════════════════════════════════════
   LOGIN & AUTH OVERLAY (กึ่งกลางเป๊ะ)
════════════════════════════════════════════════════ */
#auth-overlay, #login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: radial-gradient(ellipse at 50% 40%, #0d0820 0%, #000 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-box, .login-box {
  width: 420px;
  max-width: 90vw;
  border: 1px solid var(--border-gold);
  background: rgba(10, 7, 25, .95);
  padding: 3rem 2.5rem;
  position: relative;
  text-align: center;
}

body.theme-light .auth-input,
body.theme-light .cc-select,
body.theme-light .song-note {
  background: rgba(255,255,255,.74);
  color: #32283f;
  border-color: rgba(156,116,20,.34);
}

body.theme-light .auth-input::placeholder,
body.theme-light .song-note::placeholder {
  color: #8a7c91;
}

/* มุมกล่อง */
.lc {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: var(--gold);
  border-style: solid;
}
.lc-tl { top: 8px; left: 8px; border-width: 1px 0 0 1px; }
.lc-tr { top: 8px; right: 8px; border-width: 1px 1px 0 0; }
.lc-bl { bottom: 8px; left: 8px; border-width: 0 0 1px 1px; }
.lc-br { bottom: 8px; right: 8px; border-width: 0 1px 1px 0; }

.auth-title, .login-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: 2.5rem;
  color: var(--gold);
  text-shadow: 0 0 25px rgba(212,175,55,.8);
  animation: goldPulse 3s ease-in-out infinite;
  margin-bottom: 0.5rem;
}

@keyframes goldPulse {
  0%, 100% { text-shadow: 0 0 25px rgba(212,175,55,.8); }
  50% { text-shadow: 0 0 45px rgba(212,175,55,1); }
}

.auth-subtitle, .login-sub {
  font-family: 'Cinzel', serif;
  font-size: .65rem;
  letter-spacing: .4em;
  color: var(--tmid);
  margin-bottom: 2rem;
  text-transform: uppercase;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .45rem;
  margin-bottom: 1.35rem;
  padding: 4px;
  border: 1px solid var(--border-gold);
  background: rgba(212,175,55,.05);
}

.auth-tab {
  min-height: 38px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--tmid);
  font-family: 'Cinzel', serif;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.auth-tab:hover {
  color: var(--gold);
  border-color: rgba(212,175,55,.22);
}

.auth-tab.active {
  background: linear-gradient(135deg, rgba(212,175,55,.28), rgba(212,175,55,.12));
  border-color: var(--border-gold);
  color: var(--gold);
  box-shadow: 0 0 16px rgba(212,175,55,.22);
}

body.theme-light .auth-tabs {
  background: rgba(156,116,20,.08);
}

body.theme-light .auth-tab.active {
  background: linear-gradient(135deg, rgba(156,116,20,.2), rgba(255,255,255,.58));
  color: #6f4d09;
}

/* ════════════════════════════════════════════════════
   NAV BAR (Alignment Fix)
════════════════════════════════════════════════════ */
#nav-bar {
  position: sticky;
  top: 0;
  z-index: 500;
  background: rgba(4, 3, 10, .97);
  border-bottom: 1px solid var(--border-gold);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center; /* กึ่งกลางแนวตั้ง */
  padding: 0 1.5rem;
  height: 65px;
  gap: 0.5rem;
}

body.theme-light #nav-bar {
  background: rgba(255, 251, 241, .96);
  box-shadow: 0 8px 24px rgba(88, 64, 20, .08);
}

.nav-logo {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1rem;
  color: var(--gold-dim);
  margin-right: 1.5rem;
  display: flex;
  align-items: center;
}

.nav-btn {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  color: var(--tmid);
  background: transparent;
  border: none;
  padding: 0 1rem;
  height: 100%;
  cursor: pointer;
  transition: all .25s;
  display: flex;
  align-items: center;
  position: relative;
}

.nav-btn:hover { color: var(--gold-dim); }

.nav-btn.active {
  color: var(--gold);
  background: rgba(212, 175, 55, 0.05);
}

.nav-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold);
}

.nav-spacer { flex: 1; }

.theme-toggle {
  min-width: 72px;
  height: 32px;
  border: 1px solid var(--border-gold);
  background: rgba(212, 175, 55, .08);
  color: var(--gold);
  font-family: 'Cinzel', serif;
  font-size: .62rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.theme-toggle:hover {
  background: rgba(212, 175, 55, .16);
  box-shadow: 0 0 14px rgba(212, 175, 55, .22);
}

.nav-user {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  color: var(--gold-dim);
  letter-spacing: 1px;
}

.nav-logout {
  background: transparent;
  border: 1px solid var(--neon-pink);
  color: var(--neon-pink);
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  padding: 4px 10px;
  margin-left: 1rem;
  cursor: pointer;
  transition: 0.3s;
}

.nav-logout:hover {
  background: var(--neon-pink);
  color: #000;
}

/* ════════════════════════════════════════════════════
   APP WRAPPER & PANELS
════════════════════════════════════════════════════ */
#app {
  position: relative;
  z-index: 2;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.menu-section {
  display: none;
}

.menu-section.active {
  display: block;
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel {
  background: var(--surface);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-gold);
}

body.theme-light .panel,
body.theme-light .battle-readout,
body.theme-light .battle-feedback,
body.theme-light .chord-analysis,
body.theme-light .song-stat,
body.theme-light .song-list-card,
body.theme-light .song-chart-card,
body.theme-light .auth-box,
body.theme-light .login-box {
  background: rgba(255, 251, 241, .92);
  box-shadow: 0 16px 36px rgba(93, 68, 28, .08);
}

body.theme-light #auth-overlay,
body.theme-light #login-overlay {
  background: radial-gradient(ellipse at 50% 40%, #fff9e8 0%, #e8ddc9 100%);
}

.p-inner {
  padding: 1.5rem;
  height: 100%;
}

/* ════════════════════════════════════════════════════
   BATTLE MODE (จัดกึ่งกลางตัวโน้ต)
════════════════════════════════════════════════════ */
.battle-grid {
  display: grid;
  grid-template-columns: 260px 1fr 260px;
  gap: 1.5rem;
}

.battle-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 500px;
  gap: 1rem;
}

.battle-readout {
  width: min(100%, 380px);
  border: 1px solid rgba(212,175,55,.22);
  background: rgba(7, 5, 15, .58);
  padding: 1rem;
  text-align: center;
}

.battle-readout.compact {
  width: 180px;
  min-height: 128px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.battle-meter-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: .8rem;
  flex-wrap: wrap;
  width: 100%;
}

.battle-action-row {
  display: flex;
  gap: .55rem;
  justify-content: center;
  flex-wrap: wrap;
}

.target-display {
  font-family: 'Cinzel', serif;
  font-size: clamp(3.8rem, 8vw, 6rem);
  color: var(--gold);
  line-height: 1;
  text-align: center;
  text-shadow: 0 0 30px var(--gold);
  margin: .7rem 0;
  display: block;
  text-transform: none;
}

.det-display {
  font-family: 'Cinzel', serif;
  font-size: 3.4rem;
  min-width: 100px;
  text-align: center;
  color: #f4e7ba;
  text-transform: none;
}

.det-display.matched {
  color: var(--neon-green);
  text-shadow: 0 0 14px rgba(57,255,20,.75);
}

.target-hz {
  color: var(--tmid);
  font-family: 'Cutive Mono', monospace;
  font-size: .78rem;
}

.battle-feedback {
  width: min(100%, 520px);
  min-height: 2.2rem;
  color: #d8c899;
  background: rgba(0,0,0,.24);
  border: 1px solid rgba(212,175,55,.16);
  padding: .65rem .8rem;
  text-align: center;
  line-height: 1.45;
}

.guitar-guide {
  width: min(100%, 560px);
  border: 1px solid rgba(212,175,55,.2);
  background:
    linear-gradient(90deg, rgba(95,57,26,.26), rgba(25,13,8,.48)),
    rgba(6,4,12,.7);
  padding: .9rem;
}

body.theme-light .guitar-guide {
  border-color: rgba(156,116,20,.28);
  background:
    linear-gradient(90deg, rgba(255,248,226,.96), rgba(245,232,204,.92)),
    rgba(255,251,241,.94);
}

.guitar-guide-head {
  display: flex;
  justify-content: space-between;
  gap: .8rem;
  align-items: flex-start;
  margin-bottom: .65rem;
}

body.theme-light .guitar-guide-head {
  padding: .65rem;
  background: rgba(255, 248, 226, .94);
  border: 1px solid rgba(156,116,20,.24);
}

.guitar-guide-title {
  font-family: 'Cinzel', serif;
  color: #d4af37;
  font-size: .95rem;
  letter-spacing: .08em;
}

body.theme-light .guitar-guide-title {
  display: inline-block;
  margin-top: .2rem;
  padding: .32rem .55rem;
  background: rgba(255, 248, 226, .92);
  border: 1px solid rgba(156,116,20,.24);
  color: #7c641f;
}

.guitar-guide-meta {
  max-width: 260px;
  color: #cdbf92;
  font-family: 'Cutive Mono', monospace;
  font-size: .68rem;
  line-height: 1.45;
  text-align: right;
}

body.theme-light .guitar-guide-meta {
  padding: .38rem .55rem;
  background: rgba(255, 248, 226, .92);
  border: 1px solid rgba(156,116,20,.24);
  color: #4f3a17;
}

.guitar-neck {
  position: relative;
  display: grid;
  grid-template-columns: 46px repeat(5, 1fr);
  border: 1px solid rgba(212,175,55,.26);
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.08) 0 1px, transparent 1px calc(100% / 6)),
    linear-gradient(90deg, #2a1308, #4a2411 45%, #261006);
  overflow: hidden;
}

.guitar-nut {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 46px;
  width: 6px;
  background: #e4d0a4;
  box-shadow: 0 0 12px rgba(228,208,164,.45);
  z-index: 2;
}

.guitar-fret-numbers {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 46px repeat(5, 1fr);
  color: rgba(244,231,186,.56);
  font-family: 'Cutive Mono', monospace;
  font-size: .62rem;
  min-height: 18px;
  align-items: center;
  text-align: center;
  background: rgba(0,0,0,.22);
}

.guitar-string-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 46px repeat(5, 1fr);
  min-height: 30px;
  position: relative;
}

.guitar-string-row::after {
  content: '';
  position: absolute;
  left: 46px;
  right: 0;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, rgba(238,230,205,.8), rgba(133,123,99,.7));
  box-shadow: 0 0 5px rgba(238,230,205,.25);
}

.guitar-string-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--gold);
  font-family: 'Cinzel', serif;
  font-size: .72rem;
  background: rgba(0,0,0,.24);
  z-index: 3;
}

.guitar-open-dot {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1px solid var(--neon-green);
  color: var(--neon-green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .58rem;
  box-shadow: 0 0 8px rgba(57,255,20,.35);
}

.guitar-fret-cell {
  position: relative;
  border-left: 1px solid rgba(220,196,139,.28);
  z-index: 3;
}

.guitar-finger {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 23px;
  height: 23px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--neon-green);
  color: #041006;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: .72rem;
  font-weight: 700;
  box-shadow: 0 0 14px rgba(57,255,20,.65);
}

.guitar-muted-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 23px;
  height: 23px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(255, 92, 126, .9);
  background: var(--red);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 14px rgba(255, 48, 88, .55);
}


.cents-bar-o {
  position: relative;
  height: 10px;
  margin: .8rem 0 .45rem;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(212,175,55,.18);
}

.cents-center {
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: 50%;
  width: 2px;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(212,175,55,.5);
}

.cents-needle {
  position: absolute;
  top: -5px;
  width: 3px;
  height: 18px;
  background: var(--neon-pink);
  box-shadow: 0 0 8px rgba(233,69,96,.65);
  transform: translateX(-50%);
  transition: left .08s linear;
}

/* ════════════════════════════════════════════════════
   INSTRUMENTS & FRETBOARD (Center cells)
════════════════════════════════════════════════════ */
.fretboard-wrap {
  background: #0a0712;
  border: 1px solid var(--border-gold);
  padding: 1rem;
  overflow-x: auto;
  border-radius: 4px;
}

.string {
  display: flex;
  height: 38px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
}

.fret-cell {
  flex: 1;
  min-width: 60px;
  border-right: 1px solid #2a2040;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: 'Cutive Mono', monospace;
  font-size: 0.9rem;
  transition: 0.2s;
}

.fret-cell:hover {
  background: rgba(212, 175, 55, 0.1);
  color: var(--gold);
}

/* ════════════════════════════════════════════════════
   UI ELEMENTS (Inputs & Buttons)
════════════════════════════════════════════════════ */
.auth-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-gold);
  color: var(--gold);
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  text-align: center;
  padding: 0.8rem;
  outline: none;
  letter-spacing: 0.2em;
  margin-bottom: 1.5rem;
}

.auth-input:focus {
  border-bottom-color: var(--gold);
  box-shadow: 0 8px 18px -18px rgba(212,175,55,.8);
}

.auth-error {
  margin: -.4rem 0 1rem;
  min-height: 1.35rem;
  color: var(--neon-pink);
  font-family: 'Cinzel', serif;
  font-size: .72rem;
  line-height: 1.45;
  text-align: center;
  letter-spacing: .08em;
}

.auth-error.success {
  color: var(--neon-green);
  text-shadow: 0 0 8px rgba(57,255,20,.28);
}

.auth-note {
  margin-top: 1rem;
  color: var(--tmid);
  font-size: .72rem;
  line-height: 1.5;
}

.btn, .big-btn, .auth-btn {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 0.8rem 2rem;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
}

.btn-gold, .auth-btn {
  background: var(--gold);
  color: #000;
  border: none;
  box-shadow: 0 0 15px rgba(212,175,55,.4);
}

.auth-btn {
  width: 100%;
}

.auth-btn:hover:not(:disabled) {
  background: var(--gold-bright);
  transform: translateY(-1px);
  box-shadow: 0 0 26px rgba(212,175,55,.62);
}

.auth-btn:disabled {
  opacity: .68;
  cursor: wait;
}

.btn-gold:hover {
  background: var(--gold-bright);
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(212,175,55,.6);
}

/* Labels */
.slbl {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--tmid);
  text-transform: uppercase;
  margin-bottom: 0.2rem;
  display: block;
}

.sval {
  font-family: 'IM Fell English', serif;
  font-size: 1.2rem;
  color: #c8b88a;
  margin-bottom: 1rem;
}

.acg { color: var(--neon-green); text-shadow: 0 0 8px rgba(57,255,20,.6); }
.hidden { display: none !important; }

.chord-analysis {
  border: 1px solid rgba(212,175,55,.28);
  background: rgba(10, 7, 18, .68);
  margin: .8rem auto 0;
  max-width: 420px;
  padding: .75rem;
}

.chord-analysis-title {
  color: var(--gold);
  font-family: 'Cinzel', serif;
  font-size: .95rem;
  line-height: 1.35;
}

.chord-analysis-title span {
  color: var(--neon-green);
  font-family: 'Cutive Mono', monospace;
  font-size: .78rem;
}

.chord-analysis-meta {
  color: var(--tmid);
  font-size: .7rem;
  line-height: 1.55;
}

.chord-analysis-img {
  display: block;
  max-width: 190px;
  margin: .65rem auto 0;
  border: 1px solid rgba(212,175,55,.18);
  background: #fff;
}

.chord-analysis-ai {
  border-top: 1px solid rgba(212,175,55,.16);
  margin-top: .55rem;
  padding-top: .55rem;
}

.song-result-cover {
  width: 74px;
  aspect-ratio: 1;
  object-fit: cover;
  float: left;
  margin: .1rem .7rem .35rem 0;
  border: 1px solid rgba(212,175,55,.28);
}

.song-credit {
  margin-top: .45rem;
  color: var(--tmid);
  font-family: 'Cutive Mono', monospace;
  font-size: .62rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.song-quest {
  display: grid;
  gap: .65rem;
}

#menu-battle .song-quest .section-hd {
  font-size: 1.08rem;
  line-height: 1.25;
}

#menu-battle .song-quest .auth-input {
  margin-bottom: 0;
  padding: .95rem .75rem;
  font-size: 1.16rem;
  min-height: 50px;
}

#menu-battle .song-quest .btn {
  width: 100%;
  min-height: 48px;
  padding: .85rem 1rem;
  font-size: .78rem;
}

#menu-battle .song-quest .song-credit {
  margin-top: 0;
  font-size: .7rem;
  line-height: 1.4;
  text-align: center;
}

#menu-battle .song-quest .mb-results {
  display: grid;
  gap: .55rem;
}

#menu-battle .song-quest .song-link {
  font-size: 1.08rem;
}

.song-dashboard-panel {
  margin-top: 1.2rem;
}

.song-dashboard-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

#menu-battle .song-dashboard-copy {
  color: var(--tmid);
  font-size: 1.28rem;
  line-height: 1.55;
}

#menu-battle .song-dashboard-head .section-hd {
  font-size: 1.35rem;
  letter-spacing: .14em;
}

.song-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.song-mini-list,
.song-chart {
  display: grid;
  gap: .65rem;
}

.song-saved-menu {
  max-height: calc(76px * 3 + .65rem * 2);
  overflow-y: auto;
  padding-right: .25rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(212,175,55,.55) rgba(10,7,18,.38);
}

.song-saved-menu::-webkit-scrollbar {
  width: 7px;
}

.song-saved-menu::-webkit-scrollbar-track {
  background: rgba(10,7,18,.38);
}

.song-saved-menu::-webkit-scrollbar-thumb {
  background: rgba(212,175,55,.55);
}

.song-mini-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: .65rem;
  align-items: start;
  border: 1px solid rgba(212,175,55,.18);
  background: rgba(10,7,18,.54);
  padding: .65rem;
  min-height: 76px;
}

body.theme-light .song-mini-card,
body.theme-light .song-chart-row {
  background: rgba(255,255,255,.58);
}

.song-cover {
  width: 56px;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid rgba(212,175,55,.24);
  background: rgba(212,175,55,.08);
}

.song-cover-sm {
  width: 42px;
}

.song-cover-empty {
  display: grid;
  place-items: center;
  color: var(--gold);
  font-family: 'Cinzel', serif;
}

.song-card-main {
  min-width: 0;
}

.song-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--gold);
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.song-link:hover { color: var(--neon-green); }

.song-meta,
.song-empty {
  color: var(--tmid);
  font-size: .88rem;
  line-height: 1.45;
}

.song-note {
  width: 100%;
  margin-top: .45rem;
  padding: .38rem .45rem;
  border: 1px solid rgba(212,175,55,.2);
  background: rgba(0,0,0,.18);
  color: #d8c8ed;
  font-size: .82rem;
  outline: none;
}

.song-delete {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(233,69,96,.38);
  background: transparent;
  color: var(--neon-pink);
  cursor: pointer;
}

.song-chart-row {
  display: grid;
  grid-template-columns: 30px 42px minmax(0, 1fr) 36px;
  align-items: center;
  gap: .55rem;
  border: 1px solid rgba(212,175,55,.14);
  background: rgba(10,7,18,.42);
  padding: .55rem;
}

.song-rank,
.song-count {
  color: var(--gold);
  font-family: 'Cutive Mono', monospace;
  font-size: .9rem;
}

.song-count { text-align: right; }

.song-chart-label {
  position: relative;
  color: #c8b88a;
  font-size: 1.14rem;
  font-weight: 700;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: help;
}

.song-chart-label::after {
  content: attr(data-full-name);
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 60;
  width: max-content;
  max-width: min(420px, 80vw);
  padding: .55rem .7rem;
  background: rgba(6,4,14,.96);
  border: 1px solid rgba(212,175,55,.5);
  color: #f1e6ff;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.35;
  white-space: normal;
  box-shadow: 0 12px 28px rgba(0,0,0,.45);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity .14s ease, transform .14s ease;
}

.song-chart-label:hover::after,
.song-chart-label:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

body.theme-light .song-chart-label {
  color: #5a4830;
}

.song-chart-label span {
  color: var(--tmid);
  font-size: 1.04rem;
  font-weight: 600;
}

.song-chart-track {
  height: 7px;
  margin-top: .28rem;
  background: rgba(212,175,55,.12);
  overflow: hidden;
}

.song-chart-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--neon-pink));
}

.hr { border: none; border-top: 1px solid var(--border-dim); margin: 1.2rem 0; }

/* Visualizer */
.viz-wrap {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 80px;
  margin: .7rem 0;
  width: min(100%, 420px);
  border-bottom: 1px solid rgba(212,175,55,.18);
  padding: 0 .35rem;
}

.vbar {
  width: 8px;
  background: linear-gradient(180deg, var(--gold), var(--gold-dim));
  min-height: 4px;
  transition: height 0.04s linear, opacity 0.04s linear;
}

/* ════════════════════════════════════════════════════
   RHYTHM QUEST
════════════════════════════════════════════════════ */
.rg-screen {
  background: #000;
  border: 2px solid rgba(233, 69, 96, 0.3);
  height: 300px;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
}

.rg-target-line {
  position: absolute;
  bottom: 60px;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-top: 1px solid var(--gold);
}

.rg-score-disp {
  font-family: 'Cinzel Decorative', serif;
  font-size: 2.5rem;
  color: var(--gold);
  text-align: center;
  margin-top: 1rem;
}

/* ── GUITAR FRETBOARD (GARAGEBAND STYLE) ── */
.fretboard-wrap {
  background: #0a0712;
  border: 1px solid var(--border-gold);
  border-radius: 2px;
  overflow-x: auto;
  padding: 1rem;
}

.string-row {
  display: flex;
  align-items: center;
  margin-bottom: 3px;
  position: relative;
}

.string-label {
  font-family: 'Cutive Mono', monospace;
  font-size: .75rem;
  color: #5a4a70;
  width: 25px;
  flex-shrink: 0;
  text-align: right;
  padding-right: 8px;
}

.fret-cell {
  flex: 1;
  height: 34px;
  background: linear-gradient(180deg, #1a1228 0%, #120e20 100%);
  border-right: 1px solid #2a2040;
  border-bottom: 1px solid rgba(212,175,55,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s;
  font-family: 'Cutive Mono', monospace;
  font-size: .8rem;
  color: #3a2855;
  position: relative;
}

.fret-cell:hover {
  background: rgba(212, 175, 55, .08);
  color: var(--gold);
}

/* เอฟเฟกต์เมื่ออยู่ใน Scale หรือถูกกด */
.fret-cell.fret-played {
  background: rgba(57, 255, 20, 0.15) !important;
  color: var(--neon-green) !important;
  text-shadow: 0 0 10px var(--neon-green);
  box-shadow: inset 0 0 12px rgba(57, 255, 20, 0.2);
}

.fret-cell.fret-root {
  background: rgba(212, 175, 55, 0.15) !important;
  color: var(--gold) !important;
  text-shadow: 0 0 10px var(--gold);
}

/* เส้นสายกีตาร์ (ความหนาไล่ระดับ) */
.string-line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 1;
}

.s1 .string-line { background: rgba(180,180,220,.6); height: 1px; }
.s2 .string-line { background: rgba(180,180,220,.65); height: 1px; }
.s3 .string-line { background: rgba(180,180,220,.7); height: 1.5px; }
.s4 .string-line { background: rgba(180,180,200,.75); height: 2px; }
.s5 .string-line { background: rgba(170,170,190,.8); height: 2px; }
.s6 .string-line { background: rgba(160,160,180,.85); height: 2.5px; }

.fret-cell span { position: relative; z-index: 2; }
/* ══════════════ BATTLE FEEDBACK ══════════════ */
.fret-cell.correct {
  background: rgba(57,255,20,0.25);
  box-shadow: 0 0 12px var(--neon-green);
  color: var(--neon-green);
}

.fret-cell.wrong {
  background: rgba(255,50,50,0.25);
  box-shadow: 0 0 10px red;
  color: red;
}

.target-display.small {
  font-size: 3rem;
  opacity: 0.8;
}

/* score */
.battle-score {
  text-align: center;
  margin-top: 1rem;
  font-family: 'Cinzel';
  color: var(--gold);
}
/* ════════════════════ RHYTHM QUEST (GAME) ════════════════════ */
.rg-screen {
  background: #000;
  border: 2px solid rgba(233, 69, 96, 0.3);
  height: 400px;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  display: flex;
}

.rg-lane {
  flex: 1;
  height: 100%;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
}

.rg-note {
  position: absolute;
  width: 90%;
  left: 5%;
  height: 20px;
  background: var(--gold);
  box-shadow: 0 0 15px var(--gold);
  border-radius: 4px;
  top: -20px;
}

.rg-target-line {
  position: absolute;
  bottom: 60px;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-top: 1px solid var(--gold);
  z-index: 5;
}

.rg-score-disp {
  font-family: 'Cinzel Decorative';
  font-size: 2.5rem;
  color: var(--gold);
  text-align: center;
  margin-bottom: 10px;
}

.rg-key-hint {
  display: flex;
  width: 100%;
  justify-content: space-around;
  padding: 10px 0;
  background: rgba(0,0,0,0.5);
  font-family: 'Cutive Mono';
  color: var(--gold-dim);
}

/* แสงวูบวาบเวลาถูกโน้ต */
.rg-hit-fx {
  position: absolute;
  bottom: 60px;
  width: 100%;
  height: 40px;
  background: linear-gradient(to top, var(--neon-green), transparent);
  opacity: 0;
  pointer-events: none;
}
/* ════════════════════ RHYTHM QUEST (GAME) ════════════════════ */
.rg-screen {
  background: #000;
  border: 2px solid rgba(233, 69, 96, 0.3);
  height: 400px;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  display: flex;
}

.rg-lane {
  flex: 1;
  height: 100%;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
}

.rg-note {
  position: absolute;
  width: 90%;
  left: 5%;
  height: 20px;
  background: var(--gold);
  box-shadow: 0 0 15px var(--gold);
  border-radius: 4px;
  top: -20px;
}

.rg-target-line {
  position: absolute;
  bottom: 60px;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-top: 1px solid var(--gold);
  z-index: 5;
}

.rg-score-disp {
  font-family: 'Cinzel Decorative';
  font-size: 2.5rem;
  color: var(--gold);
  text-align: center;
  margin-bottom: 10px;
}

.rg-key-hint {
  display: flex;
  width: 100%;
  justify-content: space-around;
  padding: 10px 0;
  background: rgba(0,0,0,0.5);
  font-family: 'Cutive Mono';
  color: var(--gold-dim);
}

/* แสงวูบวาบเวลาถูกโน้ต */
.rg-hit-fx {
  position: absolute;
  bottom: 60px;
  width: 100%;
  height: 40px;
  background: linear-gradient(to top, var(--neon-green), transparent);
  opacity: 0;
  pointer-events: none;
}
/* ════════ BATTLE GRID LAYOUT ════════ */
.battle-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 340px;
  gap: 1.5rem;
  align-items: start;
}

/* Panel & Inner */
.panel {
  background: var(--surface);
  border: 1px solid var(--border-gold);
  position: relative;
}
.p-inner { padding: 1.5rem; }

/* Typography (slbl = Label, sval = Value) */
.slbl {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: #9b86bd;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}
.sval {
  font-family: 'IM Fell English', serif;
  font-size: 1.1rem;
  color: #c8b88a;
  margin-bottom: 1rem;
}
.acg { color: var(--neon-green); text-shadow: 0 0 8px rgba(57,255,20,0.5); }

/* Progress Bars (bar-o = Outer, bar-f = Fill) */
.bar-o {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(212,175,55,0.2);
  height: 8px;
  overflow: hidden;
  margin: 0.4rem 0;
}
.bar-f { height: 100%; transition: width 0.5s ease; }
.bar-gold { background: linear-gradient(90deg, var(--gold-dim), var(--gold)); }
.bar-red { background: linear-gradient(90deg, #7a0000, var(--crimson)); }

/* Battle Center Elements */
.battle-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 500px;
  text-align: center;
}
.battle-quote {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  color: #b9a8d2;
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

/* Target Note */
.target-display {
  font-family: 'Cinzel', serif;
  font-size: 5.5rem;
  color: var(--gold);
  text-shadow: 0 0 25px var(--gold);
  line-height: 1;
  margin: 1rem 0;
  text-transform: none;
}

#menu-battle {
  font-family: 'Cormorant Garamond', 'IM Fell English', serif;
  font-size: 1.08rem;
  color: #d7cce8;
}

#menu-battle .section-hd,
#menu-battle .btn,
#menu-battle .auth-input,
#menu-battle .song-link,
#menu-battle .monster-name,
#menu-battle .guitar-guide-title {
  font-family: 'Cinzel', serif;
  letter-spacing: .06em;
}

#menu-battle .battle-quote,
#menu-battle .monster-lore,
#menu-battle .quest-desc,
#menu-battle .battle-feedback,
#menu-battle .battle-log,
#menu-battle .song-dashboard-copy,
#menu-battle .song-meta,
#menu-battle .chord-analysis-meta {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
}

#menu-battle .slbl {
  font-size: .78rem;
  color: #b8a6d4;
}

#menu-battle .sval {
  color: #ead9ad;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.28rem;
  font-weight: 700;
}

#menu-battle .target-display,
#menu-battle .det-display {
  font-family: 'Cinzel', serif;
  font-variant: normal;
  letter-spacing: 0;
  text-transform: none;
}

#menu-battle .monster-name,
#menu-battle .quest-title,
#menu-battle .chord-analysis-title {
  font-size: 1.08rem;
  color: #ead08a;
  text-transform: none;
}

#menu-battle .monster-lore,
#menu-battle .quest-desc,
#menu-battle .target-hz,
#menu-battle .song-dashboard-copy,
#menu-battle .song-meta,
#menu-battle .chord-analysis-meta {
  font-size: .9rem;
  color: #b9abc9;
}

#menu-battle .battle-feedback {
  font-size: 1.08rem;
  color: #efe1bd;
  background: rgba(7, 5, 15, .42);
}

#menu-battle .auth-input {
  color: #ead08a;
  letter-spacing: .08em;
  font-size: 1.08rem;
}

#menu-battle .auth-input::placeholder {
  color: #9787ab;
}

body.theme-light #menu-battle {
  color: #332a3b;
}

body.theme-light #menu-battle .panel,
body.theme-light #menu-battle .battle-readout,
body.theme-light #menu-battle .battle-feedback,
body.theme-light #menu-battle .chord-analysis,
body.theme-light #menu-battle .song-mini-card,
body.theme-light #menu-battle .song-chart-row {
  background: rgba(255, 249, 237, .9);
  border-color: rgba(143,106,24,.24);
  box-shadow: 0 12px 26px rgba(88,64,32,.07);
}

body.theme-light #menu-battle .slbl,
body.theme-light #menu-battle .battle-quote,
body.theme-light #menu-battle .battle-log,
body.theme-light #menu-battle .target-hz,
body.theme-light #menu-battle .song-dashboard-copy,
body.theme-light #menu-battle .song-meta,
body.theme-light #menu-battle .chord-analysis-meta,
body.theme-light #menu-battle .quest-desc,
body.theme-light #menu-battle .monster-lore {
  color: #65596d;
}

body.theme-light #menu-battle .sval,
body.theme-light #menu-battle .battle-feedback {
  color: #423548;
}

body.theme-light #menu-battle .target-display,
body.theme-light #menu-battle .det-display,
body.theme-light #menu-battle .monster-name,
body.theme-light #menu-battle .quest-title,
body.theme-light #menu-battle .chord-analysis-title,
body.theme-light #menu-battle .song-link {
  color: #7d5f1f;
  text-shadow: none;
}

body.theme-light #menu-battle .det-display.matched,
body.theme-light #menu-battle .acg {
  color: #247345;
  text-shadow: none;
}

body.theme-light #menu-battle .auth-input {
  background: rgba(255,255,255,.56);
  color: #423548;
}

body.theme-light #menu-battle .auth-input::placeholder {
  color: #7f7387;
}

/* Utility */
.hr { border-top: 1px solid var(--border-gold); opacity: 0.2; margin: 1.2rem 0; }
.tc { text-align: center; }
.mt-sm { margin-top: 0.8rem; }

/* ════════════════════════════════════════════════════
   CHORD CAM — AIR GUITAR STUDIO MASTER
════════════════════════════════════════════════════ */
.cc-hero { margin-bottom: 1.2rem; }
.cc-hero-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
#menu-camera {
  font-family: 'Cormorant Garamond', 'IM Fell English', serif;
}
#menu-camera .section-hd,
#menu-camera .btn,
#menu-camera .cc-select {
  font-family: 'Cinzel', serif;
}
.cc-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(1.9rem, 4vw, 3.4rem);
  color: var(--gold);
  line-height: 1.08;
  text-shadow: 0 0 28px rgba(212,175,55,.65);
  letter-spacing: 0;
}
.cc-copy {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 600;
  color: #7b6a92;
  margin-top: .8rem;
  font-size: 1.08rem;
  line-height: 1.6;
  max-width: 760px;
}
.cc-action-tips {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
  margin-top: .8rem;
}
.cc-tip-label {
  font-family: 'Cinzel', serif;
  font-size: .6rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #7b6a92;
}
.cc-tip-word {
  position: relative;
  border: 1px solid rgba(212,175,55,.32);
  background: rgba(212,175,55,.07);
  color: var(--gold);
  padding: .36rem .52rem;
  font-family: 'Mali', 'Noto Serif Thai', serif;
  font-size: .78rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  outline: none;
}
.cc-tip-word::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  z-index: 40;
  width: min(280px, 76vw);
  padding: .65rem .75rem;
  background: rgba(6,4,14,.96);
  border: 1px solid rgba(212,175,55,.5);
  color: #e8d8ff;
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.55;
  text-align: left;
  box-shadow: 0 14px 36px rgba(0,0,0,.45);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -4px);
  transition: opacity .16s ease, transform .16s ease;
}
.cc-tip-word:hover::after,
.cc-tip-word:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}
.cc-controls { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.cc-mode-switch {
  display: inline-flex;
  min-height: 40px;
  padding: 3px;
  background: rgba(6,4,14,.78);
  border: 1px solid var(--border-gold);
}
.cc-mode-btn {
  border: 0;
  padding: .55rem .72rem;
  background: transparent;
  color: #77668f;
  font-family: 'Cinzel', serif;
  font-size: .62rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .18s ease, background .18s ease, box-shadow .18s ease;
}
.cc-mode-btn.active {
  background: linear-gradient(135deg, rgba(212,175,55,.24), rgba(233,69,96,.16));
  color: var(--gold);
  box-shadow: inset 0 0 14px rgba(212,175,55,.16);
}
.cc-controls .btn {
  min-height: 40px;
  font-size: .64rem;
  letter-spacing: .08em;
}
.cc-controls .btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.cc-controls .btn:not(.btn-gold):not(.btn-red) {
  background: rgba(212,175,55,.08);
  border: 1px solid var(--border-gold);
  color: var(--gold);
}
.cc-controls .btn-red {
  background: transparent;
  border: 1px solid rgba(233,69,96,.45);
  color: var(--neon-pink);
}
.cc-controls .btn-red:hover,
.cc-controls .btn:not(.btn-gold):not(.btn-red):hover {
  background: rgba(212,175,55,.12);
  transform: translateY(-1px);
}
.cc-select {
  background: #0a0712;
  color: var(--gold);
  border: 1px solid var(--border-gold);
  padding: .65rem .8rem;
  font-family: 'Cinzel', serif;
  font-size: .65rem;
  letter-spacing: .08em;
  outline: none;
  min-height: 40px;
}
.cc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.2rem; }
.cc-camera-panel { min-height: 650px; }
.cc-camera-inner { padding: .8rem; }
.cc-camera-stage {
  height: 630px;
  position: relative;
  background: #000;
  border: 1px solid var(--border-gold);
  overflow: hidden;
}
#cc-video, #cc-overlay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#cc-video { transform: scaleX(-1); opacity: .82; transition: opacity .42s ease, filter .42s ease; }
#cc-overlay { z-index: 3; pointer-events: auto; touch-action: none; }
.cc-camera-stage.cc-dance-mode #cc-video {
  opacity: .72;
  filter: brightness(.82) contrast(1.08);
}
.cc-zone-tag {
  position: absolute;
  top: 14px;
  z-index: 5;
  border: 1px solid var(--border-gold);
  background: rgba(4,3,10,.72);
  font-family: 'Cinzel', serif;
  font-size: .6rem;
  letter-spacing: .08em;
  color: var(--gold);
  padding: .45rem .7rem;
  text-transform: uppercase;
}
.cc-zone-chord { left: 14px; }
.cc-zone-strum { right: 14px; color: var(--neon-blue); border-color: rgba(0,207,255,.35); }
.cc-screen-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: linear-gradient(transparent, rgba(212,175,55,.4), transparent);
  z-index: 4;
}
.cc-strum-band {
  position: absolute;
  left: 54%;
  right: 5%;
  top: 50%;
  height: 64px;
  transform: translateY(-50%);
  background: rgba(255,191,0,.06);
  border-top: 2px dashed rgba(255,191,0,.75);
  border-bottom: 2px dashed rgba(255,191,0,.75);
  z-index: 4;
  box-shadow: 0 0 20px rgba(255,191,0,.12);
}
.cc-guitar-neck {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 32px;
  height: 112px;
  z-index: 4;
  background: #0a0712;
  border: 1px solid var(--border-gold);
  box-shadow: 0 0 28px rgba(212,175,55,.12);
  overflow: hidden;
}
.cc-string {
  position: absolute;
  left: 28px;
  right: 28px;
  height: 1px;
  background: rgba(180,180,220,.7);
  box-shadow: 0 0 12px rgba(180,180,220,.35);
}
.cc-string:nth-child(1) { top: 18px; }
.cc-string:nth-child(2) { top: 33px; }
.cc-string:nth-child(3) { top: 48px; height: 1.5px; }
.cc-string:nth-child(4) { top: 63px; height: 2px; }
.cc-string:nth-child(5) { top: 78px; height: 2px; }
.cc-string:nth-child(6) { top: 93px; height: 2.5px; }
.cc-camera-stage::after {
  content: 'Keyboard: 1 C · 2 G · 3 Dm · 4 Am · 5 Em · 6 F';
  position: absolute;
  left: 16px;
  bottom: 14px;
  z-index: 8;
  font: 600 .62rem Cinzel, serif;
  letter-spacing: .08em;
  color: rgba(212,175,55,.62);
  background: rgba(4,3,10,.55);
  border: 1px solid rgba(212,175,55,.16);
  padding: .35rem .55rem;
  backdrop-filter: blur(6px);
}
.cc-current-chord {
  font-family: 'Cinzel', serif;
  font-size: 5rem;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(212,175,55,1), 0 0 50px rgba(212,175,55,.5);
  animation: goldPulse 3s ease-in-out infinite;
  text-transform: none;
}
.cc-chord-hint {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 600;
  color: #8a78a2;
  margin-top: .5rem;
  font-size: 1.08rem;
}
.cc-stat-label {
  font-family: 'Cinzel', serif;
  font-size: .6rem;
  letter-spacing: .12em;
  color: #5e4a76;
  text-transform: uppercase;
  margin-bottom: .2rem;
}
.cc-stat-val {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 1.08rem;
  color: #c8b88a;
  margin-bottom: 1rem;
  line-height: 1.3;
}
.cc-stat-val.cc-neon {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.45rem;
  color: var(--neon-green);
  text-shadow: 0 0 12px rgba(57,255,20,.65);
}
.cc-pill-row, .cc-chord-map { display: flex; flex-wrap: wrap; gap: .45rem; }
.cc-pill {
  font-family: 'Cinzel', serif;
  font-size: .55rem;
  letter-spacing: .08em;
  padding: .28rem .55rem;
  border: 1px solid var(--border-dim);
  color: #6a5590;
  text-transform: none;
}
.cc-pill.on { color: #050310; background: var(--gold); border-color: var(--gold); box-shadow: 0 0 15px rgba(212,175,55,.35); }
.cc-pill.blue { color: #001014; background: var(--neon-blue); border-color: var(--neon-blue); box-shadow: 0 0 12px rgba(0,207,255,.45); }
.cc-pill.red { color: #120000; background: var(--neon-red); border-color: var(--neon-red); box-shadow: 0 0 14px rgba(255,68,68,.5); }
.cc-tips {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.6;
  color: #8a78a2;
}
.cc-tips strong { color: var(--gold); }
.cc-toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(16px);
  z-index: 999;
  opacity: 0;
  padding: .75rem 1rem;
  background: rgba(4,3,10,.82);
  border: 1px solid var(--border-gold);
  font-family: 'Cinzel', serif;
  font-size: .7rem;
  color: var(--gold);
  letter-spacing: .08em;
  transition: .2s;
  pointer-events: none;
}
.cc-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.cc-dance-avatar {
  position: absolute;
  left: var(--dance-x, 50%);
  top: 50%;
  z-index: 2;
  width: min(30%, 285px);
  max-height: 68%;
  object-fit: contain;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(.92);
  opacity: 0;
  filter: drop-shadow(0 0 18px rgba(0,0,0,.75)) drop-shadow(0 0 18px rgba(212,175,55,.25));
}
.cc-dance-left { --dance-x: 25%; --dance-tilt: -7deg; }
.cc-dance-center { --dance-x: 50%; --dance-tilt: 0deg; }
.cc-dance-right { --dance-x: 75%; --dance-tilt: 7deg; }
.cc-rainbow-spotlights {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  animation: ccLightsIn .45s ease-out forwards;
}
.cc-rainbow-spotlights span {
  position: absolute;
  top: -18%;
  left: 50%;
  width: 24%;
  height: 138%;
  transform-origin: 50% 0%;
  clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%);
  filter: blur(10px);
  opacity: .58;
  animation: ccRainbowSweep 3.2s ease-in-out infinite alternate;
}
.cc-rainbow-spotlights span:nth-child(1) { background: linear-gradient(rgba(255,40,100,.78), transparent 82%); transform: translateX(-50%) rotate(-32deg); animation-delay: -.4s; }
.cc-rainbow-spotlights span:nth-child(2) { background: linear-gradient(rgba(255,210,30,.76), transparent 82%); transform: translateX(-50%) rotate(-15deg); animation-delay: -.9s; }
.cc-rainbow-spotlights span:nth-child(3) { background: linear-gradient(rgba(57,255,20,.66), transparent 82%); transform: translateX(-50%) rotate(0deg); animation-delay: -1.3s; }
.cc-rainbow-spotlights span:nth-child(4) { background: linear-gradient(rgba(0,207,255,.72), transparent 82%); transform: translateX(-50%) rotate(16deg); animation-delay: -.2s; }
.cc-rainbow-spotlights span:nth-child(5) { background: linear-gradient(rgba(188,19,254,.76), transparent 82%); transform: translateX(-50%) rotate(32deg); animation-delay: -1.7s; }
.cc-lights-exit {
  animation: ccLightsOut .35s ease-in forwards;
}
.cc-dance-enter {
  animation: ccDanceEnter .48s cubic-bezier(.2,.8,.22,1) forwards;
}
.cc-dance-exit {
  animation: ccDanceExit .38s ease-in forwards;
}
.cc-domain-flash::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 10;
  background:
    radial-gradient(circle at 50% 45%, rgba(0,0,0,.88), rgba(0,0,0,.36) 38%, transparent 68%),
    radial-gradient(circle at 50% 50%, rgba(145,0,0,.35), transparent 56%);
  animation: ccDomainFlash 1.05s ease-out forwards;
  pointer-events: none;
}
.cc-cp52-hit::after {
  content: 'cp52';
  position: absolute;
  inset: 0;
  z-index: 11;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: clamp(.5rem, 1.6vh, 1rem);
  background:
    radial-gradient(circle at 50% 42%, rgba(105,0,30,.78), rgba(73,0,24,.62) 38%, rgba(35,0,12,.42) 72%),
    linear-gradient(135deg, rgba(118,0,30,.54), rgba(35,0,15,.32));
  color: #ffe8ec;
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(4.2rem, 11vw, 8.4rem);
  line-height: 1;
  text-transform: uppercase;
  text-shadow:
    0 0 16px rgba(255,210,220,.85),
    0 0 42px rgba(120,0,34,.95),
    0 10px 0 rgba(0,0,0,.55);
  letter-spacing: 0;
  animation: ccCp52Glow 3.8s ease-in-out infinite alternate;
  pointer-events: none;
}
.cc-cp52-intro {
  position: absolute;
  left: clamp(.8rem, 4vw, 2rem);
  right: clamp(.8rem, 4vw, 2rem);
  top: clamp(5.3rem, 15vh, 8.2rem);
  bottom: clamp(.8rem, 3vh, 1.5rem);
  z-index: 12;
  display: block;
  overflow: hidden;
  padding: clamp(.75rem, 2vw, 1.35rem);
  color: #fff3f6;
  font-family: 'Mali', 'Noto Serif Thai', serif;
  font-size: clamp(1.05rem, 2.35vw, 1.85rem);
  font-weight: 700;
  line-height: 1.62;
  text-align: center;
  text-shadow:
    0 0 10px rgba(255,230,236,.78),
    0 0 24px rgba(115,0,28,.9),
    0 2px 10px rgba(0,0,0,.9),
    0 4px 18px rgba(0,0,0,.88);
  white-space: pre-wrap;
  pointer-events: none;
  scrollbar-width: none;
  mask-image: linear-gradient(to bottom, transparent 0, #000 5%, #000 92%, transparent 100%);
}
.cc-cp52-intro::-webkit-scrollbar { display: none; }
.cc-cp52-intro::after {
  content: '';
  display: inline-block;
  width: .08em;
  height: 1em;
  margin-left: .08em;
  background: #ffe8ec;
  box-shadow: 0 0 12px rgba(255,232,236,.9);
  animation: ccCp52Caret .75s steps(2, start) infinite;
  vertical-align: -.12em;
}
.cc-smoke-layer {
  position: absolute;
  inset: 0;
  z-index: 9;
  overflow: hidden;
  pointer-events: none;
}
.cc-smoke-puff {
  position: absolute;
  width: var(--smoke-size, 140px);
  height: var(--smoke-size, 140px);
  margin-left: calc(var(--smoke-size, 140px) * -.5);
  margin-top: calc(var(--smoke-size, 140px) * -.5);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255,56,170,.92) 0%, rgba(233,69,160,.62) 34%, rgba(255,152,214,.28) 62%, transparent 72%);
  filter: blur(9px);
  mix-blend-mode: screen;
  opacity: 0;
  animation: ccSmokePuff var(--smoke-duration, 1500ms) ease-out var(--smoke-delay, 0ms) forwards;
}

@keyframes ccDanceEnter {
  0% { opacity: 0; transform: translate(-50%, -45%) scale(.62) rotate(calc(var(--dance-tilt, 0deg) - 8deg)); }
  70% { opacity: 1; transform: translate(-50%, -50%) scale(1.08) rotate(calc(var(--dance-tilt, 0deg) + 3deg)); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(var(--dance-tilt, 0deg)); }
}

@keyframes ccDanceExit {
  to { opacity: 0; transform: translate(-50%, -47%) scale(.72) rotate(calc(var(--dance-tilt, 0deg) + 8deg)); }
}

@keyframes ccLightsIn {
  to { opacity: 1; }
}

@keyframes ccLightsOut {
  to { opacity: 0; }
}

@keyframes ccRainbowSweep {
  0% { translate: -8% 0; scale: .88 1; opacity: .38; }
  50% { opacity: .72; }
  100% { translate: 8% 0; scale: 1.08 1; opacity: .54; }
}

@keyframes ccDomainFlash {
  0% { opacity: 0; transform: scale(1.1); }
  18% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.04); }
}

@keyframes ccCp52Glow {
  from { opacity: .88; filter: saturate(1.25); }
  to { opacity: 1; filter: saturate(1.8); }
}

@keyframes ccCp52Caret {
  50% { opacity: 0; }
}

@keyframes ccSmokePuff {
  0% {
    opacity: 0;
    transform: translate3d(0, 80px, 0) scale(.35) rotate(0deg);
  }
  18% {
    opacity: .95;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--smoke-x, 0px), var(--smoke-y, -220px), 0) scale(1.35) rotate(42deg);
  }
}
.cc-dog-drop {
  position: absolute;
  top: 0;
  z-index: 7;
  height: auto;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 0 12px rgba(255,191,0,.35));
  transform-origin: 50% 50%;
  opacity: 0;
  animation: ccDogWiggle var(--dog-duration, 10000ms) ease-in-out var(--dog-delay, 0ms) forwards;
  will-change: transform, opacity;
}
.cc-dog-green { filter: hue-rotate(82deg) saturate(1.8) drop-shadow(0 0 13px rgba(57,255,20,.42)); }
.cc-dog-yellow { filter: hue-rotate(22deg) saturate(1.9) brightness(1.18) drop-shadow(0 0 13px rgba(255,191,0,.42)); }
.cc-dog-blue { filter: hue-rotate(185deg) saturate(1.8) brightness(1.08) drop-shadow(0 0 13px rgba(0,207,255,.42)); }
.cc-dog-pink { filter: hue-rotate(300deg) saturate(1.9) brightness(1.12) drop-shadow(0 0 13px rgba(233,69,96,.42)); }
.cc-dog-red { filter: hue-rotate(330deg) saturate(2) brightness(1.02) drop-shadow(0 0 13px rgba(255,68,68,.44)); }
.cc-dog-exit {
  animation: ccDogExit .28s ease-in forwards;
}

@keyframes ccDogWiggle {
  0% {
    opacity: 0;
    transform: translate3d(0, -110px, 0) rotate(0deg) scale(calc(var(--dog-scale, 1) * .74));
  }
  8% {
    opacity: 1;
    transform: translate3d(10px, var(--dog-y, 180px), 0) rotate(var(--dog-wobble, 26deg)) scale(var(--dog-scale, 1));
  }
  16% {
    transform: translate3d(-14px, calc(var(--dog-y, 180px) - var(--dog-hop, 42px)), 0) rotate(calc(var(--dog-wobble, 26deg) * -1)) scale(calc(var(--dog-scale, 1) * 1.06));
  }
  27% {
    transform: translate3d(18px, calc(var(--dog-y, 180px) + 16px), 0) rotate(calc(var(--dog-spin, 28deg) * 1.7)) scale(calc(var(--dog-scale, 1) * .96));
  }
  40% {
    transform: translate3d(calc(var(--dog-drift, 0px) * .35), calc(var(--dog-y, 180px) - 22px), 0) rotate(calc(var(--dog-wobble, 26deg) * -1.35)) scale(calc(var(--dog-scale, 1) * 1.08));
  }
  55% {
    transform: translate3d(calc(var(--dog-drift, 0px) * -.25), calc(var(--dog-y, 180px) + 20px), 0) rotate(calc(var(--dog-spin, 28deg) * -1.5)) scale(var(--dog-scale, 1));
  }
  70% {
    opacity: 1;
    transform: translate3d(calc(var(--dog-drift, 0px) * .55), calc(var(--dog-y, 180px) - var(--dog-hop, 42px)), 0) rotate(calc(var(--dog-wobble, 26deg) * 1.45)) scale(calc(var(--dog-scale, 1) * 1.05));
  }
  88% {
    opacity: 1;
    transform: translate3d(calc(var(--dog-drift, 0px) * -.15), calc(var(--dog-y, 180px) + 18px), 0) rotate(calc(var(--dog-spin, 28deg) * 1.4)) scale(calc(var(--dog-scale, 1) * .98));
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--dog-drift, 0px), calc(var(--dog-y, 180px) + 56px), 0) rotate(calc(var(--dog-spin, 28deg) * 2)) scale(calc(var(--dog-scale, 1) * .8));
  }
}

@keyframes ccDogExit {
  to {
    opacity: 0;
    transform: translate3d(0, 34px, 0) rotate(18deg) scale(.72);
  }
}

@media (max-width: 980px) {
  #nav-bar {
    position: sticky;
    height: auto;
    min-height: 64px;
    flex-wrap: wrap;
    align-content: center;
    padding: .65rem .75rem;
    gap: .45rem;
  }

  .nav-logo {
    width: 100%;
    margin: 0 0 .2rem;
    justify-content: center;
  }

  .nav-btn {
    height: 38px;
    flex: 1 1 120px;
    justify-content: center;
    padding: 0 .7rem;
    border: 1px solid rgba(212,175,55,.12);
  }

  .nav-btn.active::after {
    left: 8px;
    right: 8px;
  }

  .nav-spacer {
    display: none;
  }

  .theme-toggle,
  .nav-logout {
    flex: 1 1 92px;
    height: 36px;
  }

  .nav-user {
    flex: 1 1 100%;
    order: 9;
    text-align: center;
  }

  #app {
    padding: 1rem .75rem 2rem;
  }

  .battle-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .battle-grid > aside:first-child {
    order: 2;
  }

  .battle-grid > section {
    order: 1;
  }

  .battle-grid > aside:last-child {
    order: 3;
  }

  .battle-center {
    min-height: auto;
  }

  .song-dashboard-panel {
    margin-top: 1rem;
  }

  .song-dashboard-grid { grid-template-columns: 1fr; }
  .cc-grid { grid-template-columns: 1fr; }
  .cc-status-panel { order: -1; }
  .cc-camera-stage { height: 68vh; min-height: 420px; }
  .cc-controls { justify-content: flex-start; }
}

@media (max-width: 560px) {
  html {
    font-size: 15px;
  }

  .auth-box,
  .login-box {
    width: min(92vw, 390px);
    padding: 2rem 1.2rem;
  }

  .auth-title,
  .login-title {
    font-size: 2rem;
  }

  .auth-subtitle,
  .login-sub {
    letter-spacing: .22em;
  }

  .auth-input {
    font-size: 1rem;
    letter-spacing: .12em;
  }

  .p-inner {
    padding: 1rem;
  }

  .panel {
    width: 100%;
  }

  .battle-grid > aside:first-child .p-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: .9rem;
    align-items: start;
  }

  .battle-grid > aside:first-child .level-ring,
  .battle-grid > aside:first-child .pip-row,
  .battle-grid > aside:first-child .rune-row {
    grid-column: 1 / -1;
  }

  .battle-grid > aside:first-child .hr {
    grid-column: 1 / -1;
    width: 100%;
  }

  .monster-row {
    align-items: flex-start;
    gap: .75rem;
  }

  .monster-icon {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
  }

  .monster-name {
    font-size: 1.05rem;
  }

  .target-display {
    font-size: clamp(3rem, 22vw, 4.6rem);
    margin: .4rem 0;
  }

  .target-hz {
    overflow-wrap: anywhere;
  }

  .battle-readout {
    width: 100%;
    padding: .85rem;
  }

  .battle-readout.compact {
    width: 100%;
    min-height: 104px;
  }

  .battle-meter-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: .65rem;
  }

  .battle-action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .battle-action-row .btn {
    width: 100%;
    min-height: 42px;
    padding: .7rem .45rem;
    letter-spacing: .08em;
    font-size: .62rem;
  }

  .guitar-guide {
    width: 100%;
    padding: .7rem;
    overflow-x: auto;
  }

  .guitar-guide-head {
    display: grid;
    gap: .55rem;
  }

  .guitar-guide-meta {
    max-width: none;
    text-align: left;
    overflow-wrap: anywhere;
  }

  .guitar-neck {
    min-width: 520px;
  }

  .viz-wrap {
    width: 100%;
    min-height: 50px;
  }

  .combat-log,
  .battle-log-wrap {
    width: 100%;
  }

  .song-dashboard-head { align-items: stretch; }
  .song-dashboard-head .btn { width: 100%; }
  .song-mini-card { grid-template-columns: 48px minmax(0, 1fr) auto; }
  .song-cover { width: 48px; }
  .song-chart-row { grid-template-columns: 28px 36px minmax(0, 1fr) 32px; }
  .song-cover-sm { width: 36px; }
  .song-dashboard-panel {
    margin-inline: 0;
  }
  .cc-controls, .cc-controls .btn, .cc-select { width: 100%; }
  .cc-hero-inner {
    display: grid;
  }
  .cc-title {
    font-size: 2rem;
  }
  .cc-camera-panel {
    min-height: auto;
  }
  .cc-camera-stage {
    height: 58vh;
    min-height: 320px;
  }
  .cc-zone-tag { font-size: .5rem; letter-spacing: .04em; padding: .35rem .45rem; }
  .cc-camera-stage::after { right: 16px; font-size: .52rem; }
}

@media (max-width: 390px) {
  .battle-action-row {
    grid-template-columns: 1fr;
  }

  .nav-btn,
  .theme-toggle,
  .nav-logout {
    flex-basis: 100%;
  }

  .guitar-neck {
    min-width: 480px;
  }
}
