:root {
  --ink: #10202c;
  --ink-soft: #243746;
  --muted: #6d7d86;
  --line: #d8e0df;
  --paper: #f5f3ee;
  --white: #fffefa;
  --night: #0d1620;
  --night-soft: #15232e;
  --amber: #efab3c;
  --amber-soft: #fff1cf;
  --amber-ink: #8a5a12;
  --mint: #75c9aa;
  --mint-soft: #dff4eb;
  --mint-ink: #2f6f58;
  --coral-soft: #f8e4e1;
  --coral-ink: #a6524e;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--ink); background: var(--paper); font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif; font-size: 15px; line-height: 1.5; -webkit-tap-highlight-color: transparent; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 3px solid rgba(91, 135, 216, .35); outline-offset: 2px; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.m-header { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; color: #e7f0ef; background: var(--night); }
.m-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.m-brand-mark { display: flex; flex: none; gap: 3px; align-items: flex-end; width: 30px; height: 30px; padding: 5px; border: 1px solid rgba(239, 171, 60, .8); border-radius: 7px; background: #162733; }
.m-brand-mark span { display: block; width: 4px; border-radius: 2px; background: var(--amber); }
.m-brand-mark span:nth-child(1) { height: 9px; opacity: .64; }
.m-brand-mark span:nth-child(2) { height: 15px; }
.m-brand-mark span:nth-child(3) { height: 20px; background: var(--mint); }
.m-brand strong, .m-brand small { display: block; }
.m-brand strong { font-size: 17px; line-height: 1.25; }
.m-brand small { color: #8da0aa; font-size: 11px; }
.m-user { display: flex; align-items: center; gap: 8px; min-width: 0; color: #bac6c9; font-size: 13px; }
.m-user span { overflow: hidden; max-width: 9em; text-overflow: ellipsis; white-space: nowrap; }
.m-icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; color: #d7e2e1; border: 1px solid #243845; border-radius: 8px; background: var(--night-soft); }
.m-banner { display: flex; align-items: center; gap: 8px; padding: 10px 16px; color: var(--amber-ink); border-bottom: 1px solid #f1d9a6; background: var(--amber-soft); font-size: 13px; }

.m-main { width: 100%; max-width: 560px; margin: 0 auto; padding: 16px 16px calc(28px + env(safe-area-inset-bottom)); }
.m-card { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.m-section { margin-top: 22px; }
.m-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.m-section-head h2 { margin: 0; font-size: 16px; }
.m-section-head span { color: var(--muted); font-size: 12px; }

.m-login h1 { margin: 4px 0 6px; font-size: 22px; }
.m-login p { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.m-field { display: grid; gap: 6px; margin-bottom: 14px; color: #566a70; font-size: 13px; }
.m-field small { color: #9aa6a8; }
.m-field input, .m-field textarea { width: 100%; padding: 11px 12px; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 8px; outline: 0; background: #fbfaf6; font-size: 16px; }
.m-field input:focus, .m-field textarea:focus { border-color: #9bb8c9; background: #fff; }
.m-field textarea { min-height: 84px; resize: vertical; }
.m-error { min-height: 1.4em; margin: 0 0 10px; color: var(--coral-ink); font-size: 13px; }

.m-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border: 1px solid transparent; border-radius: 8px; font-size: 15px; font-weight: 600; white-space: nowrap; }
.m-button.primary { color: #17242c; border-color: var(--amber); background: var(--amber); }
.m-button.secondary { color: var(--ink-soft); border-color: var(--line); background: var(--white); }
.m-button.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.m-button.block { width: 100%; }

.m-locate { display: flex; align-items: center; gap: 12px; }
.m-locate-icon { display: grid; flex: none; place-items: center; width: 42px; height: 42px; color: var(--muted); border-radius: 50%; background: #eef1ee; }
.m-locate-icon .icon { width: 22px; height: 22px; }
.m-locate-text { flex: 1; min-width: 0; }
.m-locate-text strong, .m-locate-text small { display: block; }
.m-locate-text small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.m-locate[data-state="ok"] .m-locate-icon { color: var(--mint-ink); background: var(--mint-soft); }
.m-locate[data-state="busy"] .m-locate-icon, .m-locate[data-state="warn"] .m-locate-icon { color: var(--amber-ink); background: var(--amber-soft); }
.m-locate[data-state="error"] .m-locate-icon { color: var(--coral-ink); background: var(--coral-soft); }
.m-locate[data-state="busy"] .m-locate-icon .icon { animation: m-spin 1.2s linear infinite; }
@keyframes m-spin { to { transform: rotate(360deg); } }

.m-list { display: grid; gap: 8px; }
.m-school { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.m-school.is-near { border-color: #a9d9c6; box-shadow: inset 3px 0 var(--mint); }
.m-school-main { flex: 1; min-width: 0; }
.m-school-main strong { display: block; font-size: 15px; }
.m-school-main small { display: block; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.m-school-side { display: flex; flex: none; flex-direction: column; align-items: flex-end; gap: 6px; }
.m-distance { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.m-school.is-near .m-distance { color: var(--mint-ink); font-weight: 600; }
.m-notice { display: flex; gap: 10px; padding: 14px; color: var(--muted); border: 1px dashed #c4d0cc; border-radius: var(--radius); background: #f8fbf9; font-size: 13px; }
.m-notice.warn { color: var(--amber-ink); border-color: #edd29b; background: #fffaf0; }
.m-notice .icon { margin-top: 1px; }
.m-search { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; padding: 0 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.m-search input { flex: 1; min-width: 0; height: 42px; padding: 0; color: var(--ink); border: 0; outline: 0; background: transparent; font-size: 16px; }

.m-history { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.m-history-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid #e7ebe6; }
.m-history-item:last-child { border-bottom: 0; }
.m-history-item strong, .m-history-item small { display: block; }
.m-history-item strong { font-size: 14px; }
.m-history-item small { margin-top: 2px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.m-tag { flex: none; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.m-tag.ok { color: var(--mint-ink); background: var(--mint-soft); }
.m-tag.pending { color: var(--amber-ink); background: var(--amber-soft); }
.m-tag.bad { color: var(--coral-ink); background: var(--coral-soft); }
.m-empty { margin: 0; padding: 16px; color: var(--muted); font-size: 13px; text-align: center; }
.m-footer { display: grid; gap: 10px; margin-top: 26px; color: var(--muted); font-size: 12px; text-align: center; }
.m-footer a { color: #9d6817; font-weight: 600; text-decoration: none; }

.m-sheet-backdrop { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; background: rgba(13, 22, 32, .45); }
.m-sheet { width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 16px 16px 0 0; background: var(--paper); animation: m-sheet-in .22s ease; }
@keyframes m-sheet-in { from { opacity: 0; transform: translateY(24px); } }
.m-eyebrow { margin: 0; color: var(--muted); font-size: 12px; letter-spacing: .08em; }
.m-sheet h2 { margin: 4px 0; font-size: 20px; }
.m-sheet-meta { margin: 0 0 16px; color: var(--mint-ink); font-size: 13px; }
.m-sheet-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.m-result { display: grid; justify-items: center; gap: 6px; padding: 8px 0 0; text-align: center; }
.m-result-icon { display: grid; place-items: center; width: 56px; height: 56px; color: var(--mint-ink); border-radius: 50%; background: var(--mint-soft); }
.m-result-icon .icon { width: 28px; height: 28px; }
.m-result[data-tone="pending"] .m-result-icon { color: var(--amber-ink); background: var(--amber-soft); }
.m-result p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }

.m-toast { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom)); left: 50%; z-index: 30; width: max-content; max-width: calc(100vw - 32px); padding: 11px 16px; color: #edf7f3; border-radius: 8px; background: #173429; box-shadow: 0 12px 28px rgba(13, 22, 32, .2); font-size: 14px; opacity: 0; transform: translate(-50%, 10px); pointer-events: none; transition: opacity .2s, transform .2s; }
.m-toast.show { opacity: 1; transform: translate(-50%, 0); }

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