/* 競技かるた 取りラボ — karuta.fun の配色(生成り+朱)を踏襲 */
:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #ece8df;
  --text: #2a241c;
  --muted: #655c4e;
  --primary: #a8452f;
  --primary-dark: #8a3623;
  --on-primary: #ffffff;
  --primary-soft: #f6e8e3;
  --green: #2f6b4f;
  --green-soft: #e6f1ea;
  --gold: #b8860b;
  --gold-text: #7d5c06;
  --on-green: #ffffff;
  --border: #ded7c9;
  --shadow: 0 6px 24px rgba(42, 36, 28, .16);
  --radius: 10px;
  --tap: 48px;
  --tabbar-h: 56px;
  --topbar-h: 46px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #15120e;
  --surface: #201c17;
  --surface-2: #2b2620;
  --text: #ece6da;
  --muted: #a69b8c;
  --primary: #d8694f;
  --primary-dark: #e07b63;
  --on-primary: #1a0f0b;
  --primary-soft: #3a221b;
  --green: #6fb592;
  --green-soft: #1d2f26;
  --gold: #d9a938;
  --gold-text: #d9a938;
  --on-green: #0f1f17;
  --border: #3a342c;
  --shadow: 0 6px 24px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15120e; --surface: #201c17; --surface-2: #2b2620; --text: #ece6da; --muted: #a69b8c;
    --primary: #d8694f; --primary-dark: #e07b63; --on-primary: #1a0f0b; --primary-soft: #3a221b;
    --green: #6fb592; --green-soft: #1d2f26; --gold: #d9a938; --gold-text: #d9a938; --on-green: #0f1f17; --border: #3a342c;
    --shadow: 0 6px 24px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}
body.sheet-open { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.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(--primary); outline-offset: 2px; }

/* ---------- 全体レイアウト ---------- */
#app { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  height: calc(var(--topbar-h) + var(--sat));
  padding: var(--sat) calc(10px + var(--sar)) 0 calc(14px + var(--sal));
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.brand { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: .04em; flex: 1; white-space: nowrap; }
.brand small { font-weight: 400; color: var(--muted); font-size: 11px; margin-right: 6px; letter-spacing: 0; }
main { flex: 1; padding-bottom: calc(var(--tabbar-h) + var(--sab)); }
.screen { max-width: 760px; margin: 0 auto; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + var(--sab));
  padding: 0 var(--sar) var(--sab) var(--sal);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.tab {
  border: 0; background: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-size: 11px; font-weight: 600;
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--primary); }

/* ---------- 部品 ---------- */
.icon { display: inline-flex; }
.icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.fill svg { fill: currentColor; stroke: none; }

.btn {
  min-height: var(--tap); padding: 0 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-weight: 600;
  white-space: nowrap; user-select: none; -webkit-user-select: none;
}
.btn:active { background: var(--surface-2); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:active { background: var(--primary-dark); }
.btn.ghost { border-color: transparent; background: none; }
.btn.danger { color: var(--primary); }
.btn.small { min-height: 42px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.iconbtn {
  width: 44px; height: 44px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: none; color: var(--text);
}
.iconbtn:active { background: var(--surface-2); }
.iconbtn.on { color: var(--gold); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; padding-right: 20px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent); }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  min-height: 40px; padding: 0 12px; flex: none;
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--border); border-radius: 18px;
  background: var(--surface); color: var(--text); font-size: 13px; white-space: nowrap;
}
.chip[aria-pressed="true"], .chip.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip .count { opacity: .85; font-size: 11px; }
.tag {
  display: inline-block; padding: 1px 7px; border-radius: 4px;
  background: var(--surface-2); color: var(--muted); font-size: 11.5px; white-space: nowrap;
}
.tag.card { background: var(--green-soft); color: var(--green); font-weight: 700; }
.tag.tech { background: var(--primary-soft); color: var(--primary-dark); }

.field { display: block; margin: 0 0 14px; }
.field > .label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.input, .textarea, .select {
  width: 100%; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font-size: 16px; /* iOSの自動ズーム防止 */
}
.textarea { min-height: 76px; resize: vertical; }
.row-inline { display: flex; gap: 8px; align-items: center; }
.row-inline > .input { flex: 1; min-width: 0; }

.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg > button { min-height: 44px; padding: 0 14px; border: 0; background: none; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.seg > button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.seg.block { display: grid; }

.empty { padding: 40px 24px; text-align: center; color: var(--muted); }
.empty h3 { margin: 0 0 6px; color: var(--text); font-size: 16px; }
.empty p { margin: 0 0 16px; font-size: 13.5px; }
.section-title { margin: 18px 14px 8px; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .06em; display: flex; align-items: center; justify-content: space-between; }

/* 一覧の行(クリップ・動画) */
.list { list-style: none; margin: 0; padding: 0; }
.row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px 8px 14px; min-height: 64px;
  border-bottom: 1px solid var(--border);
}
.row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: left; padding: 0; color: inherit; }
.row-body { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-tags { display: flex; gap: 4px; margin-top: 3px; overflow: hidden; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 18px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 18px), transparent); }
.row.current { background: var(--primary-soft); }
.thumb { position: relative; width: 88px; aspect-ratio: 16 / 9; flex: none; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .dur { position: absolute; right: 3px; bottom: 3px; padding: 0 4px; border-radius: 3px; background: rgba(0, 0, 0, .78); color: #fff; font-size: 10.5px; }
.thumb .bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--primary); }

/* ---------- シート・トースト ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .42); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 640px; max-height: calc(100dvh - 24px - var(--sat));
  display: flex; flex-direction: column;
  background: var(--bg); border-radius: 16px 16px 0 0; box-shadow: var(--shadow);
  animation: sheet-in .18s ease-out;
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 16px; border-bottom: 1px solid var(--border); flex: none; }
.sheet-head h2 { flex: 1; margin: 0; font-size: 15.5px; }
.sheet-body { padding: 14px 16px calc(16px + var(--sab)); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sheet-foot { flex: none; display: flex; gap: 8px; padding: 10px 16px calc(10px + var(--sab)); border-top: 1px solid var(--border); background: var(--bg); }
.sheet-foot .btn { flex: 1; }
.dialog { align-items: center; padding: 20px; }
.dialog .sheet { border-radius: 14px; max-width: 360px; }
.dialog .sheet-body { padding: 20px 18px 8px; }
.dialog .sheet-foot { border-top: 0; padding-bottom: 14px; }

#toast-root { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--sab) + 10px); z-index: 60; display: flex; justify-content: center; pointer-events: none; padding: 0 10px; }
.toast {
  pointer-events: auto; max-width: 520px; width: fit-content;
  display: flex; align-items: center; gap: 4px;
  padding: 6px 6px 6px 14px; border-radius: 12px;
  background: #2a241c; color: #f5f3ee; box-shadow: var(--shadow); font-size: 13.5px;
  animation: sheet-in .16s ease-out;
}
.toast.error { background: #7a2318; }
.toast-msg { padding: 6px 4px 6px 0; cursor: pointer; }
.toast button { min-height: 44px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: #ffb9a6; font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.toast button:active { background: rgba(255, 255, 255, .12); }

/* ---------- 見る ---------- */
.watch { display: flex; flex-direction: column; }
.stage { position: sticky; top: calc(var(--topbar-h) + var(--sat)); z-index: 10; background: #000; }
.player-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; min-height: 200px; max-height: 56dvh; margin: 0 auto; background: #000; }
.player-frame iframe, #player-mount { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.deck { padding: 6px 12px 10px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.needs-video[aria-disabled="true"] > * { opacity: .38; pointer-events: none; }

.notice { margin: 0; padding: 10px 12px; border-radius: var(--radius); background: var(--primary-soft); color: var(--text); font-size: 13.5px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.notice .grow { flex: 1; min-width: 180px; }
.tapplay { min-height: 56px; font-size: 16px; }

.nowline { display: flex; align-items: baseline; gap: 8px; min-height: 22px; }
.nowline .title { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowline .time { font-size: 13px; font-weight: 600; }
.nowline .time .total { color: var(--muted); font-weight: 400; }

.seek { position: relative; height: 28px; display: flex; align-items: center; }
.seek-marks { position: absolute; left: 0; right: 0; top: 50%; height: 6px; margin-top: -3px; border-radius: 3px; background: var(--border); overflow: hidden; pointer-events: none; }
.seek-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--primary); }
.seek-ab { position: absolute; top: 0; bottom: 0; background: var(--gold); opacity: .55; }
.seek-clip { position: absolute; top: 0; bottom: 0; min-width: 2px; background: var(--green); opacity: .8; }
.seek input[type="range"] { position: relative; width: 100%; height: 28px; margin: 0; background: none; -webkit-appearance: none; appearance: none; }
.seek input[type="range"]::-webkit-slider-runnable-track { height: 28px; background: none; }
.seek input[type="range"]::-moz-range-track { height: 28px; background: none; }
.seek input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: 6px; border-radius: 50%; background: var(--primary); border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--primary); }
.seek input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--primary); border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--primary); }

.transport { display: grid; grid-template-columns: 1fr 1fr 1.25fr 1fr 1fr; gap: 6px; }
.tbtn {
  height: 54px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1;
  font-weight: 700; font-size: 17px; user-select: none; -webkit-user-select: none;
}
.tbtn small { font-size: 11px; font-weight: 500; color: var(--muted); }
.tbtn:active { background: var(--surface-2); transform: scale(.97); }
.tbtn.play { background: var(--text); color: var(--bg); border-color: var(--text); }
.tbtn.play .icon svg { width: 28px; height: 28px; }

.mainrow { display: grid; grid-template-columns: 1fr 1.7fr; gap: 6px; }
.slowbtn, .savebtn { height: 56px; border-radius: var(--radius); font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: center; gap: 6px; user-select: none; -webkit-user-select: none; }
.slowbtn { border: 1.5px solid var(--border); background: var(--surface); color: var(--text); flex-direction: column; gap: 0; line-height: 1.15; }
.slowbtn small { font-size: 10.5px; font-weight: 500; color: var(--muted); }
.slowbtn[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: var(--on-green); }
.slowbtn[aria-pressed="true"] small { color: var(--on-green); }
.slowbtn.fast { border-color: var(--primary); color: var(--primary); }
.savebtn { border: 0; background: var(--primary); color: var(--on-primary); font-size: 16px; }
.savebtn:active { background: var(--primary-dark); transform: scale(.985); }
.savebtn.flash { animation: flash .5s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 0 var(--primary); } 100% { box-shadow: 0 0 0 14px transparent; } }

.rates { display: flex; gap: 4px; }
.rate { flex: 1; min-width: 0; height: 42px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--muted); font-size: 12.5px; font-weight: 600; padding: 0; }
.rate[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }

.abrow { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 6px; align-items: stretch; }
.abbtn { height: 46px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font-weight: 700; font-size: 13.5px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; padding: 0 10px; }
.abbtn small { font-size: 11px; font-weight: 500; color: var(--muted); }
.abbtn.set { border-color: var(--gold); }
.abbtn.set small { color: var(--gold-text); font-weight: 700; }
.abbtn[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #1c1608; }
.abbtn[aria-pressed="true"] small { color: #1c1608; }
.abextra { display: flex; gap: 6px; align-items: center; }
.abextra .btn { flex: 1; }
.finerow { display: flex; align-items: center; gap: 6px; }
.finerow .hint { flex: 1; font-size: 11px; color: var(--muted); line-height: 1.3; }
.finerow .btn { min-width: 76px; }

/* クリップ再生バー */
.qbar { border: 1.5px solid var(--green); border-radius: var(--radius); background: var(--green-soft); padding: 8px 10px; display: flex; flex-direction: column; gap: 8px; }
.qnav { display: flex; align-items: center; gap: 8px; }
.btn.qback { flex: none; min-height: 44px; padding: 0 12px 0 6px; gap: 2px; }
.qback .icon svg { width: 20px; height: 20px; }
.qnav .qpos { margin-left: auto; font-weight: 700; color: var(--green); font-size: 13px; white-space: nowrap; }
.qhead { display: flex; align-items: center; gap: 8px; }
.qhead .qtitle { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qmeta { display: flex; gap: 4px; flex-wrap: wrap; min-height: 0; }
.qctl { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.qctl .btn { padding: 0 6px; font-size: 13px; min-height: 44px; }
.qsub { display: flex; gap: 6px; flex-wrap: wrap; }
.qsub .btn { flex: 1; }

/* 動画を開く */
.openform { padding: 18px 16px 6px; }
.openform h2 { margin: 0 0 4px; font-size: 18px; }
.openform p { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; }
.openform .err { color: var(--primary); font-size: 13px; min-height: 20px; margin: 6px 2px 0; }
.sendhow { margin: 12px 0 4px; border: 1px solid var(--primary); border-radius: var(--radius); background: var(--surface); font-size: 13px; overflow: hidden; }
.sendhow summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--primary); background: var(--primary-soft); min-height: 46px; padding: 0 14px; display: flex; align-items: center; gap: 8px; list-style: none; }
.sendhow summary::-webkit-details-marker { display: none; }
.sendhow summary::after { content: ''; flex: none; margin-left: auto; width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-3px) rotate(45deg); transition: transform .15s; }
.sendhow[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.sendhow[open] summary { border-bottom: 1px solid var(--border); }
.sendhow dl { padding: 2px 14px 6px; }
.sendhow dl { margin: 0 0 8px; }
.sendhow dt { margin: 8px 0 2px; font-weight: 700; }
.sendhow dd { margin: 0; color: var(--muted); line-height: 1.7; }
.sendhow-btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.sendhow-note { display: block; font-size: 12px; }
.howto { margin: 8px 16px 0; padding: 0; list-style: none; counter-reset: how; font-size: 13.5px; }
.howto li { counter-increment: how; display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.howto li::before { content: counter(how); flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--text); color: var(--bg); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.yt-note { margin: 14px 16px; font-size: 11.5px; color: var(--muted); }
.yt-note a { color: inherit; }

/* ---------- 横画面(スマホ): 動画を画面の高さいっぱいに、操作は残りの右の列に集約 ---------- */
.only-landscape { display: none; }
@media (orientation: landscape) and (max-height: 520px) {
  :root {
    --tabbar-h: 0px; --rail-h: 45px; --side-min: 152px;
    /* 動画の幅 = 画面の高さいっぱい(16:9)。横幅が足りない端末では、操作列の最小幅を残して幅に合わせる */
    --vw: min(calc(100dvh * 16 / 9), calc(100vw - var(--sal) - var(--sar) - var(--side-min)));
    /* 操作列の幅 = 残りすべて(右の安全領域を含む) */
    --side-w: calc(100vw - var(--sal) - var(--vw));
  }
  .topbar { display: none; }
  main { padding-bottom: 0; }
  .screen { max-width: none; }
  /* タブは右列の下端に、アイコンだけで置く(動画の幅を削らない。文字は読み上げ用に残す) */
  .tabbar {
    left: auto; right: 0; bottom: 0; width: var(--side-w); height: calc(var(--rail-h) + var(--sab));
    grid-template-columns: repeat(5, 1fr); padding: 0 var(--sar) var(--sab) 0;
    border-left: 1px solid var(--border);
  }
  .tab { position: relative; gap: 0; padding: 0; }
  .tab svg { width: 22px; height: 22px; }
  .tab-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tab.only-landscape { display: flex; }
  #screen-library, #screen-history, #screen-recommend { padding: 0 var(--side-w) 0 var(--sal); min-height: 100dvh; }
  #screen-watch .watch { flex-direction: row; height: 100dvh; padding-left: var(--sal); }
  .stage { position: static; flex: none; width: var(--vw); display: flex; align-items: center; justify-content: center; }
  .player-frame { width: 100%; min-height: 0; max-height: none; }
  .openwrap { flex: 1; min-width: 0; overflow-y: auto; height: 100dvh; padding-right: var(--side-w); }
  .side { flex: 1; min-width: 0; height: calc(100dvh - var(--rail-h) - var(--sab)); overflow-y: auto; overscroll-behavior: contain; border-left: 1px solid var(--border); }
  .deck { padding: 4px calc(6px + var(--sar)) 8px 6px; gap: 5px; }
  .nowline .title, .nowline .time .total { display: none; }
  .nowline { justify-content: flex-end; min-height: 18px; }
  .nowline .time { font-size: 12.5px; white-space: nowrap; }
  .seek { height: 24px; }
  /* 再生は全幅、その下に「−小 +小」「−大 +大」の2列(戻る側が左、進む側が右) */
  .transport { grid-template-columns: 1fr 1fr; gap: 5px; }
  .transport .tbtn { height: 44px; font-size: 15px; }
  .transport .tbtn.play { grid-column: 1 / -1; grid-row: 1; height: 46px; }
  .transport .tbtn:nth-child(2) { grid-column: 1; grid-row: 2; }
  .transport .tbtn:nth-child(4) { grid-column: 2; grid-row: 2; }
  .transport .tbtn:nth-child(1) { grid-column: 1; grid-row: 3; }
  .transport .tbtn:nth-child(5) { grid-column: 2; grid-row: 3; }
  .mainrow { grid-template-columns: 1fr; gap: 5px; }
  .slowbtn { height: 44px; font-size: 13px; }
  .savebtn { height: 48px; font-size: 13.5px; }
  .savebtn .icon { display: none; }
  .rates { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; }
  .rate { height: 40px; font-size: 11.5px; }
  .abrow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .abbtn { height: 44px; padding: 0 2px; font-size: 12px; }
  .abrow .btn, .finerow .btn { min-height: 44px; padding: 0 2px; font-size: 12px; line-height: 1.15; white-space: normal; }
  .finerow .hint { display: none; }
  .finerow .btn { flex: 1; min-width: 0; }
  /* クリップ再生中: 戻る / 前・次・もう一度 を最上段に。リピート切替などの補助は下へ */
  .qbar { display: contents; }
  .qnav { order: -3; flex-direction: column; align-items: stretch; gap: 2px; }
  .qhead { order: -2; flex-wrap: nowrap; }
  .qctl { order: -1; grid-template-columns: 1fr 1fr; }
  .qctl .btn { min-height: 44px; }
  .qctl .btn:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .btn.qback { width: 100%; justify-content: flex-start; padding: 0 6px 0 2px; font-size: 12.5px; line-height: 1.2; white-space: normal; text-align: left; }
  .qnav .qpos { margin-left: 0; font-size: 12px; }
  .qhead .btn { min-height: 44px; padding: 0 8px; }
  .qmeta, .qbar > .muted { display: none; }
  .qbar > .chips { order: 3; }
  .rates, .finerow { order: 2; }
  .deck > .btn.only-landscape { order: 4; }
  .watch-below .section-title { margin: 10px 8px 6px; flex-wrap: wrap; gap: 6px; }
  .watch-below .row { padding-left: 8px; min-height: 52px; }
  .watch-below .iconbtn.fav { display: none; }
  .btn.only-landscape { display: flex; }
  /* 通知は右列の中(下端のタブの上まで重ねて)に出す。動画には重ねない */
  #toast-root { left: auto; right: var(--sar); bottom: calc(var(--sab) + 4px); width: calc(var(--side-w) - var(--sar)); padding: 0 6px; }
  .toast { flex-wrap: wrap; padding: 2px 2px 2px 8px; width: 100%; font-size: 12.5px; }
  .toast-msg { flex: 1 0 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .toast button { flex: 1; padding: 0 8px; font-size: 12.5px; }
  .sheet { max-height: 100dvh; border-radius: 0; }
  .sheet-head { padding-top: 0; padding-bottom: 0; }
  .sheet-foot { padding-top: 6px; padding-bottom: calc(6px + var(--sab)); }
  .sheet-foot .btn { min-height: 42px; }
}

/* ---------- タブレット・PC ---------- */
@media (min-width: 900px) and (min-height: 521px) {
  :root { --tabbar-h: 0px; }
  .tabbar { position: fixed; top: var(--sat); bottom: auto; left: 50%; right: auto; transform: translateX(-50%); width: 440px; height: var(--topbar-h); border: 0; background: none; z-index: 31; padding: 0; }
  .tab { flex-direction: row; gap: 6px; font-size: 13px; }
  .tab svg { width: 20px; height: 20px; }
  .tab[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--primary); }
  .screen { max-width: 860px; }
  #screen-watch.screen { max-width: 1500px; }
  #screen-watch .watch { display: grid; grid-template-columns: minmax(0, 1fr) 380px; align-items: start; gap: 0 4px; padding: 12px 12px 0; }
  .stage { top: calc(var(--topbar-h) + 12px); border-radius: 8px; overflow: hidden; }
  .player-frame { max-height: calc(100dvh - var(--topbar-h) - 40px); }
  .side { grid-column: 2; }
  .openwrap { grid-column: 1 / -1; }
  .deck { padding-top: 0; }
  /* 通知は右の操作列の幅に出す(広い画面でも動画に重ねない) */
  #toast-root { bottom: 16px; left: auto; right: 12px; width: 380px; justify-content: flex-end; }
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 14px; max-height: calc(100dvh - 60px); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ==== 以下: クリップ集・履歴・設定・編集シート ==== */

/* 編集シート: 札検索 */
.cardresults { display: flex; flex-direction: column; margin-top: 6px; }
.cardhit { display: grid; grid-template-columns: minmax(64px, max-content) 1fr; column-gap: 8px; align-items: baseline; text-align: left; min-height: 48px; padding: 6px 8px; border: 0; border-bottom: 1px solid var(--border); background: none; }
.cardhit:active { background: var(--surface-2); }
.cardresults.limited { max-height: 336px; overflow-y: auto; overscroll-behavior: contain; }
.cardlen { margin-top: 8px; }
.cardlen > .label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.cardhit b { grid-row: 1 / 3; align-self: center; font-size: 17px; color: var(--green); white-space: nowrap; }
.cardhit span { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cardhit small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 編集シート: 札の位置(上が敵陣、下が自陣。競技線をはさんで向かい合う) */
.posgrid { display: grid; grid-template-columns: 40px repeat(3, 1fr); gap: 4px; align-items: center; max-width: 380px; }
.posside { grid-column: 1 / -1; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.posside.own { margin-top: 6px; padding-top: 8px; border-top: 2px solid var(--text); }
.poslabel { font-size: 11.5px; color: var(--muted); }
.posgrid.cols2 { grid-template-columns: 40px repeat(2, 1fr); max-width: 280px; }
.poscell { height: 44px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--muted); font-size: 12.5px; }
.poscell[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 700; }

/* ==== クリップ集(library.js / collections.js / cardmap.js) ==== */
.lib-summary { margin: 0; padding: 6px 14px 2px; font-size: 12.5px; color: var(--muted); letter-spacing: .02em; }
.lib-seg { margin: 2px 14px 8px; }
.lib-seg > button { min-height: 40px; }
.lib-pad { padding: 0 14px; }
.lib-search { display: block; width: calc(100% - 28px); min-height: 42px; margin: 0 14px 6px; }
.lib-quickrow { display: flex; align-items: center; gap: 6px; padding: 0 14px 2px; }
.lib-quickrow > .chip { min-height: 40px; padding: 0 12px; }
.lib-quick { flex: 1; min-width: 0; }
.lib-quick .chip, .lib-active .chip { min-height: 40px; padding: 0 14px; }
.lib-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--primary); color: var(--on-primary); font-size: 11px; font-weight: 700; }
.chip[aria-pressed="true"] .lib-badge { background: var(--on-primary); color: var(--primary); }
.chip .icon svg { width: 16px; height: 16px; }
.lib-active { padding: 2px 14px 0; }
.lib-chiptext { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-head { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; padding: 2px 14px 0; }
.lib-count { flex: none; font-weight: 700; font-size: 15px; white-space: nowrap; }
.lib-count small { margin-left: 4px; font-weight: 400; font-size: 11.5px; color: var(--muted); }
.lib-head .btn { min-height: 44px; }
.lib-head .lib-play { padding: 0 12px; font-size: 13.5px; margin-right: auto; }
.lib-head .btn.small { padding: 0 10px; }
.lib-sort { width: auto; min-height: 44px; padding: 0 4px; font-size: 14px; }
.lib-actions { display: flex; gap: 8px; padding: 4px 14px 2px; }
.lib-actions .btn { flex: 1; }
.lib-list { border-top: 1px solid var(--border); margin-top: 2px; }
.lib-group { margin: 12px 14px 4px; gap: 10px; }
.lib-group-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.lib-more { padding: 14px; text-align: center; }
.row.selected { background: var(--primary-soft); }
.lib-check { width: 36px; height: 44px; flex: none; margin-left: -8px; display: flex; align-items: center; justify-content: center; }
.lib-check input { width: 22px; height: 22px; margin: 0; accent-color: var(--primary); }
.lib-selbar {
  position: sticky; bottom: calc(var(--tabbar-h) + var(--sab)); z-index: 15;
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(0, 0, 0, .12);
}
.lib-selcount { flex: 1; min-width: 0; font-size: 13px; font-weight: 700; white-space: nowrap; }
.lib-selbar .btn { min-height: 44px; padding: 0 12px; font-size: 13.5px; }

/* 絞り込みシート */
.len-hint { margin: 6px 2px 0; font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.lib-fsec .chip { min-height: 40px; }
.lib-fsec .chip.zero:not([aria-pressed="true"]), .lib-fopt.zero:not([aria-pressed="true"]) { opacity: .45; }
.lib-cardchips { max-height: 188px; overflow-y: auto; padding: 2px 0; }
.lib-flist { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.lib-fopt { min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; font-size: 13.5px; }
.lib-fopt:last-child { border-bottom: 0; }
.lib-fopt .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-fopt .count { font-size: 12px; color: var(--muted); }
.lib-fopt .check { visibility: hidden; color: var(--primary); }
.lib-fopt .check svg { width: 18px; height: 18px; }
.lib-fopt[aria-pressed="true"] { background: var(--primary-soft); font-weight: 700; }
.lib-fopt[aria-pressed="true"] .check { visibility: visible; }
.lib-fopt.more { color: var(--muted); justify-content: center; }
.lib-collist .lib-colpick { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 10px; padding: 6px 4px; border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; }
.lib-collist .lib-colpick:active { background: var(--surface-2); }
.lib-collist .lib-colpick:disabled { opacity: .4; }

/* コレクション */
.col-thumb-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.col-play { border: 1px solid var(--border); background: var(--surface); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 14px 0 8px; }
.col-head .btn.small { min-height: 44px; }
.col-meta { display: flex; flex-direction: column; gap: 8px; padding: 6px 14px 10px; }
.col-name { font-size: 17px; font-weight: 700; }
.col-desc { min-height: 56px; font-size: 14px; }
.col-metaline { flex: 1; font-size: 13px; color: var(--muted); }
.row.wrap { flex-wrap: wrap; }
.col-grouprow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 4px 14px 10px; }
.col-grouprow .btn { min-height: 44px; }
.col-tools { flex-basis: 100%; display: flex; gap: 6px; justify-content: flex-end; padding: 0 8px 6px 0; }
.col-tools .btn.small { min-height: 44px; }
.col-foot { padding: 24px 14px 8px; text-align: center; }
.col-foot p { margin: 8px 0 0; font-size: 12px; color: var(--muted); }

/* 札マップ */
.cm { padding: 0 14px 20px; }
.cm-lensec { margin: 0 0 12px; }
.cm-lensec > .label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.cm-lenstat { display: block; margin: 6px 2px 0; font-size: 12px; font-weight: 700; min-height: 0; }
.cm-lenstat:empty { display: none; }
.cm-groups { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-start; }
.cm-group { max-width: 100%; }
.cm-kana { margin: 0 0 2px 2px; font-size: 11.5px; font-weight: 700; line-height: 16px; color: var(--muted); }
.cm-grid { display: flex; flex-wrap: wrap; gap: 4px; }
.cm-card {
  flex: none; min-width: 52px; min-height: 44px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px;
  background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; line-height: 1.15;
  display: flex; flex-direction: column; align-items: center; justify-content: center; white-space: nowrap;
}
.cm-card.has { background: var(--primary-soft); border-color: var(--primary); color: var(--text); }
/* 取りの数を3段階の濃さで表す(1件 / 2〜4件 / 5件以上)。明るい2段は本文色、いちばん濃い段は on-primary で、どちらのテーマでも 4.5:1 以上 */
.cm-card.lv1, .cm-key.lv1 { background: color-mix(in srgb, var(--primary) 25%, var(--surface)); color: var(--text); }
.cm-card.lv2, .cm-key.lv2 { background: color-mix(in srgb, var(--primary) 55%, var(--surface)); color: var(--text); }
.cm-card.lv3, .cm-key.lv3 { background: var(--primary); color: var(--on-primary); }
.cm-card:active { transform: scale(.96); }
.cm-n { font-size: 10px; font-weight: 700; }
.cm-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0 0; font-size: 11.5px; color: var(--muted); }
.cm-key { padding: 1px 8px; border: 1px solid var(--primary); border-radius: 6px; font-weight: 600; }
.cm-note { margin: 6px 0 0; font-size: 11.5px; color: var(--muted); }

/* ご利用にあたって・プライバシー(privacy.html) */
.doc { max-width: 720px; margin: 0 auto; padding: 8px 18px 60px; font-size: 14.5px; line-height: 1.8; }
.doc h2 { font-size: 19px; margin: 28px 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--text); }
.doc h3 { font-size: 15px; margin: 22px 0 6px; }
.doc ul { padding-left: 1.3em; margin: 6px 0; }
.doc li { margin: 4px 0; }
.doc a, .yt-note a { color: var(--primary); }

/* 履歴: 行の補足は折り返して、取りの件数まで切らずに見せる */
#screen-history .hist-sub { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.4; }
.hist-part { white-space: nowrap; }

/* 編集シートの見出し(どの取りか) */
.edithead { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.edithead .thumb { width: 72px; }
/* シート内のリンクはタップしやすい高さに */
.sheet-body a { display: inline-flex; align-items: center; min-height: 44px; color: var(--primary); }

/* 自動バックアップ(設定シート) */
.synccode { margin: 4px 0; padding: 14px 8px; border: 1.5px dashed var(--border); border-radius: var(--radius); background: var(--surface); text-align: center; font-size: 19px; font-weight: 700; letter-spacing: .06em; word-break: break-all; user-select: all; -webkit-user-select: all; }
.syncnotes { margin: 0; padding-left: 1.2em; font-size: 12.5px; line-height: 1.7; color: var(--muted); }
.syncnotes b { color: var(--text); }
.syncstatus { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; font-size: 13.5px; font-weight: 600; }
.syncstatus.ok { color: var(--green); }
.syncstatus.err { color: var(--primary); font-weight: 500; }
.syncstatus .icon svg { width: 18px; height: 18px; }

/* ==== 札データ(読まれた札)。1行はプレイヤーの下(操作列の中)。プレイヤーの上には重ねない ==== */
.tline {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 42px; padding: 4px 8px 4px 12px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
  text-align: left; font-size: 13.5px;
}
.tline:active { background: var(--surface-2); }
.tline-label { flex: none; font-size: 11px; color: var(--muted); }
.tline-text { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tline.pre .tline-text { font-weight: 500; color: var(--muted); }
.tline-more { flex: none; display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: 11.5px; }
.tline-more .icon svg { width: 18px; height: 18px; }

/* 読まれた札の一覧シート */
.tl-hint { margin: 0 0 6px; font-size: 12px; }
.tl-list { margin: 0 -16px; border-top: 1px solid var(--border); }
.tl-row { padding: 0; min-height: 48px; }
.tl-rowbtn { flex: 1; min-width: 0; display: grid; grid-template-columns: 62px 1fr auto; align-items: center; gap: 8px; min-height: 48px; padding: 6px 16px; border: 0; background: none; text-align: left; color: inherit; }
.tl-rowbtn:active { background: var(--surface-2); }
.tl-order { font-size: 13px; color: var(--muted); }
.tl-card { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-card b { font-size: 16px; color: var(--green); }
.tl-card small { margin-left: 8px; font-size: 12px; color: var(--muted); }
.tl-time { font-size: 13px; font-weight: 600; }
.tl-row.current { background: var(--primary-soft); }
.tl-row.current .tl-order { color: var(--primary); font-weight: 700; }

/* ホーム: 「おすすめ動画を見る」導線(1行) */
.tl-home { margin: 6px 16px 0; }
.tl-homelink { width: 100%; min-height: 48px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font-weight: 700; font-size: 14.5px; text-align: left; }
.tl-homelink:active { background: var(--surface-2); }
.tl-homelink .icon { color: var(--primary); flex: none; }
.tl-homelink-text { flex: none; }
.tl-homelink-sub { flex: 1; min-width: 0; font-weight: 400; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-homelink-go { flex: none; margin-left: auto; font-size: 22px; line-height: 1; color: var(--primary); }

/* おすすめ画面 */
.rec-intro { margin: 12px 16px 8px; font-size: 13px; line-height: 1.6; }
.rec-loading { margin: 24px 16px; text-align: center; font-size: 13px; }
.rec-list { border-top: 1px solid var(--border); }
.rec-row { padding: 0; min-height: 64px; }
.rec-btn { padding: 10px 16px; min-height: 64px; width: 100%; }
.rec-btn:active { background: var(--surface-2); }
.rec-title { display: block; white-space: normal; line-height: 1.4; }
.rec-sub { display: block; white-space: normal; line-height: 1.5; margin-top: 2px; }
.rec-part { white-space: nowrap; }
.rec-count { color: var(--green); font-weight: 600; }
.rec-go { flex: none; color: var(--primary); }
.rec-empty .btn { margin: 4px; }
/* 投稿者ごとのグループ(開閉)。見出しは動画の行より一段濃い背景で見分ける */
.rec-group { border-bottom: 1px solid var(--border); }
.rec-group:first-child { border-top: 1px solid var(--border); }
.rec-group-head { cursor: pointer; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px; background: var(--surface-2); list-style: none; -webkit-tap-highlight-color: transparent; }
.rec-group-head::-webkit-details-marker { display: none; }
.rec-group-head:active { background: var(--primary-soft); }
.rec-group-head:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.rec-group-label { flex: 1; min-width: 0; font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.rec-group-count, .rec-group-kind { flex: none; font-size: 12.5px; color: var(--muted); }
.rec-group-head::after { content: ''; flex: none; width: 9px; height: 9px; margin-right: 2px; border-right: 2px solid var(--primary); border-bottom: 2px solid var(--primary); transform: translateY(-3px) rotate(45deg); transition: transform .15s; }
.rec-group[open] > .rec-group-head::after { transform: translateY(2px) rotate(-135deg); }
.rec-group[open] > .rec-group-head { border-bottom: 1px solid var(--border); }
.rec-group .rec-list { border-top: 0; }
.rec-group .rec-row:last-child { border-bottom: 0; }
@media (orientation: landscape) and (max-height: 520px) {
  /* 右の細い列に収める: 見出しと「一覧」の文字は省き、札の表記は2行まで折り返す */
  .tline { min-height: 38px; padding: 3px 4px 3px 7px; gap: 4px; font-size: 12px; }
  .tline-label, .tline-more-text { display: none; }
  .tline-text { white-space: normal; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}

/* ---------- 自動バックアップ: 現在の状態・控え・アカウント ---------- */
.syncfacts { margin: 0 0 4px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 13px; }
.syncfacts .factrow { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.syncfacts .factrow + .factrow { border-top: 1px solid var(--border); }
.syncfacts dt { margin: 0; color: var(--muted); flex: none; }
.syncfacts dd { margin: 0; text-align: right; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.syncfacts dd.ok { color: var(--green); }
.syncfacts dd.warn { color: var(--primary); }
.acctwarn { margin: 8px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--primary); font-weight: 600; }
.acctbox { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.acctbox .section-sub { margin: 0 0 6px; font-size: 13.5px; font-weight: 700; }
.acctnote { margin: 4px 0 0; font-size: 12.5px; line-height: 1.65; }
.acctwho { margin: 0 0 4px; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.codeactions .btn { flex: 1 1 0; min-width: 96px; }
.choicebox { margin: 14px 0 10px; }
.choicetitle { margin: 0 0 6px; font-size: 13.5px; font-weight: 700; }
.choices { display: flex; flex-direction: column; gap: 6px; }
.btn.choice { justify-content: flex-start; text-align: left; min-height: 44px; padding: 6px 12px; font-size: 13.5px; font-weight: 600; white-space: normal; }
.btn.choice[aria-checked="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.choicenote { margin: 8px 0 0; font-size: 12px; line-height: 1.6; }
.codesaved { margin: 0 0 10px; }
.synchint { margin-top: 14px; font-size: 12.5px; border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 12px; }
.synchint summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.synchint p { margin: 6px 0; line-height: 1.7; }
.acctnext { margin: 8px 0 4px; padding: 12px; border: 1.5px solid var(--primary); border-radius: var(--radius); background: var(--primary-soft); }
.acctnext-msg { margin: 0 0 10px; font-size: 14.5px; font-weight: 700; line-height: 1.6; }
.acctnext .btn.block { min-height: 52px; font-size: 15px; font-weight: 700; white-space: normal; }
.acctok { display: flex; align-items: flex-start; gap: 6px; margin: 6px 0 0; font-size: 13.5px; font-weight: 600; line-height: 1.6; color: var(--green); }
.acctok .icon svg { width: 18px; height: 18px; margin-top: 2px; }
.acctchoices { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.acctchoices .btn.block { white-space: normal; min-height: 48px; }
.acctsub { margin-top: 6px; font-size: 12px; }

/* ご意見・フィードバック(feedback.html) */
.fb-textarea { min-height: 160px; }
.fb-msg { margin: 12px 0; padding: 10px 12px; border-radius: var(--radius); font-size: 14px; line-height: 1.6; }
.fb-msg[hidden] { display: none; }
.fb-msg--ok { background: var(--primary-soft); color: var(--primary-dark); }
.fb-msg--ng { border: 1px solid var(--primary); color: var(--primary); }

/* コレクションの共有リンク(ui/share.js) */
.sharebox { display: block; }
.sharelead { margin: 0 0 8px; font-weight: 700; line-height: 1.6; overflow-wrap: anywhere; }
.sharehead { margin: 0 0 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.sharecheck { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; margin: 10px 0 6px; padding: 8px 0; font-size: 14px; font-weight: 700; cursor: pointer; }
.sharecheck input { width: 22px; height: 22px; flex: none; margin: 0; accent-color: var(--primary); }
.sharecheck small { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 400; color: var(--muted); }
.sharewarn { margin: 0 0 12px; }
.shareurl { width: 100%; font-size: 13px; }
.shareinfo { margin: 10px 0; padding: 8px 10px; border-radius: var(--radius); background: var(--surface-2); font-size: 12.5px; line-height: 1.7; }
.shareproblem { margin: 8px 0; font-size: 13px; color: var(--primary); line-height: 1.6; }
.shareproblem[hidden] { display: none; }
.sharesmall { margin: 8px 0 0; font-size: 12px; line-height: 1.6; }
.sharename { margin: 0 0 4px; font-size: 17px; overflow-wrap: anywhere; }
.sharedesc { margin: 0 0 8px; font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.sharefoot { display: flex; gap: 8px; flex: 1; min-width: 0; }
.sharefoot .btn { min-width: 0; padding-left: 10px; padding-right: 10px; white-space: normal; line-height: 1.3; }
.sharefoot .btn:not(.primary) { flex: 0 0 auto; }
.sharefoot .btn.primary { flex: 1; }
.sharesmall a { display: inline; min-height: 0; }
