/* Evaluation app: white scene, clear choices. */
body.kz-eval { --kz-wrap: 640px; }
.kz-main[data-view="form"] { padding-bottom: calc(180px + env(safe-area-inset-bottom)); }

/* ---------- Top bar ---------- */
.kz-topbar { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,0.94); color: var(--kz-navy); border-bottom: 1px solid var(--kz-line); -webkit-backdrop-filter: saturate(1.4) blur(8px); backdrop-filter: saturate(1.4) blur(8px); }
.kz-topbar__in {
  display: grid; grid-template-columns: var(--kz-tap) 1fr auto; align-items: center; gap: 12px;
  padding-top: calc(8px + env(safe-area-inset-top)); padding-bottom: 8px;
}
.kz-topbar__slot { width: var(--kz-tap); height: var(--kz-tap); }
.kz-wordmark { justify-self: center; font-weight: 700; letter-spacing: 0.24em; font-size: 0.95rem; padding-left: 0.24em; }
.kz-judge {
  display: inline-flex; align-items: center; gap: 8px; max-width: 44vw; min-height: var(--kz-tap);
  padding: 0 14px 0 6px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--kz-line); background: #fff; color: var(--kz-navy);
  font-size: var(--kz-fs-sm);
}
.kz-judge:hover { border-color: var(--kz-line-strong); }
.kz-judge__avatar {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--kz-navy); color: #fff; font-weight: 700;
}
.kz-judge__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Welcome ---------- */
.kz-welcome .kz-band { padding-top: 24px; text-align: center; }
.kz-logo-card { width: min(100%, 280px); margin: 0 auto 6px; padding: 0; background: transparent; box-shadow: none; } /* logo sits straight on the white page */
.kz-logo-card img { width: 100%; height: auto; }
.kz-namecard { display: grid; gap: 16px; padding: 24px; }
.kz-namecard__hello { color: var(--kz-text-3); text-align: center; font-size: var(--kz-fs-sm); }
.kz-namecard__name { font-size: var(--kz-fs-xl); font-weight: 700; text-align: center; word-break: break-word; margin-top: -10px; }
.kz-namecard .kz-link { justify-self: center; }

/* ---------- Project list ---------- */
.kz-progress { display: grid; gap: 8px; margin-top: 18px; }
.kz-progress__row { display: flex; justify-content: space-between; align-items: baseline; color: var(--kz-text-3); }
.kz-progress__row b { color: var(--kz-navy); font-size: var(--kz-fs-lg); }
.kz-bar { height: 8px; border-radius: 8px; background: var(--kz-soft); overflow: hidden; }
.kz-bar > i { display: block; height: 100%; border-radius: inherit; background: var(--kz-red); transition: width 1.2s var(--kz-out); }

.kz-search { position: relative; }
.kz-search .kz-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--kz-text-3); pointer-events: none; }
.kz-search .kz-input { padding-left: 48px; border-color: var(--kz-line); box-shadow: var(--kz-shadow); }

.kz-group { display: grid; gap: 8px; }
.kz-group__title { display: flex; align-items: center; gap: 8px; font-size: var(--kz-fs-md); font-weight: 700; color: var(--kz-text); padding: 10px 2px 0; }
.kz-group__count { min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--kz-navy); color: #fff; font-size: 0.85rem; }
.kz-list { overflow: hidden; }
.kz-project {
  -webkit-appearance: none; appearance: none; width: 100%; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  padding: 14px 14px 14px 16px; min-height: 76px;
  background: none; border: 0; border-top: 1px solid var(--kz-line);
  -webkit-tap-highlight-color: transparent;
}
.kz-project:first-child { border-top: 0; }
.kz-project:hover { background: #F8F9FC; }
.kz-project__side .kz-icon { transition: transform .3s var(--kz-out); }
.kz-project:hover .kz-project__side .kz-icon { transform: translateX(3px); }
.kz-project:active { background: var(--kz-indigo-tint); }
.kz-project__no {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--kz-soft); color: var(--kz-navy); font-weight: 700; font-variant-numeric: tabular-nums;
}
.kz-project--done .kz-project__no { background: var(--kz-success-tint); color: var(--kz-success); }
.kz-project__name { display: block; font-weight: 600; line-height: 1.4; }
.kz-project__meta { display: block; font-size: var(--kz-fs-sm); color: var(--kz-text-3); margin-top: 2px; }
.kz-project__side { display: flex; align-items: center; gap: 6px; color: var(--kz-text-3); }
.kz-empty { text-align: center; color: var(--kz-text-3); padding: 24px 12px; }

/* ---------- Evaluation form ---------- */
.kz-form .kz-band__title { font-size: var(--kz-fs-xl); }

.kz-crit { padding: 18px 16px 16px; display: grid; gap: 12px; scroll-margin-top: 84px; }
.kz-crit__head { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; padding: 0 2px; }
.kz-crit__no {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: var(--kz-soft); color: var(--kz-navy); font-weight: 700;
  transition: background-color .15s, color .15s;
}
.kz-crit.is-answered .kz-crit__no { background: var(--kz-navy); color: #fff; }
.kz-crit__title { font-size: var(--kz-fs-lg); font-weight: 700; line-height: 1.35; }
.kz-crit__en { display: block; font-size: var(--kz-fs-sm); font-weight: 500; color: var(--kz-text-3); }
.kz-options { display: grid; gap: 8px; }

.kz-option {
  -webkit-appearance: none; appearance: none; width: 100%; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  min-height: 60px; padding: 12px 12px 12px 14px;
  background: #fff; border: 1.5px solid var(--kz-line); border-radius: var(--kz-r-md);
  transition: border-color .12s, background-color .12s, color .12s;
  -webkit-tap-highlight-color: transparent;
}
.kz-option:hover { border-color: var(--kz-navy); }
.kz-option__radio {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--kz-line-strong);
  display: grid; place-items: center; flex: none;
}
.kz-option__label { line-height: 1.5; }
.kz-option__pts {
  min-width: 58px; padding: 4px 10px; border-radius: 10px; text-align: center;
  background: var(--kz-soft); color: var(--kz-navy);
  font-size: var(--kz-fs-lg); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.kz-option[aria-pressed="true"] { background: var(--kz-navy); border-color: var(--kz-navy); color: #fff; box-shadow: 0 10px 24px -14px rgba(26,30,92,.8); }
.kz-option[aria-pressed="true"] .kz-option__radio { border-color: #fff; }
.kz-option[aria-pressed="true"] .kz-option__radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #fff; animation: kz-pop .36s var(--kz-spring); }
.kz-option[aria-pressed="true"] .kz-option__pts { background: rgba(255,255,255,0.14); color: #fff; animation: kz-pop-soft .4s var(--kz-spring); }
.kz-option__pts { transition: background-color .2s, color .2s; }
.kz-crit.is-answered .kz-crit__no { animation: kz-pop .4s var(--kz-spring); }

.kz-comment { padding: 18px 18px 20px; }

/* sticky total + submit */
.kz-submitbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  background: var(--kz-panel); border-top: 1px solid var(--kz-line);
  box-shadow: 0 -8px 24px -16px rgba(26,30,92,.35);
}
.kz-submitbar__in {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 12px;
  padding-top: 12px; padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
/* the number track: 5 stops spread across the bar, joined by a line that fills up to the next stop */
.kz-track { grid-column: 1 / -1; position: relative; display: flex; justify-content: space-between; align-items: center; height: 32px; }
.kz-track__line { position: absolute; left: 16px; right: 16px; top: 50%; height: 4px; margin-top: -2px; border-radius: 4px; background: var(--kz-soft); }
.kz-track__fill { display: block; height: 100%; border-radius: inherit; background: var(--kz-navy); transition: width .45s var(--kz-out); }
.kz-track .kz-dot { position: relative; width: 32px; height: 32px; font-size: .9rem; border-width: 2px; }
.kz-total {
  -webkit-appearance: none; appearance: none; background: none; border: 0; padding: 2px 0; margin: 0;
  font: inherit; color: inherit; text-align: left; cursor: pointer; min-height: var(--kz-tap);
  display: grid; gap: 6px; -webkit-tap-highlight-color: transparent;
}
.kz-total__row { display: flex; align-items: baseline; gap: 8px; line-height: 1.1; }
.kz-total__label { font-size: var(--kz-fs-sm); color: var(--kz-text-3); white-space: nowrap; }
.kz-total__value { font-size: var(--kz-fs-xl); font-weight: 700; color: var(--kz-navy); white-space: nowrap; } /* the bar keeps one height while the total counts */
/* narrow phones: label above the number (same height whatever the total), a slimmer submit button */
@media (max-width: 400px) {
  .kz-total__row { flex-direction: column; align-items: flex-start; gap: 0; }
  .kz-submitbar .kz-btn { padding: 0 14px; }
}
.kz-total__value small { font-size: var(--kz-fs-sm); color: var(--kz-text-3); font-weight: 500; margin-left: 2px; }
.kz-dot {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: 0.75rem; font-weight: 700; line-height: 1;
  border: 1.5px solid var(--kz-line-strong); color: var(--kz-text-3); background: #fff;
  transition: background-color .15s, border-color .15s, color .15s;
}
.kz-dot.is-done { background: var(--kz-navy); border-color: var(--kz-navy); color: #fff; animation: kz-pop .4s var(--kz-spring); }
/* the next criterion to answer */
.kz-dot.is-next { border-color: var(--kz-red); color: var(--kz-red); animation: kz-next 1.6s ease-in-out infinite; }
@keyframes kz-next { 0%, 100% { box-shadow: 0 0 0 3px rgba(227, 24, 52, .16); } 50% { box-shadow: 0 0 0 5px rgba(227, 24, 52, .07); } }
.kz-submitbar, .kz-enter .kz-body > .kz-submitbar { animation: kz-bar-in .5s .15s var(--kz-out) both; }
@keyframes kz-bar-in { from { transform: translateY(100%); } to { transform: none; } }


/* ---------- Done ---------- */
.kz-done-band { text-align: center; padding-top: 28px; }
.kz-done__icon { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--kz-success-tint); color: var(--kz-success); animation: kz-pop .5s var(--kz-spring) both; }
.kz-done__icon .kz-icon { width: 32px; height: 32px; stroke-width: 2.6; }
.kz-done__icon path { stroke-dasharray: 28; stroke-dashoffset: 28; animation: kz-draw .5s .25s var(--kz-out) forwards; }
@keyframes kz-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .kz-done__icon path { stroke-dashoffset: 0; } }
.kz-done { padding: 24px; display: grid; gap: 14px; justify-items: center; text-align: center; }
.kz-done__label { color: var(--kz-text-3); font-size: var(--kz-fs-sm); }
.kz-done__score { font-size: 2.75rem; font-weight: 700; line-height: 1; color: var(--kz-navy); font-variant-numeric: tabular-nums; margin-top: -6px; }
.kz-done__score small { font-size: var(--kz-fs-lg); color: var(--kz-text-3); font-weight: 500; }
.kz-done__actions { display: grid; gap: 10px; width: 100%; }
.kz-done__next { font-size: var(--kz-fs-sm); color: var(--kz-text-3); }

/* the "ประเมินแล้ว" seal: a red rubber stamp drops beside the score once it has counted up,
   lands with a squash, leaves an ink splash ring, and the row gives a small thump */
/* timing: the score counts up from .25 s to .95 s; the seal starts its drop at .68 s and touches the paper
   42% into it (.97 s), which is when the ink splashes and the row thumps */
.kz-done__scorerow { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 18px; animation: kz-thump .32s .97s ease-out; }
.kz-stamp { position: relative; width: 116px; height: 116px; flex: none; color: var(--kz-ink); }
.kz-seal {
  display: block; width: 100%; height: 100%; overflow: visible;
  opacity: 0; transform: rotate(-12deg); mix-blend-mode: multiply;
  animation: kz-seal-drop .7s cubic-bezier(.2, .9, .25, 1) .68s forwards;
}
.kz-seal text { font-family: var(--kz-font); }
.kz-stamp::after {
  content: ""; position: absolute; inset: 6px; border-radius: 50%; pointer-events: none;
  border: 2px solid currentColor; opacity: 0; animation: kz-seal-splash .6s .97s ease-out forwards;
}
@keyframes kz-seal-drop {
  0% { opacity: 0; transform: translateY(-46px) scale(2.4) rotate(-26deg); filter: blur(4px); }
  42% { opacity: 1; transform: translateY(0) scale(.9) rotate(-11deg); filter: blur(0); }
  60% { transform: scale(1.05) rotate(-12.6deg); }
  78% { transform: scale(.985) rotate(-11.8deg); }
  100% { opacity: .93; transform: scale(1) rotate(-12deg); }
}
@keyframes kz-seal-splash { 0% { opacity: .5; transform: scale(.85); } 100% { opacity: 0; transform: scale(1.55); } }
@keyframes kz-thump { 0%, 100% { transform: none; } 35% { transform: translateY(2px) scale(.99); } 70% { transform: translateY(-1px); } }
@media (prefers-reduced-motion: reduce) {
  .kz-seal { opacity: .93; animation: none; }
  .kz-stamp::after { animation: none; }
  .kz-done__scorerow { animation: none; }
}

/* the finale: a navy ribbon banner with the logo's red/blue edge unfurls above the result card */
.kz-banner-wrap { display: grid; justify-items: center; }
.kz-banner {
  max-width: 100%; padding: 12px 22px; text-align: center; overflow-wrap: anywhere;
  color: #fff; font-size: var(--kz-fs-lg); font-weight: 700; line-height: 1.4;
  border-top: 5px solid transparent; border-radius: 12px; box-shadow: var(--kz-shadow);
  background: linear-gradient(var(--kz-navy), var(--kz-navy)) padding-box, var(--kz-ribbon) border-box;
  animation: kz-unfurl .7s .2s var(--kz-out) both;
}
@keyframes kz-unfurl { from { clip-path: inset(0 50% 0 50% round 12px); opacity: .5; } to { clip-path: inset(0 0 0 0 round 12px); opacity: 1; } }

/* ---------- the 3D KAIZEN intro (assets/js/intro.js): a white studio stage over the page, once per session ---------- */
.kz-intro {
  position: fixed; inset: 0; z-index: 40; overflow: hidden; transition: opacity .45s;
  background: radial-gradient(120% 90% at 50% 45%, #fff 0%, var(--kz-stage-mid) 50%, var(--kz-stage-edge) 100%);
  touch-action: none; overscroll-behavior: contain; /* swipes on the stage do nothing */
}
html.kz-intro-on, html.kz-intro-on body { overflow: hidden; } /* the page underneath stays put while the intro plays */
.kz-intro::before { content: ""; position: absolute; inset: 0; background: #fff; opacity: 0; transition: opacity .6s; } /* the studio's soft edges fade to the page's pure white for the hand-off */
.kz-intro.is-white::before { opacity: 1; }
.kz-intro canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.kz-intro__tag {
  position: absolute; left: 0; right: 0; top: 79%; margin: 0; text-align: center; color: var(--kz-navy);
  font-size: clamp(.8rem, .7rem + .5vw, 1rem); font-weight: 600; letter-spacing: .5em; padding-left: .5em;
  opacity: 0; transform: translateY(8px); transition: opacity .6s, transform .6s;
}
.kz-intro__tag.is-on { opacity: .85; transform: none; }
.kz-intro.is-white .kz-intro__tag { opacity: 0; }
.kz-intro__skip {
  position: absolute; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); min-height: 44px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--kz-line); background: rgba(255, 255, 255, .8); color: var(--kz-navy);
  font: inherit; font-weight: 600; cursor: pointer;
}
.kz-intro__skip:focus-visible { outline: 3px solid var(--kz-navy); outline-offset: 2px; }
.kz-intro.is-out, .kz-intro.is-out-fast { opacity: 0; pointer-events: none; }
.kz-intro.is-out-fast { transition-duration: .25s; }

@media (min-width: 768px) {
  .kz-crit { padding: 22px 22px 20px; }
  .kz-comment { padding: 22px 24px 24px; }
}
