:root {
  --red: #d7262e; --red-dark: #a81b22; --gold: #c9a24a; --ink: #141414; --muted: #707070;
  --line: #e7e2db; --bg: #f5f2ee; --card: #fff; --ok: #1f8a4c;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); min-height: 100%; }
body { font-size: 16px; line-height: 1.4; }
button, input { font: inherit; }
.splash { min-height: 100vh; display: grid; place-items: center; background: var(--ink); }
.splash img { width: 96px; border-radius: 20px; }

/* login */
.login { max-width: 420px; margin: 0 auto; padding: calc(32px + env(safe-area-inset-top)) 20px 32px; display: flex; flex-direction: column; }
.login .logo { width: 112px; height: 112px; border-radius: 22px; margin: 8px auto 12px; object-fit: cover; }
.login h1 { text-align: center; margin: 0 0 16px; font-size: 1.4rem; }
.login label { display: block; font-weight: 600; font-size: .9rem; margin: 12px 0 4px; }
.login input { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 16px; }
.login .link { text-align: center; margin-top: 18px; color: var(--red); }
.center { text-align: center; }
.btn { display: block; width: 100%; margin-top: 18px; padding: 14px; border: 0; border-radius: 12px; background: var(--red); color: #fff; font-weight: 700; font-size: 1rem; cursor: pointer; }
.btn:active { transform: scale(.99); }
.btn:disabled { opacity: .65; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.msg { padding: 11px 13px; border-radius: 10px; margin-top: 12px; font-size: .92rem; }
.msg.err { background: #fdeeee; color: var(--red-dark); }
.msg.warn { background: #fff4dc; color: #7a5410; margin: 0 0 10px; }

/* app */
.app { min-height: 100vh; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
main { max-width: 560px; margin: 0 auto; }
section { padding: 16px; }
h2 { font-size: 1.1rem; margin: 6px 0 12px; }
.spin { width: 32px; height: 32px; margin: 40vh auto 0; border: 3px solid var(--line); border-top-color: var(--red); border-radius: 50%; animation: s .8s linear infinite; }
@keyframes s { to { transform: rotate(360deg); } }
.hero { background: var(--ink); color: #fff; padding: calc(20px + env(safe-area-inset-top)) 16px 20px; display: flex; gap: 14px; align-items: center; border-bottom: 4px solid var(--red); border-radius: 0 0 20px 20px; }
.avatar { width: 68px; height: 68px; border-radius: 50%; background: #333; display: grid; place-items: center; font-weight: 800; font-size: 1.4rem; overflow: hidden; flex: none; border: 2px solid var(--gold); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.hero-txt { flex: 1; min-width: 0; }
.hero h1 { margin: 0 0 6px; font-size: 1.35rem; }
.academy { font-size: .8rem; color: #bbb; text-transform: uppercase; letter-spacing: .5px; }
.belt-label { font-size: .85rem; color: #ddd; margin-top: 4px; }
.count { text-align: center; background: #222; border-radius: 14px; padding: 8px 10px; min-width: 76px; }
.count strong { display: block; font-size: 1.6rem; color: var(--gold); }
.count span { font-size: .72rem; color: #bbb; }

.belt { position: relative; width: 120px; height: 16px; border-radius: 3px; border: 1px solid rgba(255,255,255,.25); overflow: hidden; }
.belt .tip { position: absolute; right: 12px; top: 0; bottom: 0; width: 30px; background: #111; display: flex; gap: 3px; justify-content: center; padding: 0 3px; }
.belt.b-BLACK .tip { background: #c62828; }
.belt .tip i { width: 3px; background: #fff; }
.belt.mid-white::after, .belt.mid-black::after { content: ""; position: absolute; left: 0; right: 42px; top: 6px; height: 3px; }
.belt.mid-white::after { background: #fff; } .belt.mid-black::after { background: #111; }
.b-WHITE { background: #f5f5f5; } .b-GREY { background: #9e9e9e; } .b-YELLOW { background: #f4c430; } .b-ORANGE { background: #f28c28; }
.b-GREEN { background: #2e8b57; } .b-BLUE { background: #1e4fd8; } .b-PURPLE { background: #6a1b9a; } .b-BROWN { background: #6d4c41; } .b-BLACK { background: #111; }

.class { display: flex; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 10px; }
.class.done { border-color: #bfe3cd; background: #f3fbf6; }
.class-time { font-weight: 800; font-size: 1.25rem; display: flex; flex-direction: column; min-width: 62px; }
.class-time small { font-weight: 500; font-size: .8rem; color: var(--muted); }
.class-main { flex: 1; display: flex; flex-direction: column; }
.class-main span { color: var(--muted); font-size: .9rem; }
.class-act { margin-top: 8px; }
.class-act .btn { margin-top: 2px; padding: 12px; }
.tag { display: inline-block; padding: 5px 10px; border-radius: 999px; background: #eef2fb; color: #2b4a8a; font-size: .82rem; font-weight: 700; }
.tag.ok { background: #e3f4ea; color: var(--ok); }
.tag.bad { background: #fdeeee; color: var(--red-dark); }
.tag.gray { background: #eee; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 28px 8px; background: var(--card); border-radius: 16px; border: 1px dashed var(--line); }
.hint { color: var(--muted); font-size: .82rem; margin-top: 12px; }
.row-card { display: flex; justify-content: space-between; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; }
.row-card > div { display: flex; flex-direction: column; }
.row-card span { color: var(--muted); font-size: .85rem; }
.row-card .right { align-items: flex-end; gap: 4px; }

.install { position: relative; margin: 0 16px 16px; padding: 14px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 14px; display: flex; flex-direction: column; gap: 4px; }
.install span { font-size: .9rem; color: #444; }
.install .btn { margin-top: 8px; padding: 10px; }
.install .x { position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 1.4rem; color: var(--muted); }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.tabbar button { flex: 1; border: 0; background: none; padding: 8px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .72rem; color: var(--muted); font-weight: 600; }
.tabbar .ti { font-size: 1.25rem; filter: grayscale(1); opacity: .7; }
.tabbar button.on { color: var(--red); }
.tabbar button.on .ti { filter: none; opacity: 1; }
.toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; z-index: 50; width: max-content; max-width: calc(100vw - 32px); text-align: center; }
.msg.ok { background: #e9f6ef; color: #1f8a4c; }
