/* =========================================================
   StudyMate - style.css
   世界観：夜の大図書館。紺と紫の夜空に、金のふちかざりと星のひかり。
   Color:
     --night-0 #070920 (いちばん深い夜)   --night-1 #10133a (パネル)   --night-2 #181c52 (パネルの中)
     --violet #8a74f0 (ぬくもりのある紫)    --lav #c9bcff (やさしい文字)
     --gold #e9c874 (ふち・ボタン)          --rose #ff86b0 (まちがい)   --mint #6fe3c6 (せいかい)
   Type:
     ロゴ … Cinzel / 見出し … Shippori Mincho B1 / 本文 … Zen Maru Gothic / キャッチコピー … Yuji Mai
   背景の壁紙は <body> の --wallpaper に js/app.js が入れます（ガチャで手に入れた壁紙に着せ替え）。
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700&family=Shippori+Mincho+B1:wght@500;700;800&family=Yuji+Mai&family=Zen+Maru+Gothic:wght@400;500;700;900&display=swap');

:root {
  --night-0: #070920;
  --night-1: #10133a;
  --night-2: #181c52;
  --night-3: #242a78;
  --violet: #8a74f0;
  --violet-deep: #5b45c8;
  --lav: #c9bcff;
  --gold: #e9c874;
  --gold-hi: #fff0b8;
  --gold-deep: #b8913a;
  --rose: #ff86b0;
  --rose-deep: #d94f82;
  --mint: #6fe3c6;
  --mint-deep: #2fb597;
  --sky: #7cc4ff;
  --text: #efecff;
  --text-soft: #b2afe0;

  --panel-bg: linear-gradient(180deg, rgba(24, 28, 84, .80), rgba(11, 13, 44, .88));
  --line: rgba(233, 200, 116, .62);
  --line-soft: rgba(233, 200, 116, .26);
  --glass: rgba(255, 255, 255, .06);

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(2, 3, 20, .5);
  --glow: 0 0 22px rgba(138, 116, 240, .35);
  --nav-h: 64px;

  --f-logo: 'Cinzel', 'Shippori Mincho B1', serif;
  --f-head: 'Shippori Mincho B1', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
  --f-body: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', 'Hiragino Sans', sans-serif;
  --f-hand: 'Yuji Mai', 'Shippori Mincho B1', serif;
}

* { box-sizing: border-box; }

html { background: var(--night-0); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--f-body);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  background: transparent;
  padding-bottom: calc(var(--nav-h) + 18px);
  position: relative;
}
/* 壁紙（ガチャで着せ替え）と、文字を読みやすくする暗いベール */
/* body::before {
  content: ""; position: fixed; inset: 0; z-index: -2;
  background: var(--wallpaper, none) center / cover no-repeat, var(--night-0); 
} */
 body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;

  background:
    var(--wallpaper, none) center / contain no-repeat,
    var(--night-0);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(7, 9, 32, 0) 0%, rgba(7, 9, 32, .50) 100%),
    linear-gradient(180deg, rgba(7, 9, 32, .20), rgba(7, 9, 32, .0) 30%, rgba(7, 9, 32, .20));
}
body.page-plain::after { background: rgba(7, 9, 32, .55); }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; color: inherit; }
img, svg { max-width: 100%; }
::selection { background: var(--gold); color: var(--night-0); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.hidden { display: none !important; }

h1, h2, h3 { margin: 0 0 6px; line-height: 1.35; font-family: var(--f-head); font-weight: 800; letter-spacing: .02em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.2rem; }
p { line-height: 1.75; margin: 0 0 10px; }
.sub { color: var(--text-soft); font-size: .9rem; margin: 0 0 16px; }

/* ---------- ヘッダー ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: linear-gradient(180deg, rgba(7, 9, 32, .94), rgba(10, 12, 40, .78));
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 24px rgba(2, 3, 20, .5);
  backdrop-filter: blur(8px);
}
.site-header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-soft) 20%, var(--line-soft) 80%, transparent);
}
.topbar {
  max-width: 1480px; margin: 0 auto; padding: 8px 18px;
  display: flex; align-items: center; gap: 18px; min-height: 66px;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; min-width: 0; }
.topbar .brand .mark { width: 46px; height: 46px; display: block; filter: drop-shadow(0 0 8px rgba(233, 200, 116, .55)); }
.topbar .brand .mark svg { width: 100%; height: 100%; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-family: var(--f-logo); font-size: 1.7rem; font-weight: 700; letter-spacing: .04em; color: #f3ebff; text-shadow: 0 0 14px rgba(185, 168, 255, .6); }
.brand-text small { font-size: .62rem; color: var(--lav); letter-spacing: .08em; margin-top: 3px; white-space: nowrap; }

.top-nav { flex: 1; display: flex; justify-content: center; gap: 2px; min-width: 0; }
.top-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 16px 6px; border-radius: 10px; color: var(--text-soft);
  font-size: .78rem; font-weight: 700; letter-spacing: .06em; position: relative; white-space: nowrap;
  transition: color .15s;
}
.top-nav a:hover { color: var(--text); }
.top-nav a.active { color: var(--gold-hi); }
.top-nav a.active svg { filter: drop-shadow(0 0 6px rgba(233, 200, 116, .8)); }
.top-nav a.active::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: -9px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent); box-shadow: 0 0 10px var(--gold);
}
.top-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin-left: auto; }
.top-nav + .top-right { margin-left: 0; }

.point-badge {
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  background: rgba(10, 12, 40, .7); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 14px; font-weight: 700; font-size: .92rem;
}
.pb-coin { display: inline-flex; align-items: center; gap: 4px; }
.pb-coin b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.pb-coin small { color: var(--text-soft); font-size: .72rem; }
.pb-sep { width: 1px; height: 14px; background: var(--line-soft); }
.pb-lv { color: var(--gold-hi); font-family: var(--f-head); font-weight: 800; }
.coin-svg { width: 20px; height: 20px; flex-shrink: 0; }

.avatar-chip {
  width: 46px; height: 46px; border-radius: 50%; overflow: hidden; display: block; flex-shrink: 0;
  border: 2px solid var(--gold); box-shadow: 0 0 14px rgba(138, 116, 240, .6);
  background: radial-gradient(circle at 50% 40%, #4a3fb0, #1a1650);
}
.avatar-chip svg { width: 100%; height: 100%; display: block; }

.level-pill {
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: 999px; background: rgba(10, 12, 40, .7);
  padding: 5px 11px; font-size: .76rem; font-weight: 700; cursor: pointer; color: var(--text);
}
.level-pill:hover { background: rgba(138, 116, 240, .25); }
body[data-level="junior"] .level-pill { border-color: var(--sky); color: #dff0ff; }

/* ---------- ページの入れもの ---------- */
.page { max-width: 900px; margin: 0 auto; padding: 22px 16px 8px; }

/* ---------- パネル／カード（金のふちかざり） ---------- */
.card, .panel {
  position: relative;
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 6px;
  box-shadow: var(--shadow), inset 0 0 28px rgba(138, 116, 240, .10);
  backdrop-filter: blur(6px);
}
.card { margin-bottom: 16px; }
.card::before, .panel::before {
  content: ""; position: absolute; inset: 4px; border-radius: calc(var(--radius-lg) - 4px); pointer-events: none;
  border: 1px solid rgba(233, 200, 116, .16);
}
.card::after, .panel::after {
  /* 四すみの金のかざり */
  content: ""; position: absolute; inset: -1px; pointer-events: none; border-radius: var(--radius-lg);
  --c: var(--gold);
  background:
    linear-gradient(var(--c), var(--c)) left top / 16px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) left top / 2px 16px no-repeat,
    linear-gradient(var(--c), var(--c)) right top / 16px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) right top / 2px 16px no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / 16px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / 2px 16px no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / 16px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / 2px 16px no-repeat;
  filter: drop-shadow(0 0 4px rgba(233, 200, 116, .7));
}
.card.flat { box-shadow: none; }
.panel > h2, .card > h2 { color: #f6f0ff; }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(60, 66, 150, .75), rgba(30, 34, 98, .85));
  color: var(--text); font-weight: 700; font-size: 1rem; padding: 12px 18px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(2, 3, 20, .45), inset 0 1px 0 rgba(255, 255, 255, .12);
  transition: transform .08s ease, filter .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(2px); }
.btn.block { width: 100%; }
.btn.primary { background: linear-gradient(180deg, #f9e4a2, #d9a944); color: #2a1b4a; border-color: #fff0b8; text-shadow: 0 1px 0 rgba(255, 255, 255, .4); }
.btn.blue { background: linear-gradient(180deg, #5aa2f0, #3568c8); border-color: #a8d0ff; }
.btn.mint { background: linear-gradient(180deg, #4fd6b6, #1f9a82); border-color: #b0f2e2; color: #04261f; }
.btn.coral { background: linear-gradient(180deg, #ff8aa8, #d9496f); border-color: #ffc0d0; }
.btn.grape { background: linear-gradient(180deg, #9a82f4, #5b45c8); border-color: #d2c6ff; }
.btn.ghost { background: transparent; box-shadow: none; border-color: var(--line-soft); }
.btn.small { padding: 8px 12px; font-size: .85rem; }
.btn:disabled { opacity: .4; cursor: not-allowed; filter: grayscale(.5); }

/* ---------- 教科タイル ---------- */
.subject-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 520px) { .subject-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .subject-grid { grid-template-columns: repeat(5, 1fr); } }
.subject-tile {
  --tc: var(--violet);
  position: relative; overflow: hidden; text-align: center; cursor: pointer; padding: 16px 10px 14px;
  border: 1px solid color-mix(in srgb, var(--tc) 70%, white 10%); border-radius: var(--radius-lg);
  background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 30%, transparent), rgba(11, 13, 44, .85));
  box-shadow: 0 8px 22px rgba(2, 3, 20, .45), inset 0 0 22px color-mix(in srgb, var(--tc) 22%, transparent);
  transition: transform .12s ease, box-shadow .15s;
}
.subject-tile:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(2, 3, 20, .5), 0 0 22px color-mix(in srgb, var(--tc) 55%, transparent); }
.subject-tile .icon { font-size: 1.8rem; display: block; margin-bottom: 6px; }
.subject-tile .name { font-weight: 700; font-size: .95rem; display: block; }
.subject-tile .progress-mini { height: 5px; border-radius: 4px; background: rgba(255, 255, 255, .16); margin-top: 8px; overflow: hidden; }
.subject-tile .progress-mini > span { display: block; height: 100%; background: var(--tc); box-shadow: 0 0 8px var(--tc); }
.tile-jp { --tc: #6cb6ff; }
.tile-math { --tc: #f2c75c; }
.tile-sci { --tc: #ff7aa6; }
.tile-soc { --tc: #62dfbd; }
.tile-eng { --tc: #a58cff; }

/* ---------- 進捗バー ---------- */
.progress-bar {
  display: block;
  height: 12px; background: rgba(255, 255, 255, .1); border: 1px solid var(--line-soft);
  border-radius: 999px; overflow: hidden; margin: 8px 0 4px;
}
.progress-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), var(--lav)); transition: width .35s ease; box-shadow: 0 0 10px var(--violet); }

/* ---------- クイズ ---------- */
.quiz-q { font-family: var(--f-head); font-size: 1.2rem; font-weight: 700; margin-bottom: 14px; line-height: 1.6; }
.choice-list { display: grid; gap: 10px; }
.choice-btn {
  text-align: left; border: 1px solid var(--line-soft); border-radius: var(--radius-md);
  background: rgba(255, 255, 255, .06); padding: 13px 15px; font-size: 1rem; font-weight: 700; cursor: pointer;
  color: var(--text); transition: background .15s, border-color .15s;
}
.choice-btn:hover:not(:disabled) { background: rgba(138, 116, 240, .22); border-color: var(--gold); }
.choice-btn.correct { background: rgba(111, 227, 198, .22); border-color: var(--mint); color: #dcfff6; box-shadow: 0 0 16px rgba(111, 227, 198, .35); }
.choice-btn.wrong { background: rgba(255, 134, 176, .2); border-color: var(--rose); color: #ffe3ec; }
.choice-btn:disabled { cursor: default; }
.feedback-banner { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-md); font-weight: 700; display: none; }
.feedback-banner.show { display: block; }
.feedback-banner.ok { background: rgba(111, 227, 198, .16); border: 1px solid var(--mint); color: #bff7e8; }
.feedback-banner.ng { background: rgba(255, 134, 176, .14); border: 1px solid var(--rose); color: #ffd0de; }

/* ---------- フラッシュカード ---------- */
.flash-stage { perspective: 1200px; margin-bottom: 14px; }
.flash-card {
  min-height: 200px; border-radius: var(--radius-lg); border: 1px solid var(--line);
  background: linear-gradient(160deg, #2a2f86, #14185a);
  box-shadow: var(--shadow), inset 0 0 30px rgba(138, 116, 240, .25);
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px;
  font-family: var(--f-head); font-size: 1.4rem; font-weight: 700; cursor: pointer;
  transition: transform .35s; transform-style: preserve-3d; position: relative;
}
.flash-card .face { backface-visibility: hidden; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; }
.flash-card .front { transform: rotateY(0deg); }
.flash-card .back { transform: rotateY(180deg); background: linear-gradient(160deg, #3a2f86, #1a1650); border-radius: var(--radius-lg); color: var(--gold-hi); }
.flash-card.flipped { transform: rotateY(180deg); }
.flash-card.flipped .front { visibility: hidden; }

.deck-list { display: grid; gap: 10px; margin-bottom: 16px; }
.deck-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid var(--line-soft); border-radius: var(--radius-md); padding: 10px 12px; background: rgba(255, 255, 255, .05);
}
.deck-row .txt { flex: 1; min-width: 0; }
.deck-row .txt .q { font-weight: 700; }
.deck-row .txt .a { color: var(--text-soft); font-size: .9rem; }
.deck-row .actions { display: flex; gap: 6px; }
.icon-btn {
  border: 1px solid var(--line-soft); background: rgba(255, 255, 255, .08); border-radius: 10px;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 1rem;
}
.icon-btn:hover { background: rgba(138, 116, 240, .3); }

/* ---------- フォーム ---------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-weight: 700; margin-bottom: 4px; font-size: .92rem; color: var(--lav); }
.field input, .field textarea, .field select, .geo-input, .name-input {
  width: 100%; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 10px 12px;
  font-family: inherit; font-size: 1rem; background: rgba(5, 6, 26, .65); color: var(--text);
}
.field input::placeholder, .field textarea::placeholder { color: #7f7cb8; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--gold); outline-offset: 0; }
.field select option { background: var(--night-1); color: var(--text); }
.field textarea { min-height: 80px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- タイマー ---------- */
.timer-card { text-align: center; }
.timer-display {
  font-family: var(--f-head); font-size: 3rem; font-weight: 800; letter-spacing: 2px; margin: 4px 0 12px;
  font-variant-numeric: tabular-nums; color: var(--gold-hi); text-shadow: 0 0 18px rgba(233, 200, 116, .5);
}
.timer-controls { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.timer-modes { display: flex; gap: 6px; justify-content: center; margin-bottom: 10px; flex-wrap: wrap; }
.timer-modes button, .subject-filter button, .unit-filter button, .geo-zoom button, .theme-swatch {
  border: 1px solid var(--line-soft); background: rgba(255, 255, 255, .06); border-radius: 999px;
  padding: 6px 13px; font-size: .82rem; font-weight: 700; cursor: pointer; color: var(--text); white-space: nowrap;
}
.timer-modes button:hover, .subject-filter button:hover, .unit-filter button:hover, .geo-zoom button:hover { background: rgba(138, 116, 240, .25); }
.timer-modes button.active, .subject-filter button.active, .geo-zoom button.active {
  background: linear-gradient(180deg, #f9e4a2, #d9a944); color: #2a1b4a; border-color: #fff0b8;
}
.unit-filter button.active { background: rgba(111, 227, 198, .25); border-color: var(--mint); color: #dcfff6; }

/* ---------- ストリーク / バッジ ---------- */
.streak-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.streak-dot {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: center; font-size: .8rem; background: rgba(255, 255, 255, .05); color: var(--text-soft);
}
.streak-dot.done { background: radial-gradient(circle at 40% 35%, #fff3c4, #e9c874); color: #2a1b4a; border-color: #fff0b8; font-weight: 800; box-shadow: 0 0 10px rgba(233, 200, 116, .6); }
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 8px; }
@media (min-width: 700px) { .badge-grid { grid-template-columns: repeat(5, 1fr); } }
.badge {
  text-align: center; border: 1px solid var(--line-soft); border-radius: var(--radius-md);
  padding: 12px 4px; background: rgba(255, 255, 255, .06);
}
.badge .icon { font-size: 1.6rem; display: block; }
.badge .label { font-size: .75rem; font-weight: 700; margin-top: 4px; display: block; }
.badge:not(.locked) { border-color: var(--gold); box-shadow: 0 0 14px rgba(233, 200, 116, .25), inset 0 0 14px rgba(233, 200, 116, .1); }
.badge.locked { opacity: .35; filter: grayscale(.8); }

/* ---------- トースト / ミニタイマー ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px); transform: translate(-50%, 20px);
  background: linear-gradient(180deg, #2a2f86, #14185a); color: var(--text); border: 1px solid var(--gold);
  padding: 10px 20px; border-radius: 999px; font-weight: 700; font-size: .92rem; opacity: 0; pointer-events: none;
  transition: all .25s ease; z-index: 90; white-space: nowrap; max-width: 92vw; text-overflow: ellipsis; overflow: hidden;
  box-shadow: 0 8px 24px rgba(2, 3, 20, .6), 0 0 18px rgba(138, 116, 240, .4);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.mini-timer {
  position: fixed; right: 14px; bottom: calc(var(--nav-h) + 14px); z-index: 45; display: flex; align-items: center; gap: 8px;
  background: rgba(10, 12, 40, .92); border: 1px solid var(--gold); border-radius: 999px; padding: 8px 10px 8px 14px;
  font-weight: 700; font-size: .92rem; box-shadow: var(--shadow); cursor: pointer; font-variant-numeric: tabular-nums;
}
.mini-timer.hidden { display: none; }
.mini-timer-btn { border: none; background: rgba(255, 255, 255, .2); border-radius: 50%; width: 26px; height: 26px; cursor: pointer; font-size: .85rem; display: flex; align-items: center; justify-content: center; }

/* ---------- 下部ナビ（スマホ） ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--nav-h); z-index: 40; display: flex;
  background: linear-gradient(180deg, rgba(16, 19, 58, .94), rgba(7, 9, 32, .98));
  border-top: 1px solid var(--line); backdrop-filter: blur(8px);
}
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: .62rem; font-weight: 700; color: var(--text-soft); min-width: 0; }
.bottom-nav a.active { color: var(--gold-hi); }
.bottom-nav a.active svg { filter: drop-shadow(0 0 6px rgba(233, 200, 116, .8)); }

/* ---------- 管理画面 ---------- */
.admin-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.admin-table th, .admin-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line-soft); font-size: .88rem; vertical-align: top; }
.admin-table th { font-weight: 800; color: var(--gold-hi); }
.bulk-bar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin: 12px 0 4px; }
.bulk-bar .bulk-all { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .9rem; cursor: pointer; }
.bulk-bar .sub { margin: 0; }
.bulk-bar .btn { padding: 8px 14px; font-size: .88rem; margin-left: auto; }
.admin-table input[type="checkbox"], .bulk-bar input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--gold); cursor: pointer; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; background: rgba(138, 116, 240, .3); }
.login-wrap { max-width: 360px; margin: 50px auto; text-align: center; }
.subject-filter { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; }
.empty-state { text-align: center; padding: 30px 10px; color: var(--text-soft); }
.empty-state .icon { font-size: 2.4rem; display: block; margin-bottom: 8px; }

/* ---------- 学年切り替え / 単元 ---------- */
.level-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.level-switch button {
  border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: rgba(255, 255, 255, .06);
  padding: 11px 6px; font-size: 1rem; font-weight: 800; cursor: pointer; color: var(--text);
}
.level-switch button small { display: block; font-size: .68rem; font-weight: 700; color: var(--text-soft); }
.level-switch button.active { background: linear-gradient(180deg, #f9e4a2, #d9a944); color: #2a1b4a; border-color: #fff0b8; }
.level-switch button.active small { color: #5a4420; }
body[data-level="junior"] .level-switch button.active { background: linear-gradient(180deg, #7cc4ff, #3a78d8); color: #fff; border-color: #cfe8ff; }
body[data-level="junior"] .level-switch button.active small { color: rgba(255, 255, 255, .85); }
.unit-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.unit-filter button small { opacity: .7; font-weight: 600; }
.unit-tag { display: inline-block; font-size: .7rem; font-weight: 800; background: rgba(138, 116, 240, .3); border-radius: 999px; padding: 2px 8px; margin-left: 4px; }
.exp-box { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-md); background: rgba(255, 255, 255, .07); border: 1px dashed var(--line-soft); font-size: .88rem; line-height: 1.7; }
.wrong-list { text-align: left; margin: 12px 0; display: grid; gap: 8px; }
.wrong-list .item { border: 1px solid var(--line-soft); border-radius: var(--radius-md); padding: 9px 11px; font-size: .85rem; background: rgba(255, 255, 255, .05); }
.wrong-list .item b { color: var(--mint); }

/* ---------- 地図クイズ（夜の海に、明るい陸地） ---------- */
:root { --map-line: #1b1d4a; --ocean: #1a2870; }
.geo-card { padding: 14px 8px; }
.geo-mode-list { display: grid; gap: 10px; margin-top: 10px; }
.geo-mode {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: rgba(255, 255, 255, .06);
  padding: 12px 14px; cursor: pointer; color: inherit;
}
.geo-mode:hover { background: rgba(138, 116, 240, .22); border-color: var(--gold); }
.geo-mode .ic { font-size: 1.8rem; }
.geo-mode .tx { display: block; flex: 1; }
.geo-mode .tx b { display: block; font-size: 1.02rem; }
.geo-mode .tx small { display: block; color: var(--text-soft); font-size: .78rem; line-height: 1.5; }
.geo-zoom { display: flex; gap: 6px; overflow-x: auto; padding: 0 8px 8px; }

.jp-svg { display: block; width: 100%; height: auto; max-height: 50vh; background: radial-gradient(ellipse at 50% 40%, #243594, var(--ocean)); border: 1px solid var(--line); border-radius: var(--radius-md); touch-action: manipulation; }
.jp-svg .pref { fill: var(--c, #eee); stroke: var(--map-line); stroke-width: .7; stroke-linejoin: round; cursor: pointer; transition: fill .15s; }
.jp-svg.neutral .pref { fill: #f1e6c8; }
.jp-svg.neutral .pref.hint-region { fill: var(--c); }
.jp-svg .pref:hover:not(.correct):not(.wrong) { filter: brightness(.94); }
.jp-svg.readonly .pref, .jp-svg.readonly .oki-hit { pointer-events: none; }
.jp-svg .pref.mastered { fill: var(--mint); }
.jp-svg .pref.target { fill: #ffd86a; animation: geo-pulse .9s ease-in-out infinite; }
.jp-svg .pref.correct { fill: var(--mint) !important; animation: none; }
.jp-svg .pref.wrong { fill: var(--rose) !important; animation: none; }
.jp-svg .oki-hit { fill: rgba(255, 255, 255, .22); stroke: var(--gold); stroke-width: .8; stroke-dasharray: 4 3; cursor: pointer; }
.jp-svg .oki-hit.target { fill: rgba(255, 216, 106, .6); animation: geo-pulse2 .9s ease-in-out infinite; }
.jp-svg .oki-hit.correct { fill: rgba(111, 227, 198, .55); }
.jp-svg .oki-hit.wrong { fill: rgba(255, 134, 176, .5); }
@keyframes geo-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes geo-pulse2 { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.jp-svg .pref-label { display: none; font-size: 7px; font-weight: 800; fill: var(--map-line); pointer-events: none; paint-order: stroke; stroke: #fff; stroke-width: 1.6px; }
.show-names .jp-svg .pref-label, .jp-svg .pref-label.hint-on { display: block; }
.show-names .jp-svg .pref { fill: var(--c); }
.show-names .jp-svg .pref.mastered, .show-names .jp-svg .pref.correct { fill: var(--mint); }
.show-names .jp-svg .pref.wrong { fill: var(--rose); }
.geo-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; margin-top: 10px; font-size: .72rem; font-weight: 700; }
.geo-legend i { display: inline-block; width: 11px; height: 11px; border: 1.5px solid var(--map-line); border-radius: 3px; margin-right: 3px; vertical-align: -1px; }

.world-map { display: block; width: 100%; height: auto; background: radial-gradient(ellipse at 50% 40%, #243594, var(--ocean)); border: 1px solid var(--line); border-radius: var(--radius-md); }
.world-map .ocean-zone { fill: transparent; stroke: none; cursor: pointer; }
.world-map .land { fill: #f1e6c8; stroke: var(--map-line); stroke-width: .5; stroke-linejoin: round; cursor: pointer; }
.world-map .geo-label { display: none; fill: var(--map-line); font-weight: 800; pointer-events: none; paint-order: stroke; stroke: #fff; stroke-width: 1.4px; }
.show-names .world-map .geo-label, .show-others .world-map .geo-label:not(.is-target) { display: block; }
.show-names .world-map .land { fill: var(--c); }
.world-map .geo-region.correct .land { fill: var(--mint) !important; }
.world-map .geo-region.correct .ocean-zone { fill: rgba(111, 227, 198, .35) !important; }
.world-map .geo-region.wrong .land { fill: var(--rose) !important; }
.world-map .geo-region.wrong .ocean-zone { fill: rgba(255, 134, 176, .35) !important; }
.geo-map-wrap.answered .world-map { pointer-events: none; }
.world-map .target-zone { fill: rgba(111, 227, 198, .28); stroke: var(--mint); stroke-width: .8; pointer-events: none; }
.world-map .target-dot { fill: var(--mint); pointer-events: none; }
.world-map .tap-dot { fill: var(--rose); pointer-events: none; }
/* --- 番号つき白地図・地図クリック（Start Point 風） --- */
.geo-map-wrap.zoomed { overflow: auto; max-height: 66vh; -webkit-overflow-scrolling: touch; border-radius: var(--radius-md); }
.geo-map-wrap.zoomed .jp-svg { width: calc(var(--zs, 1) * 100%); max-width: none; max-height: none; }
.jp-svg .num-badge { pointer-events: none; }
.jp-svg .num-bg { fill: #fff; stroke: var(--map-line); stroke-width: .6; }
.jp-svg .num-tx { font-size: 6.8px; font-weight: 800; fill: #1b2150; text-anchor: middle; dominant-baseline: central; }
.jp-svg .num-badge.active .num-bg { fill: #ffd86a; stroke: #b8860b; stroke-width: 1; }
.jp-svg .pref.skip { fill: #aab0c8 !important; opacity: .55; pointer-events: none; }
.show-names .jp-svg .num-badge { display: none; }
.geo-dots { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 8px 10px; }
.geo-dots span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .68rem; font-weight: 800; background: rgba(255,255,255,.07); border: 1px solid var(--line); color: var(--text-soft); }
.geo-dots span.ok { background: var(--mint); color: #0b2a24; border-color: transparent; }
.geo-dots span.ng { background: var(--rose); color: #3a0f20; border-color: transparent; }
.geo-dots span.now { outline: 2px solid var(--gold); color: var(--text); }
.nf-no { flex: none; min-width: 26px; height: 26px; padding: 0 4px; border-radius: 13px; display: inline-grid; place-items: center; font-size: .8rem; font-weight: 800; background: #fff; color: #1b2150; }
.nf-wrong-list { display: grid; gap: 6px; }
.nf-wrong { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-md); background: rgba(255, 134, 176, .12); border: 1px solid rgba(255, 134, 176, .4); }
.nf-wrong small { display: block; color: var(--text-soft); font-size: .76rem; }

/* --- 1画面に収まる問題画面（スクロールなし）：上から 問題文 → 地図（のこりの高さぜんぶ） → 回答欄 --- */
body.geo-page .page { padding-top: 8px; }
body.geo-fitting { padding-bottom: 0; }
.geo-fit { display: flex; flex-direction: column; height: var(--geo-h, 560px); margin-bottom: 0; padding: 8px 8px 6px; overflow: hidden; }
.gf-head { flex: none; }
.gf-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0 2px; font-size: .82rem; font-weight: 700; color: var(--text-soft); line-height: 1.9; }
.gf-title > span { white-space: nowrap; }
.gf-title > span:first-child { overflow: hidden; text-overflow: clip; }
.gf-bar { margin: 2px 2px 4px; }
.gf-q.quiz-q { flex: none; margin: 2px 2px 6px; font-size: 1.02rem; line-height: 1.85; }
.gf-q .sub { display: block; margin: 0; font-size: .78rem; line-height: 1.85; }
.gf-mapbox { position: relative; flex: 1 1 0; min-height: 0; }
.gf-mapbox .geo-map-wrap { position: absolute; inset: 0; overflow: hidden; border-radius: var(--radius-md); }
.gf-mapbox .geo-map-wrap.zoomed { overflow: auto; max-height: none; }
.geo-fit .jp-svg, .geo-fit .world-map { width: 100%; height: 100%; max-width: none; max-height: none; }
.geo-fit .geo-map-wrap.zoomed .jp-svg, .geo-fit .geo-map-wrap.zoomed .world-map { width: calc(var(--zs, 1) * 100%); height: calc(var(--zs, 1) * 100%); }
.geo-fit .geo-map-wrap { touch-action: none; overscroll-behavior: contain; }   /* ゆびの動きは、地図の拡大・移動につかう */
.geo-fit .geo-map-wrap.zoomed { cursor: grab; }
.geo-fit .geo-map-wrap.dragging { cursor: grabbing; }
.geo-fit .geo-map-wrap.dragging * { pointer-events: none; }
.geo-zoomfab { position: absolute; top: 8px; left: 8px; z-index: 3; display: flex; flex-direction: column; gap: 6px; }
.geo-zoomfab button { width: 38px; height: 38px; padding: 0; border-radius: 50%; border: 1px solid var(--gold); background: rgba(10, 12, 40, .78); color: var(--gold-hi); font-size: 1.15rem; font-weight: 800; line-height: 1; display: grid; place-items: center; cursor: pointer; }
.geo-zoomfab button:hover { background: rgba(138, 116, 240, .5); }
.gf-bottom { flex: none; height: 9rem; margin-top: 6px; }
.gf-bottom.gf-bottom--sm { height: 7.2rem; }
.gf-ask, .gf-done { height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.gf-done { display: none; }
.gf-done .feedback-banner { margin: 0; padding: 8px 12px; flex: 0 1 auto; min-height: 0; overflow: auto; font-size: .82rem; line-height: 1.8; }
.gf-done .btn { flex: none; }
.gf-hint { margin: 0; text-align: center; color: var(--text-soft); font-weight: 700; }
.geo-fit .btn { min-height: 44px; padding: 8px 16px; font-size: 1rem; }
.geo-fit .geo-type-row { margin: 0; }
.geo-fit .gf-giveup { min-height: 36px; padding: 4px 12px; font-size: .88rem; }
.geo-dots { flex-wrap: nowrap; overflow-x: auto; margin: 2px 2px 4px; padding-bottom: 2px; scrollbar-width: none; }
.geo-dots::-webkit-scrollbar { display: none; }
.geo-dots span { flex: none; width: 22px; height: 22px; font-size: .64rem; }
.nf-bar { display: flex; align-items: center; gap: 6px; }
.nf-nav { flex: none; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: rgba(138, 116, 240, .22); color: var(--text); font-size: 1rem; cursor: pointer; }
.nf-nav:hover { background: rgba(138, 116, 240, .4); }
.nf-cur { flex: none; min-width: 36px; height: 36px; padding: 0 8px; border-radius: 18px; display: grid; place-items: center; background: #ffd86a; color: #1b2150; font-weight: 800; }
.nf-bar .geo-input { flex: 1; min-width: 0; padding: 9px 12px; }
.jp-svg .num-badge.filled .num-bg { fill: #9be8cf; }

/* --- キーボード操作 --- */
.jp-svg .pref.kbd-cursor { fill: #fff0b8 !important; stroke: #ff9f1c; stroke-width: 2.4; paint-order: stroke; filter: drop-shadow(0 0 3px rgba(255, 159, 28, .95)); }
.world-map .geo-region.kbd-cursor .land { fill: #fff0b8 !important; stroke: #ff9f1c; stroke-width: 1.4; }
.world-map .geo-region.kbd-cursor .ocean-zone { fill: rgba(255, 240, 184, .38); stroke: #ff9f1c; stroke-width: 1.4; }
.kbd-hint, .kbd-only { display: none; }
.btn:focus-visible, .geo-mode:focus-visible, .nf-nav:focus-visible, .geo-zoomfab button:focus-visible, .geo-input:focus-visible { outline: 3px solid #ffd86a; outline-offset: 2px; }
.geo-key { flex: none; width: 24px; height: 24px; border-radius: 6px; display: none; place-items: center; font-size: .78rem; font-weight: 800; background: #fff; color: #1b2150; margin-right: 2px; }
@media (hover: hover) and (pointer: fine) {
  .kbd-hint { display: block; margin: 0; text-align: center; font-size: .72rem; line-height: 1.7; color: var(--text-soft); font-weight: 500; }
  .kbd-only { display: inline; }
  .geo-key.kbd-only { display: grid; }
  .only-touch { display: none; }
  .gf-bottom.gf-bottom--sm { height: 9.4rem; }
  .gf-bottom { height: 9.6rem; }
}

/* 横に広い画面：回答欄・ボタン・結果を横にならべて、下の帯を細くする（そのぶん地図が大きくなる） */
@media (min-width: 640px) {
  .gf-bottom, .gf-bottom.gf-bottom--sm { height: 6.6rem; }
  .gf-ask { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; }
  .gf-ask .geo-type-row { flex: 1 1 340px; }
  .gf-ask .gf-giveup { flex: none; }
  .gf-ask .kbd-hint, .gf-ask .gf-hint { flex: 1 1 100%; }
  .gf-done { flex-direction: row; align-items: stretch; gap: 10px; }
  .gf-done .feedback-banner { flex: 1 1 auto; max-height: 100%; }
  .gf-done .btn { flex: 0 0 210px; min-height: 0; }
  .gf-bottom.gf-bottom--sm { display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 6px 10px; }
  .gf-bottom--sm .nf-bar { flex: 1 1 380px; }
  .gf-bottom--sm #nf-check { flex: 0 0 240px; width: auto; }
  .gf-bottom--sm .kbd-hint { flex: 1 1 100%; }
}
.geo-type-row { display: flex; gap: 8px; margin: 14px 8px 0; }
.geo-input { flex: 1; min-width: 0; padding: 12px 14px; font-size: 1.05rem; font-weight: 700; }
.geo-input:focus { outline: 2px solid var(--gold); }
.geo-input:disabled { opacity: .6; }
.geo-hint-row { display: flex; align-items: center; gap: 10px; margin: 12px 8px 0; flex-wrap: wrap; }
.geo-hint-row .btn { padding: 8px 12px; font-size: .88rem; }
.hint-box { display: none; margin: 10px 8px 0; padding: 10px 12px; border-radius: var(--radius-md); background: rgba(233, 200, 116, .12); border: 1px dashed var(--gold); }
.hint-box.show { display: block; }
.hint-box p { margin: 0; font-weight: 700; font-size: .9rem; }
.geo-missed { display: flex; flex-wrap: wrap; gap: 6px; }

/* =========================================================
   ホーム（ダッシュボード）
   ========================================================= */
.home-wrap { max-width: 1480px; margin: 0 auto; padding: 16px 18px 30px; }
.home-grid {
  display: grid; gap: 16px;
  grid-template-columns: 230px minmax(0, 1fr) 310px;
  grid-template-areas:
    "left hero right"
    "left tiles tiles"
    "bottom bottom bottom";
}
.hud-left { grid-area: left; display: flex; flex-direction: column; gap: 14px; }
.hud-right { grid-area: right; display: flex; flex-direction: column; gap: 14px; }
.hero { grid-area: hero; }
.tiles { grid-area: tiles; }
.bottom-row { grid-area: bottom; }

.panel h3 { font-size: 1.02rem; margin-bottom: 8px; color: #f6f0ff; }

/* レベル */
.level-panel { display: grid; grid-template-columns: 78px 1fr; gap: 12px 14px; align-items: center; }
.lv-ring {
  width: 78px; height: 78px; border-radius: 50%; display: flex; align-items: center; justify-content: center; position: relative;
  font-family: var(--f-head); font-weight: 800; font-size: 1.35rem; color: var(--gold-hi);
  background: radial-gradient(circle at 50% 40%, #2c3294, #0d1040);
  border: 2px solid var(--gold); box-shadow: 0 0 16px rgba(233, 200, 116, .45), inset 0 0 14px rgba(138, 116, 240, .5);
}
.lv-ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; border: 1px solid rgba(233, 200, 116, .5); }
.lv-ring small { font-size: .7rem; margin-right: 1px; font-weight: 700; }
.lv-name { display: flex; align-items: center; gap: 6px; font-family: var(--f-head); font-weight: 800; font-size: 1.12rem; background: none; border: none; padding: 0; cursor: pointer; text-align: left; }
.lv-name:hover { color: var(--gold-hi); }
.lv-name .pen { opacity: .5; font-size: .8rem; }
.lv-exp { margin-top: 6px; }
.lv-exp .bar { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .12); overflow: hidden; border: 1px solid var(--line-soft); }
.lv-exp .bar span { display: block; height: 100%; background: linear-gradient(90deg, #6a5ae8, #b9a8ff); box-shadow: 0 0 8px var(--violet); }
.lv-exp small { color: var(--text-soft); font-size: .72rem; display: block; margin-top: 3px; }
.stat-rows { grid-column: 1 / -1; border-top: 1px solid var(--line-soft); padding-top: 10px; display: grid; gap: 8px; }
.stat-row { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.stat-row .lbl { flex: 1; font-size: .92rem; }
.stat-row .val { font-family: var(--f-head); font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.stat-row .val small { color: var(--text-soft); font-size: .72rem; margin-left: 2px; font-family: var(--f-body); }
.stat-row .gem { width: 22px; height: 22px; flex-shrink: 0; }

/* ふくろう */
.owl-panel { display: grid; grid-template-columns: 70px 1fr; gap: 12px; align-items: center; padding: 14px; }
.owl-svg { width: 70px; height: 70px; display: block; filter: drop-shadow(0 4px 10px rgba(90, 99, 224, .6)); }
.owl-panel p { margin: 0; font-size: .88rem; line-height: 1.7; }

/* プロフィールカード内のふくろうメッセージ */
.owl-mini {
  grid-column: 1 / -1;

  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);

  display: flex;
  align-items: center;
  gap: 10px;
}

.owl-mini .owl-svg {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.owl-mini b {
  display: block;
  margin-bottom: 4px;
  font-size: .85rem;
}

.owl-mini div {
  font-size: .75rem;
  line-height: 1.4;
}

/* サイドメニュー */
.side-menu { display: flex; flex-direction: column; gap: 2px; padding: 2px; width: 180px; }
.side-menu button, .side-menu a {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  background: transparent; border: 1px solid transparent; border-radius: 10px; padding: 2px 8px;
  font-size: .85rem; font-weight: 700; color: var(--text-soft);
}
.side-menu button:hover, .side-menu a:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.side-menu .on { color: var(--gold-hi); background: linear-gradient(90deg, rgba(138, 116, 240, .55), rgba(138, 116, 240, .1)); border-color: rgba(233, 200, 116, .35); }
.side-quote { font-family: var(--f-head); color: var(--lav); font-size: .95rem; line-height: 1.7; margin: 12px 8px 4px; padding-top: 12px; border-top: 1px solid var(--line-soft); }

/* ヒーロー */
.hero { position: relative; min-height: 300px; display: flex; }
.hero-copy { position: absolute; left: 0; top: 36px; z-index: 3; }
.hero-title {
  font-family: var(--f-hand); font-weight: 400; font-size: clamp(2.4rem, 4vw, 4rem); line-height: 1.15; margin: 0; white-space: nowrap;
  color: #f1ebff; transform: rotate(-4deg); transform-origin: left top; letter-spacing: .02em;
  text-shadow: 0 0 6px rgba(255, 255, 255, .85), 0 0 22px rgba(160, 140, 255, .95), 0 0 48px rgba(120, 100, 240, .8);
}
.hero-sub {
  margin: 22px 0 0 8px; padding-top: 12px; font-family: var(--f-head); font-weight: 500; font-size: 1.08rem; line-height: 1.8; color: #e6e0ff;
  border-top: 1px solid var(--line); max-width: 260px; text-shadow: 0 1px 8px rgba(5, 6, 30, .9);
}
.hero-stage { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; z-index: 2; pointer-events: none; }
.hero-stage::before {
  content: ""; position: absolute; left: 50%; bottom: 8%; width: 78%; aspect-ratio: 1; transform: translateX(-30%); border-radius: 50%;
  background: radial-gradient(circle, rgba(185, 168, 255, .45), rgba(138, 116, 240, .14) 45%, transparent 70%);
}
.hero-avatar { position: relative; height: 94%; max-width: 62%; margin-left: 16%; filter: drop-shadow(0 0 26px rgba(138, 116, 240, .55)); animation: float 7s ease-in-out infinite; }
.hero-avatar svg { height: 100%; width: auto; display: block; }
.hero-illust { position: relative; height: 100%; max-width: 100%; object-fit: contain; object-position: bottom; }
.hero-desk {
  position: absolute; left: 6%; right: 6%; bottom: 0; height: 56px; z-index: 3; pointer-events: none;
  background: linear-gradient(180deg, #3a2a5c, #1a1236); border-top: 2px solid var(--gold); border-radius: 10px 10px 0 0;
  box-shadow: 0 -8px 30px rgba(138, 116, 240, .35);
}
.hero-desk::before { content: ""; position: absolute; left: 6%; right: 6%; top: 8px; height: 1px; background: linear-gradient(90deg, transparent, var(--line), transparent); }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* 右のパネル */
.date-line { color: var(--text-soft); font-size: .82rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.goal-top { display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: center; }
.goal-emblem { width: 38px; height: 38px; }
.goal-title { font-family: var(--f-head); font-size: 1rem; font-weight: 800; margin: 2px 0 6px; }
.goal-bar { display: flex; align-items: center; gap: 10px; }
.goal-bar .bar { flex: 1; height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .14); overflow: hidden; border: 1px solid var(--line-soft); }
.goal-bar .bar span { display: block; height: 100%; background: linear-gradient(90deg, #ff9a8a, #ffd27a); box-shadow: 0 0 10px #ffb27a; transition: width .4s ease; }
.goal-bar b { font-family: var(--f-head); font-size: 1.05rem; }
.goal-note { margin: 8px 0 0; font-size: .82rem; color: var(--lav); padding-top: 8px; border-top: 1px solid var(--line-soft); }
.goal-done .goal-note { color: var(--gold-hi); }

.event-panel { padding: 0; overflow: hidden; display: block; background: linear-gradient(110deg, rgba(40, 46, 130, .92), rgba(20, 22, 70, .6)); }
.event-panel .inner { padding: 14px 120px 14px 16px; min-height: 60px; position: relative; z-index: 1; }
.event-panel .kicker { font-size: .78rem; color: var(--gold-hi); font-weight: 700; margin-bottom: 4px; }
.event-panel .copy { font-family: var(--f-head); font-weight: 800; font-size: .98rem; line-height: 1.6; }
.event-panel .art { position: absolute; right: 0; top: 0; bottom: 0; width: 120px; opacity: .95; }
.event-panel .art svg { height: 100%; width: 100%; }

.news-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.news-list li { display: flex; gap: 8px; font-size: .82rem; line-height: 1.6; }
.news-list li::before { content: ""; width: 5px; height: 5px; margin-top: .6em; flex-shrink: 0; border-radius: 50%; background: var(--gold); box-shadow: 0 0 6px var(--gold); }

/* 5つのタイル */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feature {
  display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 10px; color: var(--text);
  transition: transform .15s, box-shadow .15s;
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow), 0 0 28px rgba(138, 116, 240, .55), inset 0 0 28px rgba(138, 116, 240, .2); }
.feature .art { width: 100%; height: 70px; display: flex; align-items: center; justify-content: center; margin-bottom: 6px; position: relative; z-index: 1; }
.feature .art svg { height: 100%; width: auto; max-width: 100%; filter: drop-shadow(0 0 12px rgba(138, 116, 240, .7)); }
.feature .art .avatar-svg { border-radius: 14px; }
.feature .thumb-wp { width: 100%; height: 100%; border-radius: 10px; border: 1px solid var(--line); background-size: cover; background-position: center; }
.feature h3 { font-size: 1.2rem; margin: 0 0 4px; position: relative; z-index: 1; }
.feature .desc { font-size: .72rem; color: var(--text-soft); line-height: 1.5; position: relative; z-index: 1; min-height: 2.2em; }
.go {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin-left: 6px; vertical-align: middle;
  border-radius: 50%; border: 1px solid var(--gold); color: var(--gold-hi); font-size: .7rem; flex-shrink: 0;
}

/* 下段 */
.bottom-row { display: grid; gap: 14px; grid-template-columns: 1.15fr 1.25fr 1fr; }
.trivia-panel { display: grid; grid-template-columns: 70px 1fr; gap: 14px; align-items: center; }
.trivia-panel .head { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-family: var(--f-head); font-weight: 800; margin-bottom: -4px; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); }
.trivia-card-art { width: 70px; }
.trivia-q { font-family: var(--f-head); font-weight: 800; font-size: 1.02rem; margin: 0 0 4px; }
.trivia-a { margin: 0; font-size: .82rem; color: var(--text-soft); line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.more-btn { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; float: right; padding: 3px 12px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, .06); font-size: .75rem; font-weight: 700; cursor: pointer; }
.more-btn:hover { background: rgba(138, 116, 240, .3); }
.collection-panel .head { font-family: var(--f-head); font-weight: 800; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.collect-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.collect-item { display: flex; align-items: center; gap: 10px; color: inherit; border-radius: 10px; padding: 4px; }
.collect-item:hover { background: rgba(255, 255, 255, .06); }
.collect-item .ico { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .06); display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.collect-item .ico svg { width: 100%; height: 100%; }
.collect-item .t { font-size: .68rem; color: var(--text-soft); display: block; line-height: 1.3; }
.collect-item b { font-family: var(--f-head); font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.collect-item b small { font-size: .78rem; color: var(--text-soft); font-weight: 500; }
.pickup-panel { padding: 0; overflow: hidden; display: flex; align-items: stretch; min-height: 118px; color: inherit; }
.pickup-panel .pic { width: 44%; position: relative; background: radial-gradient(circle at 50% 30%, #4a3fb0, #14185a); overflow: hidden; }
.pickup-panel .pic .thumb { position: absolute; inset: 0; }
.pickup-panel .pic .thumb-av svg { position: absolute; left: 50%; top: 6px; height: 112%; width: auto; transform: translateX(-50%); }
.pickup-panel .pic .thumb-wp { width: 100%; height: 100%; background-size: cover; background-position: center; }
.pickup-panel .txt { flex: 1; padding: 14px 14px 12px; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.pickup-panel .kick { font-size: .72rem; color: var(--gold-hi); font-weight: 700; }
.pickup-panel .nm { font-family: var(--f-head); font-weight: 800; font-size: 1.12rem; line-height: 1.4; }
.pickup-panel .sm { font-size: .78rem; color: var(--text-soft); }

/* ホームの下のほう（教科・タイマーなど） */
.home-below { max-width: 1100px; margin: 8px auto 0; display: grid; gap: 16px; padding: 0 18px; }
.home-below .card { margin-bottom: 0; }
.below-2 { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.section-title { font-family: var(--f-head); font-size: 1.3rem; margin: 10px 0 -4px; text-shadow: 0 2px 10px rgba(5, 6, 30, .9); display: flex; align-items: center; gap: 10px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }

/* 設定ダイアログ */
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(4, 5, 24, .72); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 18px; }
.overlay .card { width: 100%; max-width: 420px; margin: 0; max-height: 90vh; overflow-y: auto; }
.name-input { font-weight: 700; }

/* =========================================================
   ガチャ
   ========================================================= */
.gacha-hero { text-align: center; padding: 22px 14px 18px; overflow: hidden; }
.gacha-hero h1 { font-size: 1.6rem; text-shadow: 0 0 18px rgba(185, 168, 255, .8); }
.gacha-machine { position: relative; display: inline-block; width: 210px; margin: 6px 0 2px; }
.gacha-machine::before { content: ""; position: absolute; inset: -30px; border-radius: 50%; background: radial-gradient(circle, rgba(185, 168, 255, .5), transparent 65%); animation: pulse 3.4s ease-in-out infinite; }
.gacha-machine .orb-svg { position: relative; width: 100%; height: auto; display: block; filter: drop-shadow(0 0 22px rgba(138, 116, 240, .75)); }
.gacha-machine.shake { animation: shake .8s ease; }
.gacha-machine.shake::before { animation: flash .8s ease; }
@keyframes pulse { 0%, 100% { opacity: .55; transform: scale(.96); } 50% { opacity: 1; transform: scale(1.05); } }
@keyframes shake { 0%, 100% { transform: rotate(0) scale(1); } 15% { transform: rotate(-7deg) scale(1.03); } 30% { transform: rotate(7deg) scale(1.05); } 45% { transform: rotate(-6deg) scale(1.06); } 60% { transform: rotate(6deg) scale(1.06); } 80% { transform: rotate(-2deg) scale(1.1); } }
@keyframes flash { 0%, 60% { opacity: .6; } 80% { opacity: 1; transform: scale(1.6); } 100% { opacity: .6; transform: scale(1); } }
.gacha-coins { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; margin: 4px 0 14px; padding: 5px 16px; border-radius: 999px; border: 1px solid var(--line); background: rgba(5, 6, 26, .5); }
.gacha-coins b { font-family: var(--f-head); font-size: 1.3rem; }
.gacha-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.gacha-buttons .btn { min-width: 180px; padding: 14px 20px; flex-direction: column; gap: 2px; line-height: 1.3; }
.gacha-buttons .btn small { font-size: .74rem; font-weight: 700; opacity: .85; display: inline-flex; align-items: center; gap: 4px; }
.gacha-buttons .btn .coin-svg { width: 15px; height: 15px; }
.gacha-note { color: var(--text-soft); font-size: .8rem; margin: 14px 0 0; }

.rate-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 12px; }
.rate-cell { text-align: center; padding: 8px 4px; border-radius: 10px; border: 1px solid var(--line-soft); background: rgba(255, 255, 255, .05); font-size: .74rem; }
.rate-cell b { display: block; font-family: var(--f-head); font-size: 1.1rem; }
.rate-cell.r-normal b { color: #c8d0f0; } .rate-cell.r-rare b { color: var(--sky); } .rate-cell.r-super b { color: #c4a8ff; } .rate-cell.r-ultra b { color: var(--gold-hi); }
.pickup-line { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--gold); background: rgba(233, 200, 116, .08); font-size: .88rem; }
.pickup-line .pic { width: 52px; height: 52px; border-radius: 10px; overflow: hidden; flex-shrink: 0; position: relative; background: #1a1650; }
.pickup-line .pic .thumb { position: absolute; inset: 0; }
.pickup-line .pic .thumb-av svg { position: absolute; left: 50%; top: 2px; height: 120%; transform: translateX(-50%); }
.pickup-line .pic .thumb-wp { width: 100%; height: 100%; background-size: cover; background-position: center; }

/* 当たり演出（全面） */
.reveal { position: fixed; inset: 0; z-index: 95; display: flex; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(circle at 50% 40%, rgba(40, 30, 110, .985), rgba(4, 5, 24, .995)); overflow-y: auto; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.reveal-inner { width: 100%; max-width: 760px; text-align: center; margin: auto; }
.prize { position: relative; width: 100%; max-width: 330px; margin: 0 auto; padding: 18px 16px 16px; border-radius: 20px; border: 2px solid var(--rc, #9aa0d0); background: linear-gradient(180deg, rgba(36, 42, 120, .95), rgba(14, 16, 56, .98)); box-shadow: 0 0 30px color-mix(in srgb, var(--rc) 55%, transparent), inset 0 0 30px color-mix(in srgb, var(--rc) 20%, transparent); animation: pop .55s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes pop { from { transform: scale(.4) rotate(-6deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
.prize.rarity-normal { --rc: #9aa6d8; } .prize.rarity-rare { --rc: var(--sky); } .prize.rarity-super { --rc: #b49cff; } .prize.rarity-ultra { --rc: var(--gold); }
.prize.rarity-ultra::before { content: ""; position: absolute; inset: -60px; z-index: -1; background: conic-gradient(from 0deg, rgba(255, 224, 140, .0), rgba(255, 224, 140, .45), rgba(255, 224, 140, 0) 25%, rgba(255, 224, 140, .45) 50%, rgba(255, 224, 140, 0) 75%, rgba(255, 224, 140, .45)); border-radius: 50%; animation: spin 7s linear infinite; filter: blur(8px); }
@keyframes spin { to { transform: rotate(360deg); } }
.prize .stars { letter-spacing: 4px; color: var(--rc); font-size: 1.1rem; text-shadow: 0 0 10px var(--rc); }
.prize .kind { display: inline-block; margin: 6px 0 2px; padding: 2px 12px; font-size: .74rem; font-weight: 700; border-radius: 999px; background: rgba(255, 255, 255, .1); border: 1px solid var(--line-soft); }
.prize .name { font-family: var(--f-head); font-weight: 800; font-size: 1.35rem; margin: 6px 0 2px; }
.prize .view { height: 230px; border-radius: 14px; overflow: hidden; margin: 10px 0; position: relative; background: radial-gradient(circle at 50% 35%, #4a3fb0, #14185a); border: 1px solid var(--line-soft); }
.prize .view .thumb { position: absolute; inset: 0; }
.prize .view .thumb-wp { width: 100%; height: 100%; background-size: cover; background-position: center; }
.prize .view .thumb-av svg { position: absolute; left: 50%; top: 8px; height: 104%; width: auto; transform: translateX(-50%); }
.prize .view .thumb-av.crop svg { top: -6px; height: 128%; }
.prize .tag-new { position: absolute; top: -10px; left: -8px; z-index: 2; background: linear-gradient(180deg, #ff9ab8, #e0487a); color: #fff; font-weight: 900; font-size: .8rem; padding: 3px 12px; border-radius: 999px; transform: rotate(-8deg); box-shadow: 0 4px 12px rgba(0, 0, 0, .4); }
.prize .dup { color: var(--text-soft); font-size: .85rem; margin: 4px 0 0; }
.reveal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.multi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 10px 0; }
.mini-prize { position: relative; border-radius: 12px; border: 2px solid var(--rc); background: rgba(14, 16, 56, .9); padding: 6px 4px 8px; box-shadow: 0 0 14px color-mix(in srgb, var(--rc) 40%, transparent); animation: pop .45s cubic-bezier(.2, 1.3, .4, 1) backwards; animation-delay: calc(var(--i) * 70ms); font-size: .72rem; font-weight: 700; line-height: 1.3; }
.mini-prize.rarity-normal { --rc: #8690c0; } .mini-prize.rarity-rare { --rc: var(--sky); } .mini-prize.rarity-super { --rc: #b49cff; } .mini-prize.rarity-ultra { --rc: var(--gold); }
.mini-prize .view { height: 92px; position: relative; border-radius: 8px; overflow: hidden; margin-bottom: 5px; background: radial-gradient(circle at 50% 35%, #4a3fb0, #14185a); }
.mini-prize .view .thumb { position: absolute; inset: 0; }
.mini-prize .view .thumb-wp { width: 100%; height: 100%; background-size: cover; background-position: center; }
.mini-prize .view .thumb-av svg { position: absolute; left: 50%; top: 4px; height: 108%; width: auto; transform: translateX(-50%); }
.mini-prize .view .thumb-av.crop svg { top: -4px; height: 130%; }
.mini-prize .nw { position: absolute; top: -7px; left: -5px; background: #e0487a; color: #fff; font-size: .62rem; font-weight: 900; padding: 1px 7px; border-radius: 999px; z-index: 2; }
.mini-prize .dp { color: var(--text-soft); font-weight: 500; font-size: .66rem; }

/* =========================================================
   着せ替え・図鑑
   ========================================================= */
.wardrobe-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); align-items: start; }
.stage-card { padding: 14px; position: sticky; top: 86px; }
.stage { position: relative; aspect-ratio: 4 / 5; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background-size: cover; background-position: center; }
.stage::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 45%, rgba(40, 30, 110, 0), rgba(5, 6, 30, .62)); }
.stage .avatar-svg { position: absolute; left: 50%; bottom: -2%; height: 104%; width: auto; transform: translateX(-50%); z-index: 1; filter: drop-shadow(0 0 22px rgba(138, 116, 240, .6)); animation: floatx 7s ease-in-out infinite; }
@keyframes floatx { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-8px); } }
.stage-name { text-align: center; font-family: var(--f-head); font-weight: 800; margin: 12px 0 2px; font-size: 1.1rem; }
.equip-list { display: grid; gap: 6px; margin-top: 10px; }
.equip-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .82rem; padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line-soft); }
.equip-row span:first-child { color: var(--text-soft); }
.equip-row b { font-weight: 700; text-align: right; }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line-soft); background: rgba(255, 255, 255, .06); font-weight: 700; cursor: pointer; font-size: .9rem; color: var(--text); }
.tabs button:hover { background: rgba(138, 116, 240, .25); }
.tabs button.active { background: linear-gradient(180deg, #f9e4a2, #d9a944); color: #2a1b4a; border-color: #fff0b8; }
.tabs button small { opacity: .75; font-weight: 600; margin-left: 4px; }

.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.item-card { position: relative; text-align: center; padding: 6px 6px 8px; border-radius: 12px; cursor: pointer; border: 2px solid var(--rc, var(--line-soft)); background: rgba(255, 255, 255, .05); color: var(--text); font-size: .76rem; font-weight: 700; line-height: 1.3; }
.item-card:hover { background: rgba(138, 116, 240, .22); }
.item-card.rarity-normal { --rc: rgba(154, 166, 216, .55); } .item-card.rarity-rare { --rc: rgba(124, 196, 255, .8); } .item-card.rarity-super { --rc: rgba(180, 156, 255, .9); } .item-card.rarity-ultra { --rc: var(--gold); }
.item-card.on { background: rgba(233, 200, 116, .16); box-shadow: 0 0 18px rgba(233, 200, 116, .5), inset 0 0 14px rgba(233, 200, 116, .15); }
.item-card.on::after { content: "つかい中"; position: absolute; top: -9px; right: -6px; background: linear-gradient(180deg, #f9e4a2, #d9a944); color: #2a1b4a; font-size: .62rem; font-weight: 900; padding: 1px 8px; border-radius: 999px; }
.item-card .thumb { height: 100px; border-radius: 8px; overflow: hidden; position: relative; margin-bottom: 6px; background: radial-gradient(circle at 50% 35%, #4a3fb0, #14185a); }
.item-card .thumb-wp { background-size: cover; background-position: center; }
.item-card .thumb-av svg { position: absolute; left: 50%; top: 4px; height: 108%; width: auto; transform: translateX(-50%); }
.item-card .thumb-av.crop svg { top: -4px; height: 134%; }
.item-card.wp .thumb { height: 76px; }
.item-card.locked { cursor: default; }
.item-card.locked .thumb { filter: brightness(.18) saturate(0); }
.item-card.locked .nm { color: var(--text-soft); }
.item-card.locked::before { content: "🔒"; position: absolute; top: 34px; left: 0; right: 0; z-index: 2; font-size: 1.3rem; }
.item-card.wp.locked::before { top: 22px; }
.item-card .rar { display: block; font-size: .62rem; font-weight: 700; margin-top: 2px; color: var(--text-soft); }
.item-card.none .thumb { display: flex; align-items: center; justify-content: center; font-size: 1.6rem; color: var(--text-soft); }

.wp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.wp-card { position: relative; border-radius: 14px; overflow: hidden; border: 2px solid var(--rc); background: rgba(10, 12, 40, .8); cursor: pointer; color: var(--text); text-align: left; padding: 0; }
.wp-card.rarity-normal { --rc: rgba(154, 166, 216, .55); } .wp-card.rarity-rare { --rc: rgba(124, 196, 255, .8); } .wp-card.rarity-super { --rc: rgba(180, 156, 255, .95); } .wp-card.rarity-ultra { --rc: var(--gold); }
.wp-card .pic { aspect-ratio: 16 / 9; background-size: cover; background-position: center; }
.wp-card .meta { padding: 9px 12px 11px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.wp-card .meta b { font-family: var(--f-head); font-size: .98rem; }
.wp-card .meta small { color: var(--text-soft); font-size: .7rem; display: block; font-weight: 500; }
.wp-card .use { font-size: .72rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--gold); color: var(--gold-hi); white-space: nowrap; }
.wp-card.on { box-shadow: 0 0 22px rgba(233, 200, 116, .55); }
.wp-card.on .use { background: linear-gradient(180deg, #f9e4a2, #d9a944); color: #2a1b4a; }
.wp-card.locked { cursor: default; }
.wp-card.locked .pic { filter: brightness(.16) saturate(0); }
.wp-card.locked .meta b { color: var(--text-soft); }
.wp-card.locked::before { content: "🔒"; position: absolute; left: 0; right: 0; top: 28%; text-align: center; font-size: 1.8rem; z-index: 2; }

.trivia-list { display: grid; gap: 10px; }
.trivia-item { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-soft); background: rgba(255, 255, 255, .05); }
.trivia-item b { font-family: var(--f-head); display: block; margin-bottom: 4px; }
.trivia-item p { margin: 0; font-size: .88rem; color: var(--lav); }
.trivia-item.locked { opacity: .5; text-align: center; font-weight: 700; color: var(--text-soft); }

/* =========================================================
   画面サイズ別
   ========================================================= */
@media (max-width: 1280px) {
  .home-grid { grid-template-columns: 270px minmax(0, 1fr) 280px; }
  .tiles { gap: 10px; }
  .feature h3 { font-size: 1.05rem; }
  .top-nav a { padding: 7px 10px 6px; }
  .brand-text small { display: none; }
}
@media (max-width: 1040px) {
  .top-nav { display: none; }
  .top-right { margin-left: auto; }
  .bottom-nav { display: flex; }
  .home-wrap { padding: 12px 12px 20px; }
  .home-grid {
    grid-template-columns: 1fr;
    grid-template-areas: "goal" "hero" "tiles" "event" "left" "news" "bottom";
  }
  .hud-right { display: contents; }
  #goal-panel { grid-area: goal; }
  #event-panel { grid-area: event; }
  #news-panel { grid-area: news; }
  .hero { min-height: 400px; }
  .hero-copy { top: 14px; max-width: 62%; }
  .hero-title { font-size: clamp(2.2rem, 9vw, 3.6rem); }
  .hero-sub { font-size: .92rem; margin-top: 14px; max-width: 220px; }
  .hero-avatar { max-width: 74%; margin-left: 30%; height: 88%; }
  .hero-desk { left: 0; right: 0; height: 40px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tiles .feature:last-child { grid-column: 1 / -1; }
  .bottom-row { grid-template-columns: 1fr; }
  .side-menu { flex-direction: row; justify-content: space-between; flex-wrap: wrap; }
  .side-menu button, .side-menu a { width: auto; flex: 1 1 40%; }
  .side-quote { display: none; }
  .below-2 { grid-template-columns: 1fr; }
  .wardrobe-grid { grid-template-columns: 1fr; }
  .stage-card { position: static; max-width: 420px; margin: 0 auto; }
  .stage { aspect-ratio: 1 / 1; }
}
@media (min-width: 1041px) {
  .bottom-nav { display: none; }
  body { padding-bottom: 36px; }
  .toast, .mini-timer { bottom: 22px; }
}
@media (max-width: 560px) {
  .topbar { padding: 6px 12px; gap: 10px; min-height: 58px; }
  .topbar .brand .mark { width: 38px; height: 38px; }
  .brand-text b { font-size: 1.3rem; }
  .avatar-chip { width: 38px; height: 38px; }
  .point-badge { padding: 4px 10px; font-size: .84rem; gap: 6px; }
  .level-pill { padding: 4px 8px; font-size: .68rem; }
  .page { padding: 16px 12px 8px; }
  .multi-grid { grid-template-columns: repeat(2, 1fr); }
  .rate-row { grid-template-columns: repeat(2, 1fr); }
  .collect-row { grid-template-columns: 1fr; }
  .gacha-buttons .btn { min-width: 100%; }
  .event-panel .inner { padding-right: 110px; }
  .event-panel .art { width: 110px; }
  .field-row { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .brand-text { display: none; }
  .topbar { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* 画像のアバター（img/avatar/*.png を使うとき） */
img.avatar-img { display: block; object-fit: contain; }
.hero-avatar img.avatar-img { height: 100%; width: auto; }
.avatar-chip img.avatar-img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 8%; }
.stage img.avatar-img { position: absolute; left: 50%; bottom: 0; height: 100%; width: auto; transform: translateX(-50%); }
.feature .art img.avatar-img { height: 100%; width: auto; border-radius: 14px; object-fit: cover; object-position: 50% 8%; aspect-ratio: 1; }
.thumb-av img.avatar-img { position: absolute; left: 50%; top: 4px; height: 108%; width: auto; transform: translateX(-50%); }

/* ミッション */
#goal-panel { cursor: pointer; }
#goal-panel:hover { box-shadow: var(--shadow), 0 0 22px rgba(138, 116, 240, .5); }
.goal-more { font-size: .72rem; color: var(--gold-hi); margin-top: 6px; display: block; text-align: right; font-weight: 700; }
.mission-list { display: grid; gap: 10px; }
.mission { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-soft); background: rgba(255, 255, 255, .05); }
.mission .mk { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line); display: flex; align-items: center; justify-content: center; font-weight: 900; color: #2a1b4a; font-size: .85rem; }
.mission.done .mk { background: radial-gradient(circle at 40% 35%, #fff3c4, #e9c874); border-color: #fff0b8; box-shadow: 0 0 10px rgba(233, 200, 116, .6); }
.mission .mb b { display: block; font-size: .95rem; }
.mission .mb small { display: block; color: var(--text-soft); font-size: .74rem; line-height: 1.5; margin-bottom: 6px; }
.mission .bar { height: 7px; border-radius: 999px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.mission .bar span { display: block; height: 100%; background: linear-gradient(90deg, #ff9a8a, #ffd27a); }
.mission .mr { text-align: right; font-size: .78rem; font-weight: 700; display: grid; gap: 2px; }
.mission .mr em { font-style: normal; color: var(--gold-hi); font-family: var(--f-head); }

/* 答えたあとの自動スクロールで、固定ヘッダー・下のメニューに隠れないように */
#next-btn { scroll-margin-bottom: calc(var(--nav-h) + 28px); }
#quiz-area { scroll-margin-top: 90px; }
@media (min-width: 1041px) { #next-btn { scroll-margin-bottom: 40px; } }

.pt-note { margin: 10px auto 0; max-width: 330px; padding: 8px 12px; border-radius: 10px; border: 1px dashed var(--line); background: rgba(255,255,255,.06); font-size: .78rem; line-height: 1.7; color: var(--text-soft); }
.pt-note b { color: var(--gold-hi); font-size: .92rem; }


/* =========================================================
   ふりがな（ルビ）  ※ js/furigana.js がつけます
   ========================================================= */
ruby.fg { ruby-position: over; ruby-align: center; white-space: nowrap; line-height: inherit; }
ruby.fg rt {
  font-size: max(.5em, 8.5px);          /* 漢字の半分くらい。でも小さくなりすぎないように */
  font-family: var(--f-body);           /* 明朝の見出しでも、ふりがなは丸ゴシックで読みやすく（小さい明朝は かすれる） */
  font-weight: 500; letter-spacing: 0; line-height: 1;
  font-feature-settings: "palt" 1;      /* かなの幅をつめて、3文字ぐらいのふりがなでも 漢字の間があきすぎないように */
  font-kerning: normal;
  color: inherit; opacity: .95; text-shadow: none;
  user-select: none; -webkit-user-select: none;
}
/* ふりがながあるぶん、行のあいだを少し広げる */
.quiz-q, .choice-btn, .exp-box, .trivia-a, .trivia-q, .news-list li, .mission, .sub, .flash-card .face, .wrong-list .item { line-height: 1.9; }
.btn, .tabs button, .subject-filter button, .unit-filter button { line-height: 1.7; }

/* =========================================================
   さわりやすさ：ボタンを大きく、まちがえてタップしにくく
   ========================================================= */
button, .btn, a.btn, .choice-btn, .tabs button, .subject-filter button, .unit-filter button, .chip-link, .geo-mode {
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.btn { min-height: 54px; padding: 12px 22px; font-size: 1.05rem; }
.btn.small { min-height: 48px; padding: 10px 16px; font-size: .95rem; }
.choice-btn { min-height: 62px; font-size: 1.05rem; }
.tabs button { min-height: 48px; padding: 10px 20px; font-size: 1rem; }
.subject-filter { flex-wrap: wrap; overflow: visible; gap: 8px; }
.subject-filter button, .subject-filter .chip-link, .unit-filter button {
  min-height: 48px; padding: 10px 16px; font-size: .98rem;
}
.chip-link {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; font-weight: 700; text-decoration: none; color: var(--text);
  border: 1px dashed var(--gold); background: rgba(233, 200, 116, .1);
}
.chip-link:hover { background: rgba(233, 200, 116, .22); }
.timer-modes button { min-height: 50px; }
.bottom-nav a { min-height: 56px; font-size: .75rem; }
.bottom-nav a svg { width: 26px; height: 26px; }
.top-nav a { min-height: 52px; }
.mini-timer-btn { min-width: 44px; min-height: 44px; }
.lv-name { min-height: 44px; }
.side-quote-solo { margin: 0; padding: 4px 8px; font-size: .85rem; color: var(--text-soft); text-align: center; line-height: 1.8; }

/* ホームのタイルは3つ */
.tiles { grid-template-columns: repeat(3, 1fr); }
.collect-item { cursor: default; }

/* =========================================================
   タロットカード（豆知識）
   ========================================================= */
.tarot {
  --tc: #9aa6d8; --tg: rgba(154, 166, 216, .35);
  position: relative; width: 100%; aspect-ratio: 5 / 8; border-radius: 12px; padding: 5px;
  background: linear-gradient(160deg, #f3dc9a, #b8913a 55%, #f3dc9a);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45), 0 0 18px var(--tg); color: #2a1b4a;
  container-type: inline-size;
}
.tarot.rarity-rare  { --tc: #7cc4ff; --tg: rgba(124, 196, 255, .55); }
.tarot.rarity-super { --tc: #b49cff; --tg: rgba(180, 156, 255, .65); }
.tarot.rarity-ultra { --tc: #ffe08a; --tg: rgba(255, 224, 138, .85); }
.tarot-in {
  position: relative; height: 100%; border-radius: 8px; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 4% 4% 5%;
  background: radial-gradient(circle at 50% 40%, #4a3fb0, #1a1650 70%); color: #fff0b8;
  border: 1.5px solid rgba(255, 240, 184, .75);
}
.tarot-num { font-family: var(--f-head, serif); font-weight: 800; font-size: 11cqw; letter-spacing: .08em; line-height: 1.1; }
.tarot-art { position: relative; width: 72%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; color: var(--tc); }
.tarot-ring { position: absolute; inset: 0; width: 100%; height: 100%; animation: tarot-spin 40s linear infinite; }
.tarot-emoji { position: relative; font-size: 30cqw; line-height: 1; filter: drop-shadow(0 0 8px var(--tg)); }
.tarot-name { font-weight: 800; font-size: 9.5cqw; line-height: 1.25; text-align: center; padding: 0 2px; }
.tarot-en { font-size: 5.2cqw; letter-spacing: .06em; opacity: .85; text-align: center; line-height: 1.2; }
.tarot.back .tarot-in { background: repeating-linear-gradient(45deg, #2b2a8a 0 6px, #1a1650 6px 12px); }
.tarot.back .tarot-emoji { color: #fff0b8; font-size: 26cqw; }
.tarot.back { filter: saturate(.55) brightness(.8); }
.tarot.rarity-ultra:not(.back) .tarot-in::after, .tarot.rarity-super:not(.back) .tarot-in::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .22) 50%, transparent 65%); background-size: 250% 100%;
  animation: tarot-shine 3.4s ease-in-out infinite;
}
@keyframes tarot-spin { to { transform: rotate(360deg); } }
@keyframes tarot-shine { 0% { background-position: 130% 0; } 60%, 100% { background-position: -80% 0; } }

/* 図鑑のタロット一覧 */
.tarot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 14px; }
.tarot-cell { background: none; border: 0; padding: 0; cursor: pointer; border-radius: 14px; transition: transform .15s; }
.tarot-cell:hover, .tarot-cell:active { transform: translateY(-3px) scale(1.02); }
.tarot-cell.locked { cursor: default; }
.tarot-cell.locked:hover { transform: none; }
.tarot-detail { width: 100%; max-width: 360px; text-align: center; }
.tarot-big { width: min(62vw, 240px); margin: 0 auto 14px; }
.trivia-reveal { background: rgba(10, 12, 40, .7); border: 1px solid var(--gold); border-radius: 14px; padding: 12px 14px; text-align: left; line-height: 1.9; }
.trivia-reveal b { color: var(--gold-hi); display: block; }
.trivia-reveal p { margin: 6px 0 0; }
.trivia-reveal .kind { display: inline-block; font-size: .72rem; font-weight: 800; padding: 1px 10px; border-radius: 999px; border: 1px solid var(--gold); color: var(--gold-hi); margin-bottom: 6px; }

/* ガチャ結果・ホームなどのせまい場所に入るタロット */
.prize .view.tarot-view { height: auto; background: none; border: 0; overflow: visible; }
.prize .view.tarot-view .tarot { width: min(50vw, 90px); margin: 0 auto; }
.mini-prize .view .tarot, .pickup-panel .pic .tarot, .pickup-line .pic .tarot { position: absolute; left: 50%; top: 50%; height: 100%; width: auto; transform: translate(-50%, -50%); padding: 2px; border-radius: 7px; box-shadow: none; }
.mini-prize .view .tarot .tarot-in, .pickup-panel .pic .tarot .tarot-in, .pickup-line .pic .tarot .tarot-in { border-width: 1px; border-radius: 5px; }
.mini-prize .view { height: 118px; }
.trivia-card-art .tarot { width: 100%; }
.trivia-card-art { width: 76px; }
.prize .trivia-reveal { margin: 10px 0 0; }

@media (max-width: 480px) {
  .tarot-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .tarot-ring, .tarot-in::after { animation: none !important; }
}
.tarot-name { padding-top: 2.5cqw; }

.fg-wrap { display: inline; }

.pb-goal { font-weight: 700; font-size: .85rem; white-space: nowrap; }
.pb-goal b { font-family: var(--f-head); color: var(--gold-hi); margin: 0 1px 0 3px; }

/* ログイン連続のスタンプカード（1日目〜7日目） */
.streak-count { margin: 4px 0 0; font-weight: 700; font-size: 1.05rem; }
.streak-count b { font-family: var(--f-head); font-size: 1.7rem; color: var(--gold-hi); margin: 0 4px; text-shadow: 0 0 14px rgba(233, 200, 116, .55); }
.streak-row { gap: 6px; flex-wrap: nowrap; }
.streak-row .streak-dot { flex: 1; min-width: 0; width: auto; height: auto; aspect-ratio: auto; border-radius: 14px; padding: 6px 0; display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.streak-row .streak-dot span { font-family: var(--f-head); font-size: 1.15rem; font-weight: 800; }
.streak-row .streak-dot small { font-size: .62rem; font-weight: 700; }
.streak-row .streak-dot.today { outline: 2px solid var(--gold-hi); outline-offset: 2px; transform: translateY(-2px); }


/* =========================================================
   学年の切り替えボタン（画面の上、コインの横）
   「小学生 | 中学生」。いまの学年が光っていて、もう一方をタップすると切りかわります
   ========================================================= */
.level-toggle {
  display: inline-flex; align-items: center; gap: 2px; flex-shrink: 0; padding: 3px;
  border-radius: 999px; border: 1px solid var(--line); background: rgba(10, 12, 40, .78);
}
.level-toggle button {
  border: 0; background: transparent; color: var(--text-soft); cursor: pointer; white-space: nowrap;
  min-height: 38px; padding: 4px 14px; border-radius: 999px;
  font-family: inherit; font-weight: 800; font-size: .86rem; line-height: 1.6; letter-spacing: .02em;
  transition: background .15s, color .15s;
}
.level-toggle button:hover { color: var(--text); background: rgba(138, 116, 240, .28); }
.level-toggle button.active {
  background: linear-gradient(180deg, #f9e4a2, #d9a944); color: #2a1b4a; cursor: default;
  box-shadow: 0 0 12px rgba(233, 200, 116, .55);
}
body[data-level="junior"] .level-toggle button.active {
  background: linear-gradient(180deg, #8fd0ff, #3a78d8); color: #fff; box-shadow: 0 0 12px rgba(124, 196, 255, .6);
}
@media (max-width: 560px) {
  .top-right { gap: 6px; }
  .level-toggle { padding: 2px; }
  .level-toggle button { min-height: 36px; padding: 2px 8px; font-size: .74rem; }
  .pb-goal, .pb-goal + .pb-sep, .pb-lv + .pb-sep { display: none; }
}
@media (max-width: 400px) {
  .level-toggle button { padding: 2px 6px; font-size: .7rem; }
  .point-badge { padding: 4px 8px; }
}


/* =========================================================
   ホーム：スクロールなしで、ぜんぶ1画面に見える
   ・パソコン／よこ向きのタブレット … 左（レベル・タイマー）／中央（タイトル・入口）／右（ミッション・お知らせ・ログイン連続）＋下段
   ・スマホ／たて向き … 2列にぎゅっとまとめる
   ・画面の高さが足りないときだけ、ふつうにスクロールできます（min-height）
   ========================================================= */
body.home { height: 100vh; height: 100dvh; min-height: 560px; padding-bottom: 0; display: flex; flex-direction: column; }
body.home .site-header { flex: 0 0 auto; }
body.home .home-wrap { flex: 1 1 0; min-height: 0; width: 100%; max-width: 1480px; margin: 0 auto; padding: 10px 18px 12px; display: flex; }
body.home .home-grid {
  flex: 1 1 auto; min-height: 0; min-width: 0; gap: 12px;
  grid-template-columns: clamp(240px, 19vw, 310px) minmax(0, 1fr) clamp(280px, 22vw, 350px);
  grid-template-rows: minmax(0, 1fr) auto auto;
  grid-template-areas: "left hero right" "left tiles right" "bottom bottom bottom";
}
body.home .hud-left, body.home .hud-right { display: flex; flex-direction: column; gap: 12px; min-height: 0; min-width: 0; }
body.home .panel { padding: 10px 12px; }
body.home .panel h3 { margin: 0 0 6px; font-size: .98rem; }

/* 左：レベル */
body.home .level-panel { flex: 0 0 auto; grid-template-columns: 64px 1fr; gap: 8px 12px; }
body.home .lv-ring { width: 64px; height: 64px; font-size: 1.2rem; }
body.home .lv-name { font-size: 1.05rem; min-height: 32px; }
body.home .stat-rows { padding-top: 8px; gap: 6px; }
body.home .stat-row .lbl { font-size: .86rem; }
body.home .owl-mini { margin-top: 6px; padding-top: 8px; }
body.home .owl-mini .owl-svg { width: 40px; height: 40px; }
/* 左：集中タイマー */
body.home .timer-panel { flex: 0 0 auto; text-align: left; }
body.home .timer-head { display: flex; flex-direction: column; gap: 6px; }
body.home .timer-title { font-family: var(--f-head); font-weight: 800; font-size: .98rem; }
body.home .timer-panel .timer-modes { margin: 0; justify-content: flex-start; flex-wrap: nowrap; gap: 6px; }
body.home .timer-panel .timer-modes button { min-height: 38px; padding: 2px 10px; font-size: .78rem; line-height: 1.6; }
body.home .timer-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
body.home .timer-panel .timer-display { font-size: 2.1rem; margin: 0; line-height: 1.2; }
body.home .timer-panel .btn { min-height: 44px; padding: 6px 14px; font-size: .92rem; white-space: nowrap; }

/* 中央：タイトル・入口 */
body.home .hero { min-height: 0; }
body.home .hero-copy { top: 10px; }
body.home .hero-title { font-size: clamp(1.9rem, min(4vw, 7vh), 4rem); }
body.home .hero-sub { margin-top: 12px; padding-top: 8px; font-size: clamp(.85rem, 1.6vh, 1.05rem); line-height: 1.7; }
body.home .tiles, body.home .tiles .feature:last-child { grid-column: auto; }
body.home .tiles { grid-template-columns: repeat(3, 1fr); gap: 12px; }
body.home .feature { padding: 6px 8px; }
body.home .feature .art { height: clamp(38px, 7vh, 62px); margin-bottom: 2px; }
body.home .feature h3 { font-size: 1.08rem; margin: 0 0 2px; }
body.home .feature .desc { min-height: 0; font-size: .72rem; line-height: 1.7; }

/* 右：ミッション・お知らせ・ログイン連続 */
body.home #goal-panel { flex: 0 0 auto; }
body.home .goal-top { grid-template-columns: 40px 1fr; gap: 10px; }
body.home .goal-title { margin: 0 0 2px; }
body.home .goal-note { margin-top: 6px; padding-top: 6px; }
body.home .goal-more { margin-top: 2px; }
body.home #news-panel { flex: 0 1 auto; min-height: 0; overflow: hidden; }
body.home #timer-panel, body.home #welcome-card { margin-top: auto; }   /* 左右の列の いちばん下に寄せる */
body.home .news-list { gap: 6px; }
body.home .news-list li { font-size: .8rem; line-height: 1.7; }
body.home .streak-panel { flex: 0 0 auto; }
body.home .streak-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 10px; }
body.home .streak-panel h3 { font-size: .95rem; margin: 0; }
body.home .streak-count { margin: 0; font-size: .86rem; }
body.home .streak-count b { font-size: 1.25rem; margin: 0 2px; }
body.home .streak-row { margin-top: 8px; gap: 4px; }
body.home .streak-row .streak-dot { padding: 3px 0; border-radius: 10px; }
body.home .streak-row .streak-dot span { font-size: .98rem; }
body.home .streak-row .streak-dot small { font-size: .56rem; }
body.home .streak-row .streak-dot.today { outline-offset: 1px; transform: none; }

/* 下段 */
body.home .bottom-row { gap: 12px; grid-template-columns: 1.15fr 1.1fr 1fr; }
body.home .trivia-panel { grid-template-columns: 44px 1fr; gap: 4px 12px; }
body.home .trivia-card-art { width: 44px; }
body.home .trivia-panel .head, body.home .collection-panel .head { font-size: .95rem; padding-bottom: 5px; margin-bottom: 0; }
body.home .collection-panel .head { margin-bottom: 8px; }
body.home .trivia-q { font-size: .92rem; margin: 0 0 2px; }
body.home .trivia-a { font-size: .78rem; line-height: 1.8; -webkit-line-clamp: 2; }
body.home .collect-row { grid-template-columns: repeat(2, 1fr); }
body.home .collect-item .ico { width: 36px; height: 36px; }
body.home .collect-item b { font-size: 1.1rem; }
body.home .pickup-panel { padding: 0; min-height: 0; }
body.home .pickup-panel .txt { padding: 8px 12px; gap: 2px; }
body.home .pickup-panel .nm { font-size: 1rem; }
body.home .pickup-panel .sm { font-size: .72rem; line-height: 1.7; }

/* ふりがなで行が高くなるぶん、ホームでは すこしだけつめる */
body.home ruby.fg rt { font-size: max(.46em, 8px); }

/* 下のメニューが出る幅（〜1040px）では、そのぶんの高さをあけておく */
@media (max-width: 1040px) { body.home { padding-bottom: var(--nav-h); } }

/* 画面がひくいパソコン（ノートパソコンなど） */
@media (min-width: 901px) and (max-height: 780px) {
  body.home .home-wrap { padding: 8px 14px 10px; }
  body.home .home-grid, body.home .hud-left, body.home .hud-right, body.home .bottom-row, body.home .tiles { gap: 8px; }
  body.home .panel { padding: 8px 10px; }
  body.home .owl-mini { display: none; }
  body.home .news-list li:nth-child(3) { display: none; }
  body.home .hero-sub { display: none; }
  body.home .feature .desc { display: none; }
  body.home .goal-more { display: none; }
}
@media (min-width: 901px) and (max-height: 660px) {
  body.home #news-panel { display: none; }
  body.home .goal-note { display: none; }
  body.home .trivia-a { -webkit-line-clamp: 1; }
}

/* ---------- スマホ・たて向きのタブレット：2列にまとめる ---------- */
@media (max-width: 900px) {
  body.home { padding-bottom: var(--nav-h); }
  body.home .home-wrap { padding: 8px 10px; }
  body.home .home-grid {
    gap: 8px; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto minmax(0, 1fr) auto auto auto auto;
    grid-template-areas: "level level" "goal timer" "hero hero" "tiles tiles" "streak streak" "trivia trivia" "collect pickup";
  }
  body.home .hud-left, body.home .hud-right, body.home .bottom-row { display: contents; }
  body.home #level-panel { grid-area: level; }
  body.home #timer-panel { grid-area: timer; }
  body.home #goal-panel { grid-area: goal; }
  body.home #welcome-card { grid-area: streak; }
  body.home .hero { grid-area: hero; }
  body.home .tiles { grid-area: tiles; gap: 8px; }
  body.home #trivia-panel { grid-area: trivia; }
  body.home #collection-panel { grid-area: collect; }
  body.home #pickup-panel { grid-area: pickup; }
  body.home #news-panel { display: none; }
  body.home .panel { padding: 8px 10px; }

  body.home .level-panel { grid-template-columns: 52px 1fr; gap: 4px 10px; align-content: start; }
  body.home .lv-ring { width: 52px; height: 52px; font-size: 1.05rem; }
  body.home .lv-name { min-height: 28px; font-size: 1rem; }
  body.home .stat-rows { display: flex; gap: 14px; padding-top: 6px; }
  body.home .stat-row { flex: 1; gap: 6px; }
  body.home .stat-row .lbl { font-size: .74rem; }
  body.home .stat-row .val { font-size: 1rem; }
  body.home .owl-mini { display: none; }

  body.home .goal-top { grid-template-columns: 1fr; }
  body.home .goal-emblem, body.home .date-line, body.home .goal-note, body.home .goal-more { display: none; }
  body.home .goal-title { font-size: .92rem; margin-bottom: 6px; }

  body.home .timer-title { font-size: .88rem; }
  body.home .timer-panel .timer-modes button { min-height: 34px; padding: 0 8px; font-size: .7rem; }
  body.home .timer-row { margin-top: 6px; gap: 6px; }
  body.home .timer-panel .timer-display { font-size: 1.6rem; }
  body.home .timer-panel .btn { min-height: 40px; padding: 4px 10px; font-size: .8rem; }

  body.home .hero-copy { top: 4px; max-width: 100%; }
  body.home .hero-title { font-size: clamp(1.7rem, 7.4vw, 2.6rem); line-height: 1.2; }
  body.home .hero-sub { display: none; }
  body.home .tiles .feature .art { height: 38px; }
  body.home .feature h3 { font-size: .86rem; }
  body.home .feature h3 .go { display: none; }
  body.home .feature .desc { display: none; }

  body.home .timer-title { display: none; }
  body.home .trivia-panel { display: flex; align-items: center; gap: 4px 10px; padding-top: 6px; padding-bottom: 6px; }
  body.home .trivia-panel .head { border: 0; padding: 0; margin: 0; flex: 0 0 auto; font-size: .82rem; }
  body.home .trivia-card-art, body.home .trivia-a { display: none; }
  body.home .trivia-q { font-size: .8rem; margin: 0; }
  body.home .collection-panel { padding-top: 6px; padding-bottom: 6px; }
  body.home .collection-panel .head { display: none; }
  body.home .collect-row { grid-template-columns: 1fr; gap: 2px; }
  body.home .collect-item { gap: 8px; padding: 1px 2px; }
  body.home .collect-item .ico { width: 28px; height: 28px; }
  body.home .collect-item > span:last-child { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
  body.home .collect-item .t { display: inline; font-size: .66rem; }
  body.home .collect-item b { font-size: .98rem; }
  body.home .pickup-panel .pic { width: 34%; }
  body.home .pickup-panel .txt { padding: 6px 8px; }
  body.home .pickup-panel .nm { font-size: .86rem; line-height: 1.5; }
  body.home .pickup-panel .sm { display: none; }
}
@media (max-width: 900px) and (min-height: 1000px) {
  body.home .hero-sub { display: block; }
  body.home .goal-note, body.home .goal-more { display: block; }
}
@media (max-width: 900px) and (max-height: 800px) {
  body.home .hero { display: none; }
  body.home .streak-panel h3 { display: none; }
}
@media (max-width: 900px) and (max-height: 700px) {
  body.home .tiles .feature .art { display: none; }
  body.home .home-grid { gap: 6px; }
  body.home .home-wrap { padding: 6px 8px; }
  body.home .panel { padding: 6px 8px; }
  body.home .level-panel .stat-rows { padding-top: 4px; }
}
@media (max-width: 900px) and (max-height: 660px) {
  body.home #trivia-panel { display: none; }
}
@media (min-width: 901px) and (max-width: 1100px) { body.home .news-list li { font-size: .74rem; line-height: 1.6; } }

/* 小学生（ふりがなあり）：見出しや小さな字でも、ルビで行の高さがガタつかないように行間をとる */
body[data-level="elem"] :is(h1, h2, h3) { line-height: 1.75; }
body[data-level="elem"] .geo-mode .tx :is(b, small) { line-height: 1.8; }
body[data-level="elem"] .btn, body[data-level="elem"] button { line-height: 1.7; }

/* 中学生はふりがなが付かないので、ふりがな用にあけていた行のあきを つめる */
body[data-level="junior"] .quiz-q, body[data-level="junior"] .choice-btn, body[data-level="junior"] .exp-box,
body[data-level="junior"] .trivia-a, body[data-level="junior"] .trivia-q, body[data-level="junior"] .news-list li,
body[data-level="junior"] .mission, body[data-level="junior"] .sub, body[data-level="junior"] .flash-card .face,
body[data-level="junior"] .wrong-list .item { line-height: 1.7; }
body[data-level="junior"] .btn, body[data-level="junior"] .tabs button,
body[data-level="junior"] .subject-filter button, body[data-level="junior"] .unit-filter button { line-height: 1.4; }
body[data-level="junior"] .gf-q.quiz-q, body[data-level="junior"] .gf-q .sub { line-height: 1.6; }

/* 改行 */
#flash-front,
#flash-back {
  white-space: pre-line;
}

/* ゲームのスタイル*/
.game-nav{
  position:fixed;
  top:12px;
  left:12px;
  z-index:1000;
}

.game-back{
  font:inherit;
  font-weight:700;
  padding:.6rem 1rem;
  border-radius:999px;
  border:1px solid var(--gold);
  background:rgba(255,255,255,.08);
  color:var(--text);
  box-shadow:
    0 0 8px rgba(233,200,116,.3);
}
.game-back:hover{
  background:rgba(138,116,240,.25);
  border-color:var(--gold);
}