:root {
  --paper: #f4f5ef;
  --surface: #ffffff;
  --ink: #171916;
  --muted: #70766b;
  --line: #dfe3d8;
  --acid: #d1f65f;
  --acid-deep: #b9e83c;
  --orange: #ff7957;
  --lavender: #dcd7ff;
  --blue: #cde9ff;
  --radius-lg: 28px;
  --radius-md: 20px;
  --shadow: 0 10px 30px rgba(23, 25, 22, .06);
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; }
button { color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; opacity: .55; }
button, a, input, textarea { outline: none; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid #637d24; outline-offset: 3px; }
button { touch-action: manipulation; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
[hidden] { display: none !important; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.app-shell { min-height: 100vh; }
.topbar { height: 82px; max-width: 1240px; padding: 0 28px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 11px; border: 0; padding: 0; background: transparent; }
.brand-mark { width: 34px; height: 34px; background: var(--ink); border-radius: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 8px; transform: rotate(-3deg); }
.brand-mark i { background: #fff; border-radius: 1px; }
.brand-mark i:last-child { background: var(--acid); }
.brand-name { font-size: 23px; font-weight: 900; letter-spacing: .08em; }
.brand-en { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .18em; padding-left: 11px; border-left: 1px solid var(--line); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.local-status { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; margin-right: 5px; }
.local-status > span { width: 7px; height: 7px; border-radius: 50%; background: #6d9b37; box-shadow: 0 0 0 4px rgba(109, 155, 55, .12); }
.icon-button { width: 43px; height: 43px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; }
.icon-button:hover { background: #ecefe6; }
.icon-button svg { width: 20px; height: 20px; }
.class-button { min-height: 43px; padding: 0 14px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); font-size: 13px; font-weight: 750; }
.class-button:hover { border-color: #a7afa0; }
.class-button > svg { width: 17px; height: 17px; color: var(--muted); }
.class-dot { width: 8px; height: 8px; background: var(--orange); border-radius: 3px; }

.main-content { max-width: 1240px; margin: 0 auto; padding: 36px 28px 138px; }
.page { animation: page-in .35s ease both; }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.eyebrow { margin: 0 0 12px; color: #68715f; font-size: 12px; line-height: 1.4; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 14px; font-size: clamp(34px, 4vw, 52px); line-height: 1.13; letter-spacing: -.045em; font-weight: 900; }
.page-subtitle { color: var(--muted); font-size: 16px; line-height: 1.7; margin-bottom: 0; }
.home-intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; margin-bottom: 38px; }
.class-summary { flex: 0 0 340px; border-left: 1px solid #d4d9cd; padding: 4px 0 4px 24px; display: grid; grid-template-columns: 42px 1fr; gap: 11px 13px; align-items: center; }
.class-summary-icon { width: 42px; height: 42px; border-radius: 13px; display: flex; align-items: center; justify-content: center; background: #e5e9dd; grid-row: 1; }
.class-summary-icon svg { width: 20px; }
.class-summary > div { display: flex; flex-direction: column; gap: 5px; }
.class-summary strong { font-size: 16px; }
.class-summary > div span { color: var(--muted); font-size: 12px; }
.text-button { grid-column: 2; justify-self: start; display: inline-flex; align-items: center; gap: 5px; border: 0; padding: 0; background: none; color: var(--muted); font-size: 12px; }
.text-button:hover { color: var(--ink); }
.text-button svg { width: 13px; height: 13px; }

.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.tool-card { position: relative; min-height: 244px; padding: 25px 27px 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); text-align: left; display: flex; flex-direction: column; overflow: hidden; transition: transform .2s, box-shadow .2s, border-color .2s; }
.tool-card::after { content: ""; position: absolute; width: 190px; height: 190px; right: -110px; top: -110px; border: 1px solid rgba(23,25,22,.09); border-radius: 50%; transition: transform .4s; }
.tool-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: #b8c0b0; }
.tool-card:hover::after { transform: scale(1.25); }
.tool-card:active { transform: translateY(0); }
.tool-card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.tool-icon { width: 52px; height: 52px; border-radius: 16px; display: flex; align-items: center; justify-content: center; background: var(--acid); }
.tool-icon svg { width: 27px; height: 27px; stroke-width: 1.7; }
.tool-number { color: #969d90; font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.tool-card-copy { margin: 25px 0 22px; }
.tool-card h2 { margin-bottom: 7px; font-size: 27px; line-height: 1.2; letter-spacing: -.035em; }
.tool-card p { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.tool-card-bottom { margin-top: auto; padding-top: 15px; border-top: 1px solid rgba(23,25,22,.09); display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; }
.round-arrow { width: 34px; height: 34px; border: 1px solid #d8ddd2; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--ink); transition: background .2s, transform .2s; }
.round-arrow svg { width: 17px; height: 17px; }
.tool-card:hover .round-arrow { background: var(--ink); color: #fff; transform: rotate(5deg); }
.tool-random { background: var(--ink); color: #fff; border-color: var(--ink); }
.tool-random p, .tool-random .tool-card-bottom, .tool-random .tool-number { color: #aeb4a8; }
.tool-random .tool-card-bottom { border-color: #393d36; }
.tool-random .round-arrow { border-color: #51574c; color: #fff; }
.tool-random:hover { border-color: #3e4439; }
.tool-random:hover .round-arrow { background: var(--acid); color: var(--ink); }
.tool-random::after { border-color: #3b4037; }
.tool-timer .tool-icon { background: var(--lavender); }
.tool-score .tool-icon { background: var(--orange); }
.tool-focus .tool-icon { background: var(--blue); }
.tool-homework .tool-icon { background: #ffe69a; }
.tool-duty .tool-icon { background: #c9f0d8; }
.home-note { margin-top: 20px; padding: 18px 21px; border: 1px dashed #cdd3c5; border-radius: 18px; display: flex; align-items: center; gap: 14px; }
.note-icon { width: 36px; height: 36px; border-radius: 50%; background: #e4e9dc; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.note-icon svg { width: 19px; }
.home-note p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.home-note p strong { color: var(--ink); margin-right: 5px; }
.note-badge { margin-left: auto; white-space: nowrap; font-size: 10px; font-weight: 800; color: #6c755f; letter-spacing: .1em; }

.page-heading { margin-bottom: 30px; }
.compact-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.compact-heading h1 { font-size: clamp(32px, 3.6vw, 46px); margin-bottom: 0; }
.compact-heading .eyebrow { margin-bottom: 9px; }
.outline-button, .offline-pill, .online-pill { min-height: 44px; padding: 0 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.outline-button:hover { border-color: #9ea796; background: #fafbf8; }
.outline-button svg, .offline-pill svg, .online-pill svg { width: 18px; height: 18px; }
.small-icon { width: 14px !important; height: 14px !important; color: var(--muted); margin-left: 4px; }
.offline-pill { background: #e8eddf; color: #526145; }
.online-pill { background: #e8f3fc; color: #42657d; }

.primary-button, .secondary-button { min-height: 54px; padding: 0 22px; border-radius: 15px; border: 1px solid var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-weight: 800; font-size: 14px; transition: transform .15s, background .15s; }
.primary-button { background: var(--ink); color: #fff; box-shadow: 0 4px 0 #0000; }
.primary-button:hover { background: #30342c; }
.primary-button:active, .secondary-button:active { transform: translateY(2px); }
.secondary-button { background: var(--surface); border-color: var(--line); }
.secondary-button:hover { background: #eef1e9; border-color: #b6beae; }
.primary-button svg, .secondary-button svg { width: 20px; height: 20px; }
.section-label { display: block; font-size: 11px; font-weight: 800; color: var(--muted); letter-spacing: .08em; }

.random-stage { position: relative; isolation: isolate; width: 100%; min-height: 390px; padding: 54px 20px 45px; overflow: hidden; border: 0; border-radius: 30px; background: var(--ink); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.stage-grid { position: absolute; inset: 0; z-index: -1; opacity: .17; background-image: linear-gradient(#89917e 1px, transparent 1px), linear-gradient(90deg, #89917e 1px, transparent 1px); background-size: 46px 46px; mask-image: radial-gradient(circle at center, #000, transparent 72%); }
.random-stage::before { content: ""; position: absolute; width: 330px; height: 330px; border: 1px solid #43483e; border-radius: 50%; z-index: -1; }
.random-stage::after { content: ""; position: absolute; width: 245px; height: 245px; border: 1px dashed #4e5548; border-radius: 50%; z-index: -1; }
.random-stage.is-rolling::after { animation: orbit 8s linear infinite; border-top-color: var(--acid); }
@keyframes orbit { to { transform: rotate(360deg); } }
.random-status { position: absolute; top: 25px; display: flex; align-items: center; gap: 8px; color: #b9c0b3; font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.random-status i, #timer-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--acid); }
.random-stage.is-rolling .random-status i { animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.random-avatar { width: 58px; height: 58px; display: flex; align-items: center; justify-content: center; background: var(--acid); color: var(--ink); border-radius: 18px; font-size: 26px; font-weight: 900; transform: rotate(-5deg); margin-bottom: 20px; box-shadow: 7px 7px 0 #39422c; }
.random-name { position: relative; font-size: clamp(50px, 8vw, 94px); line-height: 1.15; letter-spacing: -.06em; font-weight: 900; max-width: 95%; }
.random-hint { position: relative; margin-top: 17px; color: #aeb5a8; font-size: 13px; }
.random-stage.is-selected .random-avatar { animation: avatar-pop .45s ease; }
.random-stage.is-selected .random-name { color: var(--acid); animation: name-pop .45s ease; }
@keyframes avatar-pop { 50% { transform: rotate(4deg) scale(1.15); } }
@keyframes name-pop { from { opacity: .3; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }
.stage-corner { position: absolute; width: 27px; height: 27px; border-color: #555d4f; border-style: solid; }
.top-left { left: 24px; top: 24px; border-width: 1px 0 0 1px; }
.bottom-right { right: 24px; bottom: 24px; border-width: 0 1px 1px 0; }
.random-actions { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin-top: 16px; }
.random-main-button { min-height: 64px; font-size: 16px; background: var(--acid); color: var(--ink); border-color: var(--acid-deep); }
.random-main-button:hover { background: var(--acid-deep); }
.random-main-button kbd { margin-left: auto; border: 1px solid rgba(23,25,22,.25); border-radius: 6px; padding: 4px 7px; font-family: inherit; font-size: 9px; font-weight: 700; opacity: .55; }
.random-main-button > span { margin-left: auto; }
.random-actions .secondary-button { min-width: 150px; }
.random-footer { margin-top: 24px; display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; }
.history-block { flex: 1; }
.history-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.history-chip { padding: 8px 12px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; font-size: 12px; font-weight: 700; }
.history-chip:first-child { background: #e9f5ce; border-color: #d0e3a7; }
.empty-history { color: #959c8f; font-size: 12px; padding: 8px 0; }
.pool-progress { min-width: 135px; display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 6px; }
.pool-progress strong { font-size: 28px; line-height: 1; }
.pool-progress span { color: var(--muted); font-size: 11px; }
.mini-progress { grid-column: 1 / -1; height: 3px; margin-top: 9px; background: #dfe3d9; overflow: hidden; }
.mini-progress i { display: block; height: 100%; width: 100%; background: var(--ink); transition: width .3s; }

.timer-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(310px, .85fr); gap: 18px; }
.timer-display { min-height: 465px; padding: 30px 32px; background: var(--ink); color: #fff; border: 1px solid var(--ink); border-radius: var(--radius-lg); display: flex; flex-direction: column; overflow: hidden; transition: background .3s, color .3s; }
.timer-display.is-running { background: var(--acid); color: var(--ink); border-color: var(--acid-deep); }
.timer-display.is-finished { background: var(--orange); color: var(--ink); animation: finished-pulse .8s ease 2; }
@keyframes finished-pulse { 50% { transform: scale(1.01); } }
.timer-display-top { display: flex; justify-content: space-between; align-items: center; color: #b0b7a9; font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.timer-display-top > svg { width: 26px; height: 26px; color: #6b7363; }
.timer-display.is-running .timer-display-top, .timer-display.is-finished .timer-display-top { color: #526032; }
.timer-display.is-running .timer-display-top > svg, .timer-display.is-finished .timer-display-top > svg { color: var(--ink); }
#timer-state { display: flex; align-items: center; gap: 8px; }
.timer-display.is-running #timer-state i { background: var(--ink); animation: blink 1.5s infinite; }
.timer-digits { margin: auto 0 0; font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: clamp(88px, 12vw, 156px); line-height: 1; letter-spacing: -.09em; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.timer-message { color: #a8b0a1; font-size: 13px; margin: 24px 0 28px; }
.timer-display.is-running .timer-message, .timer-display.is-finished .timer-message { color: #4e5c32; }
.timer-track { height: 5px; background: #3c4238; overflow: hidden; border-radius: 4px; }
.timer-track i { display: block; width: 100%; height: 100%; background: var(--acid); transform-origin: left; }
.timer-display.is-running .timer-track { background: rgba(23,25,22,.17); }
.timer-display.is-running .timer-track i { background: var(--ink); }
.timer-panel { padding: 26px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.preset-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-top: 12px; }
.preset-grid button { position: relative; min-height: 72px; border: 1px solid var(--line); background: #fafbf8; border-radius: 14px; display: flex; align-items: baseline; justify-content: center; gap: 5px; }
.preset-grid button:hover { border-color: #9da792; }
.preset-grid button.is-active { background: #edf5dc; border-color: #a9c46e; box-shadow: inset 0 0 0 1px #a9c46e; }
.preset-grid strong { font-size: 25px; }
.preset-grid span { font-size: 11px; color: var(--muted); }
.preset-grid em { position: absolute; top: 5px; right: 6px; color: #61743f; font-size: 8px; font-style: normal; }
.custom-time { margin: 22px 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.custom-time > span { color: var(--muted); font-size: 12px; }
.custom-time > div { display: flex; align-items: center; gap: 10px; }
.custom-time button { width: 34px; height: 34px; border: 1px solid var(--line); background: #f7f8f4; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.custom-time button:hover { background: #e8ece2; }
.custom-time button svg { width: 16px; }
.custom-time strong { min-width: 55px; text-align: center; font-size: 12px; }
.timer-actions { display: grid; grid-template-columns: 1fr 56px; gap: 10px; }
.timer-actions .primary-button { min-height: 58px; }
.square-button { padding: 0; }
.sound-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 15px 0 0; color: var(--muted); font-size: 10px; }
.sound-note svg { width: 14px; height: 14px; }
.timer-scenes { margin-top: 18px; display: flex; align-items: center; gap: 9px; }
.timer-scenes > span { color: var(--muted); font-size: 11px; margin-right: auto; }
.timer-scenes button { border: 1px solid var(--line); border-radius: 10px; background: transparent; padding: 9px 12px; color: var(--muted); font-size: 10px; }
.timer-scenes button:hover { background: var(--surface); color: var(--ink); }
.timer-scenes b { color: var(--ink); margin-left: 6px; }

.danger-ghost:hover { color: #b7472d; border-color: #e4b3a4; background: #fff5f1; }
.score-overview { min-height: 94px; padding: 18px 23px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.leader-summary { display: flex; align-items: center; gap: 17px; }
.trophy-mark { width: 54px; height: 54px; display: flex; align-items: center; justify-content: center; border-radius: 16px; background: var(--acid); font-size: 11px; font-weight: 900; letter-spacing: -.03em; transform: rotate(-3deg); }
.leader-summary > div { display: flex; flex-direction: column; gap: 6px; }
.leader-summary div span { color: var(--muted); font-size: 11px; }
.leader-summary strong { font-size: 19px; }
.total-score { display: flex; align-items: center; gap: 15px; padding-left: 25px; border-left: 1px solid var(--line); }
.total-score span { color: var(--muted); font-size: 11px; }
.total-score strong { min-width: 40px; font-size: 35px; line-height: 1; text-align: right; }
.score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.score-card { position: relative; min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); overflow: hidden; }
.score-card.is-leading { border-color: #9ebf52; box-shadow: inset 0 0 0 1px #9ebf52; }
.score-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px; background: var(--group-color); }
.score-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rank-badge { padding: 5px 8px; border-radius: 7px; background: #f0f2ec; color: var(--muted); font-size: 9px; font-weight: 800; }
.is-leading .rank-badge { background: var(--acid); color: var(--ink); }
.minus-score { width: 33px; height: 33px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.minus-score:hover { background: #f0f2ec; color: var(--ink); }
.minus-score svg { width: 15px; }
.group-name { display: block; margin-top: 23px; font-size: 16px; }
.group-english { display: block; margin-top: 5px; color: #92998c; font-size: 8px; font-weight: 800; letter-spacing: .14em; }
.group-score { display: block; margin: 13px 0 16px; font-family: "SFMono-Regular", Consolas, monospace; font-size: clamp(62px, 7vw, 88px); line-height: 1; letter-spacing: -.08em; font-variant-numeric: tabular-nums; }
.group-score.bump { animation: score-bump .25s ease; }
@keyframes score-bump { 50% { transform: scale(1.14); color: #65832e; } }
.add-score { width: 100%; min-height: 58px; border: 0; border-radius: 14px; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 17px; font-weight: 900; }
.add-score:hover { background: var(--group-color); color: var(--ink); }
.add-score:active { transform: scale(.98); }
.add-score svg { width: 20px; }
.score-tip { margin: 19px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.score-tip span { display: inline-block; margin-right: 8px; padding: 2px 6px; background: #e6eadf; border-radius: 4px; color: #5d6655; font-size: 9px; font-weight: 800; }

.ai-layout { display: grid; grid-template-columns: minmax(320px, .8fr) minmax(0, 1.2fr); gap: 18px; align-items: stretch; }
.ai-form { padding: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.ai-form > label, .difficulty-field legend { display: block; margin-bottom: 11px; font-size: 12px; font-weight: 800; }
.knowledge-input-wrap { position: relative; }
.knowledge-input-wrap textarea { width: 100%; min-height: 112px; padding: 17px 17px 30px; resize: none; border: 1px solid #cdd3c6; border-radius: 15px; background: #fafbf8; color: var(--ink); font-size: 17px; line-height: 1.65; font-weight: 650; transition: border .2s, background .2s; }
.knowledge-input-wrap textarea:focus { background: #fff; border-color: #8c9a79; }
.knowledge-input-wrap > span { position: absolute; right: 12px; bottom: 10px; color: #9aa191; font-size: 9px; }
.quick-topics { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.quick-topics button { padding: 7px 10px; background: transparent; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 10px; }
.quick-topics button:hover { background: #eff2ea; color: var(--ink); }
.difficulty-field { padding: 0; margin: 24px 0 20px; border: 0; }
.segment-control { padding: 4px; background: #eff1eb; border-radius: 12px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.segment-control label { cursor: pointer; }
.segment-control input { position: absolute; opacity: 0; pointer-events: none; }
.segment-control span { min-height: 38px; display: flex; align-items: center; justify-content: center; border-radius: 9px; color: var(--muted); font-size: 11px; font-weight: 700; }
.segment-control input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(23,25,22,.07); }
.segment-control input:focus-visible + span { outline: 2px solid #637d24; }
.ai-submit { width: 100%; min-height: 60px; background: var(--acid); color: var(--ink); border-color: #b9d878; }
.ai-submit:hover { background: var(--acid-deep); }
.ai-submit .end-icon { margin-left: auto; width: 17px; }
.ai-privacy { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 15px 0 0; color: var(--muted); font-size: 10px; }
.ai-privacy svg { width: 14px; height: 14px; }
.ai-output { min-height: 460px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.ai-placeholder, .ai-loading, .ai-error { min-height: 460px; height: 100%; padding: 45px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background-image: radial-gradient(#d9ded2 .8px, transparent .8px); background-size: 18px 18px; }
.placeholder-orbit { position: relative; width: 76px; height: 76px; margin-bottom: 25px; border-radius: 24px; background: var(--blue); display: flex; align-items: center; justify-content: center; transform: rotate(-5deg); }
.placeholder-orbit::after { content: ""; position: absolute; inset: -12px; border: 1px dashed #b6c5cc; border-radius: 30px; }
.placeholder-orbit svg { width: 34px; height: 34px; }
.ai-placeholder h2, .ai-loading h2, .ai-error h2 { margin-bottom: 10px; font-size: 24px; letter-spacing: -.03em; }
.ai-placeholder > p, .ai-loading > p, .ai-error > p { max-width: 340px; margin-bottom: 22px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.placeholder-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.placeholder-meta span { padding: 7px 9px; background: rgba(255,255,255,.8); border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 9px; }
.thinking-mark { position: relative; width: 82px; height: 82px; margin-bottom: 26px; display: flex; align-items: center; justify-content: center; }
.thinking-mark i { position: absolute; inset: 0; border: 1px solid #cdd5c3; border-radius: 50%; animation: think 2s ease-out infinite; }
.thinking-mark i:nth-child(2) { animation-delay: .65s; }
.thinking-mark i:nth-child(3) { animation-delay: 1.3s; }
.thinking-mark svg { width: 38px; height: 38px; color: #738d3a; }
@keyframes think { from { transform: scale(.45); opacity: 1; } to { transform: scale(1.25); opacity: 0; } }
.skeleton-lines { width: min(280px, 90%); display: flex; flex-direction: column; gap: 9px; }
.skeleton-lines i { height: 8px; border-radius: 8px; background: linear-gradient(90deg, #edf0e8 25%, #dfe5d6 50%, #edf0e8 75%); background-size: 200% 100%; animation: skeleton 1.4s infinite; }
.skeleton-lines i:nth-child(2) { width: 85%; }
.skeleton-lines i:nth-child(3) { width: 55%; }
@keyframes skeleton { to { background-position: -200% 0; } }
.question-card { min-height: 460px; height: 100%; padding: 27px; display: flex; flex-direction: column; }
.question-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.question-top > span:first-child { padding: 6px 9px; background: #eaf3d7; border-radius: 7px; color: #5e703e; font-size: 10px; font-weight: 800; }
.teacher-only { color: var(--muted); font-size: 9px; }
.question-content { padding: 27px 2px 25px; }
.question-label { color: #8b9383; font-size: 9px; font-weight: 900; letter-spacing: .18em; }
.question-content h2 { margin: 13px 0 0; font-size: clamp(21px, 2.5vw, 30px); line-height: 1.6; letter-spacing: -.02em; white-space: pre-wrap; }
.answer-box { margin-bottom: 20px; padding: 17px; border-left: 3px solid #9dbf52; border-radius: 0 12px 12px 0; background: #f1f6e6; }
.answer-box > span { color: #6d7d51; font-size: 9px; font-weight: 800; letter-spacing: .1em; }
.answer-box p { margin: 8px 0 0; font-size: 14px; line-height: 1.65; }
#explanation-text { color: var(--muted); font-size: 12px; }
.question-actions { display: flex; gap: 8px; margin-top: auto; }
.question-actions button { flex: 1; min-height: 48px; padding: 0 11px; font-size: 11px; }
.question-actions .primary-button { background: var(--ink); }
.verify-note { margin: 13px 0 0; text-align: center; color: #949b8e; font-size: 9px; }
.ai-error > span { width: 60px; height: 60px; margin-bottom: 22px; border-radius: 50%; background: #fff0e9; color: #bd593c; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 900; }
.ai-error .primary-button { min-height: 48px; }

.bottom-nav { position: fixed; z-index: 30; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(720px, calc(100% - 32px)); min-height: 76px; padding: 7px; border: 1px solid #353a31; border-radius: 23px; background: rgba(23,25,22,.96); box-shadow: 0 14px 40px rgba(23,25,22,.22); backdrop-filter: blur(16px); display: grid; grid-template-columns: repeat(7, 1fr); }
.nav-item { position: relative; min-width: 0; min-height: 60px; padding: 7px 4px; border: 0; border-radius: 16px; background: transparent; color: #9fa69a; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; font-size: 10px; font-weight: 700; transition: color .2s, background .2s; }
.nav-item svg { width: 22px; height: 22px; }
.nav-item:hover { color: #fff; }
.nav-item.is-active { background: var(--acid); color: var(--ink); }
.ai-nav-item:not(.is-active) svg { color: var(--acid); }
.nav-running-dot { position: absolute; top: 7px; right: calc(50% - 17px); width: 6px; height: 6px; border-radius: 50%; background: var(--orange); }

.class-dialog { width: min(570px, calc(100% - 28px)); max-height: calc(100dvh - 40px); padding: 0; border: 1px solid var(--line); border-radius: 26px; background: var(--paper); color: var(--ink); box-shadow: 0 25px 80px rgba(0,0,0,.22); }
.class-dialog::backdrop { background: rgba(19,22,17,.55); backdrop-filter: blur(5px); }
.class-dialog form { padding: 27px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.dialog-heading .eyebrow { margin-bottom: 7px; }
.dialog-heading h2 { margin-bottom: 0; font-size: 25px; letter-spacing: -.03em; }
.dialog-description { margin: 12px 0 22px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.field-label { display: block; margin-bottom: 8px; font-size: 11px; font-weight: 800; }
.text-input, .roster-input { width: 100%; border: 1px solid #cfd5c8; border-radius: 12px; background: #fff; color: var(--ink); }
.text-input { height: 47px; padding: 0 13px; font-size: 14px; font-weight: 700; }
.roster-label { margin-top: 19px; display: flex; align-items: center; justify-content: space-between; }
.roster-label > span { color: var(--muted); font-size: 10px; }
.roster-input { min-height: 190px; padding: 13px; resize: vertical; font-size: 13px; line-height: 1.8; }
.field-help { margin: 7px 0 0; color: var(--muted); font-size: 10px; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: 10px; margin-top: 23px; }
.toast { position: fixed; z-index: 100; left: 50%; top: 24px; transform: translate(-50%, -20px); max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px; background: var(--ink); color: #fff; box-shadow: 0 8px 30px rgba(0,0,0,.18); font-size: 12px; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 1500px) {
  .main-content { padding-top: 48px; }
  .tool-card { min-height: 270px; }
  .random-stage { min-height: 48vh; }
  .timer-display { min-height: 53vh; }
  .timer-digits { font-size: clamp(130px, 11vw, 190px); }
}

@media (max-width: 900px) {
  .main-content { padding-top: 25px; }
  .home-intro { align-items: flex-start; }
  .class-summary { flex-basis: 285px; }
  .score-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .group-score { font-size: 82px; }
  .timer-layout { grid-template-columns: 1fr; }
  .timer-display { min-height: 350px; }
  .timer-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 24px; }
  .timer-panel > .section-label, .preset-grid { grid-column: 1; }
  .preset-grid { grid-row: 2 / 5; }
  .custom-time { grid-column: 2; margin: 0; align-self: end; }
  .timer-actions { grid-column: 2; }
  .sound-note { grid-column: 2; }
  .timer-scenes { flex-wrap: wrap; }
  .timer-scenes > span { width: 100%; }
  .ai-layout { grid-template-columns: 1fr; }
  .ai-output, .ai-placeholder, .ai-loading, .ai-error, .question-card { min-height: 400px; }
}

@media (max-width: 640px) {
  .topbar { height: 68px; padding: 0 16px; }
  .brand { gap: 8px; }
  .brand-mark { width: 31px; height: 31px; border-radius: 9px; padding: 7px; }
  .brand-name { font-size: 20px; }
  .brand-en, .local-status { display: none; }
  .topbar-actions { gap: 7px; }
  .sound-button { width: 38px; height: 38px; background: transparent; }
  .class-button { min-height: 38px; max-width: 154px; padding: 0 10px; font-size: 11px; }
  .class-button > svg { width: 14px; }
  .main-content { padding: 24px 15px calc(118px + env(safe-area-inset-bottom)); }
  h1 { font-size: 32px; }
  .eyebrow { font-size: 10px; margin-bottom: 9px; }
  .page-subtitle { max-width: 310px; font-size: 13px; line-height: 1.65; }
  .home-intro { display: block; margin-bottom: 25px; }
  .class-summary { margin-top: 22px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.45); grid-template-columns: 36px 1fr auto; }
  .class-summary-icon { width: 36px; height: 36px; border-radius: 11px; }
  .class-summary > div { gap: 3px; }
  .class-summary strong { font-size: 13px; }
  .class-summary .text-button { grid-column: 3; grid-row: 1; font-size: 10px; }
  .tool-grid { gap: 11px; }
  .tool-card { min-height: 188px; padding: 17px 16px 14px; border-radius: 21px; }
  .tool-icon { width: 43px; height: 43px; border-radius: 13px; }
  .tool-icon svg { width: 23px; height: 23px; }
  .tool-card-copy { margin: 20px 0 15px; }
  .tool-card h2 { font-size: 21px; margin-bottom: 6px; }
  .tool-card p { font-size: 10px; line-height: 1.5; }
  .tool-card-bottom { padding-top: 10px; font-size: 9px; }
  .tool-card-bottom > span:first-child { max-width: 105px; line-height: 1.4; }
  .round-arrow { width: 27px; height: 27px; flex: 0 0 auto; }
  .round-arrow svg { width: 14px; height: 14px; }
  .home-note { padding: 14px; align-items: flex-start; }
  .home-note p { font-size: 10px; }
  .home-note p strong { display: block; margin-bottom: 3px; }
  .note-badge { display: none; }
  .note-icon { width: 31px; height: 31px; }
  .compact-heading { align-items: flex-start; margin-bottom: 22px; }
  .compact-heading h1 { font-size: 29px; }
  .compact-heading .outline-button { min-width: 44px; padding: 0 11px; }
  .compact-heading .outline-button > span { display: none; }
  .compact-heading .outline-button .small-icon { display: none; }
  .offline-pill, .online-pill { min-height: 35px; padding: 0 10px; font-size: 9px; }
  .offline-pill svg, .online-pill svg { width: 14px; height: 14px; }
  .random-stage { min-height: 370px; border-radius: 24px; padding-left: 12px; padding-right: 12px; }
  .random-stage::before { width: 285px; height: 285px; }
  .random-stage::after { width: 215px; height: 215px; }
  .random-name { font-size: clamp(49px, 16vw, 70px); }
  .random-hint { max-width: 240px; text-align: center; font-size: 11px; line-height: 1.6; }
  .random-actions { grid-template-columns: 1fr 55px; gap: 9px; }
  .random-main-button { min-height: 58px; font-size: 14px; padding: 0 17px; }
  .random-main-button > span { margin: 0 auto; }
  .random-main-button kbd { display: none; }
  .random-actions .secondary-button { min-width: 0; padding: 0; }
  .random-actions .secondary-button span { display: none; }
  .random-footer { align-items: flex-start; gap: 15px; }
  .history-list { gap: 5px; }
  .history-chip { padding: 6px 8px; font-size: 10px; }
  .pool-progress { min-width: 88px; }
  .pool-progress strong { font-size: 24px; }
  .pool-progress span { font-size: 9px; }
  .timer-display { min-height: 300px; padding: 23px; border-radius: 23px; }
  .timer-digits { font-size: clamp(75px, 24vw, 108px); }
  .timer-message { margin: 17px 0 21px; font-size: 11px; }
  .timer-panel { display: block; padding: 20px; border-radius: 23px; }
  .preset-grid { margin-top: 10px; }
  .preset-grid button { min-height: 63px; }
  .custom-time { margin: 18px 0; }
  .timer-scenes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .timer-scenes > span { grid-column: 1 / -1; }
  .timer-scenes button { padding: 9px 5px; font-size: 9px; }
  .timer-scenes b { display: block; margin: 4px 0 0; }
  .score-overview { padding: 15px; }
  .trophy-mark { width: 44px; height: 44px; border-radius: 13px; font-size: 9px; }
  .leader-summary { gap: 11px; }
  .leader-summary strong { font-size: 14px; }
  .total-score { padding-left: 14px; gap: 8px; flex-direction: column; align-items: flex-end; }
  .total-score strong { font-size: 29px; }
  .score-grid { gap: 10px; }
  .score-card { padding: 15px; border-radius: 20px; }
  .group-name { margin-top: 17px; font-size: 14px; }
  .group-score { margin: 12px 0 15px; font-size: 65px; }
  .add-score { min-height: 52px; }
  .score-tip { font-size: 10px; }
  .ai-form { padding: 20px; border-radius: 23px; }
  .ai-output { border-radius: 23px; }
  .ai-placeholder, .ai-loading, .ai-error { min-height: 390px; padding: 30px 22px; }
  .question-card { padding: 21px; }
  .question-content h2 { font-size: 22px; }
  .question-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .question-actions .primary-button { grid-column: 1 / -1; grid-row: 1; }
  .bottom-nav { width: calc(100% - 20px); bottom: max(9px, env(safe-area-inset-bottom)); min-height: 68px; padding: 5px; border-radius: 20px; }
  .nav-item { min-height: 56px; border-radius: 15px; font-size: 9px; gap: 4px; }
  .nav-item svg { width: 21px; height: 21px; }
  .class-dialog form { padding: 21px; }
  .toast { top: 14px; font-size: 11px; }
}

@media (max-width: 360px) {
  .class-button { max-width: 128px; }
  .tool-card { min-height: 178px; padding: 15px 13px 12px; }
  .tool-card h2 { font-size: 19px; }
  .tool-card-bottom > span:first-child { display: none; }
  .timer-digits { font-size: 72px; }
  .group-score { font-size: 57px; }
}

/* Multi-class management and classroom-day controls. */
.dialog-shell { padding: 27px; }
.class-manager-dialog { width: min(650px, calc(100% - 28px)); }
.class-list { display: flex; flex-direction: column; gap: 9px; max-height: 42vh; overflow-y: auto; padding: 2px; }
.class-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); transition: border-color .2s, background .2s; }
.class-row.is-current { border-color: #a9c46e; background: #f3f8e8; }
.class-select { min-width: 0; min-height: 73px; padding: 12px 10px 12px 14px; border: 0; background: transparent; display: flex; align-items: center; gap: 12px; text-align: left; }
.class-list-index { width: 34px; height: 34px; border-radius: 10px; background: #edf0e8; display: flex; align-items: center; justify-content: center; color: var(--muted); font-family: Consolas, monospace; font-size: 11px; font-weight: 800; flex: 0 0 auto; }
.is-current .class-list-index { background: var(--acid); color: var(--ink); }
.class-list-copy { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.class-list-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.class-list-copy small { color: var(--muted); font-size: 10px; }
.current-badge { display: none; margin-left: auto; padding: 4px 7px; border-radius: 6px; background: var(--acid); color: #51632e; font-size: 8px; font-weight: 800; white-space: nowrap; }
.is-current .current-badge { display: inline-block; }
.class-row-actions { display: flex; gap: 2px; padding-right: 9px; }
.class-row-actions button { width: 31px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.class-row-actions button:hover { background: #e5eadc; color: var(--ink); }
.class-row-actions button:last-child:hover { background: #fff0e9; color: #b94d32; }
.class-row-actions svg { width: 15px; height: 15px; }
.class-link-guide { margin: 12px 0 2px; padding: 12px 13px; border-radius: 12px; background: #edf4e1; display: flex; align-items: flex-start; gap: 10px; }
.class-link-guide > svg { width: 18px; height: 18px; margin-top: 1px; color: #617442; }
.class-link-guide p { margin: 0; display: flex; flex-direction: column; gap: 5px; }
.class-link-guide strong { font-size: 11px; }
.class-link-guide span { color: #68745a; font-size: 9px; line-height: 1.65; }
.share-link-action { background: var(--acid) !important; color: var(--ink) !important; }
.add-class-button { width: 100%; min-height: 61px; margin-top: 12px; padding: 10px 15px; border: 1px dashed #b8c1af; border-radius: 15px; background: transparent; display: flex; align-items: center; gap: 10px; text-align: left; }
.add-class-button:hover { background: #edf2e4; border-color: #8fa36c; }
.add-class-button > svg { width: 20px; }
.add-class-button > span { font-size: 13px; font-weight: 800; }
.add-class-button > small { margin-left: auto; color: var(--muted); font-size: 10px; }
.backup-section { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.backup-section > div:first-child { display: flex; flex-direction: column; gap: 5px; }
.backup-section strong { font-size: 12px; }
.backup-section span { color: var(--muted); font-size: 9px; }
.backup-section > div:last-child { display: flex; gap: 7px; }
.backup-section .secondary-button { min-height: 39px; padding: 0 13px; font-size: 10px; }
.privacy-footnote { margin: 13px 0 0; color: #8b9384; font-size: 9px; text-align: center; }
.roster-dialog form { max-height: calc(100dvh - 80px); overflow-y: auto; }
.quick-add-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 9px; }
.quick-add-row input { min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 11px; }
.quick-add-row button { padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; background: #edf1e7; display: flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 800; }
.quick-add-row button:hover { background: #e1e9d4; }
.quick-add-row svg { width: 14px; height: 14px; }
.roster-preview { margin-top: 13px; padding: 11px 12px; border-radius: 10px; background: #edf4e1; color: #5d7042; font-size: 10px; line-height: 1.6; }
.roster-preview.has-warning { background: #fff1df; color: #96672e; }
.random-utilities { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.random-utilities .secondary-button { min-height: 44px; padding: 0 15px; color: var(--muted); font-size: 11px; }
.random-utilities .secondary-button b { margin-left: auto; color: var(--ink); font-size: 9px; }
.random-utilities svg { width: 16px; height: 16px; }
.attendance-dialog { width: min(590px, calc(100% - 28px)); }
.attendance-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 48vh; overflow-y: auto; padding: 2px; }
.attendance-student { min-width: 0; min-height: 58px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); display: grid; grid-template-columns: 32px 1fr auto; grid-template-rows: 1fr 1fr; column-gap: 9px; align-items: center; text-align: left; }
.attendance-avatar { grid-row: 1 / 3; width: 32px; height: 32px; border-radius: 9px; background: #e9eee1; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; }
.attendance-student strong { align-self: end; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.attendance-status { align-self: start; color: var(--muted); font-size: 8px; }
.attendance-check { grid-column: 3; grid-row: 1 / 3; width: 20px; height: 20px; border-radius: 50%; background: var(--acid); display: flex; align-items: center; justify-content: center; }
.attendance-check svg { width: 12px; height: 12px; }
.attendance-student.is-absent { background: #fff4ed; border-color: #edc7b5; }
.is-absent .attendance-avatar { background: #ffd9c9; }
.is-absent .attendance-status { color: #ad5a3d; }
.is-absent .attendance-check { background: #e7e9e3; color: #9ca194; }
.clear-group-score { min-height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); font-size: 9px; font-weight: 700; }
.clear-group-score:hover:not(:disabled) { background: #fff1eb; border-color: #e4b3a4; color: #b7472d; }
.score-adjust-row { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 8px; }
.remove-score { min-height: 58px; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: #f7f8f4; color: var(--ink); display: flex; align-items: center; justify-content: center; gap: 2px; font-size: 17px; font-weight: 900; }
.remove-score:hover:not(:disabled) { background: #fff0e9; border-color: #e7b8a8; color: #b7472d; }
.remove-score svg { width: 18px; height: 18px; }

@media (max-width: 640px) {
  .dialog-shell { padding: 21px; }
  .class-list { max-height: 40vh; }
  .class-select { min-height: 67px; padding-left: 10px; gap: 9px; }
  .class-list-index { width: 30px; height: 30px; }
  .class-list-copy strong { font-size: 12px; }
  .current-badge { display: none !important; }
  .class-row-actions { padding-right: 6px; }
  .class-row-actions button { width: 28px; }
  .add-class-button > small { display: none; }
  .backup-section { align-items: flex-start; }
  .backup-section > div:first-child { max-width: 180px; }
  .roster-dialog form { max-height: calc(100dvh - 60px); }
  .random-utilities { gap: 7px; }
  .random-utilities .secondary-button { padding: 0 10px; font-size: 10px; }
  .random-utilities .secondary-button b { font-size: 8px; }
  .attendance-list { grid-template-columns: 1fr; max-height: 50vh; }
  .attendance-student { min-height: 55px; }
  .score-adjust-row { grid-template-columns: 46px minmax(0, 1fr); gap: 6px; }
  .remove-score, .add-score { min-height: 52px; }
  .clear-group-score { padding: 0 6px; font-size: 8px; }
}

.first-use-tip { margin: 0 0 22px; padding: 15px 17px; border: 1px solid #c8dba4; border-radius: 16px; background: #f0f8df; display: flex; align-items: center; gap: 12px; }
.first-use-tip > svg { width: 24px; height: 24px; color: #567125; flex: 0 0 auto; }
.first-use-tip p { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.first-use-tip strong { font-size: 12px; }
.first-use-tip span { color: #62704f; font-size: 10px; line-height: 1.5; }
.first-use-tip button { margin-left: auto; padding: 8px; background: transparent; color: #52633a; font-size: 10px; font-weight: 750; white-space: nowrap; }
.onboarding-dialog { width: min(520px, calc(100% - 28px)); max-height: calc(100dvh - 30px); padding: 0; border: 0; border-radius: 28px; background: var(--paper); color: var(--ink); box-shadow: 0 30px 90px #20251d45; }
.onboarding-dialog::backdrop { background: #20251db5; backdrop-filter: blur(7px); }
.onboarding-shell { padding: 30px; text-align: center; }
.onboarding-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 29px; text-align: left; }
.onboarding-brand .brand-mark { width: 30px; height: 30px; font-size: 16px; }
.onboarding-brand strong { font-size: 13px; }
.onboarding-brand > span:last-child { margin-left: auto; color: var(--muted); font-size: 9px; }
.onboarding-shell > h2 { margin: 10px 0 11px; font-size: 30px; letter-spacing: -.04em; }
.onboarding-description { max-width: 360px; margin: 0 auto 21px; color: var(--muted); font-size: 12px; line-height: 1.75; }
.onboarding-class-card { padding: 23px; border: 1px solid #d2e4aa; border-radius: 20px; background: #eff7dc; display: flex; flex-direction: column; gap: 8px; }
.onboarding-class-card small { color: #687957; font-size: 10px; }
.onboarding-class-card strong { font-size: 28px; }
.onboarding-class-card span { color: #59674a; font-size: 11px; }
.onboarding-assurances { display: flex; justify-content: center; gap: 7px; margin: 17px 0; flex-wrap: wrap; }
.onboarding-assurances span { padding: 6px 9px; border-radius: 7px; background: #e9ede3; color: #66705d; font-size: 9px; }
.onboarding-primary { width: 100%; min-height: 58px; font-size: 15px; }
.onboarding-help { margin: 14px auto 0; max-width: 390px; color: var(--muted); font-size: 10px; line-height: 1.7; }
@media (max-width: 640px) {
  .onboarding-shell { padding: 24px 20px; }
  .onboarding-brand { margin-bottom: 24px; }
  .onboarding-shell > h2 { font-size: 27px; }
  .onboarding-class-card strong { font-size: 25px; }
  .first-use-tip { align-items: flex-start; flex-wrap: wrap; }
  .first-use-tip button { margin-left: 36px; padding-top: 0; }
}

.affairs-shortcuts { margin-top: 30px; }
.affairs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-top: 12px; }
.affair-card { min-width: 0; min-height: 92px; padding: 17px; border: 1px solid var(--line); border-radius: 19px; background: var(--surface); display: flex; align-items: center; gap: 13px; text-align: left; transition: transform .2s, border-color .2s; }
.affair-card:hover { transform: translateY(-2px); border-color: #b5c49a; }
.affair-icon { width: 43px; height: 43px; border-radius: 13px; background: var(--acid); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.duty-entry .affair-icon { background: #dceaff; }
.affair-icon svg { width: 21px; height: 21px; }
.affair-card > span:nth-child(2) { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.affair-card strong { font-size: 14px; }
.affair-card small { color: var(--muted); font-size: 10px; line-height: 1.5; }
.affair-arrow { width: 18px; height: 18px; margin-left: auto; color: var(--muted); flex: 0 0 auto; }
.local-pill { background: #edf1e8; color: #657057; }
.notice-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); gap: 22px; align-items: start; }
.notice-form, .duty-toolbar { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.notice-subject-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 12px; }
.notice-subject-grid label > span, .reminder-field > span { display: block; margin-bottom: 8px; font-size: 11px; font-weight: 800; }
.notice-subject-grid textarea, .reminder-field textarea { width: 100%; min-height: 82px; padding: 12px; resize: vertical; border: 1px solid #d4d9ce; border-radius: 12px; background: #fafbf8; font-size: 12px; line-height: 1.65; }
.notice-subject-grid textarea:focus, .reminder-field textarea:focus { border-color: #8c9a79; background: #fff; }
.reminder-field { display: block; margin-top: 16px; }
.notice-form-note { margin: 9px 0 18px; color: var(--muted); font-size: 9px; }
.notice-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.notice-actions button { min-height: 46px; }
.notice-preview-card { position: sticky; top: 24px; padding: 23px; border-radius: var(--radius-lg); background: var(--ink); color: #f5f6f0; }
.preview-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid #40443c; }
.preview-heading > span { font-size: 13px; font-weight: 800; }
.preview-heading > small { color: #a9af9f; font-size: 9px; }
.notice-preview-card pre { min-height: 350px; margin: 20px 0; color: #f0f2e9; font-family: inherit; font-size: 12px; line-height: 1.9; white-space: pre-wrap; word-break: break-word; }
.notice-preview-card > p { margin: 0; color: #979e8c; font-size: 9px; text-align: center; }
.duty-toolbar { margin-bottom: 24px; }
.duty-roster-summary { display: flex; align-items: center; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.duty-roster-summary > div { display: flex; flex-direction: column; gap: 5px; }
.duty-roster-summary strong { font-size: 12px; }
.duty-roster-summary small { color: var(--muted); font-size: 9px; }
.duty-roster-summary .text-button { margin-left: auto; }
.duty-role-editor { margin-top: 18px; }
.duty-role-editor > label { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 11px; font-weight: 800; }
.duty-role-editor > label span { color: var(--muted); font-size: 9px; font-weight: 500; }
.duty-role-editor > div { display: flex; gap: 9px; }
.duty-role-editor input { flex: 1; min-width: 0; height: 46px; padding: 0 13px; border: 1px solid #d4d9ce; border-radius: 12px; background: #fafbf8; font-size: 12px; }
.duty-actions { display: flex; gap: 9px; margin-top: 17px; }
.duty-actions button { flex: 1; min-height: 49px; }
.fairness-note { margin: 12px 0 0; color: #68745a; font-size: 10px; line-height: 1.7; }
.duty-empty { padding: 70px 20px; border: 1px dashed #c6cebb; border-radius: var(--radius-lg); text-align: center; }
.duty-empty > svg { width: 40px; height: 40px; color: #9cab87; }
.duty-empty h2 { margin: 15px 0 8px; font-size: 19px; }
.duty-empty p { margin: 0; color: var(--muted); font-size: 11px; }
.duty-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 13px; margin-top: 14px; }
.duty-card { min-width: 0; padding: 19px; border: 1px solid var(--line); border-top: 4px solid var(--acid); border-radius: 17px; background: var(--surface); }
.duty-card:nth-child(3n+2) { border-top-color: #cde9ff; }
.duty-card:nth-child(3n) { border-top-color: #ffd3c3; }
.duty-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.duty-card-heading strong { font-size: 15px; }
.duty-card-heading span { padding: 4px 7px; border-radius: 6px; background: #edf1e7; color: var(--muted); font-size: 9px; }
.duty-card p { margin: 14px 0 0; color: #52594b; font-size: 12px; line-height: 1.9; word-break: break-word; }

@media (max-width: 900px) {
  .notice-layout { grid-template-columns: 1fr; }
  .notice-preview-card { position: static; }
  .notice-preview-card pre { min-height: 260px; }
}
@media (max-width: 640px) {
  .affairs-grid { grid-template-columns: 1fr; }
  .affair-card { min-height: 82px; }
  .notice-form, .duty-toolbar { padding: 18px; border-radius: 22px; }
  .notice-subject-grid { grid-template-columns: 1fr; }
  .notice-actions button { flex: 1 1 40%; }
  .notice-actions .danger-ghost { flex: 0 0 auto; }
  .duty-roster-summary { flex-wrap: wrap; }
  .duty-roster-summary .text-button { width: 100%; margin: 3px 0 0 55px; justify-content: flex-start; }
  .duty-role-editor > label { flex-direction: column; gap: 5px; }
  .duty-role-editor > div { flex-direction: column; }
  .duty-actions { flex-wrap: wrap; }
  .duty-actions button { flex: 1 1 40%; }
  .duty-grid { grid-template-columns: 1fr; }
}

.course-form-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.course-form-heading > span { font-size: 14px; font-weight: 850; }
.course-form-heading > small { color: var(--muted); font-size: 9px; }
.course-select-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.course-select-grid label > span, .chapter-select-label > span, .custom-chapter-wrap label { display: block; margin-bottom: 8px; color: var(--ink); font-size: 11px; font-weight: 800; }
.course-select-grid select, .chapter-select-label select { width: 100%; height: 49px; padding: 0 13px; border: 1px solid #cdd3c6; border-radius: 12px; background: #fafbf8; color: var(--ink); font-family: inherit; font-size: 13px; font-weight: 700; }
.course-select-grid select:focus, .chapter-select-label select:focus { border-color: #8c9a79; background: #fff; }
.chapter-select-label { margin-top: 16px; }
.custom-chapter-wrap { margin-top: 11px; }
.custom-chapter-wrap input { width: 100%; height: 45px; padding: 0 13px; border: 1px solid #cdd3c6; border-radius: 11px; background: #fff; font-size: 12px; }
.curriculum-note { margin: 9px 0 0; color: var(--muted); font-size: 9px; line-height: 1.6; }
.notes-label { display: flex !important; align-items: center; justify-content: space-between; }
.notes-label > span { color: var(--muted); font-size: 9px; font-weight: 500; }
.ai-form .knowledge-input-wrap textarea { min-height: 77px; padding: 13px 15px 26px; font-size: 13px; font-weight: 500; }
.question-context { margin: 18px 0 0; padding: 10px 12px; border-radius: 9px; background: #f1f4eb; color: #68745a; font-size: 10px; font-weight: 700; line-height: 1.6; }

.score-page-actions { display: flex; align-items: center; gap: 8px; }
.groups-dialog { width: min(530px, calc(100% - 28px)); }
.groups-dialog form { padding: 27px; max-height: calc(100dvh - 60px); overflow-y: auto; }
.group-edit-list { display: flex; flex-direction: column; gap: 9px; }
.group-edit-row { --group-color: var(--acid); min-height: 57px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); display: grid; grid-template-columns: 8px 28px minmax(0, 1fr) 35px; align-items: center; gap: 9px; }
.group-edit-color { width: 8px; height: 30px; border-radius: 5px; background: var(--group-color); }
.group-edit-number { color: var(--muted); font-family: Consolas, monospace; font-size: 10px; }
.group-name-editor { min-width: 0; height: 39px; padding: 0 11px; border: 1px solid transparent; border-radius: 9px; background: #f5f6f1; font-size: 12px; font-weight: 700; }
.group-name-editor:focus { border-color: #a9c46e; background: #fff; }
.remove-group { width: 35px; height: 35px; padding: 0; border: 0; border-radius: 9px; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.remove-group:hover:not(:disabled) { background: #fff0e9; color: #b7472d; }
.remove-group svg { width: 16px; height: 16px; }

@media (max-width: 640px) {
  #page-score .compact-heading { display: block; }
  .score-page-actions { margin-top: 14px; }
  .score-page-actions .outline-button { min-height: 39px; }
  .groups-dialog form { padding: 21px; }
  .group-edit-row { grid-template-columns: 7px 22px minmax(0, 1fr) 32px; gap: 7px; }
}

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