:root {
  --orange: #f26519;
  --orange-hover: #df570e;
  --green: #16a34a;
  --ink: #14171c;
  --muted: #5d6470;
  --pill-bg: rgba(255, 255, 255, 0.92);
  --shadow-lg: 0 12px 34px rgba(10, 14, 22, 0.22);
  --shadow-md: 0 6px 20px rgba(10, 14, 22, 0.16);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0d1117;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  user-select: none;
  touch-action: none;
}

.hidden {
  display: none !important;
}

.viewport {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.webgl-canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  z-index: 2;
  display: block;
}

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

/* ==================== PRELOADER (Prompt 5: transform + opacity only) ==================== */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: radial-gradient(circle at 50% 42%, #1d2633 0%, #0d1117 75%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 420ms ease;
}

.preloader.fade-out {
  opacity: 0;
  pointer-events: none;
}

.preloader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.ball-stage {
  position: relative;
  width: 104px;
  height: 112px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.ball-wrap {
  width: 60px;
  height: 60px;
  transform-origin: center center;
  will-change: transform;
}

.ball-svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.4));
}

.ball-glow {
  position: absolute;
  bottom: 2px;
  width: 72px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(242, 101, 25, 0.72) 0%, rgba(242, 101, 25, 0) 72%);
  will-change: transform, opacity;
}

.preloader-title {
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.preloader-track {
  width: 180px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.preloader-fill {
  width: 100%;
  height: 100%;
  background: var(--orange);
  transform-origin: left center;
  transform: scaleX(0.06);
  will-change: transform;
}

/* ==================== HUD & PANELS ==================== */
.hud {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.glass-panel {
  background: var(--pill-bg);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.55);
  pointer-events: auto;
}

@media (hover: hover) and (pointer: fine) {
  body:not(.force-mobile) .glass-panel {
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.hud-left-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.brand-pill {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 16px 8px 10px;
  border-radius: 16px;
}

.brand-crest {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(216, 43, 43, 0.18);
  flex-shrink: 0;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
  white-space: nowrap;
}

.nav-row {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
}

.back-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink);
  padding: 0;
  flex-shrink: 0;
  transition: transform 120ms ease, background 120ms ease;
}

.back-btn:hover {
  transform: scale(1.04);
  background: #ffffff;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}

.breadcrumbs::-webkit-scrollbar {
  display: none;
}

.crumb-btn {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
}

.crumb-btn:hover {
  color: var(--ink);
}

.crumb-btn.active {
  color: var(--ink);
  cursor: default;
}

.crumb-sep {
  color: #9ba3af;
  font-size: 13px;
}

.hud-right-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.hud-right-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.screens-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
}

.screens-label {
  color: var(--muted);
  font-weight: 500;
}

.sound-btn,
.refresh-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

.sound-btn:hover,
.refresh-btn:hover {
  background: #ffffff;
}

.sound-btn.active {
  color: var(--orange);
}

/* ==================== TOP-CENTER VIEW SUMMARY CARD ==================== */
.view-summary {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  border-radius: 16px;
  z-index: 25;
}

.view-summary-kicker {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.view-summary-title {
  font-size: 17px;
  font-weight: 800;
  margin-top: 2px;
}

.view-summary-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--green);
  margin-top: 3px;
}

.avail-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

.view-summary-divider {
  width: 1px;
  height: 44px;
  background: rgba(20, 23, 28, 0.1);
}

.view-summary-right {
  text-align: right;
}

.currency-code {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.summary-price,
.chip-price,
.stub-price {
  font-size: 20px;
  font-weight: 800;
  color: var(--orange);
  line-height: 1.1;
  margin-top: 2px;
}

/* ==================== HOVER / TAP PREVIEW CHIP ==================== */
.hover-chip {
  position: fixed;
  z-index: 26;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 16px;
  pointer-events: auto;
  cursor: pointer;
  transform: translate(-50%, -115%);
}

.chip-kicker {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.chip-title {
  font-size: 18px;
  font-weight: 800;
  margin-top: 2px;
}

.chip-avail {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--green);
  margin-top: 3px;
}

.hover-chip-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hover-chip-divider {
  width: 1px;
  height: 44px;
  background: rgba(20, 23, 28, 0.1);
}

.chip-price-col {
  text-align: right;
  min-width: 34px;
}

.seat-pill {
  position: fixed;
  z-index: 26;
  background: rgba(20, 24, 30, 0.9);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  pointer-events: none;
  transform: translate(-50%, -140%);
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
}

.seat-pill.taken {
  background: rgba(32, 81, 181, 0.92);
}

/* ==================== TICKET CARD (SEAT MODE) ==================== */
.ticket-card {
  position: fixed;
  bottom: max(56px, calc(env(safe-area-inset-bottom) + 46px));
  left: 50%;
  transform: translateX(-50%);
  width: min(530px, calc(100vw - 24px));
  background: #ffffff;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  overflow: hidden;
  pointer-events: auto;
  z-index: 28;
}

.ticket-preview-wrap {
  position: relative;
  width: 215px;
  min-height: 185px;
  background: #141920;
  flex-shrink: 0;
}

.ticket-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ticket-view-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(14, 18, 24, 0.72);
  color: #ffffff;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
}

.ticket-body {
  flex: 1;
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

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

.ticket-block {
  font-size: 20px;
  font-weight: 800;
  margin-top: 2px;
}

.ticket-meta-grid {
  display: flex;
  gap: 16px;
  margin: 10px 0 12px;
}

.ticket-meta-cell {
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.meta-value {
  font-size: 18px;
  font-weight: 800;
  margin-top: 1px;
}

.ticket-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.btn-primary {
  background: var(--orange);
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(242, 101, 25, 0.34);
  transition: background 120ms ease, transform 120ms ease;
}

.btn-primary:hover {
  background: var(--orange-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  border: none;
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: background 120ms ease, transform 120ms ease;
}

.btn-secondary:hover {
  background: #ffffff;
  transform: translateY(-1px);
}

.btn-lg {
  padding: 12px 24px;
  font-size: 14.5px;
}

.btn-full {
  width: 100%;
  padding: 13px 20px;
  font-size: 15px;
}

.btn-text {
  background: none;
  border: none;
  padding: 4px 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.btn-text:hover {
  color: var(--ink);
}

.ticket-stub {
  position: relative;
  width: 74px;
  padding: 14px 10px;
  border-left: 1.5px dashed #d3d7df;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.stub-notch {
  position: absolute;
  left: -8px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(20, 24, 30, 0.35);
}

.stub-notch-top {
  top: -7px;
}

.stub-notch-bottom {
  bottom: -7px;
}

.ticket-barcode {
  width: 32px;
  height: 82px;
}

/* ==================== VIEW ACTIONS & BOTTOM ==================== */
.view-actions {
  position: fixed;
  bottom: max(56px, calc(env(safe-area-inset-bottom) + 46px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 28;
  pointer-events: auto;
}

.hud-bottom {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  pointer-events: none;
}

.hint-pill {
  background: rgba(18, 22, 28, 0.72);
  color: rgba(255, 255, 255, 0.94);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  text-align: center;
  max-width: 92vw;
}

.attribution {
  position: fixed;
  right: 14px;
  bottom: 8px;
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.86);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
  pointer-events: auto;
}

.attribution a {
  color: inherit;
}

/* ==================== CONFIRM MODAL ==================== */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(10, 14, 22, 0.64);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.confirm-card {
  width: min(400px, 100%);
  background: #ffffff;
  border-radius: 22px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

.confirm-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.confirm-check {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #eaf9ef;
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  flex-shrink: 0;
}

.confirm-eyebrow {
  font-size: 11px;
  font-weight: 800;
  color: var(--green);
  letter-spacing: 0.05em;
}

.confirm-title {
  margin: 2px 0 0;
  font-size: 17px;
  font-weight: 800;
}

.confirm-details {
  margin: 18px 0;
  padding: 14px;
  background: #f5f7fa;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.confirm-detail-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.confirm-detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.price-orange {
  color: var(--orange);
}

.qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.confirm-code {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.08em;
}

/* ==================== PHONE RESPONSIVE LAYOUT (Prompt 3 & 6) ==================== */
body.is-phone .glass-panel {
  background: #ffffff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.is-phone .brand-sub,
body.is-phone .screens-label,
body.is-phone .sound-label,
body.is-phone .refresh-label,
body.is-phone .attribution {
  display: none;
}

body.is-phone .brand-pill {
  padding: 6px 12px 6px 7px;
  border-radius: 14px;
  gap: 8px;
}

body.is-phone .brand-title {
  font-size: 14px;
  white-space: nowrap;
}

body.is-phone .hud-right-row {
  position: relative;
}

/* Prompt 6: On phone, Refresh sits directly under the Sound button */
body.is-phone .refresh-btn {
  position: absolute;
  top: 48px;
  right: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  justify-content: center;
}

body.is-phone .sound-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  justify-content: center;
}

body.is-phone .screens-pill {
  height: 40px;
  padding: 0 12px;
  font-size: 12.5px;
}

body.is-phone .back-btn {
  width: 40px;
  height: 40px;
}

body.is-phone .nav-row {
  max-width: calc(100vw - 82px);
}

body.is-phone .breadcrumbs {
  height: 40px;
  padding: 0 12px;
  font-size: 12px;
  gap: 5px;
}

body.is-phone .view-summary {
  top: max(126px, calc(env(safe-area-inset-top) + 114px));
  width: min(326px, calc(100vw - 28px));
  justify-content: space-between;
}

body.is-phone .hover-chip {
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%);
}

body.is-phone .ticket-card {
  bottom: max(14px, env(safe-area-inset-bottom));
  flex-direction: column;
  width: calc(100vw - 20px);
  max-width: 430px;
  border-radius: 20px;
}

body.is-phone .ticket-preview-wrap {
  width: 100%;
  height: 175px;
  min-height: 0;
}

body.is-phone .ticket-body {
  padding: 16px 18px 14px;
}

body.is-phone .ticket-actions {
  width: 100%;
  align-items: stretch;
  gap: 8px;
}

body.is-phone .ticket-actions .btn-primary {
  width: 100%;
  padding: 14px 20px;
  font-size: 15.5px;
}

body.is-phone .ticket-actions .btn-text {
  width: 100%;
  padding: 10px 16px;
  font-size: 14.5px;
  text-align: center;
}

body.is-phone .ticket-stub {
  display: none;
}

body.is-phone .view-actions {
  bottom: max(20px, env(safe-area-inset-bottom));
  flex-direction: column;
  width: calc(100vw - 28px);
  max-width: 420px;
}

body.is-phone .view-actions .btn-lg {
  width: 100%;
  padding: 15px 22px;
  font-size: 16px;
}

body.is-phone.has-bottom-cta .hint-pill {
  display: none;
}

@media (max-height: 480px) and (orientation: landscape) {
  body.is-phone .ticket-card {
    flex-direction: row;
    max-width: 520px;
  }
  body.is-phone .ticket-preview-wrap {
    width: 190px;
    height: auto;
  }
}
