:root {
  --bg: #0b1326;
  --bg-2: #101e3a;
  --panel: rgba(18, 31, 59, 0.88);
  --panel-2: rgba(25, 43, 79, 0.92);
  --border: rgba(137, 178, 255, 0.22);
  --text: #e9f0ff;
  --muted: #9fb0d4;
  --primary: #2f7cf6;
  --primary-2: #62b4ff;
  --gold: #ffd166;
  --danger: #ff6b81;
  --ok: #4ade80;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 5%, rgba(67, 128, 255, 0.22), transparent 42%),
    radial-gradient(circle at 90% 92%, rgba(255, 209, 102, 0.12), transparent 40%),
    linear-gradient(145deg, var(--bg), var(--bg-2));
  min-height: 100vh;
  line-height: 1.55;
}

.site-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 8%, rgba(47, 124, 246, .22), transparent 36%),
    radial-gradient(circle at 88% 92%, rgba(255, 209, 102, .12), transparent 34%);
}

.bg-photo {
  position: absolute;
  inset: -7%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transform: scale(1.05) translate3d(0, 0, 0);
  filter: saturate(.72) contrast(1.02) brightness(.82);
  mix-blend-mode: soft-light;
  animation: bg-photo-cycle 45s linear infinite;
  will-change: opacity, transform;
}

.bg-photo-1 { background-image: url("/static/photo/bg-01.jpg"); animation-delay: 0s; }
.bg-photo-2 { background-image: url("/static/photo/bg-02.jpg"); animation-delay: 9s; }
.bg-photo-3 { background-image: url("/static/photo/bg-03.jpg"); animation-delay: 18s; }
.bg-photo-4 { background-image: url("/static/photo/bg-04.jpg"); animation-delay: 27s; }
.bg-photo-5 { background-image: url("/static/photo/bg-05.jpg"); animation-delay: 36s; }

.bg-veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 24%, rgba(8, 14, 28, .08), rgba(8, 14, 28, .84) 68%),
    linear-gradient(180deg, rgba(8, 14, 28, .58), rgba(8, 14, 28, .9));
}

@keyframes bg-photo-cycle {
  0% { opacity: 0; transform: scale(1.04) translate3d(-1.2%, -1%, 0); }
  7% { opacity: .17; }
  18% { opacity: .17; }
  25% { opacity: 0; transform: scale(1.1) translate3d(1.2%, 1%, 0); }
  100% { opacity: 0; transform: scale(1.04) translate3d(-1.2%, -1%, 0); }
}

.checkin-body .site-bg { display: none; }

.ambient { position: fixed; inset: 0; z-index: 1; pointer-events: none; background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 46px 46px; mask-image: linear-gradient(to bottom, black, transparent 80%); }

.shell { width: min(1180px, 94vw); margin: 0 auto; padding: 28px 0 40px; position: relative; z-index: 2; }

a { color: var(--primary-2); text-decoration: none; }

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.7rem, 4.4vw, 2.7rem); line-height: 1.12; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.12rem, 2.4vw, 1.45rem); }

.eyebrow { color: var(--gold); font-weight: 800; letter-spacing: .16em; font-size: .74rem; text-transform: uppercase; margin-bottom: 10px; }
.lead { color: #c7d5f4; font-size: 1.02rem; }
.small, .tiny-note { color: var(--muted); font-size: .86rem; }
.tiny-note { font-size: .78rem; }
code { background: rgba(255,255,255,.08); padding: 2px 6px; border-radius: 6px; color: #dceaff; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.card-glass {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: clamp(22px, 4vw, 42px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.card-glass.narrow { max-width: 700px; margin: 0 auto; }
.card-glass.wide { max-width: 1080px; margin: 0 auto; }

.hero { text-align: center; max-width: 900px; margin: 4vh auto 0; }
.hero-sub { color: #c7d5f4; font-size: 1.06rem; }
.home-actions { display: flex; flex-direction: row; justify-content: center; gap: clamp(12px, 3vw, 26px); margin: 38px auto 24px; }
.big-button {
  flex: 0 1 300px;
  min-height: 128px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 22px;
  font-size: clamp(1.35rem, 3.2vw, 1.8rem);
  font-weight: 900;
  letter-spacing: .05em;
  border: 1px solid transparent;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
  text-decoration: none;
}
.big-button.primary { background: linear-gradient(135deg, #2f7cf6, #5fb7ff); color: #fff; box-shadow: 0 18px 40px rgba(47,124,246,.34); }
.big-button.secondary { background: linear-gradient(135deg, #ffd166, #f0a93b); color: #1b1b1f; box-shadow: 0 18px 40px rgba(255,209,102,.25); }
.big-button:hover { transform: translateY(-3px); }

.back-link { display: inline-block; margin-bottom: 20px; color: var(--muted); }
.option-list { display: grid; gap: 14px; margin-top: 24px; }
.option-card {
  display: flex; align-items: center; gap: 16px;
  padding: 20px; border-radius: 18px; color: var(--text);
  background: rgba(255,255,255,.04); border: 1px solid var(--border);
  transition: .18s ease;
}
.option-card:hover { background: rgba(86, 151, 255, .14); transform: translateX(4px); }
.option-index { color: var(--gold); font-weight: 900; font-size: 1.05rem; }
.option-main { display: flex; flex-direction: column; flex: 1; }
.option-main strong { font-size: 1.16rem; }
.option-main small { color: var(--muted); }
.option-arrow { font-size: 1.5rem; color: var(--primary-2); }

.notice { border-radius: 14px; padding: 14px 16px; margin: 18px 0; border: 1px solid rgba(255, 209, 102, .35); background: rgba(255, 209, 102, .1); color: #ffe9b0; }
.notice.danger { border-color: rgba(255, 107, 129, .45); background: rgba(255, 107, 129, .12); color: #ffd6dd; }
.status-box { border-radius: 14px; padding: 14px 16px; background: rgba(47, 124, 246, .14); border: 1px solid rgba(98, 180, 255, .32); margin: 18px 0; }
.status-box.error { background: rgba(255, 107, 129, .14); border-color: rgba(255, 107, 129, .4); }
.status-box.ok { background: rgba(74, 222, 128, .13); border-color: rgba(74, 222, 128, .38); }

.method-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 18px 0; }
.method-card { background: var(--panel-2); border: 1px solid var(--border); border-radius: 18px; padding: 20px; }
.method-tag { display: inline-block; font-size: .74rem; font-weight: 800; color: #0a1224; background: var(--gold); border-radius: 999px; padding: 3px 10px; margin-bottom: 12px; }
.section-title { margin: 34px 0 6px; }
.field-label { display: block; margin: 15px 0 7px; color: #cfdcf7; font-weight: 700; font-size: .9rem; }
input[type="text"], input[type="password"], input[type="file"], textarea, select {
  width: 100%; border-radius: 12px; border: 1px solid var(--border); background: rgba(6, 14, 30, .72);
  color: var(--text); padding: 13px 14px; font: inherit; outline: none;
}
input[type="text"]:focus, input[type="password"]:focus, textarea:focus { border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(98,180,255,.18); }
input[type="file"] { padding: 10px; }
textarea { resize: vertical; min-height: 130px; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 12px 18px; border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-weight: 800; cursor: pointer; text-decoration: none; transition: .16s ease;
}
.button.primary { background: linear-gradient(135deg, #2f7cf6, #57a8ff); color: #fff; }
.button.ghost { background: rgba(255,255,255,.06); border-color: var(--border); color: var(--text); }
.button.danger { background: linear-gradient(135deg, #ff6b81, #ff8c6b); color: #241014; }
.button.block { display: flex; width: 100%; margin-top: 12px; }
.button.small-button { min-height: 38px; padding: 8px 14px; font-size: .88rem; }
.button:disabled { opacity: .55; cursor: not-allowed; }

.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.details-box { margin-top: 14px; border: 1px dashed var(--border); border-radius: 12px; padding: 12px 14px; }
.details-box summary { cursor: pointer; font-weight: 700; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.info-grid div { background: rgba(255,255,255,.05); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.info-grid span { display: block; color: var(--muted); font-size: .8rem; }
.info-grid strong { word-break: break-all; }
.form-error, .form-success { border-radius: 12px; padding: 12px 14px; margin: 14px 0; }
.form-error { background: rgba(255, 107, 129, .14); border: 1px solid rgba(255, 107, 129, .42); color: #ffd6dd; }
.form-success { background: rgba(74, 222, 128, .13); border: 1px solid rgba(74, 222, 128, .4); color: #d7ffe5; }
.result-panel { margin-top: 20px; background: rgba(7, 16, 34, .68); border: 1px solid var(--border); border-radius: 18px; padding: 20px; }
.result-panel.success { border-color: rgba(74, 222, 128, .5); }
.key-display { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: clamp(1rem, 3.6vw, 1.35rem); word-break: break-all; background: rgba(47,124,246,.16); border: 1px dashed rgba(98,180,255,.55); border-radius: 14px; padding: 18px; margin: 14px 0; }
.warn-banner { display: block; text-align: center; font-size: clamp(1.35rem, 5vw, 2.1rem); font-weight: 900; color: #ffdfe3; background: rgba(255, 107, 129, .16); border: 2px solid rgba(255, 107, 129, .55); border-radius: 16px; padding: 14px; margin-bottom: 18px; }

.admin-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.inline-form { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline-form input[type="password"], .inline-form input[type="text"] { width: auto; min-width: 220px; }
.table-wrap { overflow-x: auto; margin-top: 18px; border: 1px solid var(--border); border-radius: 14px; }
.data-table, .flow-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.data-table th, .data-table td, .flow-table th, .flow-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table th, .flow-table th { background: rgba(255,255,255,.05); color: #cfdcf7; font-size: .84rem; position: sticky; top: 0; }
.data-table tr:last-child td, .flow-table tr:last-child td { border-bottom: 0; }
.key-cell code { word-break: break-all; }
.copy-mini, .mini { border: 1px solid var(--border); border-radius: 8px; background: rgba(255,255,255,.08); color: var(--text); padding: 6px 9px; cursor: pointer; font-size: .78rem; margin: 2px; }
.copy-mini:hover, .mini:hover { background: rgba(98,180,255,.2); }
.mini.danger { color: #ffd6dd; border-color: rgba(255,107,129,.45); }
.badge { display: inline-block; border-radius: 999px; padding: 3px 9px; font-size: .74rem; background: rgba(255,255,255,.1); }
.badge.ok { background: rgba(74,222,128,.18); color: #b8ffd0; }
.action-cell { min-width: 170px; }

.site-footer { text-align: center; color: rgba(159,176,212,.65); font-size: .8rem; margin-top: 32px; }

/* check-in mobile-first */
.checkin-body .shell { width: min(760px, 94vw); padding-top: 18px; }
.checkin-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.checkin-header h1 { margin: 0; font-size: 1.75rem; }
.live-dot { display: inline-flex; align-items: center; gap: 7px; color: #b8ffd0; font-size: .78rem; background: rgba(74,222,128,.12); padding: 6px 10px; border-radius: 999px; white-space: nowrap; }
.live-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(74,222,128,.14); animation: pulse 1.6s infinite; }
.live-dot.offline { color: #ffd6dd; background: rgba(255,107,129,.12); }
.live-dot.offline::before { background: var(--danger); }
@keyframes pulse { 50% { transform: scale(.75); opacity: .55; } }
.checkin-card { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 16px; margin-bottom: 14px; box-shadow: 0 14px 40px rgba(0,0,0,.24); }
.count-card { display: flex; align-items: center; justify-content: space-between; }
.count-card strong { font-size: 2.6rem; color: var(--gold); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-head h2 { margin: 0; }
.flow-table { min-width: 0; width: 100%; table-layout: fixed; }
.flow-table th:nth-child(1), .flow-table td:nth-child(1) { width: 22%; }
.flow-table th:nth-child(2), .flow-table td:nth-child(2) { width: 40%; }
.flow-table th:nth-child(3), .flow-table td:nth-child(3) { width: 22%; }
.flow-table th:nth-child(4), .flow-table td:nth-child(4) { width: 16%; }
.flow-table td { font-size: .82rem; word-break: break-all; }
.flow-table td.empty { text-align: center; color: var(--muted); font-size: .9rem; }
.search-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.search-grid .button { grid-column: span 1; }
.new-row { animation: new-row .8s ease; }
@keyframes new-row { from { background: rgba(74,222,128,.28); } }

@media (max-width: 760px) {
  .shell { width: 94vw; padding-top: 18px; }
  .card-glass { border-radius: 18px; padding: 20px; }
  .home-actions { gap: 10px; margin: 26px auto 18px; }
  .big-button { min-height: 104px; border-radius: 16px; }
  .method-grid, .info-grid { grid-template-columns: 1fr; }
  .admin-head { flex-direction: column; }
  .inline-form input[type="password"], .inline-form input[type="text"] { min-width: 0; width: 100%; }
  .search-grid { grid-template-columns: 1fr 1fr; }
  .search-grid input { grid-column: span 2; }
  .search-grid .button { grid-column: span 1; }
  .data-table { min-width: 880px; }
}

/* Fixed feedback toast so button clicks are always visible even when the page is scrolled. */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 22px);
  max-width: min(720px, 92vw);
  padding: 13px 18px;
  border-radius: 14px;
  background: rgba(17, 29, 54, 0.98);
  border: 1px solid rgba(137, 178, 255, 0.35);
  color: #eef5ff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 9999;
  font-size: .92rem;
  line-height: 1.45;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast.error { border-color: rgba(255, 107, 129, .55); background: rgba(72, 20, 30, .98); }
.toast.ok { border-color: rgba(74, 222, 128, .5); background: rgba(14, 52, 32, .98); }

@media (max-width: 760px) {
  .bg-photo { opacity: 0; filter: saturate(.65) brightness(.72); }
  @keyframes bg-photo-cycle {
    0% { opacity: 0; }
    8% { opacity: .12; }
    18% { opacity: .12; }
    26% { opacity: 0; }
    100% { opacity: 0; }
  }
}

@media (prefers-reduced-motion: reduce) {
  .bg-photo { animation: none; opacity: .1; }
  .bg-photo-2, .bg-photo-3, .bg-photo-4, .bg-photo-5 { display: none; }
}
