/* 話のテーマサイコロ — 画面まわりのスタイル
   色はすべて CSS変数。js/themes.js が :root に流し込んで配色を切り替える。
   ここに書いてある値は「ナイト」テーマの初期値（JSが動く前の見た目）。 */

:root {
  --bg: #080b12;
  --ink: #f2f0ea;
  --ink-dim: rgba(242, 240, 234, 0.62);
  --ink-faint: rgba(242, 240, 234, 0.38);
  --accent: #e0b264;
  --accent-soft: rgba(224, 178, 100, 0.18);
  --accent-a: #f0cd8c;
  --accent-b: #d9a851;
  --accent-ink: #241a08;
  --panel: rgba(18, 22, 32, 0.94);
  --panel-soft: rgba(14, 18, 28, 0.52);
  --line: rgba(255, 255, 255, 0.12);
  --sur: rgba(255, 255, 255, 0.05);
  --sur-2: rgba(255, 255, 255, 0.13);
  --danger: #e0705f;
  --scrim: rgba(4, 6, 10, 0.6);
  --pip-one: #d94a41;
  --font: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Yu Gothic",
    "Noto Sans JP", "Meiryo", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body { overflow: hidden; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- ステージ ---------- */

#stage { position: fixed; inset: 0; overflow: hidden; }

#gl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#gl:active { cursor: grabbing; }

/* ---------- 上部バー ---------- */

#topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 16px 14px;
  pointer-events: none;
  z-index: 6;
}
#topbar > * { pointer-events: auto; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
}

.brand-mark {
  width: 18px; height: 18px;
  border-radius: 6px;
  background: linear-gradient(150deg, #fdfaf1, #d9cfb6);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.22), 0 2px 10px rgba(0, 0, 0, 0.4);
  position: relative;
  flex: none;
}
.brand-mark::after {
  content: "";
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--pip-one);
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
}

.top-actions { display: flex; gap: 7px; }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--sur);
  color: var(--ink-dim);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.16s, color 0.16s;
  backdrop-filter: blur(8px);
}
.icon-btn:hover { background: var(--sur-2); color: var(--ink); }
.icon-btn.is-off { opacity: 0.42; }

.ic-sound, .ic-history, .ic-gear, .ic-palette, .ic-shuffle, .ic-speed {
  width: 18px; height: 18px;
  background: currentColor;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-size: contain; mask-size: contain;
}
.ic-sound {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M4 9v6h4l5 4V5L8 9H4zm12.5 3a4.5 4.5 0 0 0-2.5-4v8a4.5 4.5 0 0 0 2.5-4zM14 2v2a8 8 0 0 1 0 16v2a10 10 0 0 0 0-20z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M4 9v6h4l5 4V5L8 9H4zm12.5 3a4.5 4.5 0 0 0-2.5-4v8a4.5 4.5 0 0 0 2.5-4zM14 2v2a8 8 0 0 1 0 16v2a10 10 0 0 0 0-20z'/></svg>");
}
.ic-history {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M13 3a9 9 0 1 0 8.94 10h-2.02A7 7 0 1 1 13 5a6.96 6.96 0 0 1 4.9 2H15v2h6V3h-2v2.35A8.96 8.96 0 0 0 13 3zm-1 5v5.4l4.2 2.5.8-1.3-3.5-2.1V8H12z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M13 3a9 9 0 1 0 8.94 10h-2.02A7 7 0 1 1 13 5a6.96 6.96 0 0 1 4.9 2H15v2h6V3h-2v2.35A8.96 8.96 0 0 0 13 3zm-1 5v5.4l4.2 2.5.8-1.3-3.5-2.1V8H12z'/></svg>");
}
.ic-gear {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M19.4 13a7.6 7.6 0 0 0 .1-1 7.6 7.6 0 0 0-.1-1l2.1-1.6a.5.5 0 0 0 .1-.6l-2-3.4a.5.5 0 0 0-.6-.2l-2.5 1a7.3 7.3 0 0 0-1.7-1l-.4-2.6a.5.5 0 0 0-.5-.4h-4a.5.5 0 0 0-.5.4l-.4 2.6a7.3 7.3 0 0 0-1.7 1l-2.5-1a.5.5 0 0 0-.6.2l-2 3.4a.5.5 0 0 0 .1.6L4.5 11a7.6 7.6 0 0 0 0 2l-2.1 1.6a.5.5 0 0 0-.1.6l2 3.4a.5.5 0 0 0 .6.2l2.5-1a7.3 7.3 0 0 0 1.7 1l.4 2.6a.5.5 0 0 0 .5.4h4a.5.5 0 0 0 .5-.4l.4-2.6a7.3 7.3 0 0 0 1.7-1l2.5 1a.5.5 0 0 0 .6-.2l2-3.4a.5.5 0 0 0-.1-.6L19.4 13zM12 15.5A3.5 3.5 0 1 1 15.5 12 3.5 3.5 0 0 1 12 15.5z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M19.4 13a7.6 7.6 0 0 0 .1-1 7.6 7.6 0 0 0-.1-1l2.1-1.6a.5.5 0 0 0 .1-.6l-2-3.4a.5.5 0 0 0-.6-.2l-2.5 1a7.3 7.3 0 0 0-1.7-1l-.4-2.6a.5.5 0 0 0-.5-.4h-4a.5.5 0 0 0-.5.4l-.4 2.6a7.3 7.3 0 0 0-1.7 1l-2.5-1a.5.5 0 0 0-.6.2l-2 3.4a.5.5 0 0 0 .1.6L4.5 11a7.6 7.6 0 0 0 0 2l-2.1 1.6a.5.5 0 0 0-.1.6l2 3.4a.5.5 0 0 0 .6.2l2.5-1a7.3 7.3 0 0 0 1.7 1l.4 2.6a.5.5 0 0 0 .5.4h4a.5.5 0 0 0 .5-.4l.4-2.6a7.3 7.3 0 0 0 1.7-1l2.5 1a.5.5 0 0 0 .6-.2l2-3.4a.5.5 0 0 0-.1-.6L19.4 13zM12 15.5A3.5 3.5 0 1 1 15.5 12 3.5 3.5 0 0 1 12 15.5z'/></svg>");
}
.ic-palette {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 3a9 9 0 0 0 0 18c.83 0 1.5-.67 1.5-1.5 0-.39-.15-.74-.39-1a1.49 1.49 0 0 1 1.1-2.5H16a5 5 0 0 0 5-5c0-4.42-4.03-8-9-8zm-5.5 9a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm3-4a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm5 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm4.5 3a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 3a9 9 0 0 0 0 18c.83 0 1.5-.67 1.5-1.5 0-.39-.15-.74-.39-1a1.49 1.49 0 0 1 1.1-2.5H16a5 5 0 0 0 5-5c0-4.42-4.03-8-9-8zm-5.5 9a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm3-4a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm5 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm4.5 3a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z'/></svg>");
}
.ic-speed {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M15 1H9v2h6V1zm-4 13h2V8h-2v6zm8.03-6.61l1.42-1.42a11 11 0 0 0-1.4-1.4l-1.42 1.42A9 9 0 1 0 20 13a8.94 8.94 0 0 0-.97-4.06zM12 20a7 7 0 1 1 7-7 7 7 0 0 1-7 7z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M15 1H9v2h6V1zm-4 13h2V8h-2v6zm8.03-6.61l1.42-1.42a11 11 0 0 0-1.4-1.4l-1.42 1.42A9 9 0 1 0 20 13a8.94 8.94 0 0 0-.97-4.06zM12 20a7 7 0 1 1 7-7 7 7 0 0 1-7 7z'/></svg>");
}
.ic-shuffle {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M17 3l4 4-4 4V8h-2.2c-.9 0-1.7.4-2.3 1.1l-1.3 1.6-1.3-1.6C9.3 8.4 8.5 8 7.6 8H3V6h4.6c1.5 0 2.9.7 3.8 1.9l.6.7.6-.7C13.5 6.7 14.9 6 16.4 6H17V3zm0 10l4 4-4 4v-3h-.6c-1.5 0-2.9-.7-3.8-1.9l-.6-.7-.6.7C10.5 17.3 9.1 18 7.6 18H3v-2h4.6c.9 0 1.7-.4 2.3-1.1l1.3-1.6 1.3 1.6c.6.7 1.4 1.1 2.3 1.1H17v-3z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M17 3l4 4-4 4V8h-2.2c-.9 0-1.7.4-2.3 1.1l-1.3 1.6-1.3-1.6C9.3 8.4 8.5 8 7.6 8H3V6h4.6c1.5 0 2.9.7 3.8 1.9l.6.7.6-.7C13.5 6.7 14.9 6 16.4 6H17V3zm0 10l4 4-4 4v-3h-.6c-1.5 0-2.9-.7-3.8-1.9l-.6-.7-.6.7C10.5 17.3 9.1 18 7.6 18H3v-2h4.6c.9 0 1.7-.4 2.3-1.1l1.3-1.6 1.3 1.6c.6.7 1.4 1.1 2.3 1.1H17v-3z'/></svg>");
}

/* ---------- 配色メニュー ---------- */

.pop-wrap { position: relative; }

.pop-menu {
  position: absolute;
  top: 46px; right: 0;
  min-width: 168px;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(14px);
  z-index: 12;
}

.pop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
}
.pop-item:hover { background: var(--sur-2); }
.pop-item.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.pop-item small { display: block; font-size: 10.5px; color: var(--ink-faint); margin-top: 1px; }
.pop-item.is-active small { color: var(--accent); opacity: 0.75; }

.theme-swatch {
  width: 22px; height: 22px;
  border-radius: 7px;
  flex: none;
  box-shadow: inset 0 0 0 1px var(--line);
}

/* ---------- セット選択 ---------- */

#deckbar {
  position: absolute;
  top: max(60px, calc(env(safe-area-inset-top) + 54px));
  left: 50%;
  transform: translateX(-50%);
  width: min(430px, calc(100% - 28px));
  z-index: 5;
}

.deck-select-wrap { position: relative; }

.deck-select-wrap::after {
  content: "";
  position: absolute;
  right: 13px; top: 50%;
  width: 7px; height: 7px;
  border-right: 1.6px solid var(--ink-faint);
  border-bottom: 1.6px solid var(--ink-faint);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

#deckSelect {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  padding: 9px 32px 9px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--sur);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  text-overflow: ellipsis;
}
#deckSelect:focus { outline: 2px solid var(--accent-soft); }
#deckSelect option { background: var(--bg); color: var(--ink); }

/* ---------- サイコロの面の一覧 ---------- */

.face-panel {
  position: absolute;
  top: max(108px, calc(env(safe-area-inset-top) + 102px));
  right: 16px;
  width: 208px;
  padding: 10px 11px 11px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  backdrop-filter: blur(11px);
  z-index: 4;
  transition: opacity 0.25s;
}

.face-panel-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.face-panel-title {
  flex: 1;
  min-width: 0;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-btn {
  flex: none;
  width: 24px; height: 24px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--sur);
  color: var(--ink-dim);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.mini-btn:hover { background: var(--sur-2); color: var(--ink); }
.mini-btn .ic-shuffle { width: 14px; height: 14px; }
.mini-btn.mini-text { font-family: inherit; font-size: 12px; font-weight: 700; line-height: 1; }
.mini-btn[hidden] { display: none; }
.mini-btn.is-spin .ic-shuffle { animation: spin 0.45s ease; }
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.face-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.face-list li {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
  border-radius: 8px;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--ink-dim);
  transition: background 0.3s, color 0.3s;
}

.face-list .face-pip { color: var(--ink-faint); line-height: 0; flex: none; }
.face-list .face-text {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.face-list li.is-hit {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.face-list li.is-hit .face-pip { color: var(--accent); }

.face-random {
  margin: 2px 0 3px;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
}

.face-panel.is-random .face-list { display: none; }
.face-panel:not(.is-random) .face-random { display: none; }
.face-panel.is-hidden { opacity: 0; pointer-events: none; }

/* ---------- ヒント ---------- */

#hint {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 116px);
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
  white-space: nowrap;
  transition: opacity 0.5s;
}
#hint.is-hidden { opacity: 0; }

/* ---------- 振るボタン ---------- */

#rollbar {
  position: absolute;
  left: 0; right: 0;
  bottom: max(26px, calc(env(safe-area-inset-bottom) + 22px));
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 5;
}

.roll-btn {
  pointer-events: auto;
  border: 0;
  cursor: pointer;
  padding: 15px 42px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-ink);
  background: linear-gradient(180deg, var(--accent-a), var(--accent-b));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.12s, opacity 0.2s;
}
.roll-btn:hover { transform: translateY(-1px); }
.roll-btn:active { transform: translateY(1px) scale(0.99); }
.roll-btn.is-busy { opacity: 0.35; pointer-events: none; }

/* ---------- 結果カード ---------- */

.result {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 92px);
  transform: translateX(-50%);
  width: min(520px, calc(100% - 28px));
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  z-index: 5;
}

.result.is-open {
  visibility: visible;
  animation: cardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cardIn {
  0% { opacity: 0; transform: translateX(-50%) translateY(22px) scale(0.96); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

.result-inner {
  pointer-events: auto;
  background: var(--panel);
  border: 1px solid var(--accent-soft);
  border-radius: 20px;
  padding: 17px 20px 15px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(14px);
}

.result-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--accent);
}

.result-pips { display: flex; line-height: 0; }

.result-deck {
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--accent);
  opacity: 0.92;
}

.result-topic {
  margin: 0 0 14px;
  font-size: clamp(19px, 3.6vw, 25px);
  line-height: 1.5;
  font-weight: 700;
}

.result-actions { display: flex; gap: 8px; }

/* ---------- 汎用ボタン ---------- */

.ghost-btn {
  border: 1px solid var(--line);
  background: var(--sur);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.16s;
}
.ghost-btn:hover { background: var(--sur-2); }
.ghost-btn.subtle { color: var(--ink-dim); }
.ghost-btn.small { font-size: 12px; padding: 7px 13px; }
.ghost-btn.tiny { font-size: 11px; padding: 5px 10px; }
.ghost-btn.wide { width: 100%; margin-top: 14px; }
.ghost-btn.danger { color: var(--danger); }
.ghost-btn[disabled] { opacity: 0.35; cursor: default; }

/* ---------- ドロワー ---------- */

.scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(2px);
  z-index: 20;
}

.drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100%;
  width: min(420px, 100%);
  background: var(--panel);
  border-left: 1px solid var(--line);
  transform: translateX(102%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 30;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(18px);
}
.drawer.wide-drawer { width: min(540px, 100%); }
.drawer.is-open { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(18px, env(safe-area-inset-top)) 18px 14px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 { margin: 0; font-size: 16px; letter-spacing: 0.06em; }

.close-btn {
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-dim);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.close-btn:hover { color: var(--ink); background: var(--sur-2); }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 18px calc(28px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

/* ---------- 設定 ---------- */

.cfg-block { margin-bottom: 26px; }
.cfg-block h3 {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--accent);
  font-weight: 700;
}
.cfg-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cfg-head h3 { margin: 0; }
.cfg-note { margin: 0 0 12px; font-size: 12px; line-height: 1.75; color: var(--ink-dim); }
.cfg-note b { color: var(--ink); }
.cfg-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }

.radio-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 8px;
  cursor: pointer;
}
.radio-row:hover { background: var(--sur); }
.radio-row input { margin-top: 3px; accent-color: var(--accent); }
.radio-row b { display: block; font-size: 14px; font-weight: 600; }
.radio-row small { display: block; margin-top: 3px; font-size: 11.5px; color: var(--ink-faint); line-height: 1.6; }

.deck-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 12px;
  background: var(--sur);
}

.deck-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.deck-card-head input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; flex: none; }

input[type="text"], textarea {
  font-family: inherit;
  color: var(--ink);
  background: var(--sur);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 13.5px;
  width: 100%;
  min-width: 0;
}
input[type="text"]:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--sur-2);
}

.deck-name { font-weight: 600; }

.topic-list { display: flex; flex-direction: column; gap: 6px; }
.topic-row { display: flex; align-items: center; gap: 8px; }
.topic-pip { color: var(--ink-faint); line-height: 0; flex: none; }

.pool-toggle {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pool-count { font-size: 11.5px; color: var(--ink-faint); }
.pool-area { margin-top: 8px; height: 132px; resize: vertical; font-size: 12.5px; line-height: 1.65; }
.pool-area[hidden] { display: none; }

.io-area { height: 130px; resize: vertical; font-size: 12px; line-height: 1.6; }

/* ---------- 履歴 ---------- */

.history-list { list-style: none; margin: 0; padding: 0; }
.history-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line);
}
.h-pip { color: var(--ink-faint); line-height: 0; margin-top: 2px; flex: none; }
.h-body b { display: block; font-size: 14px; font-weight: 600; line-height: 1.5; }
.h-body small { display: block; margin-top: 3px; font-size: 11px; color: var(--ink-faint); }
.empty-note { font-size: 13px; color: var(--ink-faint); }

/* ---------- WebGLが使えないとき ---------- */

.fallback {
  position: absolute;
  inset: auto 0 40%;
  text-align: center;
  color: var(--ink-dim);
  padding: 20px;
}
.fallback .small { font-size: 12px; color: var(--ink-faint); }

/* ---------- 画面が小さいとき ---------- */

@media (max-width: 560px) {
  .brand-name { display: none; }
  #deckbar {
    top: max(58px, calc(env(safe-area-inset-top) + 52px));
    width: calc(100% - 24px);
  }
  .face-panel {
    top: max(104px, calc(env(safe-area-inset-top) + 98px));
    right: 12px;
    width: min(46vw, 172px);
    padding: 8px 9px 9px;
  }
  .face-list li { font-size: 10.5px; padding: 3px 4px; gap: 6px; }
  .roll-btn { padding: 14px 34px; font-size: 15px; }
  #hint { font-size: 11px; }
}

@media (max-height: 620px) {
  #hint { display: none; }
}
