:root {
  color-scheme: light dark;
  --bg: #faf7f2;
  --panel: #ffffff;
  --ink: #241f1a;
  --muted: #7c7166;
  --line: #e6ded2;
  --accent: #8c3b2e;
  --accent-soft: #f4e8e3;
  --ok: #2f6b4f;
  --danger: #a03024;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(36, 31, 26, .06), 0 8px 24px rgba(36, 31, 26, .06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17140f;
    --panel: #211d17;
    --ink: #f0e9df;
    --muted: #a99c8d;
    --line: #352f26;
    --accent: #e28a72;
    --accent-soft: #33251f;
    --ok: #7fc4a0;
    --danger: #e0796a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.page-head {
  text-align: center;
  margin-bottom: 36px;
}

.page-head h1 {
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 6vw, 44px);
  font-weight: 600;
  letter-spacing: .01em;
  margin: 0 0 6px;
}

.page-head p {
  margin: 0;
  color: var(--muted);
}

.rule {
  width: 64px;
  height: 2px;
  background: var(--accent);
  border: 0;
  margin: 18px auto 0;
  opacity: .55;
}

h2.section {
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 4px;
}

.section-note {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 16px;
}

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

/* --- guest menu --- */

.menu-list { list-style: none; margin: 0; padding: 0; }

.menu-list li {
  padding: 14px 0;
  border-bottom: 1px dashed var(--line);
}

.menu-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.menu-list li:first-child { padding-top: 0; }

.menu-name {
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 600;
}

.menu-desc {
  color: var(--muted);
  font-size: 14.5px;
  margin-top: 3px;
  white-space: pre-wrap;
}

.empty {
  color: var(--muted);
  font-style: italic;
  padding: 6px 0;
}

/* --- forms & buttons --- */

label.field {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

textarea { resize: vertical; min-height: 68px; }

input:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

button {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 9px 16px;
  background: var(--accent);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  button { color: #1b1510; }
}

button:hover { filter: brightness(1.06); }

button.ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

button.ghost:hover { color: var(--ink); }

button.link {
  background: none;
  border: 0;
  padding: 4px 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

button.link:hover { color: var(--ink); text-decoration: underline; }
button.link.danger:hover { color: var(--danger); }

/* --- admin --- */

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.topbar h1 {
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-size: 26px;
  margin: 0;
}

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

.login-card { max-width: 380px; margin: 60px auto 0; }

.admin-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.admin-item:last-child { border-bottom: 0; padding-bottom: 0; }

.admin-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--accent);
  flex: none;
  cursor: pointer;
}

.admin-item .body { flex: 1; min-width: 0; }
.admin-item .body .name { font-weight: 600; }
.admin-item .body .desc { color: var(--muted); font-size: 14px; white-space: pre-wrap; }
.admin-item.hidden-item .body { opacity: .5; }

.pill {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
}

.pill.off { background: transparent; border: 1px solid var(--line); color: var(--muted); }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; }

.add-form {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 18px;
}

.msg {
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}

.msg.error { background: var(--accent-soft); color: var(--danger); }
.msg.ok { background: var(--accent-soft); color: var(--ok); }

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 36px;
}

.foot a { color: var(--muted); }

/* --- codes --- */

input.code-input {
  font-size: 34px;
  font-weight: 600;
  letter-spacing: .5em;
  text-align: center;
  text-indent: .5em; /* balances the trailing letter-spacing */
  padding: 14px 12px;
}

input.code-small {
  width: 140px;
  font-size: 18px;
  letter-spacing: .28em;
  text-align: center;
  margin-bottom: 0;
}

.code-display {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(40px, 11vw, 58px);
  font-weight: 700;
  letter-spacing: .16em;
  text-indent: .16em;
  text-align: center;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 18px 12px;
  margin-bottom: 10px;
  user-select: all;
}

.tick-label {
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

.tick-label input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  cursor: pointer;
}

#guest-code-form { margin-top: 4px; }
