:root {
  color-scheme: light;
  --red: #8f1d1d;
  --deep-red: #5f1010;
  --gold: #d8b05b;
  --pale-gold: #fff1bd;
  --ink: #321b16;
  --muted: #85685e;
  --paper: #fffaf0;
  --line: rgba(116, 48, 31, .14);
  font-family: "Songti SC", "Noto Serif SC", "Microsoft YaHei", serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.signup-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 228, 157, .55), transparent 28%),
    radial-gradient(circle at 12% 18%, rgba(255,255,255,.35), transparent 20%),
    linear-gradient(160deg, #7f1718 0%, #b82424 52%, #efcf8b 130%);
  padding: 18px 14px 42px;
}

.phone-shell { width: min(430px, 100%); margin: 0 auto; }
.hero-card,
.form-card,
.result-card,
.panel,
.stat-card {
  border: 1px solid rgba(255, 238, 189, .52);
  box-shadow: 0 24px 70px rgba(67, 12, 12, .28);
}

.hero-card {
  position: relative;
  overflow: hidden;
  min-height: 360px;
  padding: 26px 22px 86px;
  border-radius: 30px;
  color: #fff8dc;
  background:
    linear-gradient(rgba(89, 12, 12, .18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(89, 12, 12, .18) 1px, transparent 1px),
    linear-gradient(145deg, #751414, #b82722 58%, #da9b42);
  background-size: 28px 28px, 28px 28px, auto;
}

.hero-card::after {
  content: "";
  position: absolute;
  right: -54px;
  bottom: -62px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  border: 34px solid rgba(255, 238, 180, .18);
}

.logo { width: 168px; height: auto; position: relative; z-index: 1; }
.hero-glow { width: 92px; height: 4px; background: var(--pale-gold); border-radius: 99px; margin: 44px 0 18px; box-shadow: 0 0 28px var(--pale-gold); }
.hero-card h1 { position: relative; z-index: 1; margin: 0; font-size: clamp(42px, 12vw, 58px); line-height: 1.04; letter-spacing: .08em; }
.hero-card p { position: relative; z-index: 1; margin: 18px 0 0; max-width: 290px; color: rgba(255, 248, 220, .86); line-height: 1.75; }

.form-card,
.result-card {
  margin-top: -58px;
  position: relative;
  z-index: 3;
  padding: 22px;
  border-radius: 28px;
  background: rgba(255, 250, 239, .96);
  backdrop-filter: blur(18px);
}

.seat-meter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  border-radius: 18px;
  color: #6d3d2e;
  background: #fff2cf;
  margin-bottom: 18px;
}
.seat-meter b { color: var(--red); font-size: 20px; }

form { display: grid; gap: 16px; }
label { display: grid; gap: 8px; font-weight: 700; }
label span { font-size: 15px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  outline: 0;
  border-radius: 16px;
  padding: 15px 14px;
  background: #fffdf8;
  color: var(--ink);
}
input:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(216, 176, 91, .18); }
small, .soft, .panel p, .admin-top p { color: var(--muted); line-height: 1.65; }

.manager-field { position: relative; }
.manager-input-wrap {
  display: grid;
  grid-template-columns: 1fr 54px;
  align-items: stretch;
}
.manager-input-wrap input {
  border-radius: 16px 0 0 16px;
  border-right: 0;
}
.manager-input-wrap input:focus {
  position: relative;
  z-index: 1;
}
.manager-dropdown-btn {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 0 16px 16px 0;
  padding: 0;
  line-height: 1;
  background: #fff2cf;
  color: var(--red);
  font-size: 26px;
  font-weight: 900;
}
.manager-dropdown-btn[aria-expanded="true"] {
  background: #f2d892;
}
.manager-suggestions {
  display: grid;
  gap: 9px;
  max-height: 310px;
  overflow-y: auto;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid rgba(184, 138, 43, .22);
  background: #fff8e7;
  box-shadow: 0 18px 42px rgba(67, 12, 12, .16);
}
.manager-list-title {
  padding: 4px 4px 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.manager-option {
  width: 100%;
  min-height: 62px;
  border: 1px solid rgba(143, 29, 29, .10);
  border-radius: 15px;
  padding: 12px 14px;
  text-align: left;
  background: #fffdf8;
  color: var(--ink);
}
.manager-option strong {
  display: block;
  font-size: 17px;
  line-height: 1.25;
}
.manager-option span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}
.manager-option:active {
  transform: scale(.985);
  background: #fff2cf;
}
.manager-empty {
  padding: 14px;
  border-radius: 14px;
  color: var(--muted);
  background: #fffdf8;
  line-height: 1.55;
}

.primary-btn,
.ghost-btn,
.danger-btn {
  border: 0;
  border-radius: 16px;
  min-height: 48px;
  padding: 0 18px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}
.primary-btn { color: #fff8dc; background: linear-gradient(135deg, var(--deep-red), #b62322 60%, #d39a3d); box-shadow: 0 14px 32px rgba(143, 29, 29, .28); }
.ghost-btn { color: var(--red); background: #fff4d7; border: 1px solid rgba(143, 29, 29, .12); }
.danger-btn { color: #fff; background: #9b2a2a; }
.mini-danger { border: 0; border-radius: 999px; padding: 7px 12px; color: #fff; background: #9b2a2a; font-weight: 800; }
button:disabled { opacity: .65; cursor: wait; }

.result-card { text-align: center; }
.success-mark { width: 62px; height: 62px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: #b88a2b; font-size: 34px; }
.result-card h2 { margin: 0; font-size: 30px; }
.seat-ticket { margin: 18px 0; padding: 20px; border-radius: 22px; background: linear-gradient(135deg, #7d1717, #c53228); color: #fff8dc; }
.seat-ticket span { display: block; opacity: .78; margin-bottom: 6px; }
.seat-ticket strong { font-size: 36px; letter-spacing: .04em; }
.admin-link { display: block; text-align: center; color: rgba(255,255,255,.82); margin-top: 20px; }

.admin-page { min-height: 100vh; background: #f6ecdc; padding: 24px; }
.admin-top { display: flex; gap: 18px; align-items: center; max-width: 1180px; margin: 0 auto 22px; }
.admin-top img { width: 168px; flex: 0 0 auto; }
.admin-top h1 { margin: 0 0 4px; font-size: 30px; }
.admin-top p { margin: 0; }
.admin-top .ghost-btn { margin-left: auto; }
.admin-grid { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card, .panel { background: rgba(255, 252, 246, .92); border-radius: 24px; padding: 20px; }
.stat-card span { color: var(--muted); }
.stat-card strong { display: block; margin-top: 8px; font-size: 34px; color: var(--red); }
.panel { grid-column: span 2; }
.settings-panel { grid-column: 1 / -1; }
.settings-form { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
.settings-form label:nth-child(2), .settings-form label:nth-child(3) { grid-column: span 2; }
.settings-form button { width: max-content; }
textarea { resize: vertical; min-height: 48px; }
.table-panel, .seat-panel { grid-column: 1 / -1; }
.panel h2 { margin: 0 0 8px; }
.upload-row { grid-template-columns: 1fr auto; align-items: center; }
.panel-head, .actions { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.actions { flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
th, td { text-align: left; padding: 13px 10px; border-bottom: 1px solid var(--line); }
th { color: #7e4a3c; }
.empty { text-align: center; color: var(--muted); padding: 28px; }
.seat-preview { overflow-x: auto; padding-bottom: 8px; }
.stage { width: min(520px, 90%); margin: 0 auto 18px; text-align: center; padding: 12px; border-radius: 999px; color: #fff8dc; background: linear-gradient(135deg, #7d1717, #c53228); }
.seat-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; min-width: 880px; }
.seat-row span { width: 44px; font-weight: 800; color: var(--red); }
.seat-grid { display: grid; grid-template-columns: repeat(var(--seat-cols), 28px); gap: 6px; }
.seat-row i { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-style: normal; font-size: 12px; background: #fff5d8; color: #8a5a25; border: 1px solid rgba(184, 138, 43, .18); }
.seat-row i.used { background: var(--red); color: #fff8dc; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: #371212; color: #fff8dc; padding: 12px 18px; border-radius: 999px; box-shadow: 0 18px 40px rgba(0,0,0,.24); }

@media (max-width: 760px) {
  .admin-page { padding: 16px; }
  .admin-top { display: grid; }
  .admin-top .ghost-btn { margin-left: 0; }
  .admin-grid { grid-template-columns: 1fr 1fr; }
  .panel { grid-column: 1 / -1; }
  .upload-row, .settings-form { grid-template-columns: 1fr; }
  .settings-form label:nth-child(2), .settings-form label:nth-child(3) { grid-column: auto; }
  .panel-head { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 440px) {
  .signup-page { padding-inline: 10px; }
  .hero-card { border-radius: 24px; padding: 22px 18px 82px; min-height: 352px; }
  .form-card, .result-card { border-radius: 24px; padding: 18px; }
  .admin-grid { grid-template-columns: 1fr; }
}

.seat-picker-block {
  display: grid;
  gap: 10px;
}
.seat-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
}
.mobile-seat-picker {
  overflow-x: auto;
  padding: 12px 0 4px;
  border-radius: 18px;
  background: #fff8e7;
  border: 1px solid rgba(184, 138, 43, .18);
}
.mobile-stage {
  width: 240px;
  margin: 0 auto 12px;
  text-align: center;
  padding: 9px 12px;
  border-radius: 999px;
  color: #fff8dc;
  background: linear-gradient(135deg, #7d1717, #c53228);
  font-weight: 800;
}
.mobile-seat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 850px;
  padding: 4px 12px;
}
.mobile-seat-row span {
  width: 44px;
  white-space: nowrap;
  color: var(--red);
  font-weight: 800;
}
.mobile-seat-row div {
  display: grid;
  grid-template-columns: repeat(var(--seat-cols), 28px);
  gap: 6px;
}
.seat-choice {
  width: 28px;
  height: 28px;
  min-height: 0;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(184, 138, 43, .28);
  background: #fffdf8;
  color: #8a5a25;
  font-size: 12px;
  font-weight: 800;
}
.seat-choice.selected {
  color: #fff8dc;
  background: #b88a2b;
  border-color: #b88a2b;
  box-shadow: 0 0 0 3px rgba(184, 138, 43, .22);
}
.seat-choice.occupied {
  color: rgba(255, 248, 220, .82);
  background: #9f8b78;
  border-color: #9f8b78;
  cursor: not-allowed;
}
.seat-scroll-hint { display: block; text-align: center; margin-top: 2px; }
.seat-empty {
  margin: 0;
  padding: 20px;
  text-align: center;
  color: var(--muted);
}
.result-actions {
  display: grid;
  gap: 10px;
}
.result-actions .primary-btn,
.result-actions .danger-btn {
  width: 100%;
}

.image-save-sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(48, 11, 9, .72);
  backdrop-filter: blur(8px);
}
.image-save-panel {
  width: min(390px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  padding: 18px;
  border-radius: 24px;
  background: #fffaf0;
  border: 1px solid rgba(255, 238, 189, .52);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .34);
  text-align: center;
}
.image-save-panel h2 {
  margin: 0 0 8px;
  color: var(--red);
}
.image-save-panel img {
  display: block;
  width: 100%;
  height: auto;
  margin: 14px 0;
  border-radius: 18px;
  box-shadow: 0 14px 38px rgba(67, 12, 12, .22);
  -webkit-touch-callout: default;
}
.image-save-panel .ghost-btn {
  width: 100%;
}

@media (max-width: 440px) {
  .mobile-seat-picker {
    margin-inline: -4px;
  }
  .manager-suggestions {
    max-height: 270px;
  }
}

.seat-open-btn {
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(184, 138, 43, .28);
  border-radius: 16px;
  color: #8f1d1d;
  background: #fff2cf;
  font-weight: 900;
}

.query-card {
  margin-top: -58px;
  position: relative;
  z-index: 3;
  padding: 22px;
  border-radius: 28px;
  background: rgba(255, 250, 239, .96);
  border: 1px solid rgba(255, 238, 189, .52);
  box-shadow: 0 24px 70px rgba(67, 12, 12, .28);
}
.query-card h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

@media (max-width: 440px) {
  .query-card { border-radius: 24px; padding: 18px; }
}

.full-settings-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.full-settings-form label:nth-child(2),
.full-settings-form label:nth-child(3),
.full-settings-form .settings-note {
  grid-column: 1 / -1;
}
.settings-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}
@media (max-width: 900px) {
  .full-settings-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .full-settings-form { grid-template-columns: 1fr; }
}
