:root {
  --accent: #f84464;
  --accent-dark: #dc3558;
  --green: #1ea83c;
  --text: #333;
  --muted: #666;
  --faint: #999;
  --line: #e5e5e5;
  --sold: #5b3d99;
  --mine: #fde2e7;
  --page: #f5f5fa;
  --card: #fff;
  --pitch: 28px;
  --seat: 22px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  font-family: Roboto, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--card);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 88px;
}

button { font: inherit; cursor: pointer; }

/* Header */
.head { background: var(--card); box-shadow: 0 1px 6px rgba(0, 0, 0, .08); position: sticky; top: 0; z-index: 5; }
.head-main { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; max-width: 1200px; margin: 0 auto; }
.title h1 { margin: 0; font-size: 18px; font-weight: 500; }
.title p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.head-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.qty-btn { border: 1px solid var(--accent); color: var(--accent); background: var(--card); border-radius: 4px; padding: 6px 12px; font-size: 12px; white-space: nowrap; }
.user { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.user .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 500; font-size: 13px; }
.user .email { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user .link { border: 0; background: none; color: var(--accent); padding: 0; font-size: 12px; }

.times { display: flex; gap: 12px; padding: 10px 24px; background: var(--page); border-top: 1px solid var(--line); }
.times .time { border: 1px solid var(--green); background: var(--green); color: #fff; border-radius: 4px; padding: 6px 18px; display: flex; flex-direction: column; align-items: center; line-height: 1.3; }
.times .time strong { font-size: 13px; font-weight: 500; }
.times .time small { font-size: 9px; letter-spacing: .3px; text-transform: uppercase; }

/* Notices */
.banner { margin: 12px auto 0; max-width: 880px; padding: 10px 16px; border-radius: 6px; background: #fff0f3; border: 1px solid #ffc7d3; color: #b3123a; font-size: 14px; text-align: center; }
.mine { margin: 12px auto 0; max-width: 880px; padding: 10px 16px; border-radius: 6px; background: var(--page); font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mine .chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--green); color: var(--green); background: var(--card); border-radius: 14px; padding: 2px 4px 2px 10px; font-weight: 500; }
.mine .chip button { border: 0; background: none; color: var(--faint); font-size: 14px; line-height: 1; padding: 2px 6px; border-radius: 10px; }
.mine .chip button:hover { color: var(--accent); background: #fff0f3; }

/* Seat map */
.map-wrap { overflow-x: auto; padding: 24px 16px 8px; }
.map { width: max-content; margin: 0 auto; }
.price-label { text-align: center; font-size: 12px; color: var(--muted); margin-left: 30px; padding-bottom: 8px; border-bottom: 1.5px solid var(--line); margin-bottom: 8px; }
.row { display: flex; align-items: center; height: 27px; }
.row-label { width: 30px; flex: none; font-size: 12px; color: var(--faint); text-align: left; padding-left: 4px; }
.slot { width: var(--pitch); height: var(--seat); flex: none; }

.seat {
  width: var(--seat); height: var(--seat); margin: 0 3px; flex: none;
  border: 1px solid var(--green); border-radius: 4px; background: var(--card); color: var(--green);
  font-size: 10px; line-height: 1; padding: 0; display: inline-grid; place-items: center;
  transition: background-color .12s, color .12s;
}
.seat:hover:not(.sold):not(.mine) { background: var(--green); color: #fff; }
.seat:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.seat.selected { background: var(--green); color: #fff; }
.seat.sold { background: var(--sold); border-color: var(--sold); color: transparent; }
.seat.mine { background: var(--mine); border-color: var(--accent); color: var(--accent); }

.screen { margin: 34px 0 0 30px; text-align: center; }
.screen svg { width: 403px; max-width: 100%; height: 46px; display: block; margin: 0 auto; }
.screen p { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

/* Legend + note */
.legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 20px; padding: 18px 16px 8px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend .seat.demo { width: 16px; height: 16px; margin: 0; cursor: default; }
.note { text-align: center; font-size: 11px; color: var(--faint); margin: 4px 16px 16px; }

/* Pay bar */
.paybar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); box-shadow: 0 -2px 10px rgba(0, 0, 0, .1); padding: 12px 16px; display: flex; justify-content: center; z-index: 6; }
.pay { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 12px 24px; min-width: 280px; font-size: 15px; font-weight: 500; }
.pay:hover { background: var(--accent-dark); }
.pay:disabled { opacity: .6; cursor: wait; }

/* Dialogs */
dialog.sheet { border: 0; border-radius: 10px; padding: 24px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 10px 40px rgba(0, 0, 0, .25); color: var(--text); }
dialog.sheet::backdrop { background: rgba(0, 0, 0, .55); }
dialog.sheet h2 { margin: 0 0 12px; font-size: 18px; font-weight: 500; text-align: center; }
dialog.sheet p { font-size: 14px; color: var(--muted); text-align: center; line-height: 1.5; margin: 0 0 16px; word-break: break-word; }
dialog.sheet p strong { color: var(--text); }
.ride { font-size: 64px; text-align: center; line-height: 1.2; margin: 4px 0 12px; }
.qty-options { display: flex; justify-content: center; gap: 14px; margin-bottom: 18px; }
.qty-options button { width: 32px; height: 32px; border-radius: 50%; border: 0; background: none; font-size: 15px; color: var(--text); }
.qty-options button[aria-checked="true"] { background: var(--accent); color: #fff; }
.qty-options button:disabled { color: #ccc; cursor: not-allowed; }
.qty-price { border-top: 1px solid var(--line); padding: 14px 0 16px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.qty-price small { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.qty-price strong { font-size: 15px; font-weight: 500; }
.qty-price em { font-style: normal; font-size: 11px; color: var(--green); font-weight: 500; }
.cta { width: 100%; background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 12px; font-size: 15px; font-weight: 500; }
.cta:hover { background: var(--accent-dark); }
.cta:disabled { opacity: .6; cursor: wait; }
.ghost { width: 100%; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 15px; }
.actions { display: flex; gap: 12px; }
.signin-slot { display: flex; justify-content: center; margin: 0 0 16px; min-height: 40px; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: #222; color: #fff; padding: 10px 16px; border-radius: 6px; font-size: 13px; z-index: 10; max-width: calc(100vw - 32px); text-align: center; }

@media (max-width: 640px) {
  .head-main { padding: 10px 16px; flex-direction: column; align-items: flex-start; }
  .head-actions { justify-content: flex-start; }
  .times { padding: 8px 16px; }
  .pay { min-width: 0; width: 100%; }
  .user .email { max-width: 140px; }
}
