/* システム UI の骨格は無彩色(デザインの規則 1・3・4)。地 #F6F6F5、主墨 #141413。外部フォントは読み込まない。
   レイアウトで語る: 丸四角の箱に入れず、8px 刻みの余白・1px の区切り線・文字の階層で組む(2026-12-02 一次チェック)。
   角丸は 3 トークン: 情報面・表・区切り線・確認の帯は 0、並ぶ操作(リモコンのボタン・行の中のボタン・入力欄)は 8px、
   余白に単独で置くワンアクション(コピー・ログイン・ログアウト)は 999px のカプセル型(2026-12-02 確定)。
   反転ボタンは白文字 600。主アクションは深いエメラルド #0F7356、停止・退出・失効は締めたピンク #B82E5E(同日確定)。
   固定背景にだけ、主張しない極薄のエメラルド(＋わずかなピンク)の滲み・粒状・泡の網目をスポットで載せる。
   全面のすりガラス板は置かない。
   値の正本は Design System v1.1 の /web/tokens.css(--if-*)。ここでは既存の名前を別名として残す(値の違うものだけ手元の値)。 */
:root {
  --bg: var(--if-bg);
  --ink: var(--if-fg);
  --ink-hover: var(--if-p-ink-800);
  --on-ink: var(--if-p-white);
  --on-ink-muted: #d8d8d6;
  /* 滲みの中心(エメラルド 14%)の上で、ふつうの行の定常は 7:1 以上、ティントの上でも 6:1 以上(あなた宛ての新着で 6.06:1。AA の 4.5:1 以上) */
  --muted: var(--if-fg-muted);
  --line: var(--if-border);
  --line-strong: rgba(20, 20, 19, 0.3); /* tokens.css の --if-border-strong(0.28)より枠をわずかに濃く保つため、既存の 0.3 を維持 */
  --surface: rgba(255, 255, 255, 0.72); /* 入力欄など、操作の面だけに使う。--if-surface-control(0.78)との差は見えない(主墨の文字で 18.0:1 と 18.1:1)ので既存の値を維持 */
  --code-bg: rgba(20, 20, 19, 0.04);
  --tint-new: rgba(18, 141, 107, 0.07); /* 新着を一瞬だけ知らせる、ごく淡いティント */
  --accent-emerald-text: var(--if-accent-text); /* 「あなた宛て」の文字(地に対して 5.8:1、ふつうの行は滲みの中心で 5.0:1)。ティントを敷く .item.is-mine の行と新着の行では --if-primary-hover にして 5.2:1 以上を保つ */
  --bg-clear: rgba(246, 246, 245, 0); /* 地の色の透明(フェードの終わり) */
  --edge-shadow: rgba(20, 20, 19, 0.08); /* コードの右端の、続きがある印 */
  --glass: rgba(255, 255, 255, 0.8); /* 確認の帯など、極小のスポットだけに使う */
  /* 背景の滲み(主軸のエメラルド × ピンク) */
  --spot-emerald: rgba(70, 188, 152, 0.14);
  --spot-emerald-deep: rgba(18, 141, 107, 0.08);
  --spot-pink: rgba(228, 74, 126, 0.05);
  --ease-out: var(--if-ease-out);
  --font: var(--if-font-sans);
  /* 数字は Space Grotesk があれば使い、無ければ本文の書体の等幅数字にする(モノスペースは飾りに使わない) */
  --font-num: "Space Grotesk", var(--font);
  --font-code: var(--if-font-mono);
  /* 余白は 8px 刻み */
  --space-1: var(--if-space-1);
  --space-2: var(--if-space-2);
  --space-3: var(--if-space-3);
  --space-4: var(--if-space-4);
  --gutter: 24px;
  --radius-0: var(--if-radius-none); /* 情報面・表・区切り線・確認の帯 */
  --radius-8: var(--if-radius-control); /* 並ぶ操作・行の中の操作・入力欄 */
  --radius-pill: var(--if-radius-pill); /* 余白に単独で置くワンアクション */
  /* 反転ボタン(白文字 600)。通常・hover・押下のどれでも白文字に対して 4.5:1 以上 */
  --primary: var(--if-primary);
  --primary-hover: var(--if-primary-hover);
  --primary-active: var(--if-primary-active);
  --danger: var(--if-danger);
  --danger-hover: var(--if-danger-hover);
  --danger-active: var(--if-danger-active);
  color-scheme: light;
}
* { box-sizing: border-box; }
/* hidden 属性は、display を指定した要素(button など)でも必ず隠す */
[hidden] { display: none !important; }
html {
  background: var(--bg); /* 地は html に置き、固定背景(z-index: -1)をその上・本文の下に重ねる */
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body {
  margin: 0;
  color: var(--ink);
  font: 16px/1.75 var(--font);
  font-feature-settings: "palt" 1;
  caret-color: var(--ink);
}
::selection { background: var(--ink); color: var(--on-ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---- 固定背景(スクロールしても動かない。操作は受けない) ---- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
/* 滲み: blur() は使わず、柔らかい radial-gradient を transform だけで動かす(毎フレームの再描画を避ける)。
   大きな塗りなので、層を先に分けておく(will-change はこの 1 要素だけ) */
.spot {
  position: absolute;
  left: 0;
  top: 0;
  width: 80vmax;
  height: 80vmax;
  margin: -40vmax 0 0 -40vmax;
  background: radial-gradient(
    closest-side,
    var(--spot-emerald) 0%,
    var(--spot-emerald-deep) 45%,
    var(--spot-pink) 72%,
    transparent 100%
  );
  transform: translate3d(50vw, 6vh, 0); /* 動きを減らす設定のときは、ここ(上端の中央)で止まる */
  will-change: transform;
}
/* 繊細な粒状(画面全体に、ごく薄く) */
.backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.22;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.08 0 0 0 0 0.08 0 0 0 0 0.07 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* 極薄い泡の網目(上端だけに出し、下へ消える。線は空気の気配程度に) */
.backdrop::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 48vh;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='420'%3E%3Cg fill='none' stroke='%23141413' stroke-opacity='.03' stroke-width='1'%3E%3Ccircle cx='118' cy='120' r='96'/%3E%3Ccircle cx='282' cy='92' r='58'/%3E%3Ccircle cx='262' cy='290' r='112'/%3E%3C/g%3E%3C/svg%3E");
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 100%); /* マスクは透明度だけを使う */
  mask-image: linear-gradient(to bottom, #000 0%, transparent 100%);
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(var(--space-4) + env(safe-area-inset-top, 0px)) calc(var(--gutter) + env(safe-area-inset-right, 0px))
    calc(96px + env(safe-area-inset-bottom, 0px)) calc(var(--gutter) + env(safe-area-inset-left, 0px));
}
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: var(--space-3); }
/* 太線ドットのマーク(18×18 の格子を 28px で、ぼかさずに出す)とワードマーク */
.brand { display: flex; align-items: center; gap: var(--space-1); min-width: 0; }
.brand-mark { display: block; flex: none; width: 28px; height: 28px; image-rendering: pixelated; image-rendering: crisp-edges; }
/* Dosis は配信しない(CSP に font-src なし)ので、無い端末の予備は tokens.css の sans-serif でなく本文の書体にそろえる */
.wordmark { font-family: "Dosis", var(--font); font-weight: 600; font-size: 20px; letter-spacing: 0.02em; margin: 0; }
.status, .stage-now, td.num, .meta { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.status { font-size: 13px; color: var(--muted); margin: 0; text-align: right; }

/* ---- ボタン(押せる境界だけを残す。角は取らない) ---- */
button {
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font: inherit;
  line-height: 1.25;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-8);
  padding: var(--if-c-button-padding-y) var(--if-c-button-padding-x);
  min-height: var(--if-c-button-min-height);
  cursor: pointer;
  text-align: left;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
button kbd { font-family: var(--font-num); font-size: 13px; color: var(--muted); }
/* 余白に単独で置くワンアクションはカプセル型 */
button.pill { border-radius: var(--radius-pill); padding: var(--if-c-button-padding-y) var(--if-c-button-padding-pill-x); }
/* 反転ボタン: 主アクション(深いエメラルド)と、停止・退出・失効(締めたピンク)。白文字 600 */
button.primary, button.danger { color: var(--on-ink); font-weight: 600; }
button.primary { background: var(--primary); border-color: var(--primary); }
button.danger { background: var(--danger); border-color: var(--danger); }
button.primary kbd, button.danger kbd { color: var(--on-ink-muted); }
button.primary:active:not(:disabled) { background: var(--primary-active); border-color: var(--primary-active); }
button.danger:active:not(:disabled) { background: var(--danger-active); border-color: var(--danger-active); }
/* 確認の状態(もう一度押すと実行される): 輪もバーも足さず、塗りを一段深くして文言を「もう一度で…」に替えるだけで示す。
   フォーカスの輪は :focus-visible の 1 本(枠の外 4px)のまま */
button.is-armed { font-weight: 600; }
/* 失効の確認は、待機時の #B82E5E より深い #8A2144(白文字で 7:1 以上)。リンクの詳細の「終了」(.detail .controls)にも当てる */
button.danger.is-armed, .detail .controls button.danger.is-armed { background: var(--danger-active); border-color: var(--danger-active); }
/* 復活など失効でない確認は、深いエメラルドの反転(黒ベタの反転は使わない) */
button.is-armed:not(.danger) { background: var(--if-primary); color: var(--if-primary-fg); border-color: var(--if-primary); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---- 聞き手: ヘッダー直下の 1 行のツールバー ---- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--space-3);
}
.toolbar button { font-size: 14px; }
.toolbar-end { display: flex; align-items: center; gap: 12px; min-width: 0; }
.toolbar-end[hidden], .session[hidden] { display: none; }
.session { display: flex; align-items: center; gap: 12px; min-width: 0; }
.whoami { font-family: var(--font-num); font-size: 14px; font-weight: 600; min-width: 0; max-width: 16em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.label-short { display: none; }
.hint { font-size: 13px; color: var(--muted); margin: calc(-1 * var(--space-2)) 0 var(--space-3); overflow-wrap: anywhere; }
.hint:empty { display: none; }

/* GitHub でのログインの案内(ツールバーの下。枠なし) */
.auth-note { margin: calc(-1 * var(--space-1)) 0 var(--space-3); font-size: 14px; line-height: 1.7; }
.auth-note p { margin: 0; overflow-wrap: anywhere; text-wrap: pretty; }
.auth-note p:empty { display: none; }
.auth-note p + p { color: var(--muted); font-size: 13px; }
.auth-note button { margin-top: var(--space-1); }
.auth-note:has(p:not(:empty)) { padding-bottom: var(--space-2); border-bottom: 1px solid var(--line); }
.auth-note:not(:has(p:not(:empty))) { display: none; }

/* 控えめな折りたたみ(管理画面の概要の編集・回復パスフレーズ)。1px の区切り線と 44px の押せる行だけ */
.legacy-fold, .fold { border-top: 1px solid var(--line); }
.legacy-fold { margin: 0 0 var(--space-2); }
.fold { margin: var(--space-2) 0; }
.fold + .fold { margin-top: calc(-1 * var(--space-2)); }
.legacy-fold > summary, .fold > summary {
  display: flex; align-items: center; min-height: 44px; cursor: pointer; list-style-position: inside;
  font-size: 13px; color: var(--muted); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px;
}
.legacy-fold[open] > summary, .fold[open] > summary { color: var(--ink); }
.fold > .desc-edit { margin-top: var(--space-1); }

/* ---- 公開概要と見出しの一覧(枠なし。下の 1px の区切り線と余白で、チャンクの行から分ける) ---- */
.entry-desc { padding-bottom: var(--space-3); margin-bottom: var(--space-3); border-bottom: 1px solid var(--line); }
.entry-desc-text { margin: 0; font-size: 17px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; text-wrap: pretty; }
.entry-toc { margin-top: var(--space-2); }
.entry-toc-title { margin: 0 0 var(--space-1); font-size: 13px; color: var(--muted); }
.entry-toc ul { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); margin: 0; padding: 0; list-style: none; font-size: 14px; }
.entry-toc li { min-width: 0; overflow-wrap: anywhere; }

/* ---- チャンクの行(枠なし。1px の区切り線と余白で組む) ---- */
.list { padding: 0; margin: 0; list-style: none; }
.item {
  min-width: 0;
  padding: var(--space-3) 0;
  border-top: 1px solid var(--line);
  position: relative;
  isolation: isolate; /* 下の ::before のティントを、行の中だけに重ねる */
}
.item:first-child { border-top: 0; padding-top: 0; }
/* 先頭の「あなた宛て」は、文字がティントの上端に付かないよう上に 16px あける */
.item.is-mine:first-child { padding-top: var(--space-2); }
/* 新着: 背景にごく淡いティントが一瞬つき、150ms で戻る */
.item.is-new { background-color: var(--tint-new); }
/* 「あなた宛て」の新着は、行の中とはみ出しに同じ濃さで敷く(::before に重ね、行の背景には付けない) */
.item.is-mine.is-new { background-color: transparent; }
.item.is-mine.is-new::before { background-color: rgba(15, 115, 86, 0.12); }
/* GitHub でログインして増えた「あなた宛て」: 左端はほかの行と 0px で揃え、文字の位置を動かさずに極淡いティントを敷く */
.item.is-mine::before { content: ""; position: absolute; inset: 0 calc(-1 * var(--if-c-list-highlight-bleed)); z-index: -1; background: var(--if-surface-tint); pointer-events: none; }
/* 続く「あなた宛て」の行は、境の 1px の罫線の行まで覆って、左右のはみ出しのティントを切らさない */
.item.is-mine + .item.is-mine::before { top: -1px; }
.item h2 {
  min-width: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  margin: 0;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.meta { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); }
.meta:empty { display: none; }
.meta .tier { color: var(--accent-emerald-text); font-weight: 600; }
.item.is-mine .meta .tier, .item.is-new .meta .tier { color: var(--if-primary-hover); } /* ティントの上でも 4.5:1 以上(あなた宛ては定常 5.7:1、新着が重なっても 5.2:1。ふつうの行の新着は 5.7:1) */
/* 「あなた宛て」「リンク限定」の前の 6px の状態ドット */
.meta .tier::before { content: ""; display: inline-block; width: var(--if-c-list-dot-size); height: var(--if-c-list-dot-size); border-radius: var(--if-radius-pill); background: var(--if-primary); margin-right: 6px; vertical-align: 1px; }
.item .body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 12px 0 0; }
.item .body + .body { margin-top: var(--space-1); }
.item .body { text-wrap: pretty; }
/* コード: 枠なしの面から浮きすぎない淡い面。横スクロールは、続きがあるあいだだけ右端を地になじむ影で示す */
.code {
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-0);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  font: 13.5px/1.6 var(--font-code);
  tab-size: 2;
  background:
    linear-gradient(to left, var(--bg) 30%, var(--bg-clear)) right center / 32px 100% no-repeat local,
    linear-gradient(to left, var(--edge-shadow), transparent) right center / 20px 100% no-repeat scroll,
    var(--code-bg);
}
.empty, .notice { color: var(--muted); padding: var(--space-3) 0; margin: 0; }
.notice:empty { padding: 0; }
.notice.is-closed { color: var(--ink); border-top: 1px solid var(--line-strong); }

/* ---- 発表者リモコン ---- */
.stage-now { font-size: 72px; font-weight: 600; line-height: 1; margin: var(--space-1) 0 var(--space-1); letter-spacing: -0.03em; }
.stage-sub { color: var(--muted); margin: 0 0 var(--space-3); }
.controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-1); margin-bottom: var(--space-2); }
.controls button { min-height: 52px; padding: 12px 16px; background: var(--surface); }
.controls button.danger { background: var(--danger); }
/* 確認の帯: 情報面なので角は 0、単色の半透明の面 */
.confirm {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 var(--space-2);
  padding: 12px 14px;
  border: 1px solid var(--ink);
  border-radius: var(--radius-0);
  background: var(--glass); /* 装飾のすりガラスはやめ、単色の半透明の面だけにする */
}
.confirm[hidden] { display: none; }
.confirm p { margin: 0; font-size: 14px; line-height: 1.6; text-wrap: pretty; }
.confirm button { flex: none; }

/* ログと相手の一覧: 箱で囲まず、32px の余白＋見出し＋1px の区切り線の表として地に溶かす */
h2.section { font-size: 20px; font-weight: 700; line-height: 1.4; margin: var(--space-4) 0 var(--space-1); }
table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
th, td { text-align: left; padding: 10px 8px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { border-bottom-color: var(--line-strong); }
th { color: var(--muted); font-weight: 500; white-space: nowrap; }
th:first-child, td:first-child { width: 6.5em; }
th.num, td.num:last-child { width: 5em; text-align: right; padding-right: 0; }
td.num { white-space: nowrap; }
th.act, td.act { width: 9.5em; text-align: right; padding-right: 0; }
td.act button { min-height: var(--if-c-button-min-height-sm); padding: var(--if-c-button-padding-sm-y) var(--if-c-button-padding-sm-x); font-size: 13px; margin-left: auto; white-space: nowrap; }
.who { display: block; font-family: var(--font-num); font-size: 12px; color: var(--ink); margin-top: 2px; overflow-wrap: anywhere; }
.more { width: 100%; justify-content: center; margin-top: var(--space-2); font-size: 14px; }
.more[hidden] { display: none; }
td .sub { display: block; font-size: 12px; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; margin-top: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* タッチ操作の端末: キーの表示を出さず(キーボードが無い)、指で押しやすい高さにする */
@media (pointer: coarse) {
  button kbd { display: none; }
  button { min-height: var(--if-c-button-min-height-touch); }
  td.act button { min-height: var(--if-c-button-min-height); }
}
@media (max-width: 480px) {
  :root { --gutter: 20px; }
  /* ログイン中もツールバーを 1 行に収める(コピーの文言を短くし、相手の ID は省略記号で切る) */
  .toolbar { flex-wrap: nowrap; }
  .label-long { display: none; }
  .label-short { display: inline; }
  .whoami { max-width: 9em; }
  /* iPhone の Safari の下に浮かぶバーに、フッターや最後のボタンが隠れないように */
  .wrap { padding-top: calc(var(--space-3) + env(safe-area-inset-top, 0px)); padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px)); }
  .stage-now { font-size: 56px; }
  .confirm { flex-direction: column; align-items: stretch; }
}

/* 押したときの反応と、マウスでのホバー。動きを減らす設定のときは付けない */
@media (prefers-reduced-motion: no-preference) {
  button, .pill-link {
    transition: transform var(--if-dur-press) var(--ease-out), background-color var(--if-dur-hover) ease, border-color var(--if-dur-hover) ease;
  }
  button:active:not(:disabled), .pill-link:active { transform: scale(var(--if-c-button-press-scale)); }
  .item, .item.is-mine::before { transition: background-color 150ms var(--ease-out); }
}
@media (hover: hover) and (pointer: fine) {
  button:hover:not(:disabled) { border-color: var(--ink); }
  button.primary:hover:not(:disabled), button.is-armed:not(.danger):hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
  button.danger:hover:not(:disabled) { background: var(--danger-hover); border-color: var(--danger-hover); }
  /* 確認待ちの失効は、ホバーでも待機時の色に戻さない */
  button.danger.is-armed:hover:not(:disabled) { background: var(--danger-active); border-color: var(--danger-active); }
}

/* ---- 入口ページ(/) ---- */
.intro { padding: var(--space-3) 0 var(--space-4); } /* 下に続くものが無いので区切り線は引かない */
.intro h1 { font-size: 28px; font-weight: 700; line-height: 1.4; margin: 0 0 var(--space-2); text-wrap: balance; }
.intro p { margin: 0 0 var(--space-2); max-width: 40em; text-wrap: pretty; }
.pill-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 20px; margin-top: var(--space-1);
  border-radius: var(--radius-pill); background: var(--primary); color: var(--on-ink); font-weight: 600; text-decoration: none; white-space: nowrap;
}
.pill-link:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .pill-link:hover { background: var(--primary-hover); } }

/* ---- 持ち主の管理画面(/dashboard) ---- */
.wrap.wide { max-width: 1040px; }
.top-end { display: flex; align-items: center; gap: 12px; min-width: 0; }
.page-title { font-size: 28px; font-weight: 700; line-height: 1.4; margin: 0 0 var(--space-2); }
.note, .small { font-size: 13px; color: var(--muted); margin: 0 0 var(--space-1); text-wrap: pretty; }
.flash { font-size: 14px; color: var(--ink); margin: 0 0 var(--space-2); min-height: 0; }
.flash:empty { display: none; }
.min0 { min-width: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.btn-col { display: flex; flex-direction: column; gap: var(--if-c-button-group-gap); align-items: flex-end; }
.url { font-family: var(--font-code); font-size: 13px; overflow-wrap: anywhere; margin: 0 0 var(--space-1); }
.sub-title { font-size: 16px; font-weight: 700; margin: 0 0 var(--space-1); }

/* 上部のタブ: 枠なし。選んでいるものだけ 2px の下線。横スクロールで隠さず、4 つとも 1 行に見せる */
.tabs { display: flex; flex-wrap: wrap; column-gap: var(--space-3); border-bottom: 1px solid var(--line); margin: var(--space-2) 0 var(--space-3); }
.tabs button {
  border: 0; border-radius: var(--radius-0); padding: 0; min-height: 48px; background: transparent; color: var(--muted);
  border-bottom: 2px solid transparent; white-space: nowrap; font-size: 15px;
}
.tabs button[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }

/* 入力欄(並ぶ入力は 8px) */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-2); margin-bottom: var(--space-2); }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 44px; font: inherit; font-size: 16px; color: inherit; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-8); padding: 8px 12px;
}
.field textarea { min-height: 96px; line-height: 1.6; resize: vertical; }
/* 公開概要の入力: 幅いっぱいの入力欄の下に、保存のボタンを単独で置く */
.desc-edit { display: grid; gap: var(--space-1); justify-items: start; margin: var(--space-3) 0; }
.desc-edit .field, .desc-new { width: 100%; max-width: 44em; }
.desc-new { margin-bottom: var(--space-2); }
/* チェックボックスの行(44px の押せる行。箱は付けない) */
.check { display: inline-flex; align-items: center; gap: var(--space-1); min-height: 44px; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--primary); cursor: pointer; }
/* 初回のセットアップ: 入力欄の下にボタンを単独で置く */
.setup { display: grid; gap: var(--space-2); justify-items: start; max-width: 24em; }
.setup .field { width: 100%; }
.inline-form { display: flex; align-items: end; gap: var(--space-1); margin: var(--space-2) 0; }
.inline-form button { min-height: 44px; } /* 隣の入力欄(44px)と高さをそろえる */
.grow { flex: 1; }

/* 表(情報面なので角は 0) */
table.data td .cell-title { display: block; font-size: 14px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
table.data th:first-child, table.data td:first-child { width: auto; }
table.data th.act, table.data td.act { width: 7.5em; }
table.data tr.is-muted td { color: var(--muted); }
table.log th:first-child, table.log td:first-child { width: 8.5em; }
table.log th:nth-child(3), table.log td:nth-child(3) { width: 12em; }

/* 共有 URL と QR(QR は読み取れるよう白地と静かな余白を持つ。角は 0) */
.share { padding: var(--space-3) 0; border-top: 1px solid var(--line); margin-top: var(--space-3); }
.share-body { display: flex; gap: var(--space-3); align-items: flex-start; flex-wrap: wrap; }
.qr { width: 200px; height: 200px; flex: none; }
.qr svg { width: 100%; height: 100%; display: block; }
.qr-bg { fill: var(--on-ink); } /* QR は読み取りのため白地にする */
.qr-fg { fill: var(--ink); }

/* リンクの詳細 */
.detail { padding: var(--space-3) 0; border-top: 1px solid var(--line-strong); margin-top: var(--space-3); }
.stage-line { margin: 0 0 var(--space-2); display: flex; align-items: baseline; gap: 12px; }
.small-num { font-size: 40px; font-weight: 600; letter-spacing: -0.02em; }
.detail .controls { max-width: 560px; }
.detail .controls button { background: var(--surface); }
.detail .controls button.danger { background: var(--danger); }

/* 権限スイッチ板: 行は枠なし。切替は 44px のスイッチ */
.board { list-style: none; padding: 0; margin: 0; }
.board-row { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: var(--space-2); padding: var(--space-2) 0; border-top: 1px solid var(--line); }
.board-row:first-child { border-top: 0; }
.board-row .cell-title { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.board-row .sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.switch { position: relative; display: inline-flex; align-items: center; width: 56px; height: 44px; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch-track { width: 44px; height: 24px; border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: var(--surface); position: relative; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: var(--if-radius-pill); background: var(--muted); }
.switch input:checked + .switch-track { background: var(--primary); border-color: var(--primary); }
.switch input:checked + .switch-track::after { left: 23px; background: var(--on-ink); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) { .switch-track::after { transition: left 160ms var(--ease-out); } }
.preview summary { cursor: pointer; font-size: 13px; color: var(--muted); min-height: 44px; display: inline-flex; align-items: center; }
.preview .code { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 280px; overflow-y: auto; }

/* 公開の取り消し(DP の清掃)が届かなかったときのやり直し */
.retry { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; padding: var(--space-1) 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 0 var(--space-2); }
.retry p { margin: 0; }

/* 公開範囲の設定のタブの中の、回復パスフレーズでの解錠(情報面なので角は 0。下の 1px の区切り線で分ける) */
.inline-unlock { padding-bottom: var(--space-3); border-bottom: 1px solid var(--line); margin-bottom: var(--space-3); }
.inline-unlock .section { margin-top: 0; }
.inline-unlock .inline-form { max-width: 560px; }
/* 主アクションは内容の幅のカプセル(狭い画面で縦に積んでも伸ばさない) */
.inline-unlock .inline-form button { align-self: flex-start; }
.small code, .inline-unlock code { font-family: var(--font-code); font-size: 12.5px; color: var(--ink); overflow-wrap: anywhere; }
/* パスキーでの自動解錠の設定(1 行の帯) */
.prf-bar { display: flex; justify-content: flex-start; padding: var(--space-1) 0; border-bottom: 1px solid var(--line); margin-bottom: var(--space-2); }
.prf-bar button { font-size: 14px; }

/* ログインした訪問者: セルの中で値を 1 行ずつ並べる */
td .line { display: block; overflow-wrap: anywhere; }
td .line + .line { margin-top: 4px; }
table.visitors th:nth-child(3), table.visitors td:nth-child(3) { width: 13em; }
/* 端末が 2 台以上のとき、操作の組の上に端末の短い ID を添える */
table.visitors .btn-col .sub { margin-top: 0; }
table.visitors .btn-col .sub:not(:first-child) { margin-top: var(--space-1); }
table.visitors th.act, table.visitors td.act { width: 10em; }

/* 単独のカプセル(URL のコピーなど)の中の文字は折らず、縮めない(縮めるのは相手の ID だけ) */
button.pill, .pill-link { white-space: nowrap; flex-shrink: 0; }

@media (max-width: 480px) {
  /* タブは 4 語に短くしたので、狭い画面でも 1 行に並べる */
  .tabs { column-gap: var(--space-2); }
}

@media (max-width: 640px) {
  /* 訪問者の表は、狭い画面では行ごとの縦積みにする(枠なし。1px の区切り線と 8px 刻みの余白) */
  table.visitors, table.visitors tbody, table.visitors tr, table.visitors td { display: block; width: auto; }
  table.visitors thead { display: none; }
  /* 見出しの行を隠すので、各セルの項目名を読み上げ用に残す(見た目には出さない) */
  table.visitors td[data-label]::before { content: attr(data-label); position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  table.visitors tr { padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
  table.visitors td, table.visitors td:nth-child(3), table.visitors td.act { border: 0; padding: 0; width: auto; }
  table.visitors .btn-col .sub { flex-basis: 100%; }
  table.visitors .btn-col .sub:not(:first-child) { margin-top: 0; }
  table.visitors td + td { margin-top: var(--space-1); }
  table.visitors td.act { text-align: left; }
  table.visitors .btn-col { flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--space-1); }
  table.visitors td.act button { margin-left: 0; }
  .hide-narrow { display: none; }
  table.log th:nth-child(3), table.log td:nth-child(3) { width: auto; }
  table.log th:first-child, table.log td:first-child { width: 5.5em; }
  .top-end .status { display: none; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .qr { width: 168px; height: 168px; }
}
