:root {
  --bg: #10172A;
  --panel: rgba(12, 18, 34, 0.94);
  --field: #0A0F1E;
  --line: rgba(238, 241, 247, 0.14);
  --line-strong: rgba(238, 241, 247, 0.32);
  --text: #EEF1F7;
  --muted: #AEB6C8;
  --accent: #FFD23F;
  --accent-ink: #10172A;
  --danger: #FFA3A3;
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: 'Atkinson Hyperlegible', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  touch-action: none;
  cursor: grab;
}
#scene:active { cursor: grabbing; }

#panel {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 352px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 20px 18px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.panel-head h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: 40px;
  line-height: 0.95;
}
.panel-head .sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

#panelBody {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
#panel.collapsed #panelBody { display: none; }

button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ghost {
  flex-shrink: 0;
  min-height: 40px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
}
.ghost:hover { color: var(--text); border-color: var(--line-strong); }

.finder .fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.finder label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}
.finder input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--display);
  font-weight: 700;
  font-size: 24px;
  line-height: 1;
}
.finder input::placeholder { color: #5E6780; }

.error {
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 14px;
  line-height: 1.4;
}

.primary {
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
}
.primary:hover { filter: brightness(1.05); }

.seat-btn {
  width: 100%;
  min-height: 46px;
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
}
.seat-btn:hover { background: rgba(255, 210, 63, 0.08); }

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}
.card h2 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 36px;
  line-height: 1;
}
.card .mine {
  margin: -2px 0 10px;
  color: var(--accent);
  font-size: 15px;
}
.card dl {
  margin: 0;
  display: grid;
  gap: 6px;
  font-size: 15px;
  line-height: 1.35;
}
.card dl > div {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
}
.card dt { color: var(--muted); }
.card dd { margin: 0; }

.views {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.views button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field);
  font-size: 14px;
}
.views button[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.toggles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
}

/* tab jenis tiket */
.tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.tabs button {
  min-height: 44px;
  border: 0;
  background: var(--field);
  color: var(--muted);
  font-size: 15px;
}
.tabs button + button { border-left: 1px solid var(--line); }
.tabs button[aria-selected="true"] { background: rgba(255, 210, 63, 0.12); color: var(--accent); font-weight: 700; }
.finder[hidden], .fest-form[hidden] { display: none; }

.fest-form { display: flex; flex-direction: column; gap: 10px; }
.mini-title { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.grid3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.grid3 button {
  min-height: 42px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--field);
  font-size: 13px;
  line-height: 1.2;
}
.grid3 button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.fest-form .hint { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }

.card .warn-line {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 210, 63, 0.1);
  color: var(--accent);
  font-size: 14px;
  line-height: 1.4;
}
.card .lead { margin: 0; font-size: 15px; line-height: 1.5; color: var(--muted); }
.card .lead strong { color: var(--text); }
.card .povgo { margin-top: 14px; }

.actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.music-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 46px;
  font-size: 15px;
  color: var(--text);
}
.music-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }

.card .hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 15px;
  cursor: pointer;
}
.toggle input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
}

.legend h2 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 24px;
}
.legend ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
}
.legend li {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 10px;
}
.sw {
  width: 18px;
  height: 18px;
  border-radius: 4px;
}
.price {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.fine {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

#tooltip {
  position: fixed;
  z-index: 5;
  pointer-events: none;
  transform: translate(14px, 14px);
  max-width: 240px;
  padding: 8px 10px;
  background: rgba(10, 15, 30, 0.95);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.4;
}
#tooltip strong {
  font-family: var(--display);
  font-weight: 700;
  font-size: 19px;
}

/* Pratinjau "dari kursi": kotak transparan, isinya digambar WebGL di belakangnya */
.pip {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 340px;
  height: 200px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  box-shadow: 0 0 0 4px rgba(10, 15, 30, 0.6);
}
.pip[hidden] { display: none; }
.pip-open {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  text-align: left;
}
.pip-open:hover .pip-tag { background: var(--accent); color: var(--accent-ink); }
.pip-tag, .pip-where {
  margin: 0 0 8px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(10, 15, 30, 0.88);
  font-size: 13px;
  line-height: 1.3;
}
.pip-tag {
  margin-left: 8px;
  color: var(--accent);
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
}
.pip-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: rgba(10, 15, 30, 0.88);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}
.pip-close:hover { color: var(--text); }

/* HUD saat mode "Dari kursi" */
.pov-hud {
  position: fixed;
  left: calc(16px + 352px + 16px);
  right: 16px;
  bottom: 16px;
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.pov-hud[hidden] { display: none; }
#panel.collapsed ~ .pov-hud { left: 16px; }
.pov-btns { display: flex; gap: 6px; flex-shrink: 0; }
.pov-btns [aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.pov-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.pov-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: 26px;
  line-height: 1.05;
}
.pov-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}
.pov-ctrls {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}
.zoom {
  flex: 1 1 180px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
  color: var(--muted);
}
.zoom output { color: var(--text); font-variant-numeric: tabular-nums; }
.zoom input { width: 100%; min-height: 28px; accent-color: var(--accent); }
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.seg[hidden] { display: none; }
.seg button {
  min-height: 40px;
  padding: 6px 12px;
  border: 0;
  background: var(--field);
  font-size: 14px;
  color: var(--muted);
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.pov-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.seg.wide { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg.wide button { min-height: 44px; font-size: 15px; }
.pip-close.static { position: static; }

/* label "simulasi" yang selalu kelihatan (ikut ke screenshot yang dibagikan) */
.sim-badge {
  position: fixed;
  left: calc(16px + 352px + 16px);
  bottom: 16px;
  margin: 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(10, 15, 30, 0.82);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}
#panel.collapsed ~ .sim-badge, body.pov .sim-badge { display: none; }

/* pemutar musik */
.music {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 340px;
  padding: 10px 12px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  z-index: 6;
}
.music[hidden] { display: none; }
.music-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.music-title { margin: 0; font-family: var(--display); font-weight: 700; font-size: 20px; }
.tracks { margin: 8px 0 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.tracks button {
  min-height: 38px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--field);
  font-size: 14px;
}
.tracks button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.player {
  height: 200px;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.player p { margin: 0; padding: 16px; color: var(--muted); font-size: 13px; line-height: 1.5; text-align: center; }
.player iframe { width: 100%; height: 100%; border: 0; display: block; }

/* peringatan awal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(5, 8, 16, 0.72);
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(460px, 100%);
  padding: 22px 22px 20px;
  background: #0E1426;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
}
.modal-card h2 {
  margin: 0 0 12px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 30px;
  line-height: 1.05;
  color: var(--accent);
}
.modal-card ul { margin: 0 0 18px; padding-left: 20px; display: grid; gap: 8px; font-size: 15px; line-height: 1.5; }

.noscript {
  position: fixed;
  inset: auto 16px 16px 16px;
  margin: 0;
  color: var(--text);
}

@media (max-width: 720px) {
  #panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 56vh;
    max-height: 56dvh;
    border-radius: 16px 16px 0 0;
    padding: 14px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .panel-head h1 { font-size: 30px; }
  .panel-head .sub { font-size: 14px; }
  #tooltip { display: none; }
  .pip {
    top: 12px;
    right: 12px;
    bottom: auto;
    width: min(46vw, 210px);
    height: 124px;
  }
  .pip-tag { font-size: 13px; }
  .pip-where { display: none; }
  .pov-hud {
    left: 12px;
    right: 12px;
    top: 12px;
    bottom: auto;
    padding: 10px 12px;
  }
  .pov-title { font-size: 21px; }
  .pov-meta { font-size: 13px; }
  .pov-hint { font-size: 11px; }
  .sim-badge { left: 12px; top: 12px; bottom: auto; padding: 5px 8px; font-size: 11px; max-width: calc(100vw - 24px - 210px - 8px); }
  body.music-open .sim-badge, body.music-open .pip { display: none; }
  .music { top: 12px; left: 12px; right: 12px; width: auto; }
  body.pov .music { top: auto; bottom: 128px; }
  .player { height: 200px; }
}

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