:root {
  --bg: #070e14;
  --panel: #0f1c26;
  --text: #eaf3f6;
  --muted: #8498a6;
  --free: #2fbe7b;
  --busy: #d4534a;
  --offline: #5c6b75;
  --selected: #f0c75e;
  --border: rgba(255, 255, 255, 0.08);
  --comfort: #2C87FD;
  --vip: #7C62FF;
  --bootcamp: #E85A9B;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --accent: #f0c75e;
  --map-aspect: 2;
  --seat-size: 5.8%;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(120% 90% at 0% -10%, rgba(44, 135, 253, 0.16), transparent 50%),
    radial-gradient(90% 70% at 100% 0%, rgba(232, 90, 155, 0.12), transparent 48%),
    radial-gradient(60% 50% at 20% 100%, rgba(124, 98, 255, 0.1), transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: "Manrope", system-ui, sans-serif;
  height: 100%;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px 8px;
  background: linear-gradient(180deg, rgba(15, 28, 38, 0.95), rgba(15, 28, 38, 0.6));
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  flex-shrink: 0;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-weight: 700;
}

.title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

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

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 18px;
  transition: transform 160ms var(--ease), background 160ms var(--ease);
}
.icon-btn:active { transform: scale(0.94); }

.legend {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  padding: 7px 12px;
  font-size: 11px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.legend::-webkit-scrollbar { display: none; }
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot.free { background: var(--free); }
.dot.busy { background: #c46a3a; }
.dot.offline { background: var(--offline); }
.dot.selected { background: var(--selected); }
.dot.hall-comfort { background: var(--comfort); }
.dot.hall-vip { background: var(--vip); }
.dot.hall-bootcamp { background: var(--bootcamp); }

.map-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: #060c12;
  touch-action: pan-x pan-y;
  padding: 8px;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.zoom-controls {
  position: fixed;
  right: 12px;
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 8;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.zoom-btn {
  pointer-events: auto;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(15, 28, 38, 0.92);
  color: var(--text);
  font-family: inherit;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.zoom-btn:active { transform: scale(0.94); }
#zoom-reset { font-size: 12px; }

.map-frame {
  position: relative;
  width: min(100%, 980px);
  margin: 0 auto;
  aspect-ratio: var(--map-aspect);
  background: #0c161d;
  border-radius: 16px;
  /* visible — бейджи залов висят над рамкой зоны и не клипаются */
  overflow: visible;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 18px 48px rgba(0, 0, 0, 0.45);
  animation: mapIn 480ms var(--ease) both;
}

@keyframes mapIn {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

.map-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  min-height: 0;
  pointer-events: none;
}

.map-fallback {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(44, 135, 253, 0.08), transparent 40%),
    linear-gradient(225deg, rgba(124, 98, 255, 0.08), transparent 40%),
    #0c161d;
}

.pc-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.zone-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* выше ПК — названия залов не перекрываются маркерами */
  z-index: 4;
  overflow: visible;
}

.zone-box {
  position: absolute;
  border-radius: 14px;
  box-sizing: border-box;
  overflow: visible;
}

.zone-badge {
  position: absolute;
  z-index: 5;
  padding: 4px 9px;
  border-radius: 9px;
  backdrop-filter: blur(8px);
  max-width: 42%;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.zone-badge-vip {
  background: rgba(27, 22, 56, 0.94);
  border: 1.5px solid #7C62FF;
  color: #ddd0ff;
}
.zone-badge-bootcamp {
  background: rgba(42, 20, 36, 0.94);
  border: 1.5px solid #E85A9B;
  color: #ffd0e6;
}
.zone-badge-comfort {
  background: rgba(18, 35, 58, 0.92);
  border: 1px solid rgba(44, 135, 253, 0.7);
  color: #8ec2ff;
}

.zone-title {
  font-family: "Manrope", system-ui, sans-serif;
  font-size: clamp(9px, 1.2vw, 12px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.02em;
}

.zone-sub {
  display: none;
}

.zone-vip {
  background: rgba(124, 98, 255, 0.16);
  border: 3px solid #9b84ff;
  box-shadow:
    inset 0 0 0 1px rgba(180, 160, 255, 0.35),
    0 0 0 1px rgba(124, 98, 255, 0.25);
}

.zone-bootcamp {
  background: rgba(232, 90, 155, 0.16);
  border: 3px solid #ff7ab5;
  box-shadow:
    inset 0 0 0 1px rgba(255, 176, 212, 0.35),
    0 0 0 1px rgba(232, 90, 155, 0.25);
}

.zone-comfort {
  background: rgba(44, 135, 253, 0.07);
  border: 2px solid rgba(44, 135, 253, 0.45);
}

@media (max-width: 720px) {
  .zone-box { border-radius: 12px; }
  .zone-vip, .zone-bootcamp { border-width: 3px; }
  .zone-badge { padding: 4px 8px; }
  .zone-title { font-size: 11px; }
  .zone-sub { font-size: 9px; }
}

.pc-marker {
  position: absolute;
  pointer-events: auto;
  border: 0;
  border-radius: 10px;
  /* width/height задаёт JS из layout (% от canvas) — без aspect-ratio, иначе overlap */
  width: 4.7%;
  height: 8%;
  font-family: "JetBrains Mono", monospace;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 2px 1px;
  overflow: visible;
  transform: translate(-50%, -50%) scale(1);
  transition: transform 160ms var(--ease), box-shadow 160ms var(--ease), outline 160ms var(--ease);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 6px 14px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  animation: seatIn 420ms var(--ease) both;
}

.pc-num {
  font-size: clamp(11px, 1.2vw, 14px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}

.pc-tag {
  font-size: clamp(7px, 0.72vw, 9px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  opacity: 0.95;
  max-width: 98%;
  white-space: nowrap;
}

.pc-meta {
  font-size: clamp(6px, 0.72vw, 9px);
  font-weight: 700;
  line-height: 1.05;
  opacity: 0.95;
  max-width: 100%;
  text-align: center;
  white-space: nowrap;
}

@keyframes seatIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.72); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.pc-marker.hall-Comfort { background: linear-gradient(160deg, #57a6ff 0%, #2C87FD 55%, #1f6fd6 100%); }
.pc-marker.hall-VIP { background: linear-gradient(160deg, #a894ff 0%, #7C62FF 55%, #6349e0 100%); }
.pc-marker.hall-BOOTCAMP { background: linear-gradient(160deg, #ff8ec1 0%, #E85A9B 55%, #d14586 100%); }

.pc-marker.free { filter: saturate(1.08); }
.pc-marker.busy {
  cursor: pointer;
  filter: none;
  opacity: 1;
}
.pc-marker.busy.kind-session {
  background: linear-gradient(160deg, #66717c, #3d4650) !important;
}
.pc-marker.busy.kind-booking {
  background: linear-gradient(160deg, #d07a42, #9d4e27) !important;
}
.pc-marker.busy .pc-meta { color: #ffe9c9; }
.pc-marker.offline {
  opacity: 0.7;
  cursor: pointer;
  background: linear-gradient(160deg, #55616c, #323940) !important;
}
.pc-marker.dimmed { opacity: 0.22; cursor: default; }
.pc-marker.selected {
  outline: 2.5px solid var(--selected);
  outline-offset: 2px;
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 0 0 4px rgba(240, 199, 94, 0.22), 0 12px 26px rgba(0, 0, 0, 0.45);
  z-index: 3;
}
.pc-marker.free:active { transform: translate(-50%, -50%) scale(0.94); }

.status-bar {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: rgba(15, 28, 38, 0.95);
  flex-shrink: 0;
  min-height: 36px;
}

.bottom-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: rgba(7, 14, 20, 0.98);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.selected-info {
  flex: 1;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text);
}

.confirm-btn {
  border: 0;
  border-radius: 14px;
  padding: 13px 18px;
  min-width: 132px;
  font-family: inherit;
  font-weight: 800;
  background: linear-gradient(135deg, #f0c75e, #e09a3c);
  color: #1a1205;
  box-shadow: 0 8px 22px rgba(224, 154, 60, 0.28);
  transition: transform 160ms var(--ease), opacity 160ms var(--ease);
}
.confirm-btn:not(:disabled):active { transform: scale(0.97); }
.confirm-btn:disabled {
  opacity: 0.38;
  filter: grayscale(0.5);
  box-shadow: none;
}

.hint-chip {
  display: none;
}

/* Телефон: карта на всю высоту области + горизонтальный скролл */
@media (max-width: 720px) {
  .topbar { padding: 8px 12px; }
  .title { font-size: 15px; }
  .eyebrow { font-size: 9px; }
  .subtitle { font-size: 11px; }
  .icon-btn { width: 36px; height: 36px; border-radius: 10px; }

  .legend {
    padding: 6px 10px;
    font-size: 10px;
    gap: 8px;
  }

  .map-wrap {
    padding: 26px 0 0;
    overscroll-behavior: contain;
  }

  .map-frame {
    height: calc(100% - 22px);
    min-height: calc(100% - 22px);
    width: auto;
    min-width: 100%;
    aspect-ratio: var(--map-aspect);
    max-width: none;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    animation: none;
    overflow: visible;
  }

  .zoom-controls {
    right: 10px;
    bottom: calc(78px + env(safe-area-inset-bottom));
  }
  .zoom-btn {
    width: 38px;
    height: 38px;
    border-radius: 11px;
  }

  .pc-marker {
    border-radius: 9px;
    gap: 0;
    padding: 1px;
  }

  .pc-num { font-size: 11px; }
  .pc-tag { font-size: 7px; }
  .pc-meta {
    font-size: 8px;
    letter-spacing: -0.02em;
  }

  .status-bar {
    font-size: 12px;
    padding: 9px 12px;
  }

  .bottom-bar {
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }

  .confirm-btn {
    min-width: 120px;
    padding: 12px 14px;
  }

  .hint-chip {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 10px;
  }
}

@media (max-width: 380px) {
  .pc-num { font-size: 10px; }
  .pc-tag { font-size: 6.5px; }
  .pc-meta { font-size: 7px; }
}

/* Bottom sheet: детали занятого ПК */
.pc-sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}
.pc-sheet.open { pointer-events: auto; }

.pc-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 12, 0.55);
  opacity: 0;
  transition: opacity 220ms var(--ease);
}
.pc-sheet.open .pc-sheet-backdrop { opacity: 1; }

.pc-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(72vh, 520px);
  background: linear-gradient(180deg, #132330 0%, #0b151d 100%);
  border-radius: 20px 20px 0 0;
  border: 1px solid var(--border);
  border-bottom: 0;
  box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.45);
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  transform: translateY(110%);
  transition: transform 280ms var(--ease);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.pc-sheet.open .pc-sheet-panel { transform: translateY(0); }

.pc-sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  margin: 0 auto 4px;
}

.pc-sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.pc-sheet-eyebrow {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.pc-sheet-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-top: 2px;
}

.pc-sheet-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.pc-sheet-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.chip-free { background: rgba(47, 190, 123, 0.18); color: #7dffb8; }
.chip-off { background: rgba(92, 107, 117, 0.28); color: #c2ccd3; }
.chip-session { background: rgba(120, 135, 150, 0.28); color: #dce4eb; }
.chip-booking { background: rgba(208, 122, 66, 0.28); color: #ffd2a8; }
.chip-busy { background: rgba(212, 83, 74, 0.25); color: #ffb4ae; }

.sheet-now {
  font-size: 13px;
  color: var(--muted);
}

.pc-sheet-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.pc-sheet-events {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 4px;
}

.event-empty {
  font-size: 13px;
  color: var(--muted);
  padding: 10px 0 4px;
}

.event-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}
.event-row.session { border-color: rgba(160, 175, 190, 0.25); }
.event-row.booking { border-color: rgba(208, 122, 66, 0.35); }

.event-tag {
  flex-shrink: 0;
  min-width: 52px;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #e8f0f4;
}
.event-row.session .event-tag { background: rgba(120, 135, 150, 0.3); }
.event-row.booking .event-tag { background: rgba(208, 122, 66, 0.3); color: #ffd2a8; }

.event-title {
  font-size: 13px;
  font-weight: 700;
}
.event-time {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  font-family: "JetBrains Mono", monospace;
}
.event-who {
  font-size: 12px;
  color: #c5d5df;
  margin-top: 4px;
}
