:root {
  --bg: #fffaf0;
  --card: #ffffff;
  --text: #1c1e19;
  --muted: #6b6455;
  --primary: #1c1e19;
  --primary-2: #f7a501;
  --primary-soft: #fff1cc;
  --ok: #2e7d32;
  --ok-soft: #e3f4e4;
  --warn: #b26a00;
  --warn-soft: #fff1d6;
  --danger: #c62828;
  --border: #efe2c4;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(28, 30, 25, 0.07);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

.wrap { max-width: 480px; margin: 0 auto; padding: 20px 16px 40px; }
header.brand { text-align: center; margin: 0 0 20px; }
header.brand .logo { display: block; width: 120px; height: 120px; margin: 0 auto 10px; border-radius: 22px; box-shadow: var(--shadow); }
header.brand .event { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
header.brand h1 { margin: 4px 0 0; font-size: 24px; color: var(--primary); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

h2 { margin: 0 0 12px; font-size: 20px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }

label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; }
input[type=text], input[type=tel], input[type=number], input[type=time], input[type=password], select, textarea {
  width: 100%;
  font: inherit;
  font-size: 17px;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 13px; color: var(--muted); }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--primary); flex: none; }
.check + .check { margin-top: 10px; }
.optional { font-weight: 600; color: var(--muted); }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 16px;
  border: 0; border-radius: 12px; padding: 13px 18px;
  background: var(--primary); color: #fff; cursor: pointer; text-decoration: none;
  transition: transform .05s, opacity .2s;
}
button:active { transform: scale(.98); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.block { width: 100%; margin-top: 18px; padding: 15px; font-size: 17px; }
button.ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--border); }
button.danger { background: transparent; color: var(--danger); border: 1.5px solid #f3c2c2; }
button.ok { background: var(--ok); }
button.warn { background: var(--warn); }
button.sm { padding: 8px 12px; font-size: 14px; border-radius: 10px; }

.error { color: var(--danger); font-size: 14px; margin-top: 10px; min-height: 1em; }

.stats { display: flex; gap: 12px; }
.stat { flex: 1; background: var(--primary-soft); border-radius: 14px; padding: 12px; text-align: center; }
.stat b { display: block; font-size: 24px; color: var(--primary); }
.stat span { font-size: 12px; color: var(--muted); }

/* Ticket */
.ticket-head { text-align: center; }
.ticket-number { font-size: 64px; font-weight: 800; color: var(--primary); line-height: 1; margin: 6px 0; }
.ticket-name { font-size: 18px; font-weight: 600; }
.position { font-size: 56px; font-weight: 800; line-height: 1; }
.position small { font-size: 22px; font-weight: 700; }
.status-card { text-align: center; }
.status-card.approaching { background: var(--warn-soft); border-color: #f5d79a; }
.status-card.called { background: var(--primary-2); color: var(--primary); border-color: var(--primary-2); animation: pulse 1.4s infinite; }
.status-card.called .muted { color: #3d3200; }
.status-card.serving, .status-card.done { background: var(--ok-soft); border-color: #bfe3c1; }
.big-msg { font-size: 30px; font-weight: 800; margin: 4px 0 8px; }
.countdown { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(247, 165, 1, .55); }
  50% { box-shadow: 0 0 0 14px rgba(247, 165, 1, 0); }
}

.progress { height: 10px; background: var(--primary-soft); border-radius: 99px; overflow: hidden; margin: 14px 0 4px; }
.progress > div { height: 100%; background: var(--primary-2); transition: width .6s; }

.notice { border-radius: 14px; padding: 14px; font-size: 14px; margin-bottom: 16px; }
.notice.info { background: #eef4ff; color: #1d3c78; }
.notice.warn { background: var(--warn-soft); color: #6b4300; }
.notice ol { margin: 8px 0 0; padding-left: 20px; }

.conn { position: fixed; top: 0; left: 0; right: 0; background: #333; color: #fff; text-align: center; font-size: 13px; padding: 6px; z-index: 10; }

footer { text-align: center; font-size: 12px; color: var(--muted); margin-top: 24px; }
