:root {
  --bg: #f6f7f9; --card: #fff; --text: #1f2328; --muted: #656d76; --line: #d8dee4;
  --accent: #1f6feb; --accent-text: #fff;
  --o: #1a7f37; --o-bg: #dafbe1; --x: #cf222e; --x-bg: #ffebe9; --x-cell: #eef1f4;
  --sat: #0969da; --sun: #cf222e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117; --card: #161b22; --text: #e6edf3; --muted: #8d96a0; --line: #30363d;
    --accent: #2f81f7;
    --o: #3fb950; --o-bg: #12301b; --x: #f85149; --x-bg: #3b1416; --x-cell: #21262d;
    --sat: #58a6ff; --sun: #ff7b72;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif; }
main { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 1.4rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
label { display: block; font-weight: 600; margin: 14px 0 6px; }
label:first-child { margin-top: 0; }
.req { color: var(--x); font-size: .8rem; margin-left: 4px; }
input[type=text], input[type=date], textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; }
textarea { min-height: 80px; resize: vertical; }
button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); padding: 8px 14px; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent);
  font-weight: 700; padding: 12px 20px; width: 100%; margin-top: 20px; }
button:disabled { opacity: .6; cursor: default; }
button.small { padding: 4px 10px; font-size: .85rem; }
button.danger { color: var(--x); }
.error { color: var(--x); margin-top: 12px; white-space: pre-wrap; }
.ok { color: var(--o); font-weight: 600; }
.note { white-space: pre-wrap; color: var(--muted); margin: 8px 0 0; }
.date { font-size: 1.15rem; font-weight: 700; }

/* 共有URL */
.share { display: flex; gap: 6px; }
.share input { flex: 1; min-width: 0; font-size: .9rem; }
.hint { color: var(--muted); font-size: .85rem; margin: 6px 0 0; }

.mine { list-style: none; padding: 0; margin: 0; }
.mine li { padding: 6px 0; border-top: 1px solid var(--line); }
.mine li:first-child { border-top: 0; }
a { color: var(--accent); }

/* タイムライン（行=日付、列=時間） */
.legend { color: var(--muted); font-size: .9rem; margin: 0 0 12px; }
.bulk { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; color: var(--muted); font-size: .9rem; }
.tl { display: grid; gap: 3px; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.tl-head { position: sticky; top: 0; z-index: 2; background: var(--card); padding: 6px 0 2px; }
.tl-row { display: grid; grid-template-columns: 5.6em repeat(var(--cols), minmax(0, 1fr)); gap: 3px; align-items: stretch; }
.tl-date { font-size: .85rem; font-weight: 600; display: flex; align-items: center; gap: 1px; white-space: nowrap;
  font-variant-numeric: tabular-nums; padding: 0; background: none; border: 0; color: inherit; text-align: left; }
.tl-date .dw::before { content: "（"; } .tl-date .dw::after { content: "）"; }
.tl-date.sat { color: var(--sat); } .tl-date.sun { color: var(--sun); }
button.tl-date { cursor: pointer; border-radius: 4px; }
button.tl-date:hover { text-decoration: underline; }
.tl-head .tl-hour, .tl-head button { font-size: .75rem; color: var(--muted); text-align: left; padding: 0 0 2px;
  border: 0; border-left: 1px solid var(--line); border-radius: 0; background: none; padding-left: 3px; }
.tl-head button:hover { color: var(--text); }
.cell { height: 34px; border-radius: 4px; border: 1px solid transparent; padding: 0; font-size: .95rem; line-height: 1;
  display: flex; align-items: center; justify-content: center; background: var(--x-cell); color: var(--muted); }
button.cell { cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color .08s; }
.cell.o { background: var(--o-bg); border-color: var(--o); color: var(--o); font-weight: 700; }
.cell.x { color: var(--x); }
.cell.none { color: var(--muted); }
.views { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.views button[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.ok-list { margin: 0; padding-left: 1.2em; }
.ok-list li { font-variant-numeric: tabular-nums; }
.resp-list { list-style: none; padding: 0; margin: 0; }
.resp-list li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.resp-list li:first-child { border-top: 0; }
.resp-list .c { color: var(--muted); font-size: .9rem; white-space: pre-wrap; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row2 label { margin-top: 14px; }
.ng { display: grid; gap: 12px; }
.ng-head { font-weight: 700; margin-bottom: 2px; }

/* 回答画面：使い方・送信バー */
.howto { margin: 0 0 12px; padding-left: 1.2em; color: var(--muted); font-size: .9rem; }
.howto b { color: var(--text); }
.bulk button { padding: 6px 14px; }
button { touch-action: manipulation; }
.submit-bar { position: sticky; bottom: 0; z-index: 3; display: flex; align-items: center; gap: 12px;
  margin: 16px -20px -20px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; }
.submit-bar .primary { margin: 0; width: auto; flex: 1; }
.sel-count { color: var(--muted); font-size: .85rem; white-space: nowrap; }

/* スマホ */
@media (max-width: 600px) {
  main { padding: 16px 10px 40px; }
  .card { padding: 16px 14px; border-radius: 10px; }
  h1 { font-size: 1.25rem; }
  .pc-only { display: none; }
  #grid { margin: 0 -8px; }
  .tl, .tl-row { gap: 2px; }
  .tl-row { grid-template-columns: 2.7em repeat(var(--cols), minmax(0, 1fr)); }
  .tl-date { flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; line-height: 1.15; font-size: .8rem; }
  .tl-date .dw { font-size: .72rem; font-weight: 500; }
  .tl-date .dw::before, .tl-date .dw::after { content: none; }
  .tl-head .tl-date { display: block; }
  .tl-head .tl-hour, .tl-head button { font-size: .72rem; padding-left: 2px; }
  .cell { height: 44px; font-size: .9rem; border-radius: 3px; }
  .submit-bar { margin: 16px -14px -16px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
}

/* 作成画面：時間枠・休日 */
fieldset.slot-setting { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 14px; margin: 16px 0 0; min-width: 0; }
fieldset.slot-setting legend { font-weight: 600; padding: 0 4px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 4px; }
.seg label, label.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; margin: 8px 0 0; cursor: pointer; }
label.check { margin-top: 12px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
select, input[type=time], input[type=password] { width: 100%; padding: 10px 12px; font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.row3 label { margin-top: 10px; font-weight: 500; font-size: .9rem; }
.custom-list { display: grid; gap: 8px; margin: 8px 0 10px; }
.custom-row { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 8px; align-items: center; }
.slot-preview { margin: 12px 0 0; font-size: .9rem; color: var(--o); }
.slot-preview.bad { color: var(--x); }
.mine li { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
/* 飛び飛びの時間枠の見出し（開始／〜終了の2行） */
.tl-head-range .tl-hour > span, .tl-head-range button > span { display: flex; flex-direction: column; line-height: 1.2; }
.tl-head-range .to { font-size: .85em; opacity: .8; }
.tl-head .tl-hour, .tl-head button { overflow: hidden; }
@media (max-width: 600px) {
  .row3 { grid-template-columns: 1fr 1fr; }
  .row3 > div:last-child { grid-column: 1 / -1; }
  .tl-head-range .tl-hour, .tl-head-range button { font-size: .62rem; }
}
.slot-info { margin: 6px 0 0; font-size: .9rem; }

.privacy { color: var(--muted); font-size: .8rem; margin: 14px 0 0; }
.closed-notice { color: var(--x); font-weight: 600; }
