/* アカデミア英単語 — 興國高校 アカデミアコース */
:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --soft: #F6F7F9;
  --line: #E4E7EC;
  --line-2: #D3D8E0;
  --ink: #2F3A4B;
  --ink-2: #4A5568;
  --muted: #7C8698;
  --faint: #AEB6C3;

  --red: #E5283F;     --red-lip: #B3172C;   --red-soft: #FFE8EB;
  --navy: #12306B;
  --blue: #2F6FDE;    --blue-lip: #1E4FB0;  --blue-soft: #E6EFFF; --blue-line: #9DBCF5;
  --green: #2DBE5B;   --green-lip: #1E9644; --green-soft: #DCF7E4; --green-ink: #178A3B;
  --gold: #FFC21A;    --gold-lip: #E09E00;  --gold-soft: #FFF4D1; --gold-ink: #A87200;
  --orange: #FF8A00;  --orange-lip: #D46F00;
  --purple: #8358E8;  --purple-lip: #6139C2;
  --gem: #1E9BF0;
  --wrong-ink: #D11C33; --wrong-line: #FF8C9A;

  --r: 16px;
  --f: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", system-ui, sans-serif;
  --f-en: "Nunito", "M PLUS Rounded 1c", sans-serif;
  --top-h: 60px;
  --tab-h: 66px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1A2C; --surface: #0F1A2C; --soft: #17253D; --line: #26364F; --line-2: #33456A;
    --ink: #EEF2F8; --ink-2: #CBD3E1; --muted: #93A0B8; --faint: #5E6C86;
    --red-soft: #3A1620; --blue-soft: #16294D; --blue-line: #2F4F8F; --green-soft: #12351F; --green-ink: #5BE089;
    --gold-soft: #3A2F0F; --gold-ink: #FFD35C; --wrong-ink: #FF6B7D; --wrong-line: #8F3040;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1A2C; --surface: #0F1A2C; --soft: #17253D; --line: #26364F; --line-2: #33456A;
  --ink: #EEF2F8; --ink-2: #CBD3E1; --muted: #93A0B8; --faint: #5E6C86;
  --red-soft: #3A1620; --blue-soft: #16294D; --blue-line: #2F4F8F; --green-soft: #12351F; --green-ink: #5BE089;
  --gold-soft: #3A2F0F; --gold-ink: #FFD35C; --wrong-ink: #FF6B7D; --wrong-line: #8F3040;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh;
  background: var(--bg); color: var(--ink);
  font-family: var(--f); font-size: 16px; line-height: 1.55; font-weight: 500;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; }
svg { display: block; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 10px; }
.en { font-family: var(--f-en); }
.hidden { display: none !important; }

/* ============ ボタン ============ */
.btn {
  --c: var(--red); --lip: var(--red-lip); --t: #fff;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 20px; border: 0; border-radius: 16px;
  background: var(--c); color: var(--t);
  font-weight: 800; font-size: 16px; letter-spacing: .06em;
  box-shadow: 0 4px 0 var(--lip);
  transition: transform .06s, box-shadow .06s, filter .15s;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--lip); }
.btn.btn:disabled { --c: var(--line); --lip: var(--line-2); --t: var(--faint); pointer-events: none; }
.btn.green { --c: var(--green); --lip: var(--green-lip); }
.btn.blue { --c: var(--blue); --lip: var(--blue-lip); }
.btn.gold { --c: var(--gold); --lip: var(--gold-lip); --t: #5A3B00; }
.btn.white { --c: #fff; --lip: rgba(0,0,0,.18); --t: var(--unit, var(--red)); }
.btn.outline { --c: var(--surface); --lip: var(--line); --t: var(--blue); border: 2px solid var(--line); }
.btn.block { width: 100%; }
.btn.sm { min-height: 40px; font-size: 14px; padding: 0 14px; border-radius: 12px; box-shadow: 0 3px 0 var(--lip); }
.btn.sm:active { transform: translateY(3px); box-shadow: none; }
.linkbtn { background: none; border: 0; color: var(--blue); font-weight: 800; letter-spacing: .04em; padding: 10px; }

/* ============ 上のバー ============ */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--bg); border-bottom: 2px solid var(--line); padding-top: env(safe-area-inset-top); }
.topbar-in { max-width: 600px; margin: 0 auto; height: var(--top-h); display: flex; align-items: center; justify-content: space-between; padding: 0 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 10px; border-radius: 12px;
  background: none; border: 0; font-family: var(--f-en); font-weight: 900; font-size: 18px; color: var(--faint);
}
.chip:hover { background: var(--soft); }
.chip svg { width: 28px; height: 28px; }
.chip.on { color: var(--orange); }
.chip.gem { color: var(--gem); }
.chip.lv { color: var(--gold-ink); }
.course-chip { padding: 0 6px; }
.course-chip img { width: 36px; height: 36px; border-radius: 10px; border: 2px solid var(--line); background: #fff; object-fit: cover; }

/* ============ 下のタブ ============ */
.tabbar {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
  background: var(--bg); border-top: 2px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px;
}
.tabbar button { position: relative; height: 54px; border-radius: 14px; border: 2px solid transparent; background: none; display: grid; place-items: center; }
.tabbar button svg { width: 32px; height: 32px; transition: transform .15s; }
.tabbar button[aria-current="page"] { background: var(--blue-soft); border-color: var(--blue-line); }
.tabbar button:active svg { transform: scale(.88); }
.tabbar .dot { position: absolute; top: 5px; right: calc(50% - 24px); width: 13px; height: 13px; border-radius: 50%; background: var(--red); border: 2px solid var(--bg); }
.with-tabs { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 24px); }
@media (min-width: 640px) {
  .tabbar { left: 50%; right: auto; width: 600px; transform: translateX(-50%); border: 2px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; }
}

.page { max-width: 600px; margin: 0 auto; padding: 16px; }
.h1 { font-size: 24px; font-weight: 800; letter-spacing: .02em; margin: 6px 0 4px; line-height: 1.3; }
.h2 { font-size: 20px; font-weight: 800; margin: 28px 0 12px; line-height: 1.3; }
.sub { color: var(--muted); font-size: 14px; margin: 0; font-weight: 600; }
.box { border: 2px solid var(--line); border-radius: var(--r); background: var(--surface); }

/* ============ 学ぶ（道） ============ */
.path { max-width: 600px; margin: 0 auto; padding: 16px 16px 40px; }
.unit { margin-bottom: 30px; --unit: var(--red); --unit-lip: var(--red-lip); }
.unit.c1 { --unit: var(--blue); --unit-lip: var(--blue-lip); }
.unit.c2 { --unit: var(--green); --unit-lip: var(--green-lip); }
.unit.c3 { --unit: var(--purple); --unit-lip: var(--purple-lip); }
.unit.c4 { --unit: var(--orange); --unit-lip: var(--orange-lip); }
.unit-head {
  position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top) + 12px); z-index: 12;
  display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 18px; border-radius: 16px;
  background: var(--unit); color: #fff; box-shadow: 0 4px 0 var(--unit-lip);
}
.unit-head .t { flex: 1; min-width: 0; }
.unit-head .k { font-family: var(--f-en); font-weight: 900; font-size: 13px; letter-spacing: .14em; opacity: .85; display: flex; align-items: center; gap: 8px; }
.unit-head .n { font-weight: 800; font-size: 20px; line-height: 1.3; }
.unit-head .tag { font-family: var(--f); letter-spacing: .04em; font-size: 11px; font-weight: 800; background: #fff; color: var(--unit); border-radius: 99px; padding: 1px 8px; }
.guide-btn {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 12px; border-radius: 12px;
  background: transparent; border: 2px solid rgba(255,255,255,.45); color: #fff; font-weight: 800; font-size: 14px;
  box-shadow: 0 3px 0 rgba(0,0,0,.14);
}
.guide-btn svg { width: 20px; height: 20px; }
.guide-btn:active { transform: translateY(3px); box-shadow: none; }
.nodes { position: relative; display: grid; justify-items: center; gap: 22px; padding: 76px 0 6px; }
.node-wrap { position: relative; z-index: 2; transform: translateX(var(--x, 0)); display: grid; justify-items: center; }
.node-wrap.has-pop { z-index: 30; }
.node {
  position: relative; z-index: 1; width: 74px; height: 68px; border-radius: 50%; border: 0;
  background: var(--unit); color: #fff; box-shadow: 0 8px 0 var(--unit-lip);
  display: grid; place-items: center; transition: transform .08s, box-shadow .08s;
}
.node svg { width: 36px; height: 36px; }
.node:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--unit-lip); }
.node.locked { background: var(--line); color: var(--faint); box-shadow: 0 8px 0 var(--line-2); }
.node.boss { width: 86px; height: 78px; }
.node.boss svg { width: 42px; height: 42px; }
.node.done.boss { background: var(--gold); box-shadow: 0 8px 0 var(--gold-lip); }
.node-ring { position: absolute; left: 50%; top: 0; width: 100px; height: 100px; margin: -14px 0 0 -50px; pointer-events: none; }
.node-wrap.boss .node-ring { width: 112px; height: 112px; margin: -15px 0 0 -56px; }
.node-ring circle { fill: none; stroke-width: 7; }
.node-ring .bg { stroke: var(--line); }
.node-ring .fg { stroke: var(--unit); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; }
.start-bubble {
  position: absolute; left: 50%; bottom: calc(100% + 20px); z-index: 3;
  background: var(--surface); color: var(--unit); border: 2px solid var(--line); border-radius: 12px;
  padding: 7px 14px; font-weight: 800; font-size: 14px; letter-spacing: .08em; white-space: nowrap;
  animation: bob 1.6s ease-in-out infinite; pointer-events: none; transform: translateX(-50%);
}
.start-bubble::after {
  content: ""; position: absolute; left: 50%; top: 100%; width: 12px; height: 12px; margin: -5px 0 0 -6px;
  background: var(--surface); border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: rotate(45deg);
}
@keyframes bob { 50% { transform: translate(-50%, -6px); } }
.node-stars { display: flex; justify-content: center; gap: 2px; margin-top: 14px; }
.node-stars svg { width: 20px; height: 20px; }
.chest-node { position: relative; z-index: 1; width: 84px; height: 76px; border: 0; background: none; padding: 0; display: grid; place-items: center; }
.chest-node svg { width: 76px; height: 76px; filter: drop-shadow(0 5px 0 rgba(0,0,0,.12)); }
.chest-node.locked svg { filter: grayscale(1) opacity(.4); }
.chest-node.ready svg { animation: wiggle 2.4s ease-in-out infinite; }
@keyframes wiggle { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-8deg); } 85% { transform: rotate(8deg); } 92% { transform: rotate(-4deg); } }
.path-mascot { position: absolute; z-index: 1; top: 46%; transform: translateY(-50%); pointer-events: none; }
.path-mascot.l { left: 0; } .path-mascot.r { right: 0; }

.pop {
  position: absolute; z-index: 20; top: calc(100% + 18px); left: 50%; width: min(300px, 84vw);
  transform: translateX(calc(-50% - var(--x, 0px) / 2));
  background: var(--unit); color: #fff; border-radius: 16px; padding: 16px; text-align: left;
  animation: popin .18s ease-out;
}
.pop.gray { background: var(--soft); color: var(--ink); border: 2px solid var(--line); }
.pop::before { content: ""; position: absolute; left: calc(50% + var(--x, 0px) / 2); top: -8px; width: 16px; height: 16px; margin-left: -8px; background: inherit; transform: rotate(45deg); border-radius: 3px; }
.pop.gray::before { border-left: 2px solid var(--line); border-top: 2px solid var(--line); top: -9px; }
.pop b { display: block; font-size: 18px; font-weight: 800; line-height: 1.35; }
.pop p { margin: 4px 0 14px; font-size: 14px; opacity: .92; line-height: 1.5; font-weight: 600; }
.pop .btn.white { width: 100%; }
@keyframes popin { from { opacity: 0; margin-top: -6px; } }

/* ============ 練習・クエスト ============ */
.card-row {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; text-align: left;
  border: 2px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: 0 4px 0 var(--line);
  transition: transform .06s, box-shadow .06s;
}
button.card-row:active { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }
button.card-row:disabled { opacity: .5; }
.card-row .ic { flex: none; width: 52px; height: 52px; }
.card-row .ic svg { width: 100%; height: 100%; }
.card-row .t { flex: 1; min-width: 0; }
.card-row .t b { display: block; font-weight: 800; font-size: 17px; line-height: 1.35; }
.card-row .t small { display: block; color: var(--muted); font-size: 13px; line-height: 1.45; margin-top: 2px; font-weight: 600; }
.card-row .count { font-family: var(--f-en); font-weight: 900; font-size: 22px; color: var(--red); }
.card-row .go { width: 22px; height: 22px; color: var(--faint); transform: scaleX(-1); }
.stack { display: grid; gap: 12px; }

.hero { display: flex; align-items: center; gap: 12px; padding: 18px 16px 18px 20px; border-radius: 20px; color: #fff; overflow: hidden; }
.hero .t { flex: 1; min-width: 0; }
.hero .t b { font-size: 22px; font-weight: 800; display: block; line-height: 1.3; }
.hero .t span { font-size: 14px; opacity: .92; display: block; margin-top: 4px; font-weight: 600; }
.hero .t .btn { margin-top: 14px; }
.hero .mascot { flex: none; }
.hero.red { background: var(--red); box-shadow: 0 4px 0 var(--red-lip); }
.hero.blue { background: var(--blue); box-shadow: 0 4px 0 var(--blue-lip); }
.hero.purple { background: var(--purple); box-shadow: 0 4px 0 var(--purple-lip); }

.quest { display: grid; grid-template-columns: 44px 1fr; gap: 6px 14px; align-items: center; padding: 16px; border-bottom: 2px solid var(--line); }
.quest:last-child { border-bottom: 0; }
.quest .ic { grid-row: span 2; width: 44px; height: 44px; }
.quest .ic svg { width: 100%; height: 100%; }
.quest b { font-weight: 800; font-size: 16px; line-height: 1.35; }
.qbar-row { display: flex; align-items: center; gap: 10px; }
.qbar { flex: 1; height: 18px; border-radius: 99px; background: var(--line); position: relative; overflow: hidden; }
.qbar i { position: absolute; inset: 0 auto 0 0; background: var(--gold); border-radius: 99px; transition: width .8s cubic-bezier(.2,.9,.2,1); }
.qbar i::after { content: ""; position: absolute; left: 8px; right: 8px; top: 4px; height: 4px; border-radius: 99px; background: rgba(255,255,255,.4); }
.qbar span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--f-en); font-weight: 900; font-size: 12px; color: var(--ink-2); }
.qbar.done i { background: var(--green); }
.qbar.blue i { background: var(--blue); }
.qbar-row .reward { flex: none; width: 34px; height: 34px; }
.qbar-row .reward svg { width: 100%; height: 100%; }

.shop-item { display: flex; align-items: center; gap: 12px; padding: 16px 14px; border-bottom: 2px solid var(--line); }
.shop-item:last-child { border-bottom: 0; }
.shop-item .ic { width: 46px; height: 46px; flex: none; }
.shop-item .ic svg { width: 100%; height: 100%; }
.shop-item .t { flex: 1; min-width: 0; }
.shop-item .t b { display: block; font-weight: 800; white-space: nowrap; }
.shop-item .t small { color: var(--muted); font-size: 13px; display: block; line-height: 1.45; font-weight: 600; }
.price { display: inline-flex; align-items: center; gap: 4px; font-family: var(--f-en); font-weight: 900; }
.price svg { width: 20px; height: 20px; }
.btn.outline .price { color: var(--gem); }

/* ============ リーグ ============ */
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--soft); border: 2px solid var(--line); }
.seg button { flex: 1; border: 0; background: none; border-radius: 10px; padding: 8px 4px; font-weight: 800; font-size: 14px; color: var(--muted); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--blue); box-shadow: 0 2px 0 var(--line); }
.league-head { text-align: center; padding: 4px 0 16px; }
.league-head .shield { width: 88px; height: 88px; margin: 0 auto 6px; }
.league-head .shield svg { width: 100%; height: 100%; }
.league-head b { font-size: 22px; font-weight: 800; display: block; }
.league-head span { color: var(--muted); font-size: 14px; font-weight: 600; }
.league-head .left { color: var(--orange); font-weight: 800; }
.days { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 12px -16px 0; padding: 2px 16px 8px; }
.days::-webkit-scrollbar { display: none; }
.days button { flex: none; min-width: 64px; height: 42px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font-family: var(--f-en); font-weight: 900; font-size: 14px; color: var(--muted); box-shadow: 0 3px 0 var(--line); }
.days button[aria-pressed="true"] { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); box-shadow: 0 3px 0 var(--blue-line); }
.rank-list { margin-top: 10px; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; }
.rank-row.me { background: var(--blue-soft); }
.rank-no { flex: none; width: 34px; display: grid; place-items: center; font-family: var(--f-en); font-weight: 900; font-size: 17px; color: var(--muted); }
.rank-no svg { width: 34px; height: 34px; }
.rank-av { flex: none; width: 50px; height: 50px; border-radius: 50%; background: var(--soft); display: grid; place-items: end center; overflow: hidden; border: 2px solid var(--line); }
.rank-av svg { margin-bottom: -7px; }
.rank-name { flex: 1; min-width: 0; }
.rank-name b { display: block; font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-name small { display: block; color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-val { flex: none; font-family: var(--f-en); font-weight: 900; font-size: 16px; color: var(--ink-2); text-align: right; }
.rank-val small { font-size: 12px; color: var(--muted); margin-left: 2px; }
.class-bar { flex: 1; min-width: 0; }
.class-bar b { font-weight: 800; font-size: 17px; }
.class-bar .qbar { height: 14px; margin-top: 6px; }
.empty { text-align: center; padding: 26px 16px; color: var(--muted); font-weight: 700; }
.empty .mascot { margin: 0 auto 10px; }

/* ============ プロフィール ============ */
.profile-top { display: flex; align-items: center; gap: 16px; padding: 6px 0 20px; border-bottom: 2px solid var(--line); }
.profile-av { flex: none; width: 108px; height: 108px; border-radius: 50%; background: var(--soft); border: 2px solid var(--line); display: grid; place-items: end center; overflow: hidden; }
.profile-av svg { margin-bottom: -12px; }
.profile-top .nm { font-size: 24px; font-weight: 800; line-height: 1.25; word-break: break-all; }
.profile-top .cl { color: var(--muted); font-weight: 700; margin-top: 2px; }
.title-pill { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; padding: 3px 12px 3px 8px; border-radius: 99px; font-weight: 800; font-size: 13px; color: #fff; }
.title-pill svg { width: 18px; height: 18px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 14px; }
.stat .ic { width: 30px; height: 30px; flex: none; }
.stat .ic svg { width: 100%; height: 100%; }
.stat b { display: block; font-family: var(--f-en); font-weight: 900; font-size: 20px; line-height: 1.2; }
.stat small { color: var(--muted); font-size: 12px; font-weight: 700; }
.lvbar { margin-top: 16px; padding: 14px 16px; border: 2px solid var(--line); border-radius: 14px; }
.lvbar .row { display: flex; justify-content: space-between; align-items: baseline; font-weight: 800; }
.lvbar .row span { color: var(--muted); font-family: var(--f-en); font-weight: 800; font-size: 14px; }
.lvbar .qbar { margin-top: 8px; }
.badge-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 2px solid var(--line); }
.badge-row:last-child { border-bottom: 0; }
.badge-art { flex: none; width: 60px; height: 68px; position: relative; display: grid; place-items: center; }
.badge-art > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.badge-art .fg { position: relative; width: 32px; height: 32px; margin-top: -3px; }
.badge-art .fg svg { width: 100%; height: 100%; }
.badge-row.locked .badge-art { filter: grayscale(1); opacity: .4; }
.badge-row .t { flex: 1; min-width: 0; }
.badge-row b { font-weight: 800; display: block; }
.badge-row small { color: var(--muted); font-size: 13px; display: block; line-height: 1.45; font-weight: 600; }
.badge-row .qbar { height: 14px; margin-top: 8px; }
.badge-row .qbar span { font-size: 10px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 2px solid var(--line); font-weight: 700; }
.setting:last-child { border-bottom: 0; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line-2); transition: background .15s; }
.switch i::after { content: ""; position: absolute; left: 4px; top: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 3px solid var(--blue); outline-offset: 2px; }
.code { font-family: var(--f-en); font-weight: 900; font-size: 20px; letter-spacing: .1em; text-align: center; padding: 12px; border-radius: 12px; border: 2px dashed var(--line-2); background: var(--soft); user-select: all; }

/* ============ 入力 ============ */
.field { display: grid; gap: 6px; }
.input {
  width: 100%; min-height: 58px; padding: 0 16px; border-radius: 14px; border: 2px solid var(--line); background: var(--soft);
  font-size: 19px; font-weight: 700; color: var(--ink);
}
.input:focus { outline: none; border-color: var(--blue); background: var(--surface); }
.input::placeholder { color: var(--faint); }
.err { color: var(--wrong-ink); font-weight: 700; font-size: 14px; min-height: 1.5em; }
.class-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.class-card {
  border: 2px solid var(--line); border-radius: 18px; background: var(--surface); padding: 14px 8px 12px; text-align: center;
  box-shadow: 0 4px 0 var(--line); transition: transform .06s, box-shadow .06s;
}
.class-card:active { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }
.class-card .mascot { margin: 0 auto 2px; }
.class-card b { display: block; font-size: 26px; font-weight: 800; line-height: 1.2; }
.class-card small { color: var(--muted); font-weight: 700; font-size: 13px; }
.class-card[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 4px 0 var(--blue-line); }
.class-card[aria-pressed="true"] b { color: var(--blue); }

/* ============ はじめに ============ */
.onb { min-height: 100dvh; display: flex; flex-direction: column; max-width: 520px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom)); }
.onb-top { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.onb-body { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 20px; padding: 16px 0; }
.onb-foot { display: grid; gap: 12px; }
.splash { text-align: center; }
.splash .logo { width: 230px; max-width: 72%; margin: 0 auto 4px; display: block; }
:root[data-theme="dark"] .splash .logo { background: #fff; border-radius: 12px; padding: 8px 12px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .splash .logo { background: #fff; border-radius: 12px; padding: 8px 12px; } }
.splash .mascot { margin: 10px auto 4px; animation: hop 2.4s ease-in-out infinite; }
@keyframes hop { 0%, 60%, 100% { transform: translateY(0); } 70% { transform: translateY(-14px); } 80% { transform: translateY(0); } 86% { transform: translateY(-5px); } }
.splash h1 { font-size: 30px; font-weight: 800; margin: 4px 0 0; line-height: 1.3; letter-spacing: .02em; }
.splash .course { font-weight: 800; color: var(--red); letter-spacing: .14em; font-size: 14px; }
.splash p { color: var(--muted); margin: 8px 0 0; font-weight: 600; }
.speech { display: flex; align-items: flex-end; gap: 8px; }
.speech .mascot { flex: none; }
.bubble { position: relative; border: 2px solid var(--line); border-radius: 16px; padding: 12px 16px; background: var(--surface); font-weight: 700; font-size: 17px; line-height: 1.5; }
.bubble::before { content: ""; position: absolute; left: -9px; bottom: 22px; width: 14px; height: 14px; background: var(--surface); border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: rotate(45deg); }

/* ============ レッスン ============ */
.lesson { min-height: 100dvh; display: flex; flex-direction: column; }
.lesson-top { max-width: 640px; width: 100%; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: calc(22px + env(safe-area-inset-top)) 16px 8px; }
.iconbtn { flex: none; width: 42px; height: 42px; border: 0; background: none; color: var(--faint); display: grid; place-items: center; border-radius: 12px; }
.iconbtn svg { width: 26px; height: 26px; }
.iconbtn:hover { color: var(--muted); background: var(--soft); }
.pbar { position: relative; flex: 1; height: 18px; border-radius: 99px; background: var(--line); }
.pbar i { position: absolute; inset: 0 auto 0 0; min-width: 0; border-radius: 99px; background: var(--green); transition: width .45s cubic-bezier(.3,1.4,.5,1); }
.pbar i::after { content: ""; position: absolute; left: 8px; right: 8px; top: 4px; height: 5px; min-width: 0; border-radius: 99px; background: rgba(255,255,255,.35); }
.pbar.hot i { background: var(--orange); }
.combo { position: absolute; left: 4px; bottom: calc(100% + 3px); display: flex; align-items: center; gap: 3px; white-space: nowrap; font-weight: 800; font-size: 13px; color: var(--orange); letter-spacing: .04em; animation: comboin .4s cubic-bezier(.3,1.6,.5,1); }
.combo svg { width: 17px; height: 17px; }
@keyframes comboin { from { transform: scale(.4); opacity: 0; } }
.hearts { flex: none; display: flex; align-items: center; gap: 1px; }
.hearts svg { width: 26px; height: 26px; }
.hearts .lost { animation: heartlost .5s ease; }
@keyframes heartlost { 40% { transform: scale(1.5) rotate(-10deg); } }
.boss-strip { max-width: 640px; width: 100%; margin: 0 auto; padding: 4px 16px 0; display: flex; align-items: center; gap: 12px; font-family: var(--f-en); font-weight: 900; color: var(--muted); font-size: 15px; }
.boss-tag { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px 3px 7px; border-radius: 99px; background: var(--gold-soft); color: var(--gold-ink); font-family: var(--f); font-weight: 800; font-size: 13px; }
.boss-tag svg { width: 16px; height: 16px; }
.boss-strip .time { flex: none; display: inline-flex; align-items: center; gap: 5px; min-width: 70px; }
.boss-strip .time svg { width: 20px; height: 20px; }
.boss-strip { flex-wrap: wrap; row-gap: 10px; }
.race { flex: 1 1 100%; display: grid; gap: 8px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 14px; }
.lane { display: grid; grid-template-columns: 76px 1fr; gap: 10px; align-items: center; font-family: var(--f); font-size: 12px; font-weight: 800; }
.lane span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lane .t { position: relative; height: 8px; border-radius: 99px; background: var(--line); margin-right: 10px; }
.lane .t i { position: absolute; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 3px solid var(--bg); background: var(--blue); transition: left .3s; }
.lane.rival .t i { background: var(--orange); }

.lesson-body { flex: 1; max-width: 640px; width: 100%; margin: 0 auto; padding: 20px 16px 190px; display: flex; flex-direction: column; }
.q-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--purple); font-weight: 800; font-size: 14px; letter-spacing: .06em; margin-bottom: 4px; }
.q-tag svg { width: 18px; height: 18px; }
.q-title { font-size: 22px; font-weight: 800; line-height: 1.35; margin: 0 0 18px; }
.prompt { display: flex; align-items: flex-end; gap: 4px; margin-bottom: 24px; }
.prompt .mascot { flex: none; }
.prompt .bubble { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.prompt .word { font-size: 26px; font-weight: 800; line-height: 1.3; }
.prompt .word.en { font-family: var(--f-en); font-weight: 900; font-size: 30px; letter-spacing: .01em; }
.prompt .hint { display: block; width: 100%; color: var(--muted); font-size: 13px; font-weight: 700; margin-top: -4px; }
.spk { flex: none; width: 46px; height: 46px; border-radius: 12px; border: 0; background: var(--blue); color: #fff; display: grid; place-items: center; box-shadow: 0 4px 0 var(--blue-lip); }
.spk svg { width: 24px; height: 24px; }
.spk:active { transform: translateY(4px); box-shadow: none; }
.spk.sm { width: 38px; height: 38px; border-radius: 11px; box-shadow: 0 3px 0 var(--blue-lip); }
.spk.sm svg { width: 20px; height: 20px; }
.spk.quiet { background: var(--surface); color: var(--blue); box-shadow: 0 3px 0 var(--line); border: 2px solid var(--line); }

.opts { display: grid; gap: 12px; }
.opt {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 62px; padding: 10px 14px; text-align: left;
  border: 2px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 4px 0 var(--line);
  font-weight: 700; font-size: 18px; transition: transform .06s, box-shadow .06s;
}
.opt.en { font-family: var(--f-en); font-weight: 800; font-size: 20px; }
.opt kbd { flex: none; width: 30px; height: 30px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center; font-family: var(--f-en); font-weight: 900; font-size: 14px; color: var(--faint); }
.opt:active { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }
.opt[aria-pressed="true"] { border-color: var(--blue-line); background: var(--blue-soft); box-shadow: 0 4px 0 var(--blue-line); color: var(--blue); }
.opt[aria-pressed="true"] kbd { border-color: var(--blue-line); color: var(--blue); }
.opt.right { border-color: var(--green); background: var(--green-soft); box-shadow: 0 4px 0 var(--green); color: var(--green-ink); }
.opt.right kbd { border-color: var(--green); color: var(--green-ink); }
.opt.wrong { border-color: var(--wrong-line); background: var(--red-soft); box-shadow: 0 4px 0 var(--wrong-line); color: var(--wrong-ink); }
.lesson.checked .opt, .lesson.checked .tile, .lesson.checked .type-area { pointer-events: none; }

.listen-box { display: flex; justify-content: center; align-items: flex-end; gap: 16px; margin: 8px 0 30px; }
.big-spk { width: 124px; height: 124px; border-radius: 28px; border: 0; background: var(--blue); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 0 var(--blue-lip); }
.big-spk svg { width: 62px; height: 62px; }
.big-spk:active { transform: translateY(6px); box-shadow: none; }
.big-spk.slow { width: 76px; height: 76px; border-radius: 20px; }
.big-spk.slow svg { width: 42px; height: 42px; }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match .col { display: grid; gap: 12px; align-content: start; }
.mt {
  min-height: 62px; padding: 8px 10px; border: 2px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 4px 0 var(--line);
  font-weight: 700; font-size: 16px; line-height: 1.3; transition: transform .06s, box-shadow .06s, opacity .3s;
}
.mt.en { font-family: var(--f-en); font-weight: 800; font-size: 18px; }
.mt:active { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }
.mt[aria-pressed="true"] { border-color: var(--blue-line); background: var(--blue-soft); box-shadow: 0 4px 0 var(--blue-line); color: var(--blue); }
.mt.ok { border-color: var(--green); background: var(--green-soft); color: var(--green-ink); box-shadow: 0 4px 0 var(--green); }
.mt.gone { opacity: .45; pointer-events: none; border-color: var(--line); background: var(--soft); box-shadow: none; transform: translateY(4px); color: var(--faint); }
.mt.ng { border-color: var(--wrong-line); background: var(--red-soft); color: var(--wrong-ink); box-shadow: 0 4px 0 var(--wrong-line); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.answer-line { min-height: 70px; border-bottom: 2px solid var(--line); display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px; padding: 6px 0 12px; margin-bottom: 28px; }
.bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.tile-slot { width: 50px; height: 58px; border-radius: 14px; background: var(--line); }
.tile {
  width: 50px; height: 58px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); box-shadow: 0 4px 0 var(--line);
  font-family: var(--f-en); font-weight: 900; font-size: 25px; display: grid; place-items: center; padding: 0; transition: transform .06s, box-shadow .06s;
}
.tile:active { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }

.type-area {
  width: 100%; min-height: 130px; resize: none; border: 2px solid var(--line); border-radius: 16px; background: var(--soft);
  padding: 16px; font-family: var(--f-en); font-weight: 800; font-size: 28px; color: var(--ink); letter-spacing: .02em;
}
.type-area:focus { outline: none; border-color: var(--blue); background: var(--surface); }
.type-area::placeholder { color: var(--faint); font-family: var(--f); font-weight: 700; font-size: 17px; letter-spacing: 0; }

.intro-card { border: 2px solid var(--line); border-radius: 20px; padding: 28px 18px 24px; text-align: center; box-shadow: 0 4px 0 var(--line); }
.intro-card .w { font-family: var(--f-en); font-weight: 900; font-size: 46px; line-height: 1.15; letter-spacing: .01em; word-break: break-word; }
.intro-card .m { font-size: 24px; font-weight: 800; margin-top: 12px; color: var(--ink-2); }
.intro-card .spks { display: flex; justify-content: center; gap: 12px; margin-top: 20px; }
.intro-tip { display: flex; gap: 10px; align-items: flex-end; margin-top: 18px; }
.intro-tip .bubble { font-size: 15px; font-weight: 700; color: var(--ink-2); margin-bottom: 10px; }

.checkbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; border-top: 2px solid var(--line); background: var(--bg); padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.checkbar-in { max-width: 640px; margin: 0 auto; display: grid; gap: 14px; }
.checkbar .msg { display: none; align-items: center; gap: 12px; }
.checkbar .msg .ic { flex: none; width: 56px; height: 56px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; }
.checkbar .msg .ic svg { width: 42px; height: 42px; }
.checkbar .msg b { display: block; font-size: 22px; font-weight: 800; line-height: 1.3; }
.checkbar .msg .ans { font-size: 16px; font-weight: 700; line-height: 1.45; }
.checkbar .msg .ans .en { font-weight: 900; font-size: 19px; }
.checkbar.ok, .checkbar.ng { border-top-color: transparent; animation: sheetup .22s ease-out; }
.checkbar.ok { background: var(--green-soft); color: var(--green-ink); }
.checkbar.ng { background: var(--red-soft); color: var(--wrong-ink); }
.checkbar.ok .msg, .checkbar.ng .msg { display: flex; }
.checkbar.ok .ic { color: var(--green); }
.checkbar.ng .ic { color: #FF4B5C; }
@keyframes sheetup { from { transform: translateY(24px); opacity: .4; } }
@media (min-width: 700px) {
  .checkbar-in { grid-template-columns: 1fr auto; align-items: center; }
  .checkbar-in .btn { min-width: 180px; }
}

/* ============ 完了・演出 ============ */
.done-screen { min-height: 100dvh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; padding: calc(24px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom)); text-align: center; }
.done-screen .body { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; }
.done-screen h2 { font-size: 30px; font-weight: 800; margin: 10px 0 0; line-height: 1.3; color: var(--gold-ink); }
.done-screen h2.red { color: var(--red); }
.done-screen h2.orange { color: var(--orange); }
.done-screen p { color: var(--muted); margin: 0; font-weight: 700; }
.done-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; margin-top: 22px; }
.dstat { border-radius: 16px; border: 2px solid var(--c); background: var(--c); overflow: hidden; animation: rise .5s both cubic-bezier(.3,1.4,.5,1); }
.dstat:nth-child(2) { animation-delay: .12s; } .dstat:nth-child(3) { animation-delay: .24s; }
@keyframes rise { from { transform: translateY(20px) scale(.9); opacity: 0; } }
.dstat .k { color: #fff; font-weight: 800; font-size: 12px; letter-spacing: .08em; padding: 5px 0 4px; }
.dstat .v { background: var(--surface); border-radius: 13px; padding: 12px 4px; display: flex; align-items: center; justify-content: center; gap: 4px; font-family: var(--f-en); font-weight: 900; font-size: 22px; color: var(--c); }
.dstat .v svg { width: 22px; height: 22px; }
.dstat.gold { --c: var(--gold); } .dstat.gold .k { color: #5A3B00; }
.dstat.green { --c: var(--green); } .dstat.blue { --c: var(--blue); } .dstat.red { --c: var(--red); }
.big-stars { display: flex; justify-content: center; align-items: flex-start; gap: 6px; }
.big-stars svg { width: 60px; height: 60px; }
.big-stars .s { animation: starpop .5s both cubic-bezier(.3,1.8,.5,1); }
.big-stars .s:nth-child(2) { animation-delay: .2s; margin-top: -16px; } .big-stars .s:nth-child(3) { animation-delay: .4s; }
@keyframes starpop { from { transform: scale(0) rotate(-60deg); } }
.note-card { width: 100%; margin-top: 12px; display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; border: 2px solid var(--line); border-radius: 16px; font-weight: 700; font-size: 14px; }
.note-card .ic { flex: none; width: 36px; height: 36px; }
.note-card .ic svg { width: 100%; height: 100%; }
.missed-list { width: 100%; margin-top: 14px; text-align: left; }
.missed-list .cap { font-weight: 800; font-size: 14px; color: var(--muted); margin: 0 4px 6px; }
.streak-big { width: 160px; height: 160px; margin: 0 auto; }
.streak-big svg { width: 100%; height: 100%; animation: flamein .7s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes flamein { from { transform: scale(.3); opacity: 0; } }
.streak-num { font-family: var(--f-en); font-weight: 900; font-size: 92px; line-height: 1; color: var(--orange); margin-top: -8px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; width: 100%; margin-top: 22px; padding: 14px 10px; border: 2px solid var(--line); border-radius: 18px; }
.week div { display: grid; justify-items: center; gap: 6px; font-weight: 800; font-size: 13px; color: var(--muted); }
.week i { width: 32px; height: 32px; border-radius: 50%; background: var(--line); display: grid; place-items: center; }
.week i.on { background: var(--orange); }
.week i.frz { background: #39B4FF; }
.week i svg { width: 18px; height: 18px; color: #fff; }
.week .today { color: var(--orange); }
.chest-big { width: 180px; height: 180px; margin: 0 auto; }
.chest-big svg { width: 100%; height: 100%; }
.chest-big.shake svg { animation: wiggle 1.2s ease-in-out infinite; }
.chest-big.open svg { animation: flamein .5s cubic-bezier(.3,1.6,.5,1) both; }
.reward-pill { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; padding: 8px 20px; border-radius: 99px; border: 2px solid var(--line); font-family: var(--f-en); font-weight: 900; font-size: 26px; color: var(--gem); animation: rise .5s .2s both; }
.reward-pill svg { width: 30px; height: 30px; }

/* ============ 単語帳・赤シート ============ */
.back-row { display: flex; align-items: center; gap: 6px; margin: -6px 0 6px -10px; }
.word-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 2px solid var(--line); }
.word-row:last-child { border-bottom: 0; }
.word-row .t { flex: 1; min-width: 0; }
.word-row .w { font-family: var(--f-en); font-weight: 900; font-size: 19px; line-height: 1.3; }
.word-row .m { color: var(--muted); font-weight: 700; font-size: 14px; }
.word-row .rv { display: inline-block; margin-left: 6px; font-family: var(--f); font-size: 11px; font-weight: 800; color: var(--purple); border: 2px solid currentColor; border-radius: 99px; padding: 0 7px; vertical-align: 3px; letter-spacing: .04em; }
.strength { display: flex; align-items: flex-end; gap: 3px; height: 22px; flex: none; }
.strength i { width: 5px; border-radius: 2px; background: var(--line); }
.strength i:nth-child(1) { height: 7px; } .strength i:nth-child(2) { height: 12px; } .strength i:nth-child(3) { height: 17px; } .strength i:nth-child(4) { height: 22px; }
.strength.s1 i:nth-child(-n+1), .strength.s2 i:nth-child(-n+2), .strength.s3 i:nth-child(-n+3) { background: var(--gold); }
.strength.s4 i { background: var(--green); }

.paper { background: #FFFDF7; color: #23272F; border-radius: 16px; border: 2px solid #E9E2D2; box-shadow: 0 4px 0 #E9E2D2; position: relative; overflow: hidden; }
.paper .srow { display: grid; grid-template-columns: 1fr 1fr 38px; align-items: center; gap: 10px; padding: 0 12px 0 16px; height: 58px; border-bottom: 1px dashed #E3DBC8; }
.paper .srow:last-child { border-bottom: 0; }
.paper .w { font-family: var(--f-en); font-weight: 900; font-size: 19px; }
.paper .m { font-weight: 800; font-size: 16px; }
.paper .ink-red { color: #F4512C; transition: color .12s; }
.paper .srow.covered .ink-red { color: transparent; }
.paper .spk.quiet { position: relative; z-index: 4; background: #fff; border-color: #E9E2D2; box-shadow: 0 3px 0 #E9E2D2; }
.film {
  position: absolute; left: 0; right: 0; bottom: 0; top: var(--top, 0px); z-index: 2;
  background: rgba(232, 22, 44, .84); mix-blend-mode: multiply; transition: top .15s ease-out; touch-action: none;
}
.film.drag { transition: none; }
.film-edge { position: absolute; left: 0; right: 0; top: var(--top, 0px); z-index: 3; height: 0; transition: top .15s ease-out; }
.film-edge.drag { transition: none; }
.film-handle {
  position: absolute; left: 50%; top: 0; transform: translate(-50%, -50%); width: 76px; height: 34px; border-radius: 99px; touch-action: none;
  background: #D9142C; border: 3px solid #fff; box-shadow: 0 3px 10px rgba(0,0,0,.28); display: grid; place-items: center; cursor: grab;
}
.film-handle::before { content: ""; width: 30px; height: 10px; background: linear-gradient(#fff 0 2px, transparent 2px 4px, #fff 4px 6px, transparent 6px 8px, #fff 8px 10px); border-radius: 1px; }
.sheet-hint { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 700; font-size: 14px; margin: 10px 2px 14px; }

.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.dex-card { display: flex; align-items: center; gap: 10px; padding: 12px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left; box-shadow: 0 3px 0 var(--line); width: 100%; }
.dex-card .t { flex: 1; min-width: 0; }
.dex-card .w { font-family: var(--f-en); font-weight: 900; font-size: 16px; word-break: break-word; line-height: 1.25; }
.dex-card .m { color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1.35; }
.dex-card.locked { background: var(--soft); box-shadow: none; }
.dex-card.locked .w { color: var(--faint); letter-spacing: .12em; }
.dex-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.dex-sum div { border: 2px solid var(--line); border-radius: 14px; padding: 10px; text-align: center; }
.dex-sum b { display: block; font-family: var(--f-en); font-weight: 900; font-size: 24px; line-height: 1.2; }
.dex-sum small { color: var(--muted); font-weight: 700; font-size: 12px; }

/* ============ ポップアップ ============ */
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(8, 18, 38, .55); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-width: 560px; background: var(--bg); border-radius: 24px 24px 0 0; padding: 24px 20px calc(20px + env(safe-area-inset-bottom)); text-align: center; animation: sheetin .28s cubic-bezier(.2,1,.3,1); max-height: 92dvh; overflow-y: auto; }
@keyframes sheetin { from { transform: translateY(40px); opacity: .5; } }
@media (min-width: 640px) { .overlay { align-items: center; } .sheet { border-radius: 24px; } }
.sheet h3 { font-size: 24px; font-weight: 800; margin: 8px 0 6px; line-height: 1.35; }
.sheet p { color: var(--muted); margin: 0 0 18px; font-weight: 600; }
.sheet .mascot { margin: 0 auto; }
.sheet .actions { display: grid; gap: 12px; }
.sheet.left { text-align: left; }
.lvl-num { font-family: var(--f-en); font-weight: 900; font-size: 88px; line-height: 1; color: var(--gold-ink); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 16px; border-radius: 3px; animation: fall 2.2s cubic-bezier(.3,.6,.5,1) forwards; }
@keyframes fall { to { transform: translate(var(--dx), 110vh) rotate(var(--r)); } }

.toasts { position: fixed; left: 50%; top: calc(10px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; background: var(--surface); color: var(--ink); border: 2px solid var(--line); border-radius: 16px; padding: 10px 14px; font-weight: 800; font-size: 15px; box-shadow: 0 12px 30px -14px rgba(0,0,0,.4); animation: toastin .35s cubic-bezier(.3,1.5,.5,1) both; }
.toast .ic { flex: none; width: 34px; height: 34px; }
.toast .ic svg { width: 100%; height: 100%; }
.toast small { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.toast.out { animation: toastout .3s ease both; }
@keyframes toastin { from { transform: translateY(-16px) scale(.95); opacity: 0; } }
@keyframes toastout { to { transform: translateY(-12px); opacity: 0; } }

.footnote { text-align: center; color: var(--faint); font-size: 12px; font-weight: 700; margin: 28px 0 0; line-height: 1.6; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
