/*
 * cross.term — cross.skd と同じ「インクと紙」の配色（色トークンは cross.skd の globals.css と同一）
 * 色を持つのは注意表示だけ。強弱は太さ・余白・罫線で作る。
 */
:root {
  --bg: #f6f4f0;
  --surface: #fffefc;
  --surface-2: #f0ede7;
  --surface-hover: #eae7e0;
  --border: #e2ded6;
  --border-strong: #cfcabf;
  --text: #191813;
  --text-muted: #6a655b;
  --accent: #1f1e1a;
  --accent-hover: #34312b;
  --accent-fg: #fbfaf7;
  --accent-soft: #eceae4;
  --urgent: #8f3a2f;
  --urgent-soft: #f4e7e3;
  --high: #7a5a1c;
  --high-soft: #f4ecdd;
  --radius: 10px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
  --script: "Homemade Apple", cursive;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --lift: 0 22px 44px -14px color-mix(in srgb, var(--text) 38%, transparent), 0 2px 6px color-mix(in srgb, var(--text) 10%, transparent);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121110;
    --surface: #1a1917;
    --surface-2: #221f1d;
    --surface-hover: #292724;
    --border: #302d29;
    --border-strong: #423e39;
    --text: #f2efe9;
    --text-muted: #a49e94;
    --accent: #ebe7df;
    --accent-hover: #ffffff;
    --accent-fg: #17160f;
    --accent-soft: #262320;
    --urgent: #d98c80;
    --urgent-soft: #2a1d1a;
    --high: #c9a066;
    --high-soft: #272016;
    --lift: 0 22px 44px -14px color-mix(in srgb, var(--bg) 80%, transparent), 0 0 0 1px var(--border-strong);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font-family: var(--font); font-feature-settings: "palt" 1; -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#app { position: fixed; inset: 0; overflow: hidden; }
.view { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); }

/* ---------- 手書き・ロゴ（手書き風は見出しの「Make it happen」だけ） ---------- */
.script { font-family: var(--script); font-weight: 400; line-height: 1.6; display: inline-block; transform: rotate(-4deg); transform-origin: left; }
.lockup { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; flex: none; }
.wordmark { font-size: 16px; font-weight: 500; letter-spacing: 0.16em; line-height: 1; }
.wordmark .ext { color: var(--text-muted); }

/* ---------- ボタン ---------- */
.icon-btn {
  width: 44px; height: 44px; flex: none; border: 1px solid var(--border); background: var(--surface);
  border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: var(--text);
  transition: background 0.15s, transform 0.1s; padding: 0;
}
.icon-btn.plain { border-color: transparent; background: transparent; }
.icon-btn:hover { background: var(--surface-hover); }
.icon-btn:active { transform: scale(0.95); }
.btn {
  height: 44px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--surface); font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; transition: background 0.15s, transform 0.1s; white-space: nowrap;
}
.btn:hover { background: var(--surface-hover); }
.btn:active { transform: scale(0.985); }
.btn-primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); }
.btn[disabled] { opacity: 0.5; cursor: default; }
.btn.small { height: 44px; padding: 0 12px; font-size: 12.5px; }

/* ---------- 状態バッジ ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; flex: none; }
.badge.running { background: var(--accent-soft); color: var(--text); }
.badge.running .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.4s ease-in-out infinite; }
.badge.waiting { background: var(--high-soft); color: var(--high); }
/* 大輪の返事がないと進まない（自動で進まない返答待ち）は墨で塗って目立たせる */
.badge.waiting.you { background: var(--text-muted); color: var(--surface); }
.badge .pz { width: 7px; height: 8px; border-left: 2.5px solid currentColor; border-right: 2.5px solid currentColor; }
.badge.done { background: var(--surface-2); color: var(--text-muted); }
.badge.error { background: var(--urgent-soft); color: var(--urgent); }
.badge.idle { background: transparent; color: var(--text-muted); font-weight: 500; padding: 0 2px; }
@keyframes pulse { 50% { opacity: 0.35; } }

/* ---------- 上のバー ---------- */
.bar { display: flex; align-items: center; gap: 10px; padding: calc(8px + var(--safe-t)) 12px 8px 18px; min-height: 60px; }
.bar .heading { margin: 0 6px 0 4px; font-size: 17px; flex: none; }
.tabs { flex: 1; min-width: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 4px 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; height: 44px; max-width: 220px; padding: 0 12px; border-radius: 12px; border: 1px dashed var(--border-strong);
  background: transparent; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; touch-action: none; user-select: none;
}
.tab:hover { background: var(--surface); }
.tab .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab.attn { border-style: solid; }
.tab.you, .tab.you:hover { background: var(--border); border-color: var(--high); }
.layouts { display: flex; gap: 2px; padding: 0 2px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); flex: none; }
.layouts .icon-btn { color: var(--text-muted); border-radius: 10px; }
.layouts .icon-btn[aria-pressed="true"] { color: var(--text); background: var(--surface-2); }
.layouts .icon-btn svg rect { transition: all 0.25s var(--ease); }
.new-btn { flex: none; }
.tidy { color: var(--text-muted); }
.bar.drop-min .tabs { outline: 2px dashed var(--border-strong); outline-offset: 2px; border-radius: 12px; background: var(--surface-2); min-height: 52px; }
.bar.drop-min .tabs::before { content: "ここで離すとタブになります"; align-self: center; padding: 0 10px; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
/* 5つ以上並べたときは上部を少し詰める */
.board[data-count="5"] .pane-head, .board[data-count="6"] .pane-head, .board[data-count="7"] .pane-head, .board[data-count="8"] .pane-head { min-height: 48px; }

/* ---------- ボード（PC） ---------- */
.board { position: relative; flex: 1; min-height: 0; display: grid; gap: 10px; padding: 0 10px 10px; grid-template-rows: minmax(0, 1fr); }
.board.maxed > .pane:not(.is-max), .board.maxed > .pane-empty, .board.maxed > .divider { display: none; }
.board.maxed > .pane.is-max { grid-area: 1 / 1 / -1 / -1; }

.pane {
  position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.pane[data-state="waiting"] { border-color: var(--high); box-shadow: 0 0 0 3px var(--high-soft); }
.pane[data-state="error"] { border-color: var(--urgent); }
/* 大輪の返事待ち：上の帯と会話の背景を灰色で塗り、ぱっと見で「手を動かす作業」とわかるようにする */
.pane[data-me="true"] { border-width: 2px; }
.pane[data-me="true"] .pane-head { background: var(--border-strong); border-bottom-color: var(--border-strong); }
.pane[data-me="true"] .pane-head .grip { color: var(--text-muted); }
.pane[data-me="true"] .msgs { background: var(--border); }
.pane.lifted { z-index: 6; box-shadow: var(--lift); cursor: grabbing; transition: none; }
.pane.drop-target { border-color: var(--text); box-shadow: 0 0 0 3px var(--accent-soft); }
.pane.flash { box-shadow: 0 0 0 3px var(--border-strong); }
/* 箱が細い・低いときは、それぞれの箱の大きさに合わせて詰める（8つ並べたとき用） */
.pane { container-type: size; }
.pane-name { min-width: 4.5em; }
@media (min-width: 768px) {
@container (max-width: 420px) {
  .pane-head { gap: 2px; padding-left: 4px; }
  .pane-head .grip { display: none; }
  .pane-head .badge .lbl { display: none; }
  .pane-head .icon-btn { width: 34px; }
  .hold-btn { padding: 0 9px; }
  .msgs { padding: 10px 10px 8px; }
}
@container (max-width: 330px) {
  .box [data-act="paste"], .box [data-act="mic"] { display: none; }
  .pane-head .max-btn { display: none; }
}
@container (max-height: 320px) {
  .composer { padding: 6px 8px; }
  .msgs { gap: 8px; }
}
}
.pane-empty {
  min-width: 0; min-height: 0; border: 1px dashed var(--border-strong); border-radius: 14px; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--text-muted); font-size: 13px;
}

.pane-head { display: flex; align-items: center; gap: 6px; min-height: 52px; padding: 4px 4px 4px 6px; border-bottom: 1px solid var(--border); cursor: grab; user-select: none; touch-action: none; }
.pane-head .grip { width: 14px; flex: none; color: var(--border-strong); display: flex; justify-content: center; }
.pane-name {
  min-width: 0; height: 44px; padding: 0 6px; border: 0; background: transparent; border-radius: 8px; font-size: 14.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; cursor: text; flex: 0 1 auto;
}
.pane-name:hover { background: var(--surface-2); }
.name-input { min-width: 0; flex: 1; height: 40px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg); font-size: 15px; font-weight: 600; }
.pane-head .sp { flex: 1; }
.pane-head .icon-btn { border: 0; background: transparent; color: var(--text-muted); }
.pane-head .icon-btn:hover { background: var(--surface-2); color: var(--text); }
.hold-btn { height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--high); background: var(--surface); color: var(--high); font-size: 12px; font-weight: 600; flex: none; position: relative; }
.hold-btn::after { content: ""; position: absolute; inset: -5px -2px; } /* 押せる範囲は44px */

.cd { height: 3px; background: var(--high-soft); flex: none; overflow: hidden; }
.cd i { display: block; height: 100%; background: var(--high); transform-origin: left; }

/* ---------- 会話 ---------- */
.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 14px 10px; display: flex; flex-direction: column; gap: 12px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; background: var(--bg); }
.msgs .empty { margin: auto; text-align: center; color: var(--text-muted); font-size: 13px; line-height: 1.8; padding: 20px; }
.divider-line { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 11.5px; }
.divider-line::before, .divider-line::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.me { align-self: flex-end; max-width: 88%; background: var(--accent); color: var(--accent-fg); padding: 10px 13px; border-radius: 16px 16px 5px 16px; font-size: 15px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; animation: rise 0.18s var(--ease); }
.me.long { max-height: 9.9em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); cursor: pointer; }
.me .files { margin-top: 6px; font-size: 12px; opacity: 0.8; }
.me-auto { align-self: flex-end; font-size: 11px; color: var(--text-muted); margin-bottom: -8px; }
.ai { align-self: flex-start; max-width: 96%; min-width: 0; display: flex; flex-direction: column; gap: 8px; animation: rise 0.18s var(--ease); }
@keyframes rise { from { transform: translateY(4px); opacity: 0; } }
.bubble { background: var(--surface); border: 1px solid var(--border); border-radius: 16px 16px 16px 5px; padding: 10px 13px; }
.txt { font-size: 15px; line-height: 1.7; word-break: break-word; }
.txt p { margin: 0 0 8px; } .txt p:last-child { margin-bottom: 0; }
.txt ul { margin: 0 0 8px; padding-left: 1.2em; } .txt li { margin: 2px 0; }
.txt code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; word-break: break-all; }
.txt pre { margin: 0 0 8px; background: var(--surface-2); padding: 10px 12px; border-radius: 8px; overflow-x: auto; font-size: 12px; line-height: 1.6; }
.txt pre code { background: none; padding: 0; }
.txt a { word-break: break-all; }

/* 作業（コマンド・ファイル編集など）は1行に折りたたむ */
.work { align-self: flex-start; max-width: 100%; text-align: left; border: 0; background: transparent; padding: 0; display: flex; flex-direction: column; gap: 4px; color: var(--text-muted); }
.work .hd { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px 0 8px; border-radius: 8px; font-size: 13px; }
.work .hd:hover { background: var(--surface-2); color: var(--text); }
.work .hd svg { transition: transform 0.18s var(--ease); flex: none; }
.work.open .hd svg { transform: rotate(90deg); }
.work .now { display: flex; align-items: center; gap: 8px; padding-left: 10px; font-size: 12px; min-width: 0; }
.work .now span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work ul { list-style: none; margin: 2px 0 4px; padding: 0 0 0 10px; border-left: 2px solid var(--border); margin-left: 12px; display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text); }
.work li { display: flex; align-items: flex-start; gap: 7px; min-width: 0; word-break: break-all; }
.work li svg { flex: none; margin-top: 3px; color: var(--text-muted); }
.work li.ng, .work li.ng svg { color: var(--urgent); }
.spin { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--text); animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.shots.one { grid-template-columns: minmax(0, 1fr); }
.shots a { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.shots img { display: block; width: 100%; height: 180px; object-fit: contain; background: var(--surface-2); }
.shots.one img { height: auto; max-height: 360px; }

.card { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.card .q { font-size: 15px; font-weight: 600; }
.card .note { font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.card.waiting { border-color: var(--high); }
.card .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.card .acts .btn { flex: 1 1 auto; min-width: 88px; }
.card .acts .btn-primary { flex: 2 1 auto; }
.card ul { margin: 0; padding-left: 1.1em; font-size: 12.5px; color: var(--text-muted); line-height: 1.6; word-break: break-all; }
.done-card { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.done-card .ttl { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; }
.err { padding: 10px 12px; border-radius: var(--radius); background: var(--urgent-soft); color: var(--urgent); font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.meta { font-size: 11.5px; color: var(--text-muted); }
.typing { display: inline-flex; gap: 4px; padding: 6px 2px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; } .typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 50% { opacity: 0.2; } }

/* ---------- 入力欄 ---------- */
.composer { padding: 8px 10px 10px; border-top: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 6px; flex: none; }
.attached { display: flex; gap: 6px; flex-wrap: wrap; }
.attached span { display: inline-flex; align-items: center; gap: 2px; height: 30px; padding: 0 2px 0 10px; border-radius: 999px; background: var(--surface-2); font-size: 12px; max-width: 220px; }
.attached span b { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attached span.img { height: 44px; padding-left: 4px; border-radius: 10px; }
.attached span.img img { width: 36px; height: 36px; object-fit: cover; border-radius: 7px; margin-right: 6px; flex: none; }
.attached button { width: 28px; height: 28px; border: 0; background: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); }
.box { display: flex; align-items: flex-end; gap: 2px; background: var(--bg); border: 1px solid var(--border-strong); border-radius: 22px; padding: 2px; }
.box textarea { flex: 1; min-width: 0; border: 0; background: transparent; resize: none; font-size: 16px; line-height: 24px; padding: 10px 4px; max-height: 168px; outline: none; }
.box .icon-btn { border: 0; background: transparent; border-radius: 50%; color: var(--text-muted); }
.box .icon-btn:hover { background: var(--surface-2); }
.box .icon-btn.mic-on { color: var(--urgent); background: var(--urgent-soft); }
.box .send { background: var(--accent); color: var(--accent-fg); }
.box .send:hover { background: var(--accent-hover); }
.box .send[disabled] { opacity: 0.35; }
.box .stop { background: var(--surface-2); color: var(--text); }

/* ---------- 列の境目（幅の変更） ---------- */
.divider { position: absolute; z-index: 4; width: 14px; margin-left: -7px; cursor: col-resize; touch-action: none; display: flex; justify-content: center; }
.divider::before { content: ""; width: 3px; height: 100%; border-radius: 3px; background: transparent; transition: background 0.15s; }
.divider:hover::before, .divider.active::before { background: var(--border-strong); }
.divider.snapped::before { background: var(--text-muted); }

/* ---------- タブを列へドラッグするときの影 ---------- */
.ghost { position: fixed; z-index: 30; pointer-events: none; box-shadow: var(--lift); background: var(--surface); border-style: solid; transform: scale(0.98); }

/* ---------- スマホ（768px 未満） ---------- */
.tabbar, .kb-chip { display: none; }
@media (max-width: 767px) {
  /* 上部は今見ている作業の名前と状態だけ（全体のバーは出さない） */
  .bar { display: none; }
  .board-view { --tabbar-h: 56px; }
  .board { display: block; padding: 0; overflow: hidden; }
  .board > .pane { position: absolute; inset: 0; border-radius: 0; border: 0; padding-top: var(--safe-t); }
  .board > .pane[data-state="waiting"], .board > .pane[data-state="error"] { box-shadow: none; }
  .board > .pane:not(.is-cur):not(.leaving) { display: none; }
  .board > .pane-empty, .board > .divider { display: none; }
  .pane-head { cursor: default; min-height: 52px; }
  .pane-head .grip { display: none; }
  .board > .pane[data-state="waiting"] .pane-head { border-bottom-color: var(--high); }
  .pane .msgs { padding-bottom: calc(12px + var(--tabbar-h)); }
  .composer { padding-bottom: calc(10px + var(--safe-b)); }
  .max-btn, .min-btn { display: none !important; }

  /* 画面下の切り替えバー：入力欄のすぐ上に固定（入力欄の高さは JS が --composer-h に入れる） */
  .tabbar {
    position: absolute; left: 0; right: 0; bottom: var(--composer-h, 72px); z-index: 5;
    display: flex; gap: 6px; height: var(--tabbar-h); padding: 6px 8px; align-items: stretch;
    background: var(--surface); border-top: 1px solid var(--border); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  }
  body.kb .tabbar { display: none; }
  body.kb .pane .msgs { padding-bottom: 12px; }
  .tabbar button { min-height: 44px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 13px; position: relative; overflow: hidden; padding: 0; }
  .tb-work { flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 10px !important; }
  .tb-work .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
  .tb-work .st { flex: none; display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; }
  .tb-work .st.waiting { color: var(--high); }
  .tb-work .st.error { color: var(--urgent); }
  .tb-work .st.done { color: var(--text-muted); }
  .tb-work .mk.run { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.4s ease-in-out infinite; }
  .tb-work .pz { width: 7px; height: 8px; border-left: 2.5px solid currentColor; border-right: 2.5px solid currentColor; }
  .tb-work[data-state="waiting"] { border-color: var(--high); box-shadow: inset 0 0 0 1px var(--high); }
  .tb-work[data-state="error"] { border-color: var(--urgent); }
  .tb-work[data-me="true"]:not(.sel) { background: var(--border); }
  .tb-work .cd { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; }
  /* 選択中は墨色で塗る */
  .tb-work.sel { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
  .tb-work.sel .st.waiting, .tb-work.sel .st.done, .tb-work.sel .st.error { color: var(--accent-fg); }
  .tb-work.lifted { z-index: 2; box-shadow: var(--lift); }
  .tb-side { flex: none; width: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 1px; color: var(--text-muted) !important; }
  .tb-side small { font-size: 10px; }
  .tb-side.attn::after { content: ""; position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--high); }

  /* キーボード中：入力欄の左端に作業名チップ。タップでキーボードを閉じてバーを戻す */
  body.kb .kb-chip {
    flex: 0 1 auto; max-width: 30%; height: 44px; padding: 0 12px; border: 0; border-radius: 22px;
    background: var(--surface-2); color: var(--text); font-size: 12px; font-weight: 600; position: relative;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; line-height: 44px;
  }
  body.kb .kb-chip.attn::after { content: ""; position: absolute; top: 8px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--high); }
  body.kb .box [data-act="paste"], body.kb .box [data-act="mic"] { display: none; }
}
@media (min-width: 768px) { .ov-btn { display: none !important; } }

/* ---------- 一覧（スマホで切り替えバーを上にスワイプしたとき） ---------- */
.ov-list { display: flex; flex-direction: column; gap: 8px; max-height: 62vh; overflow-y: auto; margin: 0 -4px; padding: 2px 4px; }
.ov-card { position: relative; display: flex; align-items: stretch; gap: 4px; border: 1px solid var(--border); background: var(--surface); border-radius: 14px; min-height: 72px; }
.ov-card[data-state="waiting"] { border-color: var(--high); }
.ov-card[data-me="true"] { background: var(--border); }
.ov-card.lifted { z-index: 3; box-shadow: var(--lift); }
.ov-card .handle { width: 44px; flex: none; display: flex; align-items: center; justify-content: center; color: var(--text-muted); touch-action: none; border: 0; background: transparent; cursor: grab; }
.ov-card .main { flex: 1; min-width: 0; border: 0; background: transparent; text-align: left; padding: 10px 0; display: flex; flex-direction: column; gap: 4px; }
.ov-card .row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ov-card .nm { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-card .ln { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-card .ren { align-self: center; padding: 0 10px; }
.ov-card .main.pad { padding-left: 14px; }
.ov-card .end { align-self: center; margin-right: 6px; color: var(--urgent); border-color: var(--border); }
.ov-sep { font-size: 11px; color: var(--text-muted); padding: 4px 2px 0; }

/* ---------- 下から出るシート ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(20, 19, 16, 0.36); display: flex; align-items: flex-end; justify-content: center; z-index: 10; animation: fade 0.18s; }
@media (min-width: 768px) { .sheet-bg { align-items: center; } .sheet { border-radius: 18px !important; } }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-width: 520px; background: var(--bg); border-radius: 18px 18px 0 0; padding: 18px 16px calc(20px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; animation: up 0.22s var(--ease); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet h2 { margin: 0; font-size: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 500; }
.field input { height: 46px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); font-size: 16px; font-weight: 400; }
.field small { font-weight: 400; color: var(--text-muted); }
.picks { display: flex; gap: 6px; flex-wrap: wrap; }
.pick { height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; position: relative; }
.pick::after { content: ""; position: absolute; inset: -4px 0; }
.sheet .list-btn { justify-content: flex-start; width: 100%; }
.sheet .list-btn.danger { color: var(--urgent); }
/* 受付 */
.q-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-fg); font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.q-entry small { margin-left: auto; color: var(--text-muted); font-size: 12px; }
.field textarea { padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); font-size: 16px; font-weight: 400; line-height: 1.6; resize: vertical; min-height: 104px; }
.q-ctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.q-slots { flex: 1; max-width: 300px; display: flex; gap: 2px; padding: 0 2px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.q-slots .icon-btn { flex: 1; width: auto; min-width: 0; color: var(--text-muted); border-radius: 10px; font-size: 14px; font-variant-numeric: tabular-nums; }
.q-slots .icon-btn[aria-pressed="true"] { color: var(--accent-fg); background: var(--accent); font-weight: 600; }
.q-ctl .btn { margin-left: auto; }
.q-list { max-height: 34vh; }
.q-list .ov-card { min-height: 60px; flex: none; }
.sheet:has(.q-list) { max-height: calc(100dvh - 12px - var(--safe-t)); overflow-y: auto; }
.q-list .main { padding: 10px 0; }
.q-no { width: 36px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.q-empty { margin: 4px 2px; }
.toast { position: fixed; left: 50%; bottom: calc(110px + var(--safe-b)); transform: translateX(-50%); background: var(--accent); color: var(--accent-fg); padding: 10px 16px; border-radius: 999px; font-size: 13px; z-index: 40; animation: fade 0.18s; max-width: calc(100% - 32px); }

/* ---------- 画像をその場で大きく見る ---------- */
.viewer { position: fixed; inset: 0; z-index: 60; background: rgba(20, 19, 16, 0.94); touch-action: none; user-select: none; -webkit-user-select: none; }
.v-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: calc(56px + var(--safe-t)) 8px calc(16px + var(--safe-b)); }
.v-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; will-change: transform; -webkit-user-drag: none; }
.v-top { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 6px; padding: calc(6px + var(--safe-t)) 8px 6px 16px; color: #f6f4f0; }
.v-count { flex: 1; font-size: 13px; font-variant-numeric: tabular-nums; }
.v-close, .v-open { width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(246, 244, 240, 0.14); color: #f6f4f0; display: inline-flex; align-items: center; justify-content: center; }
.v-close svg { width: 18px; height: 18px; }
.v-nav { position: absolute; top: 50%; width: 44px; height: 64px; margin-top: -32px; border: 0; border-radius: 12px; background: rgba(246, 244, 240, 0.12); color: #f6f4f0; font-size: 30px; line-height: 1; }
.v-nav.prev { left: 10px; } .v-nav.next { right: 10px; }
@media (max-width: 767px) { .v-nav { display: none; } }
.shots a { cursor: zoom-in; }

/* ---------- 登録画面 ---------- */
.pair { flex: 1; overflow-y: auto; padding: calc(48px + var(--safe-t)) 24px 24px; display: flex; flex-direction: column; gap: 28px; align-items: stretch; max-width: 420px; margin: 0 auto; width: 100%; }
.pair .script { font-size: 32px; }
.pair .lockup.center { align-self: center; }
.pair .btn-primary { height: 50px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.m0 { margin: 0; }
.pk-btn { height: 56px; font-size: 16px; }
.link-btn { height: 44px; border: 0; background: none; color: var(--text-muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.pair p { margin: 0; color: var(--text-muted); font-size: 14px; line-height: 1.7; }
.pair input.code { text-align: center; letter-spacing: 0.2em; font-size: 20px; text-transform: uppercase; }

/* 端末の「動きを減らす」設定ではアニメーションをすべて止める */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
