/* ==========================================================================
   Kotoba — components
   ========================================================================== */

/* ── 状況ピッカー ───────────────────────────────────── */
.grp { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; margin-bottom: 12px;
       scrollbar-width: none; -ms-overflow-style: none; }
.grp::-webkit-scrollbar { display: none; }
.grp__b {
  font: inherit; font-size: 12.5px; font-weight: 500; color: var(--ink-3);
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 4px 3px 7px; cursor: pointer; white-space: nowrap;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.grp__b:hover { color: var(--ink); }
.grp__b[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.grp__b[data-sensitive="1"][aria-pressed="true"] { color: var(--danger); border-bottom-color: var(--danger); }

.sits { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 520px) { .sits { grid-template-columns: 1fr 1fr; } }

.sit {
  display: block; width: 100%; text-align: left; font: inherit; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-m);
  padding: 12px 14px; transition: all var(--dur) var(--ease); position: relative;
}
.sit:hover { border-color: var(--line-2); background: var(--surface); }
.sit[aria-pressed="true"] {
  border-color: var(--ink); background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.sit__t { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.5; }
.sit__d { display: block; font-size: 11.5px; color: var(--ink-3); line-height: 1.7; margin-top: 3px; }
.sit__f {
  display: inline-block; margin-top: 6px; font-size: 10px; letter-spacing: .1em;
  color: var(--danger); border: 1px solid currentColor; border-radius: 3px; padding: 0 5px;
}
.sit__f--w { color: var(--accent); }

/* ── 結果 ───────────────────────────────────────────── */
#results { scroll-margin-top: calc(var(--header-h) + 16px); }

.res {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-l); overflow: hidden; box-shadow: var(--shadow-s);
  animation: rise .4s var(--ease) backwards;
}
.res + .res { margin-top: 12px; }
.res:nth-child(2) { animation-delay: .06s; }
.res:nth-child(3) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

.res__hd {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 15px; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.res__lb {
  flex: none;
  font-family: var(--serif); font-size: 13.5px; font-weight: 600; letter-spacing: .09em;
}
.res__note { font-size: 11.5px; color: var(--ink-3); flex: 1; min-width: 0; line-height: 1.5; }
.res__body {
  padding: 17px 16px; font-size: 15px; line-height: 2.0;
  white-space: pre-wrap; color: var(--ink); letter-spacing: .015em;
}
.res__ft {
  display: flex; align-items: center; gap: 8px; padding: 0 12px 12px;
}
.res__len { margin-right: auto; font-size: 11px; color: var(--ink-4); font-variant-numeric: tabular-nums; padding-left: 4px; }

.copybtn { position: relative; }
.copybtn.is-done { border-color: var(--ok); color: var(--ok); }

.tips { margin-top: 14px; padding: 14px 16px; background: var(--bg-alt); border-radius: var(--r-m); border: 1px solid var(--line); }
.tips__t { font-size: 11px; letter-spacing: .14em; color: var(--ink-4); margin-bottom: 8px; }
.tips ul { margin: 0; padding-left: 1.15em; }
.tips li { font-size: 12.5px; color: var(--ink-2); line-height: 1.85; }
.tips li + li { margin-top: 4px; }

/* ── スケルトン ─────────────────────────────────────── */
.sk { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 17px 16px; }
.sk + .sk { margin-top: 12px; }
.sk__l { height: 11px; border-radius: 4px; background: linear-gradient(90deg, var(--bg-alt) 25%, var(--surface-2) 50%, var(--bg-alt) 75%);
         background-size: 200% 100%; animation: sk 1.3s ease-in-out infinite; }
.sk__l + .sk__l { margin-top: 10px; }
.sk__l:nth-child(1) { width: 32%; }
.sk__l:nth-child(3) { width: 88%; }
.sk__l:nth-child(4) { width: 66%; }
@keyframes sk { to { background-position: -200% 0; } }

/* ── 履歴 ───────────────────────────────────────────── */
.hist { border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); overflow: hidden; }
.hist + .hist { margin-top: 10px; }
.hist__hd {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  font: inherit; background: none; border: 0; padding: 13px 15px; cursor: pointer;
}
.hist__hd:hover { background: var(--surface-2); }
.hist__t { display: block; font-size: 13.5px; font-weight: 600; min-width: 0; }
.hist__m { display: block; font-size: 11px; color: var(--ink-4); margin-top: 2px; }
.hist__grow { flex: 1; min-width: 0; }
.hist__star { font: inherit; background: none; border: 0; cursor: pointer; color: var(--ink-4); font-size: 15px; padding: 4px; line-height: 1; }
.hist__star.is-on { color: var(--warn); }
.hist__ar { color: var(--ink-4); font-size: 11px; transition: transform var(--dur) var(--ease); }
.hist.is-open .hist__ar { transform: rotate(90deg); }
.hist__body { border-top: 1px solid var(--line); padding: 14px 15px; }

.tag {
  font-size: 10px; letter-spacing: .08em; padding: 1px 6px; border-radius: 3px;
  border: 1px solid var(--line-2); color: var(--ink-3); white-space: nowrap;
}
.tag--sens { border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }
.tag--ok { border-color: color-mix(in srgb, var(--ok) 45%, transparent); color: var(--ok); }
.tag--warn { border-color: color-mix(in srgb, var(--warn) 50%, transparent); color: var(--warn); }

/* ── 認証ページ ─────────────────────────────────────── */
.auth { min-height: 100svh; display: flex; flex-direction: column; }
.auth__main { flex: 1; display: flex; align-items: center; justify-content: center;
              padding: 32px max(18px, env(safe-area-inset-left)) 48px; }
.auth__card { width: min(480px, 100%); }
.auth__hd { text-align: center; margin-bottom: 26px; }
.auth__hd h1 { font-family: var(--serif); font-size: 25px; letter-spacing: .05em; }
.auth__hd p { margin-top: 8px; font-size: 13px; color: var(--ink-3); line-height: 1.8; }
.auth__alt { margin-top: 20px; text-align: center; font-size: 12.5px; color: var(--ink-3); }
.auth__alt a { color: var(--ink); font-weight: 500; }

.steps { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; }
.steps__i { flex: 1; height: 2px; background: var(--line-2); border-radius: 2px; transition: background var(--dur) var(--ease); }
.steps__i.is-on { background: var(--ink); }
.steps__n { font-family: var(--mono); font-size: 10.5px; color: var(--ink-4); letter-spacing: .1em; }

.pwmeter { display: flex; gap: 4px; margin-top: 8px; }
.pwmeter__b { flex: 1; height: 3px; border-radius: 2px; background: var(--line-2); transition: background var(--dur) var(--ease); }
.pwmeter__b.is-1 { background: var(--danger); }
.pwmeter__b.is-2 { background: var(--warn); }
.pwmeter__b.is-3 { background: var(--ok); }

/* ── 同意 ───────────────────────────────────────────── */
.cons { border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface-2); }
.cons__i { display: flex; gap: 11px; padding: 13px 14px; cursor: pointer; align-items: flex-start; }
.cons__i + .cons__i { border-top: 1px solid var(--line); }
.cons__cb { position: absolute; opacity: 0; pointer-events: none; }
.cons__mk {
  flex: none; width: 20px; height: 20px; margin-top: 2px; border-radius: 5px;
  border: 1.5px solid var(--line-2); background: var(--surface); position: relative;
  transition: all var(--dur) var(--ease);
}
.cons__mk::after {
  content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px;
  border: solid var(--accent-ink); border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0); transition: transform var(--dur) var(--ease);
}
.cons__cb:checked + .cons__mk { background: var(--ink); border-color: var(--ink); }
.cons__cb:checked + .cons__mk::after { border-color: var(--bg); transform: rotate(45deg) scale(1); }
.cons__cb:focus-visible + .cons__mk { outline: 2px solid var(--accent); outline-offset: 2px; }
.cons__tx { min-width: 0; }
.cons__t { font-size: 13px; font-weight: 500; line-height: 1.6; display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.cons__d { display: block; font-size: 11.5px; color: var(--ink-3); line-height: 1.75; margin-top: 3px; }
.cons__all { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--bg-alt); }
.cons__all span { font-size: 12.5px; font-weight: 600; }

/* ── 管理 ───────────────────────────────────────────── */
.admin-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 14px 15px; }
.stat__l { display: block; font-size: 11px; color: var(--ink-4); letter-spacing: .08em; }
.stat__v { font-family: var(--serif); font-size: 26px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat__s { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

.tblwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 720px; }
.tbl th, .tbl td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
.tbl th { font-size: 10.5px; letter-spacing: .1em; color: var(--ink-4); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl td.wrap-cell { white-space: normal; min-width: 240px; }

.bars { display: flex; flex-direction: column; gap: 7px; }
.barrow { display: grid; grid-template-columns: 120px 1fr 42px; gap: 10px; align-items: center; font-size: 12px; }
.barrow__n { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barrow__t { height: 7px; background: var(--bg-alt); border-radius: 4px; overflow: hidden; }
.barrow__f { height: 100%; background: var(--accent); border-radius: 4px; }
.barrow__v { text-align: right; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ── モーダル ───────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .modal { align-items: center; } }
.modal__bg { position: absolute; inset: 0; background: rgba(20, 18, 15, .5); backdrop-filter: blur(3px); border: 0; width: 100%; cursor: pointer; }
.modal__box {
  position: relative; width: min(560px, 100%); max-height: 88svh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-l) var(--r-l) 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-l); animation: sheet .3s var(--ease);
}
@media (min-width: 640px) { .modal__box { border-radius: var(--r-l); padding-bottom: 22px; } }
@keyframes sheet { from { transform: translateY(24px); opacity: 0; } }
.modal__t { font-family: var(--serif); font-size: 17px; margin-bottom: 6px; letter-spacing: .04em; }
.modal__d { font-size: 12.5px; color: var(--ink-3); line-height: 1.85; margin-bottom: 16px; }
.modal__ft { display: flex; gap: 9px; justify-content: flex-end; margin-top: 18px; }
.modal__ft .btn { flex: 1; }
@media (min-width: 640px) { .modal__ft .btn { flex: none; } }

/* ── 法務ページ ─────────────────────────────────────── */
.legal { max-width: 680px; }
.legal h1 { font-family: var(--serif); font-size: 24px; letter-spacing: .05em; margin-bottom: 6px; }
.legal .meta { font-size: 11.5px; color: var(--ink-4); margin-bottom: 30px; }
.legal h2 { font-size: 14.5px; margin: 30px 0 10px; padding-top: 16px; border-top: 1px solid var(--line); letter-spacing: .04em; }
.legal p, .legal li { font-size: 13.5px; color: var(--ink-2); line-height: 1.95; }
.legal ul, .legal ol { padding-left: 1.3em; margin: 8px 0; }
.legal li + li { margin-top: 5px; }

/* details 見出し */
.field__label--sum { cursor: pointer; list-style: none; }
.field__label--sum::-webkit-details-marker { display: none; }
.field__label--sum::before {
  content: "＋"; font-size: 11px; color: var(--ink-4); transition: transform var(--dur) var(--ease);
}
details[open] > .field__label--sum::before { content: "－"; }

/* ── セットアップの確認リスト ───────────────────────── */
.chk { display: flex; flex-direction: column; gap: 2px; }
.chk__row { display: flex; gap: 11px; align-items: flex-start; padding: 9px 0; }
.chk__row + .chk__row { border-top: 1px solid var(--line); }
.chk__i {
  flex: none; width: 19px; height: 19px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; margin-top: 2px;
}
.chk__i--ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.chk__i--ng { background: var(--danger-sub); color: var(--danger); }
.chk__b { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; min-width: 0; flex: 1; }
.chk__l { font-size: 13px; font-weight: 500; }
.chk__v { font-size: 12px; color: var(--ink-3); margin-left: auto; font-variant-numeric: tabular-nums; }
.chk__h { flex-basis: 100%; font-size: 11.5px; color: var(--danger); line-height: 1.7; }

code {
  font-family: var(--mono); font-size: .88em; background: var(--bg-alt);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px;
}

/* ── フッター ───────────────────────────────────────── */
.ft {
  border-top: 1px solid var(--line);
  background: var(--bg-alt);
  margin-top: 40px;
  padding: 26px max(18px, env(safe-area-inset-left)) calc(30px + env(safe-area-inset-bottom));
}
body:has(.bar:not(.hidden)) .ft { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
.ft__in { max-width: var(--maxw); margin: 0 auto; }
.ft__nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 14px; }
.ft__nav a { font-size: 12px; color: var(--ink-3); text-decoration: none; }
.ft__nav a:hover { color: var(--ink); text-decoration: underline; }
.ft__consent {
  font-size: 10.5px; line-height: 1.85; color: var(--ink-4);
  border-left: 2px solid var(--line-2); padding-left: 12px;
}
.ft__meta { font-size: 10px; color: var(--ink-4); margin-top: 12px; letter-spacing: .02em; }

/* ── 読み取り専用の同意表示 ─────────────────────────── */
.cons__i--ro { cursor: default; }
.cons__mk--on { background: var(--ink); border-color: var(--ink); color: var(--bg);
                display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.cons__mk--off { background: var(--surface); }
.cons__all { cursor: pointer; }

/* ── 同意（スクロールして読む形式）─────────────────── */
.agree {
  border: 1px solid var(--line-2);
  border-radius: var(--r-m);
  background: var(--surface);
  overflow: hidden;
  transition: border-color var(--dur) var(--ease);
}
.agree.is-read { border-color: var(--ok); }

.agree__doc {
  max-height: min(46svh, 380px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 16px 16px 4px;
  background:
    linear-gradient(var(--surface) 30%, rgba(0,0,0,0)) top / 100% 22px no-repeat,
    linear-gradient(rgba(0,0,0,0), var(--surface) 70%) bottom / 100% 22px no-repeat,
    var(--surface);
  background-attachment: local, local, scroll;
}
.agree__doc:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.agree__lead {
  font-size: 12.5px; line-height: 1.9; color: var(--ink-2);
  padding-bottom: 14px; margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.agree__i { padding: 13px 0; border-bottom: 1px solid var(--line); }
.agree__i:last-of-type { border-bottom: 0; }
.agree__t {
  display: flex; gap: 9px; align-items: baseline;
  font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.6;
}
.agree__n {
  flex: none; font-family: var(--mono); font-size: 10px;
  color: var(--ink-4); letter-spacing: .08em; padding-top: 1px;
}
.agree__d {
  font-size: 12px; line-height: 1.9; color: var(--ink-3);
  margin-top: 5px; padding-left: 26px;
}
.agree__d a { color: var(--ink-2); }
.agree__end {
  text-align: center; font-size: 11px; color: var(--ink-4);
  letter-spacing: .2em; padding: 16px 0 20px;
}

.agree__foot {
  display: flex; flex-direction: column; gap: 7px;
  padding: 11px 14px 13px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.agree__track { height: 3px; border-radius: 2px; background: var(--line-2); overflow: hidden; }
.agree__fill {
  height: 100%; width: 0; border-radius: 2px; background: var(--ink-4);
  transition: width .15s linear, background var(--dur) var(--ease);
}
.agree.is-read .agree__fill { background: var(--ok); }
.agree__status { font-size: 11.5px; color: var(--ink-3); letter-spacing: .02em; }
.agree.is-read .agree__status { color: var(--ok); font-weight: 600; }
.agree.is-read .agree__status::before { content: "✓ "; }
