@font-face { font-family: Prompt; font-weight: 400; font-display: swap; src: url(fonts/prompt-thai-400-normal.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: Prompt; font-weight: 400; font-display: swap; src: url(fonts/prompt-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: Prompt; font-weight: 600; font-display: swap; src: url(fonts/prompt-thai-600-normal.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: Prompt; font-weight: 600; font-display: swap; src: url(fonts/prompt-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }

:root {
  --blue: #2A3890; --blue-600: #222e78; --blue-50: #eef0fa; --blue-100: #dde1f4;
  --ink: #1b1f33; --muted: #5d6480; --line: #e3e6f0; --bg: #f6f7fb; --ok: #1f9d63; --warn: #c2410c;
  --radius: 16px; --shadow: 0 1px 2px rgba(20, 28, 80, .06), 0 6px 20px rgba(20, 28, 80, .07);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  font: 400 17px/1.5 Prompt, "Noto Sans Thai", "Leelawadee UI", Tahoma, system-ui, sans-serif;
  color: var(--ink); background: var(--bg);
}
button, input, select { font: inherit; color: inherit; }
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px; background: #fff; border-bottom: 3px solid var(--blue);
}
.logo { height: 40px; width: auto; }
.lang {
  border: 1.5px solid var(--blue); background: #fff; color: var(--blue); font-weight: 600;
  border-radius: 999px; padding: 6px 16px; min-height: 40px; cursor: pointer;
}
main { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 18px 16px 110px; }
.foot { text-align: center; font-size: 13px; color: var(--muted); padding: 10px 16px max(14px, env(safe-area-inset-bottom)); }

h1 { font-size: 22px; line-height: 1.3; margin: 0 0 4px; color: var(--blue); font-weight: 600; }
h2, .h2 { font-size: 20px; margin: 6px 0 14px; font-weight: 600; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 14px; }
.strong { font-weight: 600; margin: 0 0 12px; }
.center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px 0; }
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 20px; }
.card.center { padding: 32px 20px; }
.big-icon { font-size: 48px; }
.pill { display: inline-block; margin: 8px 0 0; padding: 3px 12px; border-radius: 999px; background: var(--blue-50); color: var(--blue); font-size: 14px; }
.pill.warn { background: #fff1e6; color: var(--warn); }
.topic-head { margin-bottom: 6px; }
.step { margin: 14px 0 10px; font-weight: 600; color: var(--blue); font-size: 15px; letter-spacing: .2px; }
.link { background: none; border: 0; color: var(--blue); padding: 4px 0 10px; cursor: pointer; font-weight: 600; }

.btn {
  min-height: 54px; padding: 12px 20px; border-radius: 14px; border: 2px solid transparent;
  font-weight: 600; font-size: 17px; cursor: pointer; transition: transform .08s, background .15s, opacity .15s;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--blue-600); }
.btn.ghost { background: #fff; color: var(--blue); border-color: var(--blue-100); }
.row { display: flex; gap: 10px; margin-top: 18px; }
.row .btn { flex: 1; }
.row .btn.primary { flex: 1.7; }
:focus-visible { outline: 3px solid #f5b400; outline-offset: 2px; }

.spinner { width: 40px; height: 40px; border-radius: 50%; border: 4px solid var(--blue-100); border-top-color: var(--blue); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.list { display: grid; gap: 12px; }
.topic-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 18px; cursor: pointer; box-shadow: var(--shadow);
}
.topic-card strong { color: var(--blue); font-size: 18px; }
.topic-card:disabled { opacity: .6; cursor: default; }

.search { display: grid; grid-template-columns: 1fr; gap: 8px; position: sticky; top: 66px; z-index: 4; background: var(--bg); padding: 6px 0; }
.search input, .search select {
  width: 100%; min-height: 54px; border-radius: 14px; border: 2px solid var(--blue-100); background: #fff; padding: 10px 14px;
}
.search input { font-size: 18px; }
.search input:focus, .search select:focus { border-color: var(--blue); outline: none; }
.names { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 8px; }
.name {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left;
  background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 16px; min-height: 62px; cursor: pointer;
}
.name span { display: flex; flex-direction: column; }
.name small { color: var(--muted); font-size: 14px; }
.name b { color: var(--blue); font-size: 24px; font-weight: 400; }
.name:hover:not(:disabled) { border-color: var(--blue); }
.name.is-voted { background: #f1f2f6; cursor: not-allowed; }
.name.is-voted strong { color: #8a90a6; text-decoration: line-through; }
.name em { font-style: normal; font-size: 13px; color: var(--ok); background: #e6f6ee; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.empty { padding: 20px; text-align: center; }

.who { text-align: center; }
.who-name { font-size: 28px; font-weight: 600; color: var(--blue); margin: 4px 0 6px; line-height: 1.25; }
.who-dept { margin: 0 0 18px; font-size: 18px; }

.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.option {
  position: relative; min-height: 96px; padding: 16px 12px; border-radius: var(--radius);
  background: #fff; border: 2px solid var(--line); box-shadow: var(--shadow); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  transition: border-color .15s, background .15s, transform .08s;
}
.option:active { transform: scale(.98); }
.opt-label { font-weight: 600; font-size: 17px; line-height: 1.3; }
.option .tag { font-size: 12px; background: var(--blue-50); color: var(--blue); border-radius: 999px; padding: 1px 8px; }
.option .check {
  position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 15px; color: #fff; background: var(--blue); opacity: 0; transform: scale(.6); transition: .15s;
}
.option.selected { border-color: var(--blue); background: var(--blue-50); }
.option.selected .check { opacity: 1; transform: scale(1); }
@media (min-width: 560px) { .options { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.sticky-actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; gap: 10px;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .96);
  border-top: 1px solid var(--line); backdrop-filter: blur(6px);
}
.sticky-actions .btn { flex: 1; max-width: 320px; margin: 0 auto; }
.sticky-actions .btn.ghost { flex: 0 0 auto; }

.review .choice { font-size: 26px; font-weight: 600; color: var(--blue); margin: 2px 0 12px; }
.note { font-size: 14px; color: var(--muted); background: var(--bg); border-radius: 10px; padding: 10px 12px; margin: 0; }
.err { color: #b91c1c; background: #fdecec; border-radius: 10px; padding: 10px 12px; margin: 12px 0 0; font-weight: 600; }

.done h2 { color: var(--blue); font-size: 24px; }
.tick svg { width: 88px; height: 88px; }
.tick circle { fill: none; stroke: var(--ok); stroke-width: 3; stroke-dasharray: 160; stroke-dashoffset: 160; animation: draw .6s ease-out forwards; }
.tick path { fill: none; stroke: var(--ok); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .4s .5s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } .tick circle, .tick path { stroke-dashoffset: 0; } }
