/* One column of event cards, and a bar along the bottom that saves them. */
:root {
  --ground: #f6f7f9;
  --card: #ffffff;
  --ink: #1d2128;
  --sub: #5d6573;
  --rule: #dde1e7;
  --accent: #2f5fa8;
  --accent-ink: #ffffff;
  --chip-on: #e6eefa;
  --danger: #b3261e;
  --font-body: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', system-ui, sans-serif;
  --bar-space: calc(76px + env(safe-area-inset-bottom, 0px)); /* what the bar covers */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #1a1d22; --card: #22262d; --ink: #e6e9ee; --sub: #a0a8b5; --rule: #343a44;
    --accent: #8fb4ee; --accent-ink: #10151d; --chip-on: #2a3a55; --danger: #f2877e;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #1a1d22; --card: #22262d; --ink: #e6e9ee; --sub: #a0a8b5; --rule: #343a44;
  --accent: #8fb4ee; --accent-ink: #10151d; --chip-on: #2a3a55; --danger: #f2877e;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.6 var(--font-body);
  font-variant-numeric: tabular-nums;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) 16px var(--bar-space);
}
.top h1 { font-size: 22px; margin: 0 0 4px; }
.lead { margin: 0 0 20px; color: var(--sub); font-size: 13px; }
.note { color: var(--sub); font-size: 12px; margin: 16px 0 24px; }

.event {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  display: grid;
  gap: 14px;
  scroll-margin-top: 16px;
}
.event-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.event-no { font-size: 13px; font-weight: 600; color: var(--sub); margin: 0; }
.event-actions { display: flex; gap: 4px; }
.link { appearance: none; background: none; border: 0; padding: 6px 8px; border-radius: 6px; color: var(--accent); cursor: pointer; font-size: 13px; }
.link.danger { color: var(--danger); }
@media (hover: hover) { .link:hover { background: var(--ground); } }

.field { display: grid; gap: 6px; min-width: 0; }
.label { font-size: 12px; color: var(--sub); }
/* 16px より小さい入力欄は、iPhone が拡大したまま戻さない */
.input {
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 8px 10px;
}
textarea.input { resize: vertical; min-height: 64px; }
select.input { padding-right: 28px; }
.input.num { width: 4.5em; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; justify-self: start; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }

.when { display: grid; gap: 12px; }
.dt { display: flex; gap: 6px; }
.dt .input { flex: 1 1 0; }
.dt .input.time { flex: 0 0 7.5em; }

.repeat-more { display: grid; gap: 10px; margin-top: 4px; padding-left: 12px; border-left: 2px solid var(--rule); }
.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inline select.input { width: auto; }
.inline input[type="date"].input { width: auto; }
.unit { color: var(--sub); font-size: 14px; }

.chips, .weekdays { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  appearance: none;
  border: 1px solid var(--rule);
  background: var(--card);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.weekdays { gap: 4px; }
.weekdays .chip { width: 36px; padding: 6px 0; }
.chip[aria-pressed="true"] { background: var(--chip-on); border-color: var(--accent); color: var(--accent); font-weight: 600; }

.problems { margin: 0; padding: 0; list-style: none; color: var(--danger); font-size: 13px; }
.problems:empty { display: none; }

.btn { appearance: none; border-radius: 10px; padding: 10px 18px; font-weight: 600; cursor: pointer; border: 1px solid transparent; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:disabled { opacity: 0.4; cursor: default; }
.btn.ghost { background: none; border-color: var(--rule); color: var(--ink); font-weight: 500; }
.btn.block { display: block; width: 100%; }
.btn:active:not(:disabled) { transform: scale(0.98); }

.bar {
  position: fixed;
  inset: auto 0 0;
  background: color-mix(in srgb, var(--ground) 92%, transparent);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--rule);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
}
.bar-inner { max-width: 640px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.status { color: var(--sub); font-size: 13px; min-width: 0; }
