:root {
  --bg: #0b1220;
  --bg-2: #111a2c;
  --line: #1f2b44;
  --text: #e6edf7;
  --muted: #8fa1bd;
  --accent: #34d399;
  --accent-2: #f97316;
  --open: #5eead4;
  --sold: #1c2638;
  --held: #39445c;
  --radius: 12px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 18, 32, 0.94);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
}

.brand {
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 13px;
  color: var(--accent);
  white-space: nowrap;
}
.brand span { color: var(--muted); font-weight: 500; margin-left: 2px; }

.load {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.load input {
  flex: 1;
  min-width: 0;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}
.load input:focus { outline: 2px solid rgba(52, 211, 153, 0.45); outline-offset: 1px; }

button {
  font: inherit;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  padding: 10px 14px;
  cursor: pointer;
}
button:hover { border-color: #2e3f60; }
button:disabled { opacity: 0.45; cursor: default; }
button.primary {
  width: 100%;
  background: var(--accent);
  border-color: var(--accent);
  color: #06231a;
  font-weight: 650;
  padding: 12px 16px;
}
button.ghost { width: 100%; margin-top: 8px; }

main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  min-height: 0;
}

.map {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1200px 500px at 50% -10%, #16223a 0%, var(--bg) 60%);
  min-height: 0;
  touch-action: none;
}

#map { width: 100%; height: 100%; display: block; cursor: grab; }
#map.dragging { cursor: grabbing; }

.seat { fill: var(--open); }
.seat.sold { fill: var(--sold); pointer-events: none; }
.seat.held { fill: var(--held); pointer-events: none; }
.seat.selected { fill: var(--accent-2); stroke: #ffd8b0; stroke-width: 1.5; }
.seat.hidden { display: none; }
.seat.open { cursor: pointer; }
.seat.open:hover { stroke: #ffffff; stroke-width: 2; }

.stage { fill: none; stroke: #3b4c6d; }

.tools, .mapTools {
  position: absolute;
  right: 12px;
  bottom: 14px;
  display: flex;
  gap: 6px;
}
.mapTools button {
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 18px;
  background: rgba(17, 26, 44, 0.9);
}

.empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  padding: 24px;
  text-align: center;
  pointer-events: none;
}

.status {
  position: absolute;
  left: 12px;
  top: 12px;
  max-width: min(90%, 560px);
  background: rgba(17, 26, 44, 0.95);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  z-index: 5;
}
.status.error { border-color: #7f1d1d; color: #fecaca; }

.tip {
  position: absolute;
  pointer-events: none;
  background: #050a13;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 10;
  transform: translate(12px, 12px);
}

.panel {
  border-left: 1px solid var(--line);
  padding: 18px;
  overflow-y: auto;
  background: var(--bg-2);
  min-height: 0;
}

.eventHead h1 { font-size: 19px; margin: 0 0 4px; }
.eventHead p { margin: 0 0 14px; color: var(--muted); font-size: 13px; }

.filters { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.filters .check { flex-direction: row; align-items: center; gap: 7px; color: var(--text); }
select, .knobs input {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  max-width: 100%;
}

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 16px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

h2 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 16px 0 8px; display: flex; align-items: center; gap: 8px; }
.pill { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; font-size: 12px; letter-spacing: 0; }

.selected { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 6px; }
.selected li {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 13px;
}
.selected li.muted { color: var(--muted); justify-content: center; border-style: dashed; }
.selected .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected .price { color: var(--accent); font-variant-numeric: tabular-nums; }
.selected button { padding: 2px 8px; font-size: 13px; }

.total { font-weight: 650; margin: 6px 0 16px; font-variant-numeric: tabular-nums; }

.knobs { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 6px; }
.knobs summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.knobs label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }

.spec { white-space: pre-wrap; word-break: break-word; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 12px; margin: 12px 0 0; max-height: 260px; overflow: auto; }

.note { color: var(--muted); font-size: 12px; margin-top: 16px; }

@media (max-width: 800px) {
  .bar { flex-wrap: wrap; gap: 10px; padding: 10px 12px; }
  .load { order: 2; width: 100%; flex-basis: 100%; }
  main { grid-template-columns: 1fr; grid-template-rows: 52dvh minmax(0, 1fr); }
  .panel { border-left: 0; border-top: 1px solid var(--line); padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); }
  .mapTools button { width: 46px; height: 46px; }
}
