/* Listening Vocab ウェブ版(デスクトップ向け)。iOS 版と同じ配色: インディゴ → バイオレット → ピンク。 */
:root {
  --indigo: #3a2ee8; --violet: #8442f5; --pink: #ff5c8c;
  --grad: linear-gradient(135deg, #3a2ee8 0%, #8442f5 55%, #ff5c8c 100%);
  --bg: #f4f3f9; --panel: #ffffff; --text: #1c1c1e; --muted: #6e6e73; --sep: #e6e5ee; --field: #f2f1f7;
  --violet-soft: rgba(132, 66, 245, .10); --radius: 14px; --sidebar-w: 300px;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }
.brandmark { display: inline-grid; place-items: center; border-radius: 22%; background: var(--grad); color: #fff; box-shadow: 0 8px 20px rgba(132, 66, 245, .3); }
.btn { border: 0; border-radius: 12px; height: 46px; padding: 0 18px; font-weight: 700; font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.grad { background: var(--grad); color: #fff; }
.btn.light { background: #fff; color: var(--text); border: 1px solid #c7c7cc; }
.btn.ghost { background: var(--violet-soft); color: var(--violet); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.field { width: 100%; height: 46px; border: 1px solid transparent; border-radius: 12px; background: var(--field); padding: 0 14px; font-size: 15px; }
.field:focus { outline: 0; border-color: var(--violet); background: #fff; }
textarea.field { height: auto; min-height: 260px; padding: 12px 14px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; line-height: 1.55; }
.link { background: none; border: 0; color: var(--violet); cursor: pointer; padding: 0; font-size: 13px; }
.link:disabled { color: var(--muted); cursor: default; }
.muted { color: var(--muted); }
.msg-error { color: #d0021b; font-size: 13px; text-align: center; }
.msg-info { color: var(--violet); font-size: 13px; text-align: center; }

/* ---- ログイン(中央のカード。背景はアイコンと同じグラデーション) ---- */
.login-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: var(--grad); }
.login-card { width: 100%; max-width: 420px; background: #fff; border-radius: 22px; padding: 36px 32px 28px; box-shadow: 0 24px 60px rgba(30, 10, 90, .35); display: flex; flex-direction: column; gap: 12px; }
.login-card .brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 8px; }
.login-card .brand .brandmark { width: 84px; height: 84px; font-size: 42px; }
.login-card h1 { margin: 0; font-size: 24px; font-weight: 800; }
.login-card .sub { font-size: 13px; color: var(--muted); text-align: center; margin-top: -6px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 2px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--sep); }
.row-links { display: flex; justify-content: space-between; }

/* ---- シェル(左: 単語帳、右: 中身) ---- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100dvh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--sep); display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 12px; font-weight: 800; font-size: 17px; }
.sidebar .brand .brandmark { width: 36px; height: 36px; font-size: 18px; box-shadow: none; }
.sidebar .nav { flex: 1; overflow: auto; padding: 4px 10px 10px; }
.sidebar .label { font-size: 11.5px; color: var(--muted); font-weight: 700; letter-spacing: .04em; margin: 14px 10px 6px; }
.deck { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 10px 10px; border-radius: 10px; cursor: pointer; }
.deck:hover { background: var(--field); }
.deck.active { background: var(--violet-soft); }
.deck .ico { width: 32px; height: 32px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-size: 15px; flex: none; }
.deck .ico.outline { background: #fff; color: var(--violet); box-shadow: inset 0 0 0 2px var(--violet); }
.deck .body { flex: 1; min-width: 0; }
.deck .name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck .sub { font-size: 12px; color: var(--muted); }
.deck .progress { height: 4px; background: var(--sep); border-radius: 2px; overflow: hidden; margin-top: 5px; }
.deck .progress > i { display: block; height: 100%; background: var(--violet); width: 0; transition: width .3s; }
.sidebar .foot { border-top: 1px solid var(--sep); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.account-btn { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; text-align: left; padding: 8px 6px; border-radius: 10px; cursor: pointer; }
.account-btn:hover { background: var(--field); }
.account-btn .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--violet-soft); color: var(--violet); display: grid; place-items: center; font-weight: 800; }
.account-btn .email { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-btn .prov { font-size: 11.5px; color: var(--muted); }

.main { padding: 28px 36px 60px; min-width: 0; }
.main h2 { font-size: 26px; font-weight: 800; margin: 0 0 6px; }
.main .lead { color: var(--muted); margin: 0 0 22px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 26px; }
.card { background: var(--panel); border-radius: var(--radius); padding: 18px 20px; box-shadow: 0 1px 0 var(--sep); }
.card .big { font-size: 30px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.card .cap { font-size: 12.5px; color: var(--muted); }
.welcome { max-width: 760px; }
.welcome .steps { display: grid; gap: 12px; }
.welcome .step { display: flex; gap: 14px; align-items: flex-start; background: var(--panel); border-radius: var(--radius); padding: 14px 16px; }
.welcome .step .n { width: 30px; height: 30px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }

/* ---- 単語帳の画面(再生コントロール + 表) ---- */
.deckhead { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.deckhead .stats { color: var(--muted); font-size: 13.5px; }
.deckhead .stats b { color: var(--text); }
.bar { height: 6px; background: var(--sep); border-radius: 3px; overflow: hidden; margin: 8px 0 18px; max-width: 420px; }
.bar > i { display: block; height: 100%; background: var(--grad); }
.controls { position: sticky; top: 0; z-index: 2; background: var(--panel); border-radius: var(--radius); padding: 12px 16px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; box-shadow: 0 1px 0 var(--sep); margin-bottom: 14px; }
.controls .transport { display: flex; align-items: center; gap: 12px; }
.controls .side { border: 0; background: var(--field); width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 16px; color: var(--violet); }
.controls .mainbtn { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--grad); color: #fff; font-size: 22px; cursor: pointer; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(132, 66, 245, .35); }
.controls .now { min-width: 180px; }
.controls .now .en { font-weight: 800; font-size: 18px; }
.controls .now .ja { font-size: 13px; color: var(--muted); }
.controls .knob { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.controls select { font: inherit; font-size: 13px; border: 1px solid var(--sep); border-radius: 8px; padding: 6px 8px; background: #fff; }
.controls input[type=range] { width: 120px; accent-color: var(--violet); }
.controls .spacer { flex: 1; }
.controls .hint { font-size: 11.5px; color: var(--muted); }
kbd { font: 11px ui-monospace, Menlo, monospace; background: var(--field); border: 1px solid var(--sep); border-radius: 5px; padding: 1px 5px; }
table.words { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 0 var(--sep); }
table.words th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--sep); }
table.words td { padding: 9px 14px; border-bottom: 1px solid var(--sep); vertical-align: middle; }
table.words tr:last-child td { border-bottom: 0; }
table.words tr.active td { background: var(--violet-soft); }
table.words tr.active td.en { color: var(--violet); font-weight: 800; }
table.words tr.done td.en, table.words tr.done td.ja { opacity: .4; }
table.words td.num { width: 56px; color: var(--muted); font-variant-numeric: tabular-nums; }
table.words td.chk { width: 44px; }
table.words td.en { font-weight: 500; cursor: pointer; }
table.words td.ja { color: var(--muted); }
table.words td.act { width: 60px; text-align: right; }
.check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #c7c7cc; background: none; cursor: pointer; display: grid; place-items: center; }
.check.on { border: 0; background: var(--grad); color: #fff; font-size: 13px; }
.flag { border: 0; background: none; color: #c7c7cc; cursor: pointer; font-size: 15px; padding: 4px 6px; border-radius: 6px; }
.flag:hover { color: var(--violet); background: var(--violet-soft); }

/* ---- アカウント ---- */
.kv { display: flex; justify-content: space-between; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--sep); }
.kv:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.kv:last-child { border-bottom: 0; border-radius: 0 0 var(--radius) var(--radius); }
.kv span:last-child { color: var(--muted); }
.actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.btn.danger { background: #fff; color: #d0021b; border: 1px solid #f0c0c5; }
.note { font-size: 12.5px; color: var(--muted); line-height: 1.55; margin: 10px 2px; }
.section-label { font-size: 12.5px; color: var(--muted); font-weight: 700; margin: 18px 2px 8px; }

/* ---- モーダル(設定・作成・報告) ---- */
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(20, 10, 60, .45); display: grid; place-items: center; padding: 20px; }
.modal .panel { width: 100%; max-width: 520px; max-height: 90dvh; overflow: auto; background: var(--bg); border-radius: 18px; padding: 8px 20px 22px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.modal .panel h3 { font-size: 18px; margin: 14px 0 12px; }
.opt { display: flex; justify-content: space-between; align-items: center; padding: 11px 14px; background: var(--panel); border: 0; border-bottom: 1px solid var(--sep); width: 100%; text-align: left; cursor: pointer; }
.opt:first-child { border-radius: 12px 12px 0 0; } .opt:last-child { border-bottom: 0; border-radius: 0 0 12px 12px; }
.opt .tick { color: var(--violet); font-weight: 700; }
.slider-row { padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--sep); }
.slider-row:first-child { border-radius: 12px 12px 0 0; } .slider-row:last-child { border-bottom: 0; border-radius: 0 0 12px 12px; }
.slider-row .lab { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 4px; }
.slider-row input[type=range] { width: 100%; accent-color: var(--violet); }
.switch-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 14px; background: var(--panel); border-bottom: 1px solid var(--sep); }
.switch-row:first-child { border-radius: 12px 12px 0 0; } .switch-row:last-child { border-bottom: 0; border-radius: 0 0 12px 12px; }
input.sw { width: 44px; height: 26px; appearance: none; background: #e9e9eb; border-radius: 13px; position: relative; cursor: pointer; margin: 0; }
input.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: left .2s; }
input.sw:checked { background: var(--violet); } input.sw:checked::after { left: 20px; }
.form-label { font-size: 12.5px; color: var(--muted); font-weight: 700; margin: 14px 2px 6px; }
.count { font-weight: 700; color: var(--violet); } .count.bad { color: #d0021b; }
.menu button { display: block; width: 100%; padding: 13px; background: var(--panel); border: 0; border-bottom: 1px solid var(--sep); font-size: 15px; cursor: pointer; text-align: left; }
.menu button:first-child { border-radius: 12px 12px 0 0; } .menu button:last-child { border-bottom: 0; border-radius: 0 0 12px 12px; }
.menu button:hover { background: var(--field); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 28px; background: rgba(28,28,30,.92); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 30; max-width: 90%; }

/* ---- 狭い画面(スマホ)では縦に並べる ---- */
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--sep); }
  .sidebar .nav { max-height: 40dvh; }
  .main { padding: 18px 16px 40px; }
  .controls .now { min-width: 0; }
  table.words td.num { display: none; } table.words th:first-child { display: none; }
}

/* さがす */
.btn.light.on { border-color: var(--violet); color: var(--violet); }
.cat-list { display: grid; gap: 12px; max-width: 760px; }
.cat-row { display: flex; align-items: center; gap: 14px; background: var(--panel); border-radius: var(--radius); padding: 14px 16px; box-shadow: 0 1px 0 var(--sep); }
.cat-row .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--grad); color: #fff; display: grid; place-items: center; font-size: 20px; flex: none; }
.cat-row .body { flex: 1; min-width: 0; }
.cat-row .name { font-weight: 800; font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cat-row .sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.cat-row .pill { font-size: 11px; font-weight: 800; color: var(--violet); background: var(--violet-soft); border-radius: 999px; padding: 2px 8px; }
.cat-row .btn { height: 40px; padding: 0 16px; flex: none; }

/* さがす: 中身 */
.cat-row .body.clickable { cursor: pointer; }
.cat-row .body.clickable:hover .name { color: var(--violet); }
table.words.preview td.ja { color: var(--muted); }
/* まとめて直す */
table.words.edit input.cell { width: 100%; box-sizing: border-box; border: 1px solid var(--sep); border-radius: 8px; padding: 6px 8px; font: inherit; background: #fff; }
table.words.edit input.cell:focus { outline: 2px solid var(--violet); border-color: transparent; }
table.words.edit tr.changed td { background: var(--violet-soft); }
/* クイズ */
.quiz-setup { max-width: 520px; }
.quiz-setup .seg { display: flex; gap: 6px; margin-bottom: 8px; }
.quiz-setup .seg button { flex: 1; border: 1px solid var(--sep); background: var(--panel); border-radius: 10px; height: 40px; font: inherit; font-weight: 700; cursor: pointer; }
.quiz-setup .seg button.on { border-color: var(--violet); color: var(--violet); background: var(--violet-soft); }
.quiz-setup .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quiz-setup .btn.block { margin-top: 12px; }
.quiz { max-width: 560px; }
.quiz-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.quiz-top .bar { flex: 1; height: 8px; background: var(--sep); border-radius: 999px; overflow: hidden; }
.quiz-top .bar i { display: block; height: 100%; background: var(--grad); transition: width .2s; }
.quiz-top .cnt { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; }
.quiz-card { position: relative; background: var(--panel); border-radius: 20px; min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px 20px 28px; margin-bottom: 14px; box-shadow: 0 1px 0 var(--sep); }
.quiz-card .speak { width: 84px; height: 84px; border-radius: 50%; border: 0; background: var(--bg); font-size: 36px; cursor: pointer; }
.quiz-card .big { font-size: 30px; font-weight: 800; text-align: center; }
.quiz-card .sub { color: var(--muted); }
.quiz-card .timer { position: absolute; left: 20px; right: 20px; bottom: 12px; height: 5px; background: var(--sep); border-radius: 999px; overflow: hidden; }
.quiz-card .timer i { display: block; height: 100%; background: var(--grad); transition: width .05s linear; }
.choices { display: grid; gap: 10px; }
.choice { display: flex; align-items: center; gap: 12px; text-align: left; min-height: 54px; padding: 0 16px; border: 2px solid transparent; border-radius: 14px; background: var(--panel); font: inherit; font-weight: 600; cursor: pointer; box-shadow: 0 1px 0 var(--sep); }
.choice:hover:not(:disabled) { border-color: var(--violet); }
.choice .n { color: var(--muted); font-weight: 800; width: 18px; }
.choice .mark { margin-left: auto; font-weight: 800; }
.choice.correct { background: #e6f7ea; border-color: #2ea44f; }
.choice.wrong { background: #fdecec; border-color: #d0021b; }
.choice.dim { opacity: .45; }
.quiz-foot { display: flex; justify-content: flex-end; margin-top: 10px; }
.quiz-result { text-align: center; padding: 20px 0 10px; }
.quiz-result .score { font-size: 44px; font-weight: 900; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.quiz-result .sub { color: var(--muted); }

/* 単語の一覧の文字の大きさ(再生の設定) */
:root { --word-scale: 1; }
table.words td.en, table.words td.ja, table.words.edit input.cell { font-size: calc(15px * var(--word-scale)); }
.now .en { font-size: calc(20px * var(--word-scale)); }

/* 再生の設定: 選ぶ形式 */
.modal .kv { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.modal select.sel { width: auto; min-width: 150px; height: 36px; padding: 0 30px 0 12px; border-radius: 10px; }

/* まとめて直す: 外す語(打ち消し線)と、外す/戻すの小さなボタン */
.words.edit tr.removed td { text-decoration: line-through; opacity: .5; background: #fff1f1; }
.words.edit td.del { width: 36px; text-align: center; }
.words.edit button.rowdel { border: 0; background: transparent; cursor: pointer; font-size: 15px; opacity: .55; padding: 2px 4px; border-radius: 6px; }
.words.edit button.rowdel:hover { opacity: 1; background: #eee; }
.btn.sm { padding: 4px 10px; font-size: 13px; }

/* ---- クイズ(iOS アプリと同じ作り) ---- */
.qhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.qpills { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 18px; }
.qpill { border: 1.5px solid var(--sep); background: var(--panel); border-radius: 999px; padding: 8px 16px; font: inherit; font-weight: 700; cursor: pointer; }
.qpill.on { background: var(--grad); border-color: transparent; color: #fff; }
.qchips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 16px; }
.qchip { border: 1.5px solid var(--sep); background: var(--panel); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.qchip.on { background: var(--grad); border-color: transparent; color: #fff; }
.btn.grad.qgo { display: flex; flex-direction: column; gap: 2px; padding: 14px; max-width: 520px; }
.btn.grad.qgo small { font-weight: 500; opacity: .9; }
.qsecs { display: grid; gap: 1px; background: var(--sep); border-radius: 16px; overflow: hidden; margin-top: 18px; max-width: 520px; }
.qsec { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--panel); border: 0; font: inherit; text-align: left; cursor: pointer; }
.qsec:hover { background: #fafafa; }
.qsec.locked { color: var(--muted); }
.qsec-body { flex: 1; }
.qsec-name { font-weight: 700; }
.qsec-sub { font-size: 13px; color: var(--muted); }
.qsec-n { font-size: 13px; color: var(--muted); border: 1px solid var(--sep); border-radius: 999px; padding: 3px 10px; }
.ring { position: relative; width: 44px; height: 44px; border-radius: 50%; background: var(--sep); display: grid; place-items: center; flex: none; }
.ring::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--panel); }
.ring > span { position: relative; z-index: 1; font-weight: 700; font-size: 14px; }
.ring.lock { background: var(--sep); }
.quiz-card .flag { position: absolute; right: 16px; bottom: 26px; border: 0; background: transparent; font-size: 22px; opacity: .35; cursor: pointer; }
.quiz-card .flag.on { opacity: 1; }
.quiz-card .speak { position: absolute; right: 16px; top: 16px; width: 52px; height: 52px; font-size: 24px; }
.quiz-foot { display: flex; justify-content: flex-end; margin: -6px 0 12px; }
.skip { border: 1.5px solid var(--sep); background: var(--panel); border-radius: 999px; width: 64px; height: 64px; font: inherit; font-weight: 800; color: var(--muted); cursor: pointer; }
.skip:disabled { opacity: .4; }
.choice b { color: var(--muted); font-weight: 800; width: 18px; }
.quiz-done .score { font-size: 32px; font-weight: 800; margin: 14px 0; }
.quiz-done .score span { font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 12px; }
.qresult { border-radius: 14px; padding: 12px 16px; font-weight: 700; margin: 10px 0; }
.qresult.pass { background: #e6f7ea; color: #1b7a38; }
.qresult.fail { background: #fdecec; color: #b3001b; }

/* ---- 単語帳の一覧: 並べ替えと行のメニュー ---- */
.deckrow { display: flex; align-items: stretch; gap: 2px; }
.deckrow .deck { flex: 1; min-width: 0; }
.deckrow.dragging { opacity: .4; }
.deckrow.over { box-shadow: inset 0 2px 0 var(--violet); }
.deckmenu { border: 0; background: transparent; color: var(--muted); font-size: 18px; width: 28px; border-radius: 10px; cursor: pointer; }
.deckmenu:hover { background: var(--sep); color: var(--fg); }
