/* Elective -- one stylesheet for every page */
:root {
  --ground: #f7f6f3; --surface: #ffffff; --ink: #1d1d1f; --muted: #5f5f66; --soft: #45454b;
  --line: #e6e4df; --line2: #efeee9; --chip: #f2f1ec;
  --accent: #7a3b69; --accent-ink: #3d1f35; --accent-bg: #f4eaf1;
  --blue: #1f5f8b; --blue-bg: #e8f1f8; --green: #2f6b3d; --green-bg: #eef5ef;
  --amber: #7a5200; --amber-bg: #fbf1df; --grey-bg: #efeee9; --gold: #b7791f;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink);
  font-family: 'Anuphan', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 16px; }
a { color: var(--accent); } a:hover { color: #5c2a4f; }
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
.wait { display: flex; align-items: center; justify-content: center; min-height: 100vh; color: var(--muted); font-size: 14px; }

.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top.dark { background: #1d1d1f; color: #fff; border-bottom: none; }
.top-in { max-width: 1180px; margin: 0 auto; padding: 12px 20px; display: flex; flex-wrap: wrap;
  align-items: center; justify-content: space-between; gap: 10px; }
.brand { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.brand b { font-size: 22px; font-weight: 700; color: inherit; text-decoration: none; }
.brand span { font-size: 15px; color: var(--muted); }
.top.dark .brand span, .top.dark .who { color: #d4d2cc; }
.who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.pill-btn { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border: 1px solid var(--line);
  border-radius: 999px; background: #fafaf8; color: var(--ink); text-decoration: none; font-size: 14px; }
.top.dark .pill-btn { background: transparent; border-color: #4a4a50; color: #fff; }
.tag-staff { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: #1d1d1f; color: #fff; }

main { max-width: 1120px; margin: 0 auto; padding: 24px 20px 64px; display: flex; flex-direction: column; gap: 22px; }
main.narrow { max-width: 880px; }
main.wide { max-width: 1240px; }
h1 { margin: 0; font-size: 30px; font-weight: 700; line-height: 1.3; }
h2 { margin: 0; font-size: 21px; font-weight: 700; }
.muted { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.pad { padding: 18px 20px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.code { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-weight: 600; font-size: 14px;
  background: var(--chip); border-radius: 8px; padding: 5px 9px; min-width: 52px; text-align: center; display: inline-block; }
.chip { font-size: 13px; padding: 4px 10px; border-radius: 999px; white-space: nowrap; display: inline-block; }
.c-todo { background: var(--grey-bg); color: var(--soft); }
.c-done { background: var(--blue-bg); color: var(--blue); }
.c-part { background: var(--blue-bg); color: var(--blue); }
.c-open { background: var(--accent-bg); color: var(--accent); }
.c-ready { background: var(--green-bg); color: var(--green); }
.c-soon { background: var(--amber-bg); color: var(--amber); }
.c-kind { background: var(--grey-bg); color: var(--soft); }
.c-unknown { background: var(--amber-bg); color: var(--amber); }
.b-strong { font-weight: 600; }

.intro { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between; }
.stat { border-radius: 12px; padding: 10px 16px; min-width: 110px; }
.stat b { display: block; font-size: 24px; }
.stat span { font-size: 13px; }

.list { overflow: hidden; }
.item { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 13px 18px; border-top: 1px solid var(--line2);
  text-decoration: none; color: var(--ink); }
.item:first-child { border-top: none; }
.item:hover { background: #fcfbf9; color: var(--ink); }
.item .t { flex: 1 1 300px; display: flex; flex-direction: column; gap: 2px; }
.item .t b { font-weight: 500; font-size: 16px; }
.item .t span { font-size: 13px; color: var(--muted); }
.study { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; align-items: baseline; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 12px; border: 1px solid #d9d7d0; background: var(--surface); color: var(--ink);
  text-decoration: none; font-size: 15px; font-weight: 600; }
.btn:hover { color: var(--ink); background: #fbfaf8; }
.btn.dark { background: #1d1d1f; color: #fff; border-color: #1d1d1f; }
.btn.dark:hover { background: #333; color: #fff; }
.btn.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.accent:hover { background: #6a3159; color: #fff; }
.btn.big { min-height: 56px; padding: 0 30px; font-size: 18px; border-radius: 14px; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn[disabled], .btn.off { opacity: .45; pointer-events: none; }
.btn svg { flex-shrink: 0; }

.slides { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.clue { background: var(--accent-bg); border-radius: 16px; padding: 16px 20px; display: flex; gap: 12px; }
.clue b { font-size: 14px; color: var(--accent); }
.clue p, .note p { margin: 4px 0 0; line-height: 1.65; color: var(--accent-ink); white-space: pre-line; }
.note { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 20px; }
.note p { color: var(--ink); }
.q { display: flex; flex-direction: column; gap: 10px; }
.q label { font-weight: 600; line-height: 1.6; white-space: pre-line; }
textarea, input[type=text], input[type=email], input[type=password], input[type=number], select {
  width: 100%; padding: 11px 13px; border: 1px solid #d9d7d0; border-radius: 12px; background: #fcfcfa; line-height: 1.6; }
textarea { resize: vertical; min-height: 92px; }
textarea:focus, input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea[readonly] { background: #f6f5f1; color: var(--soft); }
.saved { font-size: 14px; color: var(--green); }
.saved.bad { color: #a12b2b; }
.lockbox { border: 1px dashed #cfccc3; background: var(--surface); border-radius: 16px; padding: 14px 18px;
  display: flex; gap: 12px; align-items: center; color: var(--soft); line-height: 1.6; }
.key { background: var(--accent-bg); border-radius: 18px; padding: 20px 24px; }
.key b { color: var(--accent); font-size: 14px; }
.key p { margin: 8px 0 0; font-size: 17px; line-height: 1.7; color: var(--accent-ink); white-space: pre-line; }
.answers { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.ans { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.ans.mine { border-color: var(--blue); }
.ans.star { border: 2px solid var(--gold); }
.ans header { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 700; }
.ans p { margin: 0; line-height: 1.7; white-space: pre-line; }
.star-btn { width: 42px; height: 42px; border: none; border-radius: 10px; background: var(--ground);
  display: inline-flex; align-items: center; justify-content: center; }
.teach .ans p { font-size: 17px; }
.teach h1 { font-size: 34px; }
.qhead { font-size: 18px; font-weight: 600; line-height: 1.6; white-space: pre-line; }
.empty { text-align: center; padding: 44px 20px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.empty .big { font-size: 26px; font-weight: 600; }
.nav2 { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th, table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--line2); text-align: left; vertical-align: middle; }
table.grid th { background: #fafaf8; color: var(--soft); font-weight: 600; position: sticky; top: 0; }
table.grid td.n, table.grid th.n { text-align: center; }
.cnt { display: inline-block; min-width: 46px; padding: 3px 9px; border-radius: 999px; font-weight: 600; font-size: 13px; text-align: center; }
.cnt.full { background: var(--blue); color: #fff; }
.cnt.part { background: var(--blue-bg); color: var(--blue); }
.cnt.none { background: var(--grey-bg); color: var(--muted); }
.scroll { overflow-x: auto; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form .full { grid-column: 1 / -1; }
.form label span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.msg { padding: 12px 16px; border-radius: 12px; background: var(--amber-bg); color: var(--amber); }
.msg.ok { background: var(--green-bg); color: var(--green); }
.login { max-width: 400px; margin: 10vh auto; padding: 28px; }
.login h1 { font-size: 26px; }

@media (max-width: 640px) {
  h1 { font-size: 25px; }
  .teach h1 { font-size: 26px; }
  main { padding: 18px 14px 48px; }
  .form { grid-template-columns: minmax(0, 1fr); }
  .item { padding: 12px 14px; }
}
