:root {
  --bg: #0f1115;
  --panel: #171a21;
  --line: #2a2f3a;
  --text: #e7e9ee;
  --muted: #8b93a3;
  --available: #2f6f4f;
  --available-bright: #34c77b;
  --reserved: #5a2f33;
  --reserved-bright: #e0535f;
  --seat: #3a4150;
  --accent: #d9b25f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.topbar {
  text-align: center;
  padding: 20px 16px 8px;
}
.topbar h1 {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: 0.06em;
}
.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.floor {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}

/* Projector — the "screen" at the front, like the airplane cabin head */
.projector {
  margin: 8px auto 24px;
  width: 70%;
  text-align: center;
  padding: 10px;
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  color: var(--accent);
  background: linear-gradient(180deg, rgba(217,178,95,0.18), transparent);
  border-top: 2px solid var(--accent);
  border-radius: 50% 50% 0 0 / 80% 80% 0 0;
}

.notice {
  text-align: center;
  margin: 0 0 16px;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.95rem;
}

.legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
  font-size: 0.8rem;
  color: var(--muted);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.swatch.available { background: var(--available-bright); }
.swatch.reserved  { background: var(--reserved-bright); }

/* Two-column grid of tables */
.map {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px 40px;
  justify-items: center;
  position: relative;
}

/* PROLAZ — walkway down the middle between the two columns */
.map::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  transform: translateX(-50%);
  border-left: 2px dashed var(--line);
}
.map::after {
  content: "PROLAZ";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  writing-mode: vertical-rl;
  letter-spacing: 0.35em;
  font-size: 0.7rem;
  color: var(--muted);
  background: var(--bg);
  padding: 8px 2px;
}

/* Error state — hide the PROLAZ walkway line and show a centered message */
.map.error::before,
.map.error::after { display: none; }
.load-error {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--reserved-bright);
  padding: 40px 16px;
  font-size: 0.95rem;
}

/* A single table "unit": seats arranged around a central table */
.table-unit {
  width: 100%;
  max-width: 220px;
  cursor: default;
  user-select: none;
}
.table-unit.reserved { cursor: pointer; }

.seat-row {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.seat {
  width: 26px;
  height: 22px;
  background: var(--seat);
  border-radius: 6px 6px 3px 3px;
}

/* The table surface with its number */
.table-body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  margin: 6px 0;
  border-radius: 12px;
  border: 2px solid var(--line);
  font-weight: 600;
  position: relative;
  text-align: center;
}

/* status coloring */
.table-unit.available .seat       { background: var(--available); }
.table-unit.available .table-body { background: rgba(47,111,79,0.18); border-color: var(--available-bright); }

.table-unit.reserved .seat        { background: var(--reserved); }
.table-unit.reserved .table-body  { background: rgba(90,47,51,0.22); border-color: var(--reserved-bright); }

.table-unit.reserved:hover .table-body { filter: brightness(1.25); }

.table-label { font-size: 0.95rem; }
.table-sub { display: block; font-size: 0.65rem; color: var(--muted); font-weight: 400; }
.table-name {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--reserved-bright);
  margin-top: 2px;
}
.table-time {
  display: block;
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--muted);
}

/* Info popover */
.info-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.info-backdrop[hidden] { display: none; }
.info-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 24px;
  width: 100%;
  max-width: 320px;
}
.info-card h2 { margin: 0 0 12px; font-size: 1.1rem; }
.info-card dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; }
.info-card dt { color: var(--muted); }
.info-card dd { margin: 0; text-align: right; }
.info-card input {
  width: 100%;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  text-align: right;
}
.info-card button {
  margin-top: 20px;
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #1a1305;
  font-weight: 600;
  cursor: pointer;
}

@media (max-width: 420px) {
  .map { gap: 22px 20px; }
  .seat { width: 22px; }
}
