/* =========================================================
 * 先生、ノート見てください。 — スタイル
 * ========================================================= */
:root {
  --hud-h: 104px;
  --panel-h: 108px;
  --stu-w: clamp(150px, 30vh, 290px);
  --stu-top: calc(var(--hud-h) - 6px);
  --ink: #2f2a33;
  --paper: #fffdf4;
  --rule: #b7cde6;
  --margin: #f0a4a4;
  --accent: #e8566a;
  --accent-d: #c8404f;
  --wood: #8f6038;
  --ui-font: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', 'Hiragino Sans', 'Yu Gothic UI', 'Meiryo', sans-serif;
  --note-font: 'Klee One', 'YuKyokasho', 'UD Digi Kyokasho N-R', 'Hiragino Maru Gothic ProN', 'Hiragino Sans', 'Yu Gothic', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #efe4cf; color: var(--ink); font-family: var(--ui-font); }
#app { position: relative; width: 100vw; height: 100vh; min-height: 560px; overflow: hidden; user-select: none; -webkit-user-select: none; }
button { font-family: inherit; }
kbd { font-family: var(--ui-font); font-size: .8em; background: #fff; border: 1px solid #c9bfae; border-bottom-width: 3px; border-radius: 6px; padding: 1px 6px; color: #5a4e40; }
code { background: #f3ecdf; border-radius: 4px; padding: 0 5px; font-size: .92em; }

/* ---------- 教室 ---------- */
#classroom { position: absolute; inset: 0; z-index: 0; }
#classroom > div { position: absolute; }
.wall { inset: 0 0 30% 0; background:
  linear-gradient(180deg, #f8f1e2 0%, #f1e5cd 100%); }
.wall::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 10px; background: #c9a77d; }
.board { left: 22%; right: 22%; top: 15%; height: 34%; background:
  radial-gradient(ellipse at 30% 30%, rgba(255,255,255,.07), transparent 60%), #2f5b47;
  border: 10px solid var(--wood); border-radius: 6px; box-shadow: inset 0 0 30px rgba(0,0,0,.35), 0 6px 0 rgba(0,0,0,.08); }
.chalk { position: absolute; color: rgba(255,255,255,.82); font-family: var(--note-font); font-size: clamp(13px, 2vh, 18px); line-height: 1.6; text-shadow: 0 0 1px rgba(255,255,255,.5); }
.chalk.left { left: 4%; top: 10%; }
.chalk.right { left: 4%; top: 44%; }
.tray { position: absolute; left: -10px; right: -10px; bottom: -18px; height: 10px; background: #7a512f; border-radius: 2px; }
.tray i { position: absolute; left: 20%; top: -5px; width: 26px; height: 6px; border-radius: 3px; background: #fff; }
.tray i.r { left: 26%; background: #f4c64d; }
.window { right: 2%; width: 14%; top: 11%; height: 42%; border: 9px solid #e9e4da; border-radius: 4px;
  background: linear-gradient(180deg, #9fd2f5 0%, #d6eefc 100%); overflow: hidden; box-shadow: inset 0 0 0 3px #cfc6b5; }
.window .sash { position: absolute; left: 50%; top: 0; bottom: 0; width: 7px; margin-left: -3px; background: #e9e4da; }
.cloud { position: absolute; width: 60px; height: 22px; background: #fff; border-radius: 20px; opacity: .9; animation: drift 40s linear infinite; }
.cloud::before { content: ''; position: absolute; left: 12px; top: -12px; width: 28px; height: 28px; border-radius: 50%; background: #fff; }
.cloud.c1 { top: 18%; left: -30%; }
.cloud.c2 { top: 52%; left: -60%; transform: scale(.7); animation-duration: 55s; animation-delay: -20s; }
@keyframes drift { to { left: 120%; } }
.shuji { top: 15%; width: 6.4%; height: 32%; background: #fffefa; box-shadow: 0 3px 6px rgba(0,0,0,.12); border-top: 6px solid #6d4c33;
  display: flex; flex-direction: column; align-items: center; padding: 8px 0; }
.shuji.s1 { left: 3%; transform: rotate(-1deg); }
.shuji.s2 { left: 11.5%; transform: rotate(1.2deg); }
.shuji span { writing-mode: vertical-rl; font-family: var(--note-font); font-weight: 600; font-size: clamp(18px, 3.6vh, 34px); color: #1a1a1a; letter-spacing: .1em; flex: 1; display: flex; align-items: center; }
.shuji i { writing-mode: vertical-rl; font-style: normal; font-size: 10px; color: #555; font-family: var(--note-font); }
.lockers { left: 0; right: 0; top: 55%; height: 15%; background:
  repeating-linear-gradient(90deg, transparent 0 calc(8.33% - 3px), #b98f60 calc(8.33% - 3px) 8.33%),
  linear-gradient(180deg, #d9b98d 0 49%, #b98f60 49% 51%, #d9b98d 51% 100%);
  border-top: 5px solid #b98f60; }
.floor { left: 0; right: 0; top: 70%; bottom: 0; background:
  repeating-linear-gradient(90deg, transparent 0 118px, rgba(90,55,25,.18) 118px 120px),
  linear-gradient(180deg, #c99a63 0%, #b8864f 100%); }

/* ---------- HUD ---------- */
#hud { position: absolute; z-index: 5; top: 12px; left: 16px; right: 16px; height: calc(var(--hud-h) - 20px);
  display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; transition: opacity .3s; }
.is-title #hud { opacity: 0; }
.hud-card { background: rgba(255,255,255,.92); border-radius: 18px; box-shadow: 0 4px 0 rgba(120,90,50,.18), 0 8px 20px rgba(0,0,0,.06); padding: 10px 16px; }
.hud-card.logo { font-weight: 800; font-size: 14px; line-height: 1.35; color: var(--accent-d); transform: rotate(-2deg); }
.hud-card.clock { display: flex; align-items: center; gap: 10px; padding: 8px 18px 8px 10px; }
.clock-face { width: 64px; height: 64px; }
.clock-text { display: flex; align-items: baseline; gap: 4px; }
.clock-text small { font-size: 13px; color: #8a7a68; font-weight: 700; }
#hud-time { font-size: 40px; font-weight: 800; min-width: 2.2ch; text-align: center; font-variant-numeric: tabular-nums; }
.hud-card.clock.hurry { animation: hurry .5s ease-in-out infinite alternate; }
.hud-card.clock.hurry #hud-time { color: #e0404f; }
@keyframes hurry { from { transform: scale(1); } to { transform: scale(1.06); } }
.hud-card.stats { min-width: 190px; text-align: right; }
.stats .score small { font-size: 13px; color: #8a7a68; font-weight: 700; margin-right: 8px; }
#hud-score { font-size: 38px; font-weight: 800; color: var(--accent-d); font-variant-numeric: tabular-nums; }
.stats .score.bump #hud-score { display: inline-block; animation: bump .35s ease-out; }
@keyframes bump { 40% { transform: scale(1.3); } }
.stats .sub { font-size: 13px; color: #6d6052; display: flex; gap: 12px; justify-content: flex-end; }
.stats .sub b { font-size: 16px; color: var(--ink); }

/* ---------- 舞台 ---------- */
#stage { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
#student-slot { position: absolute; left: 50%; top: var(--stu-top); width: var(--stu-w); margin-left: calc(var(--stu-w) / -2); }
#student .stu-svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 6px 0 rgba(0,0,0,.06)); }
#student-slot.enter { animation: stuIn .42s cubic-bezier(.2,.9,.3,1.2) both; }
#student-slot.leave { animation: stuOut .3s ease-in both; }
@keyframes stuIn { from { transform: translateX(160px) scale(.62); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes stuOut { 0% { transform: rotate(0); } 30% { transform: translateY(8px) rotate(-3deg); } 100% { transform: translateX(-260px) rotate(-8deg); opacity: 0; } }
.is-title #student-slot { transform: translateY(10px); }

#queue .mini { position: absolute; filter: saturate(.75) brightness(.97); transition: all .4s; }
#queue .mini svg { width: 100%; height: auto; display: block; }
#queue .m0 { left: calc(50% + var(--stu-w) * 0.55); top: calc(var(--stu-top) + var(--stu-w) * 0.30); width: calc(var(--stu-w) * 0.62); }
#queue .m1 { left: calc(50% + var(--stu-w) * 1.05); top: calc(var(--stu-top) + var(--stu-w) * 0.34); width: calc(var(--stu-w) * 0.52); opacity: .95; }
#queue .m2 { left: calc(50% + var(--stu-w) * 1.48); top: calc(var(--stu-top) + var(--stu-w) * 0.38); width: calc(var(--stu-w) * 0.44); opacity: .9; }
.is-title #queue { display: none; }

/* ---------- ノート ---------- */
#note-wrap { position: absolute; left: 0; right: 0; top: calc(var(--stu-top) + var(--stu-w) * 0.93); display: flex; justify-content: center; z-index: 3; }
#note-wrap.hidden { visibility: hidden; }
.is-title #note-wrap { display: none; }
#note-wrap.enter { animation: noteIn .34s cubic-bezier(.2,.9,.3,1.15) both; }
#note-wrap.thud { animation: noteThud .5s cubic-bezier(.2,.9,.3,1) both; }
#note-wrap.leave { animation: noteOut .28s ease-in both; }
@keyframes noteIn { from { transform: translateY(-50px) scale(.86); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes noteOut { to { transform: translateY(-70px) scale(.8); opacity: 0; } }
@keyframes noteThud { 0% { transform: translateY(-80px) scale(.9); opacity: 0; } 60% { transform: translateY(6px) scale(1.01); opacity: 1; } 75% { transform: translateY(-3px); } 100% { transform: none; } }

.note-fit { position: relative; transform: scale(var(--fit, 1)); transform-origin: top center;
  --fs: 31px; --lh: 52px; width: min(600px, 86vw); }
#note-wrap[data-cat="odd"] .note-fit { width: min(650px, 88vw); }
#note-wrap[data-cat="long"] .note-fit { --fs: 26px; --lh: 44px; width: min(820px, 94vw); }

/* 180度回転：ノート全体（紙・罫線・文字・名前欄）を回す */
.note-paper { transform: rotate(180deg); position: relative;
  background-color: var(--paper);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .45  0 0 0 0 .40  0 0 0 0 .30  0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    linear-gradient(90deg, transparent 58px, var(--margin) 58px, var(--margin) 60px, transparent 60px);
  border-radius: 3px 8px 8px 3px;
  padding: 14px 26px 18px 74px;
  box-shadow: 0 -10px 24px rgba(60,40,20,.20), 0 2px 0 #e9e1cf, 0 4px 0 #f6f0e2, 0 6px 0 #e4dbc6;
}
/* 綴じ側（生徒から見て左＝先生から見て右） */
.note-paper::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 22px; border-radius: 3px 0 0 3px;
  background: repeating-linear-gradient(180deg, #e4dccb 0 14px, #d2c8b4 14px 16px); box-shadow: inset -2px 0 3px rgba(0,0,0,.08); }
.note-head { display: flex; gap: 28px; font-family: var(--note-font); font-size: 13px; color: #7d8fa8; height: 26px; align-items: center; }
.note-head u { text-decoration: none; border-bottom: 1px solid #a9bcd5; display: inline-block; min-width: 50px; padding: 0 6px; color: #3b4a60; font-size: 15px; }
.note-name { position: absolute; right: 26px; top: 14px; height: 26px; display: flex; align-items: center; font-family: var(--note-font); font-size: 13px; color: #7d8fa8; }
.note-name u { text-decoration: none; border-bottom: 1px solid #a9bcd5; min-width: 90px; padding: 0 8px; color: #33384a; font-size: 17px; font-weight: 600; }
.note-text { font-family: var(--note-font); font-weight: 600; font-size: var(--fs); line-height: var(--lh); color: #26252c;
  min-height: calc(var(--lh) * 3); word-break: break-all; line-break: strict;
  background-image: repeating-linear-gradient(180deg, transparent 0 calc(var(--lh) - 1.5px), var(--rule) calc(var(--lh) - 1.5px) var(--lh));
  letter-spacing: .02em; }
#note-wrap[data-cat="long"] .note-text { min-height: calc(var(--lh) * 5); }
.note-text .seg { transition: color .15s, background .15s; border-radius: 3px; }
.note-text .seg.done { color: #c3baa8; }
.note-text .seg.cur { background: linear-gradient(transparent 58%, rgba(255,226,90,.75) 58%); }

/* 生徒の手（ノートの手前側の端を持っている） */
.hand { position: absolute; top: -16px; width: 46px; height: 34px; background: var(--skin, #fdd8b8);
  border-radius: 22px 22px 16px 16px; box-shadow: inset 0 -4px 0 rgba(0,0,0,.07), 0 2px 3px rgba(0,0,0,.12); z-index: 2; }
.hand::after { content: ''; position: absolute; bottom: 6px; left: 12px; right: 12px; height: 2px; border-radius: 2px;
  background: rgba(0,0,0,.08); box-shadow: 0 -7px 0 rgba(0,0,0,.06); }
.hand.l { left: 16%; transform: rotate(-6deg); }
.hand.r { right: 16%; transform: rotate(6deg); }

#app.paused .note-fit { filter: blur(14px); }

/* ---------- 演出 ---------- */
#fx { position: fixed; inset: 0; z-index: 8; pointer-events: none; }
.pop { position: absolute; transform: translate(-50%, 0); font-weight: 800; font-size: 34px; color: var(--accent-d);
  text-shadow: 0 3px 0 #fff, 0 0 12px #fff; animation: popUp 1.1s ease-out forwards; }
.pop.big { font-size: 52px; color: #e08a10; }
.pop { white-space: nowrap; text-align: center; line-height: 1.1; }
.pop small { display: block; font-size: 18px; color: #e0559a; }
@keyframes popUp { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.7); } 15% { opacity: 1; transform: translate(-50%, -10px) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -80px) scale(1); } }
.spark { position: absolute; font-size: 22px; color: #ff7fa0; animation: spark 1.1s ease-out forwards; }
.spark:nth-child(3n) { color: #f2b636; } .spark:nth-child(3n+1) { color: #6fc1e8; }
@keyframes spark { 0% { opacity: 0; transform: translate(0, 0) scale(.4); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx), -70px) scale(1.2) rotate(40deg); } }
.say { position: absolute; font-weight: 800; font-size: 18px; color: #7a5a3a; background: #fff; border-radius: 14px; padding: 4px 12px;
  box-shadow: 0 3px 0 rgba(0,0,0,.08); animation: say 1s ease-out forwards; white-space: nowrap; }
@keyframes say { 0% { opacity: 0; transform: translateY(6px) scale(.8); } 20% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }

/* ---------- 入力欄 ---------- */
#panel { position: absolute; z-index: 6; left: 50%; bottom: 14px; transform: translateX(-50%); width: min(940px, calc(100vw - 32px)); height: var(--panel-h);
  background: #fff; border-radius: 20px; box-shadow: 0 5px 0 rgba(110,80,40,.25), 0 10px 26px rgba(0,0,0,.10);
  display: flex; align-items: center; gap: 16px; padding: 0 20px; border: 3px solid transparent; transition: border-color .15s, opacity .3s; }
.is-title #panel { opacity: 0; }
.panel-label { flex: none; writing-mode: horizontal-tb; font-size: 13px; font-weight: 800; color: #fff; background: var(--accent); border-radius: 12px; padding: 8px 10px; line-height: 1.3; text-align: center; }
#decoded { flex: 1; min-width: 0; height: 64px; display: flex; align-items: center; white-space: nowrap; overflow: hidden;
  font-size: 32px; font-weight: 700; border-bottom: 2px dashed #e1d6c4; }
#d-done { color: #2f2a33; font-family: var(--note-font); font-weight: 600; }
#d-kana { color: #2f62c8; }
#d-buf { color: #9a8f80; font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: .8em; margin-left: 2px; }
#d-miss { color: #e0404f; font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: .8em; text-decoration: line-through; margin-left: 4px; }
.caret { display: inline-block; flex: none; width: 3px; height: 36px; background: var(--accent); margin-left: 2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.panel-keys { flex: none; display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: #8a7d6c; }
#panel.miss { border-color: #ff8a95; animation: shake .3s; background: #fff6f6; }
@keyframes shake { 20% { transform: translateX(calc(-50% - 7px)); } 40% { transform: translateX(calc(-50% + 6px)); } 60% { transform: translateX(calc(-50% - 4px)); } 80% { transform: translateX(calc(-50% + 2px)); } }

#ime-toast { position: absolute; z-index: 30; left: 50%; bottom: calc(var(--panel-h) + 28px); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #3a2f2a; color: #fff; border-radius: 14px; padding: 10px 18px; font-size: 15px; transition: all .25s; white-space: nowrap; }
#ime-toast b { color: #ffd65a; }
#ime-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- オーバーレイ共通 ---------- */
.overlay { position: absolute; inset: 0; z-index: 20; display: none; align-items: center; justify-content: center;
  background: rgba(60,40,20,.28); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); padding: 16px; }
.overlay.clear { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; pointer-events: none; }
.overlay.show { display: flex; }
.btn { border: 0; cursor: pointer; border-radius: 16px; font-weight: 800; font-size: 16px; padding: 12px 22px; background: #fff; color: var(--ink);
  box-shadow: 0 4px 0 #d8ccb8; transition: transform .08s, box-shadow .08s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #d8ccb8; }
.btn.primary { background: var(--accent); color: #fff; font-size: 24px; padding: 16px 28px; box-shadow: 0 5px 0 var(--accent-d); }
.btn.primary:active { box-shadow: 0 2px 0 var(--accent-d); }
.btn.primary small { font-size: 12px; opacity: .8; margin-left: 6px; font-weight: 700; }
.btn.small { font-size: 14px; padding: 9px 16px; background: #f6f1e8; }
.btn.small.on { background: #fff3c4; }

/* タイトル */
.title-card { display: flex; width: min(920px, 100%); background: #fffaf0; border-radius: 22px; overflow: hidden; box-shadow: 0 10px 0 rgba(90,60,30,.25), 0 20px 50px rgba(0,0,0,.18); }
.cover { position: relative; flex: 1.1; background:
  linear-gradient(90deg, #2f5fa8 0 26px, transparent 26px),
  linear-gradient(180deg, #8ec5ef 0%, #a9d7f3 100%);
  padding: 34px 30px 34px 56px; display: flex; align-items: center; justify-content: center; min-height: 440px; }
/* タイトル：ノートに書かれた逆さまの文字だけ */
.title-note { margin: 0; width: min(330px, 100%); padding: 26px 26px 30px; background-color: var(--paper); border-radius: 4px;
  box-shadow: 0 10px 22px rgba(0,0,0,.2); transform: rotate(-4deg);
 }
/* 罫線も文字と一緒に回転させて、行とぴったり揃える */
.title-note .sn-in { display: block; transform: rotate(180deg);
  background-image: repeating-linear-gradient(180deg, transparent 0 63px, var(--rule) 63px 64px); font-family: var(--note-font); font-weight: 600;
  font-size: clamp(34px, 4.6vw, 46px); line-height: 64px; color: #2f2a33; letter-spacing: .02em; }
.menu { flex: 1; padding: 30px 30px 26px; display: flex; flex-direction: column; gap: 18px; }
.menu .btn.primary { width: 100%; }
.credit { margin: auto 0 0; text-align: right; font-size: 11.5px; color: #b0a290; letter-spacing: .05em; }
#copy-toast { position: fixed; z-index: 100; left: 50%; bottom: 28px; transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: #2f2a33; color: #fff; font-weight: 800; font-size: 14px; padding: 10px 18px; border-radius: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.25);
  transition: opacity .2s, transform .2s; white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; }
#copy-toast.show { opacity: 1; transform: translate(-50%, 0); }
.setting-label { font-size: 13px; font-weight: 800; color: #8a7a68; margin-bottom: 6px; }
.chips { display: flex; gap: 8px; }
.chip { flex: 1; border: 2px solid #e4d9c6; background: #fff; border-radius: 12px; padding: 10px 0; font-weight: 800; font-size: 16px; cursor: pointer; color: #6d6052; }
.chip.on { border-color: var(--accent); background: #fff0f1; color: var(--accent-d); }
.chips.mini .chip { font-size: 12.5px; padding: 6px 0; border-radius: 10px; }
.setting-label small { font-weight: 700; color: #a99a86; margin-left: 4px; }
.best { border-collapse: collapse; font-size: 12px; color: #6d6052; width: 100%; }
.best th, .best td { padding: 2px 4px; text-align: center; font-weight: 700; }
.best th:first-child { text-align: left; width: 4.5em; }
.best tr:first-child th { color: #a99a86; font-size: 11.5px; }
.best b { font-size: 17px; color: var(--ink); }
.best small { font-size: 10.5px; color: #a99a86; }
.best tr.up { opacity: .7; }
#hud-mode { display: none; margin-top: 4px; font-size: 11px; background: #3f7a5c; color: #fff; border-radius: 6px; padding: 2px 6px; width: fit-content; }
.upright #hud-mode { display: block; }
.upright .note-paper { transform: none; }
#r-mode { font-size: 13px; background: rgba(255,255,255,.2); border-radius: 6px; padding: 2px 8px; }
#r-mode.up { background: #fff3c4; color: #6b4a2e; }
#r-next { margin: 4px 0 0; font-size: 11.5px; color: #a07e86; }
#r-compare { margin: 0; font-size: 12.5px; line-height: 1.6; color: #4f4539; background: #f2f7f3; border-radius: 10px; padding: 8px 10px; }
#r-compare b { color: #3f7a5c; font-size: 15px; }
.row { display: flex; gap: 10px; }
#howto { max-height: 0; overflow: hidden; transition: max-height .35s ease; }
#howto.open { max-height: 400px; }
#howto ul { margin: 0; padding: 12px 14px 12px 30px; background: #f7f1e6; border-radius: 12px; font-size: 13px; line-height: 1.75; color: #4f4539; }

/* カウントダウン */
#count-num { font-size: 140px; font-weight: 800; color: #fff; text-shadow: 0 6px 0 var(--accent-d), 0 0 30px rgba(0,0,0,.25); }
#count-num.go { font-size: 84px; }
#count-num.enter { animation: countIn .5s cubic-bezier(.2,.9,.3,1.3) both; }
@keyframes countIn { from { transform: scale(1.8); opacity: 0; } to { transform: none; opacity: 1; } }
.end-text { font-size: 64px; font-weight: 800; color: #fff; text-align: center; line-height: 1.2; text-shadow: 0 5px 0 #6b4a2e, 0 0 30px rgba(0,0,0,.3); animation: countIn .6s both; }

/* 一時停止 */
.pause-card { background: #fffaf0; border-radius: 22px; padding: 30px 40px; text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; box-shadow: 0 8px 0 rgba(90,60,30,.25); }
.pause-card h2 { margin: 0; font-size: 28px; }
.pause-card p { margin: 0; color: #8a7a68; }

/* リザルト（学級日誌） */
.result-card { width: min(980px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: #fffdf6; border-radius: 18px;
  box-shadow: 0 10px 0 rgba(90,60,30,.25), 0 20px 50px rgba(0,0,0,.18); overflow: hidden; }
.r-head { display: flex; gap: 24px; align-items: center; background: #3f7a5c; color: #fff; padding: 12px 24px; font-weight: 800; }
.r-head span:first-child { font-size: 20px; letter-spacing: .2em; margin-right: auto; }
.r-main { display: flex; gap: 22px; padding: 20px 24px; min-height: 0; flex: 1; }
.r-left { flex: none; width: 330px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; min-height: 0; }
.r-rank-box { text-align: center; border: 2px dashed #e0b0b6; border-radius: 14px; padding: 10px; background: #fff5f6; }
.r-rank-box small, .r-score-box small { font-size: 12px; color: #8a7a68; font-weight: 800; }
#r-rank { font-size: 32px; font-weight: 800; color: var(--accent-d); }
#r-rank-desc { margin: 2px 0 0; font-size: 13px; color: #6d6052; }
.r-score-box { text-align: center; }
.r-score-box div { font-weight: 800; font-size: 22px; }
#r-score { font-size: 64px; color: var(--ink); line-height: 1.05; }
#r-best { margin: 0; font-size: 13px; color: #8a7a68; font-weight: 700; }
#r-best.new { color: #e08a10; animation: hurry .6s ease-in-out infinite alternate; }
.r-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.r-table th, .r-table td { border-bottom: 1px solid #e6dcc8; padding: 7px 4px; }
.r-table th { text-align: left; color: #7a6d5c; font-weight: 700; }
.r-table th small { font-size: 11px; color: #a99a86; margin-left: 2px; }
.r-table td { text-align: right; font-weight: 800; }
.r-right { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.r-right h3 { margin: 0 0 8px; font-size: 17px; }
.r-right h3 small { font-size: 12px; color: #8a7a68; font-weight: 700; }
#r-log { margin: 0; padding: 0; list-style: none; overflow-y: auto; flex: 1; min-height: 120px; max-height: 52vh; border-top: 2px solid #e8a8a8; }
#r-log li { position: relative; display: grid; grid-template-columns: 96px 1fr auto; gap: 10px; align-items: baseline; padding: 8px 6px; border-bottom: 1px solid #ece4d4; }
#r-log li.empty { display: block; color: #8a7a68; }
#r-log .who { font-size: 12px; color: #7a6d5c; font-weight: 700; }
#r-log .what { font-family: var(--note-font); font-weight: 600; font-size: 16px; line-height: 1.6; color: #2f2a33; }
#r-log .pts { color: var(--accent-d); font-size: 16px; }
#r-log .tag { font-size: 11px; color: #9a8f80; background: #f1ebe0; border-radius: 8px; padding: 2px 8px; white-space: nowrap; }
#r-log .tags { display: flex; gap: 6px; align-items: baseline; white-space: nowrap; }
#r-log .pts.sub { font-size: 13px; opacity: .75; }
#r-log li.skip .what, #r-log li.unfinished .what { color: #a49a8a; }
#r-log li.long { background: #fff8e6; }
.longtag { display: inline-block; margin-left: 4px; font-size: 10px; background: #e08a10; color: #fff; border-radius: 6px; padding: 0 5px; }
.r-buttons { display: flex; gap: 12px; justify-content: center; padding: 14px; border-top: 1px solid #ece4d4; }

/* 小さめの画面 */
@media (max-height: 700px) {
  :root { --hud-h: 92px; --panel-h: 92px; }
  .clock-face { width: 54px; height: 54px; }
  #hud-time { font-size: 34px; }
  #decoded { font-size: 27px; }
}
@media (max-width: 760px) {
  .title-card { flex-direction: column; }
  .cover { min-height: 0; }
  .title-note { width: min(300px, 100%); }
  .r-main { flex-direction: column; }
  .r-left { width: auto; }
  .hud-card.logo { display: none; }
  .panel-keys { display: none; }
}
