:root {
  --ink: #eef3ef;
  --mute: #9bb0a2;
  --gold: #d4b56a;
  --jade: #3f8f6e;
  --panel: rgba(8, 18, 15, 0.78);
  --line: rgba(212, 181, 106, 0.28);
  --font-display: "Cormorant Garamond", "Noto Serif TC", serif;
  --font-body: "Noto Sans TC", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #050807;
  color: var(--ink);
  font-family: var(--font-body);
}

a {
  color: var(--gold);
}

.lobby {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.lobby .bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% 20%, rgba(63, 143, 110, 0.28), transparent 60%),
    linear-gradient(180deg, #0b1412, #050807);
  z-index: 0;
}

.card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 1.6rem 1.4rem 1.4rem;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.28em;
  font-size: 0.72rem;
  color: var(--gold);
}

.card h1 {
  margin: 0.35rem 0 0;
  font-family: var(--font-display);
  font-size: 2.4rem;
  letter-spacing: 0.12em;
}

.lead {
  margin: 0.45rem 0 1.2rem;
  color: var(--mute);
  font-size: 0.92rem;
}

.field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  font-size: 0.82rem;
  color: var(--mute);
}

.field input,
.panel input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--ink);
  padding: 0.7rem 0.85rem;
  font: inherit;
}

.actions {
  display: grid;
  gap: 0.55rem;
  margin-top: 1rem;
}

button,
.actions button {
  border: 0;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font: inherit;
  cursor: pointer;
}

.primary {
  background: linear-gradient(180deg, #4a9a78, #2f6d54);
  color: #f4fff8;
  font-weight: 700;
}

.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line) !important;
}

.hint {
  margin: 1rem 0 0;
  color: var(--mute);
  font-size: 0.8rem;
  line-height: 1.55;
}

.hint.dim,
.mini.dim {
  opacity: 0.7;
}

/* —— room —— */
.room {
  overflow: hidden;
  height: 100dvh;
  width: 100%;
  touch-action: none;
}

#gl,
#css3d {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* WebGL 在下、CSS3D 螢幕在上（才能看到 YouTube） */
#gl {
  z-index: 1;
  background: #101a16;
}

#css3d {
  z-index: 2;
  pointer-events: none;
}

#css3d iframe {
  border: 0;
  width: 960px;
  height: 540px;
  background: #000;
  pointer-events: none;
}

.crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  z-index: 4;
  pointer-events: none;
  opacity: 0.5;
}

.hud-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.9rem 1rem;
  pointer-events: none;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.85);
}

.room-code {
  margin: 0.2rem 0 0;
  font-size: 0.95rem;
}

.who {
  margin: 0;
  color: var(--mute);
  font-size: 0.85rem;
}

.hud-hint {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%);
  z-index: 5;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: var(--mute);
  font-size: 0.78rem;
  pointer-events: none;
}

.final-banner {
  position: fixed;
  top: 3.4rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  max-width: min(640px, 92vw);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(212, 181, 106, 0.45);
  background: rgba(40, 28, 8, 0.72);
  color: var(--gold);
  font-size: 0.8rem;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
}

.panel {
  position: fixed;
  right: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
  width: min(300px, 42vw);
  max-height: min(78dvh, 640px);
  overflow: auto;
  padding: 0.95rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(14px);
}

.panel h2 {
  margin: 0 0 0.6rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.08em;
}

#songForm {
  display: grid;
  gap: 0.45rem;
}

#songForm button,
.panel-actions button {
  background: #2f6d54;
  color: #fff;
}

.now-box {
  margin: 0.75rem 0 0.5rem;
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
}

.mini {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--gold);
  text-transform: uppercase;
}

#nowTitle {
  margin: 0.25rem 0 0;
  font-size: 0.92rem;
}

.qlist,
.plist {
  margin: 0.35rem 0 0.65rem;
  padding: 0 0 0 1.1rem;
  max-height: 7.5rem;
  overflow: auto;
  font-size: 0.82rem;
  color: var(--mute);
}

.plist {
  list-style: disc;
  max-height: 5.5rem;
}

.panel-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.vol-box {
  margin: 0.55rem 0 0.35rem;
  padding: 0.5rem 0.55rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  display: grid;
  gap: 0.4rem;
}

.vol-row {
  display: grid;
  grid-template-columns: 2.4rem 1fr 2rem;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--mute);
}

.vol-row input[type="range"] {
  width: 100%;
  accent-color: #d4b56a;
  cursor: pointer;
}

.vol-val {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  font-size: 0.72rem;
}

.vol-note {
  margin: 0;
  font-size: 0.68rem;
  color: var(--mute);
  opacity: 0.85;
  line-height: 1.35;
}

.vol-row input[type="range"]:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.voice-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.panel-actions button {
  padding: 0.45rem 0.2rem;
  font-size: 0.78rem;
}

@media (max-width: 720px) {
  .panel {
    right: 0;
    left: 0;
    top: auto;
    bottom: 0;
    transform: none;
    width: 100%;
    max-height: 42dvh;
    border-radius: 16px 16px 0 0;
  }
}
