:root {
  --paper: #f6f3ec;
  --paper-deep: #eeeadf;
  --surface: #fffdf8;
  --surface-soft: #fbf8f1;
  --ink: #19221c;
  --ink-soft: #344038;
  --muted: #747b73;
  --muted-light: #9a9f97;
  --line: rgba(25, 34, 28, 0.11);
  --line-strong: rgba(25, 34, 28, 0.2);
  --accent: #d94e2b;
  --accent-deep: #b93d1d;
  --accent-soft: #fae8df;
  --green: #2f6b4f;
  --green-deep: #24543d;
  --green-soft: #e5efe7;
  --gold: #a8742a;
  --gold-soft: #f8efdf;
  --danger: #b3382d;
  --shadow-sm: 0 2px 10px rgba(32, 40, 34, 0.05);
  --shadow-md: 0 18px 48px rgba(32, 40, 34, 0.09);
  --shadow-lg: 0 32px 80px rgba(25, 34, 28, 0.16);
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --sans: "PingFang SC", "Hiragino Sans GB", "Songti SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, -apple-system, sans-serif;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", Georgia, serif;
  --mono: "SF Mono", "Roboto Mono", "JetBrains Mono", Menlo, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(circle at 8% -10%, rgba(217, 78, 43, 0.07), transparent 32%),
    radial-gradient(circle at 92% 4%, rgba(47, 107, 79, 0.07), transparent 28%),
    var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.is-locked {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

img,
svg {
  display: block;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

::selection {
  background: rgba(217, 78, 43, 0.22);
}

.paper-grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.035'/%3E%3C/svg%3E");
}

.container {
  width: min(1240px, calc(100% - 64px));
  margin: 0 auto;
}

.icon {
  flex: none;
}

/* ------------------------------- site header ------------------------------ */

.site-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 88px;
  width: min(1240px, calc(100% - 64px));
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}

.brand-mark {
  width: 38px;
  height: 38px;
  color: var(--ink);
}

.brand-word {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-word strong {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.brand-word small {
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.26em;
  color: var(--muted);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  transition: color 0.2s ease, background 0.2s ease;
}

.nav-link:hover {
  color: var(--ink);
  background: rgba(25, 34, 28, 0.05);
}

.nav-link.is-current {
  color: var(--ink);
  background: rgba(25, 34, 28, 0.06);
}

/* --------------------------------- buttons -------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fffaf4;
  box-shadow: 0 8px 22px rgba(217, 78, 43, 0.2);
}

.btn-primary:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  box-shadow: 0 12px 28px rgba(217, 78, 43, 0.26);
}

.btn-dark {
  background: var(--ink);
  border-color: var(--ink);
  color: #fbf8f0;
}

.btn-dark:hover {
  background: #2b382f;
  border-color: #2b382f;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink-soft);
}

.btn-ghost:hover {
  background: rgba(25, 34, 28, 0.045);
  border-color: rgba(25, 34, 28, 0.32);
}

.btn-soft {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.btn-soft:hover {
  border-color: var(--line-strong);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #992d24;
}

.btn-sm {
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

.btn-lg {
  height: 54px;
  padding: 0 28px;
  font-size: 16px;
}

.btn-block {
  width: 100%;
}

.btn .icon {
  transition: transform 0.2s ease;
}

.btn:hover .icon-arrow {
  transform: translateX(2px);
}

/* --------------------------------- badges --------------------------------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(217, 78, 43, 0.12);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: rgba(25, 34, 28, 0.06);
  color: var(--ink-soft);
}

.pill.is-demo {
  background: var(--gold-soft);
  color: var(--gold);
}

.pill.is-green {
  background: var(--green-soft);
  color: var(--green);
}

.pill.is-accent {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.pill .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

/* ---------------------------------- form ---------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field + .field {
  margin-top: 18px;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}

.field-label span {
  color: var(--muted-light);
  font-weight: 400;
}

.input,
.select {
  width: 100%;
  height: 48px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.input::placeholder {
  color: var(--muted-light);
}

.input:focus,
.select:focus {
  border-color: rgba(217, 78, 43, 0.55);
  box-shadow: 0 0 0 4px rgba(217, 78, 43, 0.09);
  background: #fff;
}

.input-with-icon {
  position: relative;
}

.input-with-icon .icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-light);
  pointer-events: none;
}

.input-with-icon .input {
  padding-left: 44px;
}

.form-error {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--danger);
}

.form-error.is-visible {
  display: flex;
}

/* ---------------------------------- modal --------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 28, 23, 0.48);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.modal {
  width: min(540px, 100%);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transform: translateY(16px) scale(0.985);
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal-overlay.is-open .modal {
  transform: translateY(0) scale(1);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 28px 30px 0;
}

.modal-title {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.modal-sub {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: rgba(25, 34, 28, 0.06);
  color: var(--muted);
  transition: background 0.18s ease, color 0.18s ease;
}

.modal-close:hover {
  background: rgba(25, 34, 28, 0.1);
  color: var(--ink);
}

.modal-body {
  padding: 24px 30px 30px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 26px;
}

.modal-actions .btn {
  flex: 1;
}

.confirm-dialog {
  width: min(420px, 100%);
  padding: 30px;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateY(12px);
  transition: transform 0.22s ease;
}

.modal-overlay.is-open .confirm-dialog {
  transform: translateY(0);
}

.confirm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.confirm-icon.is-danger {
  background: #f7e3e0;
  color: var(--danger);
}

.confirm-dialog h3 {
  margin-top: 18px;
  font-family: var(--serif);
  font-size: 22px;
}

.confirm-dialog p {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}

.confirm-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.confirm-actions .btn {
  flex: 1;
}

/* ---------------------------------- toast --------------------------------- */

.toast-holder {
  position: fixed;
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(90vw, 420px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fdfaf3;
  font-size: 13px;
  box-shadow: 0 12px 32px rgba(25, 34, 28, 0.24);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-in {
  opacity: 1;
  transform: translateY(0);
}

.toast-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7cc99c;
}

.toast.is-error .toast-dot {
  background: #ff917e;
}

/* -------------------------------- seat map -------------------------------- */

.map-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 240px;
  margin: 0 auto 22px;
  padding: 7px 34px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(180deg, rgba(25, 34, 28, 0.04), rgba(25, 34, 28, 0.09));
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.24em;
}

.map-stage.is-dark {
  background: linear-gradient(180deg, rgba(25, 34, 28, 0.05), rgba(25, 34, 28, 0.1));
}

.map-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(25, 34, 28, 0.18) transparent;
}

.map-scroll::-webkit-scrollbar {
  height: 5px;
}

.map-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(25, 34, 28, 0.16);
}

.map-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin-bottom: var(--seat-gap, 6px);
}

.map-row-label {
  position: sticky;
  left: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 30px;
  flex: 0 0 30px;
  padding-right: 2px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted-light);
  background: var(--map-bg, var(--surface));
}

.admin-map,
.result-map {
  width: max-content;
  min-width: 100%;
}

.map-seats {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: var(--seat-gap, 6px);
}

.seat {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: var(--seat-size, 48px);
  height: var(--seat-size, 48px);
  min-width: 0;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: calc(var(--seat-size, 48px) * 0.16);
  background: #fffdf8;
  color: var(--muted);
  font-family: var(--mono);
  font-size: clamp(8px, calc(var(--seat-size, 48px) * 0.21), 12px);
  line-height: 1;
  overflow: hidden;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
}

button.seat {
  appearance: none;
}

button.seat:hover {
  z-index: 1;
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: 0 6px 16px rgba(25, 34, 28, 0.12);
}

.seat-no {
  font-weight: 600;
  letter-spacing: -0.03em;
}

.seat-name {
  max-width: 100%;
  padding: 0 2px;
  font-family: var(--sans);
  font-size: clamp(7px, calc(var(--seat-size, 48px) * 0.17), 10px);
  font-weight: 500;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.82;
}

.seat.is-bound {
  border-color: #ead7ba;
  background: #fbf2e4;
  color: #8b6327;
}

.seat.is-bound:hover {
  border-color: #d7bb91;
}

.seat.is-checked {
  border-color: var(--green);
  background: var(--green);
  color: #f4faf5;
}

.seat.is-checked .seat-name {
  opacity: 0.9;
}

.seat.is-checked::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #a8dfb9;
}

.seat.is-self {
  z-index: 2;
  border-color: var(--accent);
  background: var(--accent);
  color: #fffaf4;
  box-shadow: 0 0 0 5px rgba(217, 78, 43, 0.16), 0 10px 24px rgba(217, 78, 43, 0.3);
  animation: seatPop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}

.seat.is-self::before {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1.5px solid rgba(217, 78, 43, 0.5);
  border-radius: calc(var(--seat-size, 48px) * 0.2);
  animation: seatPulse 2s ease-out infinite;
}

.seat.is-occupied {
  border-color: transparent;
  background: #e9e6de;
  color: #a7a89f;
}

.seat.is-reserved {
  border-color: #ecdcc4;
  background: #faf0e1;
  color: #b08a54;
}

.seat.is-free {
  border-color: var(--line);
  background: #fffdf8;
  color: #a7aaa2;
}

.seat-static {
  cursor: default;
}

@keyframes seatPop {
  from {
    transform: scale(0.72);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes seatPulse {
  0% {
    opacity: 0.65;
    transform: scale(0.98);
  }
  70% {
    opacity: 0;
    transform: scale(1.22);
  }
  100% {
    opacity: 0;
  }
}

/* -------------------------------- skeleton -------------------------------- */

.skeleton {
  background: linear-gradient(90deg, rgba(25, 34, 28, 0.05) 25%, rgba(25, 34, 28, 0.09) 37%, rgba(25, 34, 28, 0.05) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

/* --------------------------------- footer --------------------------------- */

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(1240px, calc(100% - 64px));
  margin: 0 auto;
  padding: 34px 0 38px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.site-footer .footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
}

.site-footer .footer-mark {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--ink);
  position: relative;
}

.site-footer .footer-mark::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 2px;
  background:
    linear-gradient(to right, transparent 33%, var(--paper) 33%, var(--paper) 66%, transparent 66%),
    linear-gradient(to bottom, transparent 33%, var(--paper) 33%, var(--paper) 66%, transparent 66%);
}

/* ------------------------------- responsive ------------------------------- */

@media (max-width: 900px) {
  .container,
  .site-header,
  .site-footer {
    width: calc(100% - 40px);
  }

  .site-header {
    height: 74px;
  }

  .nav-link {
    display: none;
  }

  .nav-link.is-visible-mobile {
    display: inline-flex;
  }
}

@media (max-width: 600px) {
  .container,
  .site-header,
  .site-footer {
    width: calc(100% - 32px);
  }

  .site-header {
    height: 68px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-word strong {
    font-size: 20px;
  }

  .modal-overlay {
    padding: 14px;
    align-items: flex-end;
  }

  .modal {
    width: 100%;
    max-height: calc(100dvh - 28px);
    border-radius: 24px;
  }

  .modal-head {
    padding: 24px 22px 0;
  }

  .modal-body {
    padding: 20px 22px 26px;
  }

  .modal-title {
    font-size: 23px;
  }

  .confirm-dialog {
    align-self: center;
    padding: 26px 22px;
  }

  .btn {
    height: 42px;
    padding: 0 17px;
    font-size: 13px;
  }

  .btn-lg {
    height: 50px;
    font-size: 15px;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 26px 0 30px;
  }
}
