:root {
  color-scheme: dark;
  --bg: #000; --card: #151515; --card2: #1f1f1f; --line: #2c2c2c; --text: #fff; --mute: #9a9a9a;
  --blue: #2e9bff; --purple: #a65cff; --pink: #ff5f7e; --orange: #ff9f0a; --yellow: #ffd479; --green: #30d158;
  --r: 18px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 Anuphan, system-ui, sans-serif; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.wrap { max-width: 1100px; margin: auto; padding: 24px 16px 60px; }
.eyebrow { color: var(--blue); font-weight: 600; font-size: 14px; }
.h1 { font-size: clamp(28px, 6vw, 44px); line-height: 1.15; font-weight: 700; margin: 4px 0 18px; }
.muted { color: var(--mute); }
.card { background: var(--card); border-radius: var(--r); padding: 18px; }
.sec { margin-top: 28px; }
.sec > h2 { font-size: 20px; margin-bottom: 12px; }
.btn { white-space: nowrap; border: 0; border-radius: 12px; padding: 10px 18px; font-weight: 700; background: var(--blue); color: #000; }
.btn.ghost { background: var(--card2); color: var(--text); font-weight: 600; }
.btn.pink { background: var(--pink); }
.btn:disabled { opacity: .5; cursor: default; }
.field { width: 100%; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.field:focus { border-color: var(--blue); outline: none; }
.err { color: var(--pink); min-height: 1.5em; font-size: 14px; }

/* ไทม์ไลน์ */
.tl { display: flex; overflow-x: auto; gap: 0; padding: 8px 4px 6px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.tl .d { flex: 0 0 84px; text-align: center; position: relative; scroll-snap-align: center; }
.tl .d::before { content: ""; position: absolute; top: 33px; left: 0; right: 0; height: 2px; background: var(--line); }
.tl .d:first-child::before { left: 50%; } .tl .d:last-child::before { right: 50%; }
.tl .dot { position: relative; width: 26px; height: 26px; border-radius: 50%; margin: 20px auto 6px; background: var(--bg); border: 2px solid #555; }
.tl .teach .dot { background: var(--blue); border-color: var(--blue); }
.tl .due .dot { background: var(--pink); border-color: var(--pink); }
.tl .off .dot { border: 0; background: none; color: #666; font-size: 20px; line-height: 26px; }
.tl .off .dot::after { content: "×"; }
.tl .past .dot { background: #3a3a3a; border-color: #3a3a3a; }
.tl .past .num, .tl .past .lbl { color: #666; }
.tl .num { font-weight: 700; font-size: 22px; line-height: 1; }
.tl .mon { font-size: 11px; color: var(--mute); }
.tl .lbl { font-size: 12px; color: var(--mute); line-height: 1.3; margin-top: 4px; padding: 0 2px; }
.tl .teach .lbl { color: var(--blue); } .tl .due .lbl { color: var(--pink); }
.tl .now .dot { box-shadow: 0 0 0 6px rgba(46,155,255,.25); }
.tl .now .tag { position: absolute; top: -2px; left: 50%; transform: translateX(-50%); background: var(--blue); color: #000; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px; white-space: nowrap; }
.next { margin-top: 10px; font-size: 15px; }
.next b { color: var(--blue); }

/* แถบคะแนน 4 ส่วน */
.parts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.part { background: var(--card2); border-radius: 14px; padding: 12px; border-top: 4px solid var(--c); }
.part .v { font-size: 26px; font-weight: 700; color: var(--c); line-height: 1.1; }
.part .v small { font-size: 14px; color: var(--mute); font-weight: 400; }
.part .n { font-size: 13px; color: var(--mute); }
@media (max-width: 560px) { .parts { grid-template-columns: repeat(2, 1fr); } }

/* สถานะ */
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 99px; background: var(--card2); color: var(--mute); white-space: nowrap; }
.st.ok, .st.graded, .st.P { background: rgba(48,209,88,.15); color: var(--green); }
.st.late, .st.L { background: rgba(255,159,10,.15); color: var(--orange); }
.st.missing, .st.A { background: rgba(255,95,126,.15); color: var(--pink); }
.st.wait { background: rgba(166,92,255,.15); color: var(--purple); }
.pip { width: 12px; height: 12px; border-radius: 4px; background: #333; display: inline-block; }
.pip.ok, .pip.graded, .pip.P { background: var(--green); } .pip.late, .pip.L { background: var(--orange); }
.pip.missing, .pip.A { background: var(--pink); } .pip.wait { background: var(--purple); }
.pip.open { background: none; border: 2px solid #555; } .pip.none { background: #222; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--mute); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
