/* ============================================================
   英単語帳 — スタイル
   ============================================================ */

:root {
  --bg: #f6f7fb;
  --bg-grad-1: #eef2ff;
  --bg-grad-2: #f7f6fb;
  --surface: #ffffff;
  --surface-2: #f2f4f9;
  --surface-hover: #eef1f8;
  --border: #e5e8f0;
  --text: #1b1f2a;
  --text-sub: #5c6478;
  --text-mute: #8b93a7;
  --accent: #4f6bff;
  --accent-soft: rgba(79, 107, 255, 0.1);
  --accent-2: #7c4dff;
  --good: #12b981;
  --good-soft: rgba(18, 185, 129, 0.12);
  --bad: #f4556c;
  --bad-soft: rgba(244, 85, 108, 0.12);
  --star: #f5a524;
  --shadow-sm: 0 1px 2px rgba(20, 25, 45, 0.05), 0 2px 8px rgba(20, 25, 45, 0.04);
  --shadow-md: 0 6px 20px rgba(20, 25, 45, 0.08);
  --shadow-lg: 0 18px 50px rgba(20, 25, 45, 0.14);
  --radius: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur: 0.28s;
}

html[data-theme="dark"] {
  --bg: #0d1017;
  --bg-grad-1: #131a2b;
  --bg-grad-2: #0d1017;
  --surface: #161b26;
  --surface-2: #1d2330;
  --surface-hover: #232a39;
  --border: #262e3d;
  --text: #eef1f7;
  --text-sub: #a8b1c4;
  --text-mute: #737d92;
  --accent: #7f93ff;
  --accent-soft: rgba(127, 147, 255, 0.16);
  --accent-2: #a481ff;
  --good: #2fd39b;
  --good-soft: rgba(47, 211, 155, 0.16);
  --bad: #ff7085;
  --bad-soft: rgba(255, 112, 133, 0.16);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 55px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN",
    "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 12% -8%, var(--bg-grad-1), transparent 60%),
    radial-gradient(900px 500px at 88% 0%, var(--accent-soft), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
  padding-bottom: 92px;
}

/* 動きを減らす設定を尊重 */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}

/* ---------- ヘッダー ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
}
@supports not (background: color-mix(in srgb, red, blue)) {
  .app-header { background: var(--bg); }
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 1.02rem;
  white-space: nowrap;
}
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 14px var(--accent-soft);
  font-size: 0.86rem;
}
.brand small {
  display: block;
  font-weight: 500;
  font-size: 0.68rem;
  color: var(--text-mute);
  letter-spacing: 0.04em;
}

.header-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-sub);
  cursor: pointer;
  display: grid; place-items: center;
  transition: transform 0.18s var(--ease), background-color 0.18s var(--ease),
    color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); transform: translateY(-1px); }
.icon-btn:active { transform: scale(0.94); }

/* ---------- 進捗バー ---------- */
.progress-strip {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 18px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.progress-track {
  flex: 1;
  height: 7px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--good), #4ad9b0);
  transition: width 0.6s var(--ease);
}
.progress-label { font-size: 0.76rem; color: var(--text-mute); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- タブ ---------- */
.tabs {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 18px;
  display: flex;
  gap: 4px;
  position: relative;
}
.tab {
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-mute);
  padding: 10px 14px 13px;
  cursor: pointer;
  position: relative;
  border-radius: 12px 12px 0 0;
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
  display: inline-flex; align-items: center; gap: 7px;
}
.tab:hover { color: var(--text-sub); background: var(--accent-soft); }
.tab[aria-selected="true"] { color: var(--accent); }
.tab-indicator {
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: transform 0.35s var(--ease), width 0.35s var(--ease);
  pointer-events: none;
}

/* ---------- レイアウト ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 20px 18px 40px; }

.panel { animation: panelIn 0.34s var(--ease) both; }
.panel[hidden] { display: none; }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- ツールバー ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}
.search-wrap {
  position: relative;
  flex: 1 1 240px;
  min-width: 200px;
}
.search-wrap i {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--text-mute); font-size: 0.85rem; pointer-events: none;
}
.search-wrap input {
  width: 100%;
  padding: 11px 36px 11px 36px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.search-wrap input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border: 0; border-radius: 50%;
  background: var(--surface-2); color: var(--text-mute);
  cursor: pointer; display: grid; place-items: center; font-size: 0.7rem;
  opacity: 0; pointer-events: none; transition: opacity 0.2s var(--ease);
}
.search-clear.show { opacity: 1; pointer-events: auto; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-sub);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: 99px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}
.chip:hover { background: var(--surface-hover); transform: translateY(-1px); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-soft);
}
.chip .cnt { font-size: 0.72rem; opacity: 0.72; font-variant-numeric: tabular-nums; }
.chip .fa-star { font-size: 0.62rem; color: var(--star); }
.chip[aria-pressed="true"] .fa-star { color: #ffe9b8; }

/* ---------- 一覧 ---------- */
.list-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
  font-size: 0.78rem; color: var(--text-mute);
}
.mini-toggle {
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-sub); font: inherit; font-size: 0.78rem; font-weight: 600;
  padding: 6px 12px; border-radius: 99px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.2s var(--ease);
}
.mini-toggle:hover { background: var(--surface-hover); }
.mini-toggle[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.word-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }

.word-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 15px;
  display: flex;
  align-items: center;
  gap: 13px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease),
    border-color 0.2s var(--ease), background-color 0.2s var(--ease);
  animation: itemIn 0.3s var(--ease) both;
}
.word-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.word-item:active { transform: translateY(0) scale(0.995); }
@keyframes itemIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.word-main { flex: 1; min-width: 0; }
.word-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.word-en {
  font-size: 1.06rem; font-weight: 700; letter-spacing: -0.01em;
  font-family: "Inter", sans-serif;
}
.word-stars { color: var(--star); font-size: 0.62rem; letter-spacing: 1px; }
.word-ja {
  margin-top: 3px;
  font-size: 0.88rem;
  color: var(--text-sub);
  line-height: 1.5;
  transition: filter 0.25s var(--ease), opacity 0.25s var(--ease);
}
.word-note {
  margin-top: 5px; font-size: 0.72rem; color: var(--text-mute);
  background: var(--surface-2); display: inline-block;
  padding: 3px 8px; border-radius: 8px;
}
.masked .word-ja { filter: blur(6px); opacity: 0.55; }
.masked .word-item.revealed .word-ja { filter: none; opacity: 1; }

.word-tools { display: flex; gap: 6px; flex-shrink: 0; }
.tool-btn {
  width: 34px; height: 34px; border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-mute);
  cursor: pointer; display: grid; place-items: center;
  font-size: 0.82rem;
  transition: all 0.18s var(--ease);
}
.tool-btn:hover { transform: translateY(-1px) scale(1.05); color: var(--text); }
.tool-btn:active { transform: scale(0.9); }
.tool-btn.on-known { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.tool-btn.on-weak { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }

.word-item.is-known { border-left: 3px solid var(--good); }
.word-item.is-weak { border-left: 3px solid var(--bad); }

.empty {
  text-align: center; padding: 56px 20px; color: var(--text-mute);
}
.empty i { font-size: 2rem; opacity: 0.4; display: block; margin-bottom: 12px; }

/* ---------- フラッシュカード ---------- */
.card-stage {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
}
.card-counter {
  font-size: 0.8rem; color: var(--text-mute); font-variant-numeric: tabular-nums;
  display: flex; align-items: center; gap: 10px;
}
.card-counter .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--border); }

.flashcard {
  width: 100%;
  max-width: 520px;
  height: 300px;
  perspective: 1400px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.flashcard-inner {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.3, 0.8, 0.25, 1);
}
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 26px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 28px; text-align: center; gap: 12px;
}
.flashcard-face.back {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, var(--surface), var(--surface-2));
}
.fc-word {
  font-size: clamp(1.8rem, 7vw, 2.6rem);
  font-weight: 800; letter-spacing: -0.02em;
  font-family: "Inter", sans-serif;
  word-break: break-word;
}
.fc-stars { color: var(--star); font-size: 0.72rem; letter-spacing: 2px; }
.fc-hint { font-size: 0.74rem; color: var(--text-mute); }
.fc-meaning { font-size: clamp(1.05rem, 4.4vw, 1.35rem); font-weight: 600; line-height: 1.7; }
.fc-note { font-size: 0.75rem; color: var(--text-mute); }
.fc-badge {
  position: absolute; top: 14px; left: 16px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em;
  color: var(--text-mute);
}
.fc-fav {
  position: absolute; top: 10px; right: 12px;
  width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: transparent; color: var(--text-mute); cursor: pointer;
  transition: all 0.18s var(--ease);
}
.fc-fav:hover { background: var(--surface-2); color: var(--bad); }
.fc-fav.on { color: var(--bad); }

.card-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit; font-weight: 650; font-size: 0.9rem;
  padding: 11px 20px; border-radius: 14px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease),
    background-color 0.18s var(--ease), border-color 0.18s var(--ease), opacity 0.18s var(--ease);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0) scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #fff;
}
.btn.good { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.btn.bad { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.lg { padding: 14px 26px; font-size: 0.98rem; border-radius: 16px; }
.btn.block { width: 100%; justify-content: center; }

.card-hintbar { font-size: 0.74rem; color: var(--text-mute); text-align: center; line-height: 1.8; }
kbd {
  font-family: inherit; font-size: 0.7rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px;
  color: var(--text-sub);
}

/* ---------- テスト ---------- */
.quiz-setup { max-width: 560px; margin: 0 auto; }
.card-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}
.card-box + .card-box { margin-top: 14px; }
.card-box h2 { margin: 0 0 4px; font-size: 1.05rem; }
.card-box p.sub { margin: 0 0 16px; font-size: 0.82rem; color: var(--text-mute); line-height: 1.6; }
.field { margin-bottom: 16px; }
.field > label {
  display: block; font-size: 0.76rem; font-weight: 700; letter-spacing: 0.03em;
  color: var(--text-mute); margin-bottom: 8px; text-transform: uppercase;
}
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-btn {
  flex: 1 1 auto;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-sub); font: inherit; font-size: 0.84rem; font-weight: 600;
  padding: 10px 12px; border-radius: 12px; cursor: pointer;
  transition: all 0.2s var(--ease); white-space: nowrap;
}
.seg-btn:hover { background: var(--surface-hover); }
.seg-btn[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 4px 12px var(--accent-soft);
}

.quiz-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.quiz-count { font-size: 0.82rem; color: var(--text-mute); font-variant-numeric: tabular-nums; font-weight: 600; }
.quiz-score { display: flex; gap: 10px; font-size: 0.82rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.quiz-score .ok { color: var(--good); }
.quiz-score .ng { color: var(--bad); }

.quiz-progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-bottom: 18px; }
.quiz-progress > span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 99px; transition: width 0.4s var(--ease);
}

.quiz-question {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-md);
  padding: 30px 22px;
  text-align: center;
  margin-bottom: 14px;
  animation: qIn 0.32s var(--ease) both;
}
@keyframes qIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.quiz-prompt-label { font-size: 0.7rem; letter-spacing: 0.08em; color: var(--text-mute); font-weight: 700; }
.quiz-prompt {
  margin-top: 10px;
  font-size: clamp(1.4rem, 5.6vw, 2.05rem);
  font-weight: 800; letter-spacing: -0.02em; line-height: 1.4;
  word-break: break-word;
}
.quiz-prompt.ja { font-size: clamp(1.1rem, 4.2vw, 1.5rem); font-weight: 700; }

.quiz-options { display: grid; gap: 9px; }
.opt {
  text-align: left;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit; font-size: 0.92rem; font-weight: 600;
  padding: 14px 16px; border-radius: 15px;
  cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s var(--ease), background-color 0.2s var(--ease),
    border-color 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.opt:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-md); }
.opt:active:not(:disabled) { transform: scale(0.99); }
.opt .key {
  width: 25px; height: 25px; flex-shrink: 0;
  border-radius: 8px; background: var(--surface-2); color: var(--text-mute);
  display: grid; place-items: center; font-size: 0.74rem; font-weight: 700;
  transition: all 0.2s var(--ease);
}
.opt .txt { flex: 1; line-height: 1.5; }
.opt:disabled { cursor: default; }
.opt.correct {
  background: var(--good-soft); border-color: var(--good); color: var(--good);
  animation: pop 0.36s var(--ease);
}
.opt.correct .key { background: var(--good); color: #fff; }
.opt.wrong {
  background: var(--bad-soft); border-color: var(--bad); color: var(--bad);
  animation: shake 0.4s var(--ease);
}
.opt.wrong .key { background: var(--bad); color: #fff; }
.opt.dim { opacity: 0.45; }
@keyframes pop {
  0% { transform: scale(1); } 45% { transform: scale(1.025); } 100% { transform: scale(1); }
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-6px); } 40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); } 80% { transform: translateX(2px); }
}

.quiz-feedback {
  margin-top: 14px; text-align: center; min-height: 26px;
  font-size: 0.88rem; font-weight: 700;
}
.quiz-feedback .fb {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 99px;
  animation: fbIn 0.28s var(--ease) both;
}
.quiz-feedback .fb.ok { background: var(--good-soft); color: var(--good); }
.quiz-feedback .fb.ng { background: var(--bad-soft); color: var(--bad); }
@keyframes fbIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 結果 */
.result { text-align: center; max-width: 520px; margin: 0 auto; }
.score-ring {
  width: 168px; height: 168px; margin: 4px auto 18px;
  position: relative;
}
.score-ring svg { transform: rotate(-90deg); }
.score-ring .track { stroke: var(--surface-2); }
.score-ring .bar {
  stroke: url(#scoreGrad);
  stroke-linecap: round;
  transition: stroke-dashoffset 1s var(--ease);
}
.score-ring .num {
  position: absolute; inset: 0; display: grid; place-items: center;
  flex-direction: column;
}
.score-ring .num b { font-size: 2.5rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.score-ring .num span { font-size: 0.72rem; color: var(--text-mute); margin-top: 6px; display: block; }
.result h2 { margin: 0 0 6px; font-size: 1.3rem; }
.result .msg { color: var(--text-sub); font-size: 0.88rem; margin-bottom: 20px; }
.review-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; text-align: left; }
.review-list li {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--bad);
  border-radius: var(--radius-sm); padding: 11px 14px;
  animation: itemIn 0.3s var(--ease) both;
}
.review-list .rw { font-weight: 700; font-family: "Inter", sans-serif; }
.review-list .rm { font-size: 0.82rem; color: var(--text-sub); margin-top: 2px; }
.result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }

/* ---------- トースト ---------- */
.toast-area {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: max-content; max-width: 90vw;
}
.toast {
  background: var(--text); color: var(--bg);
  font-size: 0.82rem; font-weight: 650;
  padding: 10px 18px; border-radius: 99px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s var(--ease) both;
  display: flex; align-items: center; gap: 8px;
}
.toast.out { animation: toastOut 0.25s var(--ease) both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(0.96); } }

/* ---------- モバイル下部ナビ ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: none;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
@supports not (background: color-mix(in srgb, red, blue)) {
  .bottom-nav { background: var(--surface); }
}
.bottom-nav-inner { display: flex; max-width: 560px; margin: 0 auto; }
.bn-btn {
  flex: 1; border: 0; background: none; font: inherit;
  color: var(--text-mute); font-size: 0.66rem; font-weight: 700;
  padding: 7px 4px; cursor: pointer; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.bn-btn i { font-size: 1.06rem; transition: transform 0.24s var(--ease); }
.bn-btn[aria-selected="true"] { color: var(--accent); background: var(--accent-soft); }
.bn-btn[aria-selected="true"] i { transform: translateY(-2px) scale(1.08); }

/* ---------- 詳細シート ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(12, 16, 26, 0.42);
  backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.28s var(--ease);
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; z-index: 71;
  left: 50%; bottom: 0;
  width: min(520px, 100%);
  transform: translate(-50%, 105%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  box-shadow: var(--shadow-lg);
  padding: 10px 22px calc(26px + env(safe-area-inset-bottom));
  transition: transform 0.36s var(--ease);
}
.sheet.open { transform: translate(-50%, 0); }
.sheet-grip { width: 44px; height: 4px; border-radius: 99px; background: var(--border); margin: 4px auto 16px; }
.sheet h3 { margin: 0; font-size: 1.7rem; letter-spacing: -0.02em; font-family: "Inter", sans-serif; }
.sheet .sheet-stars { color: var(--star); font-size: 0.7rem; letter-spacing: 2px; margin-top: 6px; }
.sheet .sheet-mean { margin: 14px 0 0; font-size: 1rem; line-height: 1.8; color: var(--text-sub); }
.sheet .sheet-note { margin-top: 10px; font-size: 0.78rem; color: var(--text-mute); background: var(--surface-2); padding: 8px 12px; border-radius: 10px; }
.sheet-actions { display: flex; gap: 8px; margin-top: 20px; }
.sheet-actions .btn { flex: 1; justify-content: center; }

/* ---------- レスポンシブ ---------- */
@media (min-width: 720px) {
  .word-list { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .tabs { display: none; }
  .bottom-nav { display: block; }
  .header-inner { padding: 10px 14px; }
  .progress-strip { padding: 0 14px 10px; }
  main { padding: 16px 14px 30px; }
  .brand span.brand-text { font-size: 0.95rem; }
  .flashcard { height: 270px; }
  .word-item { padding: 12px 13px; gap: 10px; }
  .tool-btn { width: 32px; height: 32px; }
}
