:root {
  --bg: #FBF7EE;
  --panel: #FFFFFF;
  --ink: #22271F;
  --ink-soft: #5B5C4F;
  --accent: #DD8F2C;
  --accent-ink: #5A3B0C;
  --accent-2: #2E6E60;
  --line: #E1D9C2;
  --danger: #B54430;
  --danger-bg: #F7E7E1;
  --ok-bg: #EAF2ED;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1B1B15;
    --panel: #242419;
    --ink: #F1EEE1;
    --ink-soft: #B9B4A0;
    --accent: #EFA24E;
    --accent-ink: #3A2505;
    --accent-2: #5FAA97;
    --line: #3B392A;
    --danger: #E08268;
    --danger-bg: #3A241F;
    --ok-bg: #223028;
  }
}
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', system-ui, sans-serif;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3, .brand { font-family: 'Zen Maru Gothic', 'Noto Sans JP', 'Hiragino Maru Gothic ProN', sans-serif; }
#app { max-width: 480px; margin: 0 auto; padding: 20px 16px 64px; }
.loading { color: var(--ink-soft); text-align: center; padding: 40px 0; }
header.top { padding: 6px 0 18px; border-bottom: 3px solid var(--accent); margin-bottom: 20px; }
header.top .brand { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
header.top .hours { color: var(--ink-soft); font-size: 14px; }
.updated { color: var(--ink-soft); font-size: 12px; }
.staff-link {
  display: inline-block; margin-top: 10px; font-size: 12px; color: var(--ink-soft);
  text-decoration: underline; background: none; border: none; padding: 4px 0; cursor: pointer; font-family: inherit;
}
section { margin-bottom: 28px; }
.step-title { display: flex; align-items: baseline; gap: 8px; margin: 0 0 4px; font-size: 17px; font-weight: 700; }
.step-num { color: var(--accent); font-size: 15px; font-weight: 700; }
.step-desc { color: var(--ink-soft); font-size: 13.5px; margin: 0 0 12px; }
.grade-picker { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 10px 0 14px; }
.grade-title { font-weight: 700; margin-bottom: 8px; }
.grade-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.grade-option input { position: absolute; opacity: 0; pointer-events: none; }
.grade-option span { display: block; min-height: 44px; padding: 9px 6px; border: 1px solid var(--line); border-radius: 8px; text-align: center; font-size: 13px; cursor: pointer; }
.grade-option input:checked + span { border-color: var(--accent-2); background: var(--ok-bg); color: var(--accent-2); font-weight: 700; }
.grade-option input:focus-visible + span { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.booth-card {
  background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--accent-2);
  border-radius: 8px; padding: 12px 14px; margin-bottom: 10px;
}
.booth-card.dim { opacity: 0.55; }
.booth-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.booth-name { font-weight: 700; font-size: 15.5px; }
.booth-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
.booth-check input { width: 18px; height: 18px; accent-color: var(--accent-2); }
details.booth-card summary { cursor: pointer; list-style: none; }
details.booth-card summary::-webkit-details-marker { display: none; }
.summary-meta { font-size: 12.5px; color: var(--ink-soft); }
.slot-list { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.slot-chip { font-size: 12.5px; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-soft); }
.slot-chip.avail { border-color: var(--accent-2); color: var(--accent-2); }
.slot-chip.full { text-decoration: line-through; opacity: 0.6; }
.slot-chip.age-outside { opacity: 0.38; text-decoration: none; }
.age-badge { display: inline-block; margin: 0 4px; padding: 1px 5px; border-radius: 4px; font-size: 10px; line-height: 1.5; font-weight: 700; text-decoration: none; }
.age-k2 { background: #F8DDE4; color: #82364B; }
.age-e35 { background: #FFF0BC; color: #70530A; }
.age-e6j2 { background: #DCEAF8; color: #285577; }
.age-all { background: #E2E8DE; color: #3F5940; }
.outside-text { display: inline-block; margin-left: 3px; font-size: 10px; font-weight: 700; }
.no-age-slots { color: var(--danger); font-size: 12px; margin: 2px 0; }
select, input[type="text"], input[type="password"], input[type="number"], input[type="time"] {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px;
}
.reserve-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px;
}
.reserve-row select { flex: 1 1 120px; min-width: 0; }
.btn {
  font: inherit; font-weight: 700; cursor: pointer; border: none; border-radius: 8px;
  padding: 11px 16px; background: var(--accent); color: var(--accent-ink);
}
.btn.secondary { background: transparent; color: var(--accent-2); border: 1px solid var(--accent-2); font-weight: 500; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.ghost { background: none; border: 1px solid var(--line); color: var(--ink-soft); font-weight: 500; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible, .count-btn:focus-visible, .remove-x:focus-visible, .staff-link:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent-2); outline-offset: 2px;
}
.remove-x { background: none; border: none; color: var(--ink-soft); font-size: 16px; cursor: pointer; padding: 2px 8px; }
.plan-notice { margin: 8px 0 12px; padding: 8px 10px; border-left: 3px solid var(--accent-2); background: var(--ok-bg); color: var(--ink-soft); font-size: 12.5px; }
.plan-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.plan-item:last-child { border-bottom: none; }
.plan-time { font-weight: 700; font-size: 13.5px; width: 96px; flex: none; color: var(--accent-2); }
.plan-body .name { font-weight: 700; font-size: 14.5px; }
.plan-body .tag { font-size: 12px; color: var(--ink-soft); }
.gap-card { background: var(--ok-bg); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; font-size: 13.5px; }
.warn-card { background: var(--danger-bg); color: var(--danger); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; font-size: 13.5px; }
.admin-panel { background: var(--panel); border: 1px dashed var(--accent); border-radius: 10px; padding: 14px; }
.admin-booth { border-bottom: 1px solid var(--line); padding: 12px 0; }
.admin-booth:last-of-type { border-bottom: none; }
.admin-booth .booth-head input { flex: 1; min-width: 0; font-weight: 700; }
.admin-slot-row { display: flex; align-items: center; gap: 6px; font-size: 13px; margin: 8px 0; flex-wrap: wrap; }
.admin-slot-row input[type="time"] { width: 104px; }
.admin-slot-row input[type="number"] { width: 64px; }
.admin-ages { display: flex; flex: 1 1 100%; flex-wrap: wrap; gap: 4px; }
.admin-age-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.admin-age-toggle span { display: block; padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-soft); font-size: 11px; line-height: 1.5; cursor: pointer; }
.admin-age-toggle input:checked + span { border-color: var(--accent-2); background: var(--ok-bg); color: var(--accent-2); font-weight: 700; }
.admin-age-toggle input:focus-visible + span { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.count-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink); font-weight: 700; cursor: pointer; line-height: 1; font-size: 16px;
}
.cap-badge { font-size: 13px; min-width: 64px; text-align: center; }
.cap-badge.full { color: var(--danger); font-weight: 700; }
.field-row { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; align-items: center; font-size: 13px; }
.field-row label { display: flex; gap: 6px; align-items: center; }
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 13px;
  z-index: 50; opacity: 0; pointer-events: none; transition: opacity 0.25s ease; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; }
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center;
  justify-content: center; padding: 20px; z-index: 60;
}
.modal { background: var(--panel); border-radius: 12px; padding: 20px; max-width: 340px; width: 100%; }
.modal h3 { margin-top: 0; }
.modal input { width: 100%; }
.modal .field-row { flex-wrap: nowrap; }
.modal .btn { flex: 1; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
.gap-lead { margin-top: 14px; }
.add-booth { margin-top: 12px; }
.admin-slot-row { padding-bottom: 8px; border-bottom: 1px dotted var(--line); }
@media (prefers-color-scheme: dark) {
  .age-k2 { background: #512D37; color: #F5BECF; }
  .age-e35 { background: #4A3C18; color: #F3D77B; }
  .age-e6j2 { background: #233E55; color: #B9D9F3; }
  .age-all { background: #304331; color: #C9DEC5; }
}
@media (max-width: 480px) {
  .admin-ages { flex-basis: 100%; }
  .admin-slot-row .remove-x { margin-left: auto; }
}
