:root {
  --tk-bg: #eaf3f8;
  --tk-surface: #ffffff;
  --tk-ink: #273746;
  --tk-muted: #61788a;
  --tk-line: #bfd7e6;
  --tk-accent: #3498db;
  --tk-accent-2: #2980b9;
  --tk-accent-soft: #dceefb;
  --tk-ok: #1e6b45;
  --tk-bad: #a33a2f;
  --tk-radius: 18px;
  --tk-shadow: 0 10px 30px rgba(36, 113, 163, 0.10);
  --tk-font: "Manrope", system-ui, sans-serif;
  --tk-display: "Manrope", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body.tk-body {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  font-family: var(--tk-font);
  color: var(--tk-ink);
  background:
    radial-gradient(ellipse 70% 45% at 100% 0%, #dceefb 0%, transparent 55%),
    linear-gradient(180deg, #f0f8fd 0%, var(--tk-bg) 100%);
  line-height: 1.45;
}
a { color: var(--tk-accent); text-decoration: none; }
img { max-width: 100%; height: auto; }
button, input { font: inherit; }

.tk-skip {
  position: absolute; left: -999px; top: 0;
  background: #fff; padding: 8px 12px; z-index: 100;
}
.tk-skip:focus { left: 8px; top: 8px; }

.tk-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px clamp(16px, 3vw, 36px);
  border-bottom: 1px solid var(--tk-line);
  background: rgba(255,255,255,0.94);
  box-shadow: 0 2px 14px rgba(36, 113, 163, 0.06);
}
.tk-brand { display: flex; gap: 12px; align-items: center; }
.tk-brand__name { font-weight: 800; font-size: 1.1rem; }
.tk-brand__sub { color: var(--tk-muted); font-size: 0.85rem; }
.tk-top__user { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tk-chip {
  background: var(--tk-accent-soft);
  color: var(--tk-accent-2);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
}

.tk-main {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-width: 1360px;
  margin: 0 auto;
  padding: clamp(10px, 2.2vh, 24px);
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.8vh, 18px);
  overflow: hidden;
}

.tk-title {
  margin: 0;
  font-family: var(--tk-display);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  line-height: 1.15;
}
.tk-title--sm { font-size: clamp(1.35rem, 2vw, 1.75rem); }
.tk-subtitle { margin: 24px 0 12px; font-size: 1.15rem; }
.tk-lead { color: var(--tk-muted); margin: 8px 0 0; max-width: 42rem; font-size: 1.05rem; }
.tk-kicker {
  margin: 0 0 4px;
  color: var(--tk-muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tk-muted { color: var(--tk-muted); }

.tk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 14px;
  border: 1px solid var(--tk-line);
  background: var(--tk-surface);
  color: var(--tk-ink);
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.tk-btn:hover { text-decoration: none; background: #f3f9fd; border-color: var(--tk-accent); }
.tk-btn:active { transform: translateY(1px); }
.tk-btn--primary {
  background: var(--tk-accent);
  border-color: var(--tk-accent);
  color: #fff;
}
.tk-btn--primary:hover { background: var(--tk-accent-2); }
.tk-btn--ghost { background: transparent; }
.tk-btn--xl { min-height: 56px; padding: 14px 28px; font-size: 1.05rem; min-width: 180px; }

.tk-menu {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.tk-menu-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  column-gap: 16px;
  row-gap: 6px;
  align-items: start;
  padding: clamp(14px, 2.2vh, 22px);
  min-height: 0;
  background: var(--tk-surface);
  border: 1px solid var(--tk-line);
  border-radius: var(--tk-radius);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(36, 113, 163, 0.06);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}
.tk-menu-card:hover {
  border-color: var(--tk-accent);
  box-shadow: var(--tk-shadow);
  transform: translateY(-2px);
  text-decoration: none;
}
.tk-menu-card strong { font-size: clamp(1.05rem, 2.4vh, 1.35rem); }
.tk-menu-card span { color: var(--tk-muted); }
.tk-menu-card--accent { border-color: #9dcbea; background: #f3f9fd; }
.tk-menu-card--muted { opacity: 0.85; }
.tk-menu-card__icon {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: clamp(42px, 7vh, 58px);
  height: clamp(42px, 7vh, 58px);
  border-radius: 16px;
  background: var(--tk-accent-soft);
  color: var(--tk-accent-2) !important;
  font-size: clamp(1.2rem, 3vh, 1.7rem);
  font-weight: 800;
}
.tk-menu-card__title { grid-column: 2; }
.tk-menu-card__action {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  color: var(--tk-accent-2) !important;
  font-weight: 800;
}
.tk-menu-card__action b { font-size: 1.25rem; }

.tk-panel {
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  background: var(--tk-surface);
  border: 1px solid var(--tk-line);
  border-radius: var(--tk-radius);
  padding: clamp(14px, 2.5vh, 28px);
  box-shadow: var(--tk-shadow);
}
.tk-form { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.tk-field { display: flex; flex-direction: column; gap: 8px; font-weight: 600; }
.tk-input {
  min-height: 64px;
  padding: 12px 18px;
  border-radius: 14px;
  border: 1px solid var(--tk-line);
  font-size: 1.3rem;
  font-weight: 700;
}
.tk-input:focus {
  outline: 3px solid color-mix(in srgb, var(--tk-accent) 22%, transparent);
  border-color: var(--tk-accent);
}
.tk-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.tk-actions--stack { flex-direction: column; align-items: stretch; }
.tk-anon { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--tk-line); }

.tk-ticket-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: clamp(5px, 1vh, 10px);
}
.tk-ticket-grid form { min-width: 0; min-height: 0; }
.tk-ticket {
  width: 100%;
  height: 100%;
  min-height: 38px;
  border-radius: clamp(8px, 1.3vw, 14px);
  border: 1px solid #acd2eb;
  background: linear-gradient(180deg, #fff 0%, #f2f8fc 100%);
  color: var(--tk-accent-2);
  font-weight: 800;
  font-size: clamp(0.78rem, 2.2vh, 1.2rem);
  cursor: pointer;
  box-shadow: 0 2px 7px rgba(36, 113, 163, 0.07);
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
.tk-ticket span {
  display: grid;
  place-items: center;
  width: clamp(25px, 4.5vh, 40px);
  height: clamp(25px, 4.5vh, 40px);
  margin: auto;
  border-radius: 50%;
  background: var(--tk-accent-soft);
}
.tk-ticket:hover,
.tk-ticket:focus-visible {
  border-color: var(--tk-accent);
  background: #fff;
  box-shadow: 0 7px 18px rgba(36, 113, 163, 0.18);
  transform: translateY(-2px);
}
.tk-ticket:hover span,
.tk-ticket:focus-visible span {
  background: var(--tk-accent);
  color: #fff;
}

.tk-session-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.tk-session-actions { display: flex; align-items: center; gap: 8px; }
.tk-timer {
  min-width: 110px;
  text-align: center;
  font-weight: 800;
  font-size: 1.6rem;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--tk-accent-2);
  color: #fff;
}
.tk-progress {
  height: 8px;
  background: var(--tk-line);
  border-radius: 999px;
  overflow: hidden;
}
.tk-progress span {
  display: block;
  height: 100%;
  background: var(--tk-accent);
}
.tk-question-nav {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: clamp(2px, 0.45vw, 6px);
  flex: 0 0 auto;
}
.tk-question-nav__item {
  display: grid;
  place-items: center;
  min-width: 0;
  height: clamp(30px, 4.8vh, 42px);
  border: 1px solid var(--tk-line);
  border-radius: clamp(5px, 0.7vw, 9px);
  background: #fff;
  color: var(--tk-muted);
  font-size: clamp(0.68rem, 1.55vh, 0.88rem);
  font-weight: 800;
  text-decoration: none;
}
a.tk-question-nav__item:hover {
  border-color: var(--tk-accent);
  background: var(--tk-accent-soft);
  color: var(--tk-accent-2);
  text-decoration: none;
}
.tk-question-nav__item.is-current {
  border-color: var(--tk-accent);
  background: var(--tk-accent);
  color: #fff;
  box-shadow: 0 3px 10px rgba(36, 113, 163, 0.24);
}
.tk-question-nav__item.is-answered {
  border-color: #8fc3e5;
  background: var(--tk-accent-soft);
  color: var(--tk-accent-2);
}
.tk-question-nav__item.is-skipped {
  border-color: #e5b46e;
  background: #fff4df;
  color: #8a570e;
}

.tk-question {
  flex: 1;
  min-height: 0;
  background: var(--tk-surface);
  border: 1px solid var(--tk-line);
  border-radius: var(--tk-radius);
  padding: clamp(8px, 1.4vh, 14px);
  display: grid;
  grid-template-columns: minmax(0, 44%) minmax(0, 56%);
  gap: clamp(8px, 1.3vw, 18px);
  overflow: hidden;
  box-shadow: var(--tk-shadow);
}
.tk-question__prompt,
.tk-question__response {
  min-width: 0;
  min-height: 0;
}
.tk-question__prompt {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(8px, 1.4vh, 14px);
  padding: clamp(10px, 1.8vh, 18px);
  border-radius: 14px;
  background: #f4f9fc;
  border: 1px solid #d8e9f4;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.tk-question__prompt .tk-question__text,
.tk-question__prompt h3 { flex: 0 0 auto; }
.tk-question__response {
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1vh, 10px);
  overflow: hidden;
}
.tk-question__response .tk-options--reveal {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.tk-question__response .tk-actions,
.tk-question__response > .tk-btn { flex: 0 0 auto; }
.tk-question__text {
  margin: 0;
  font-size: clamp(0.95rem, 2.1vh, 1.35rem);
  line-height: 1.35;
}
.tk-question__image-btn {
  position: relative;
  display: block;
  width: 100%;
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  border-radius: 12px;
}
.tk-question__image {
  display: block;
  width: 100%;
  height: 100%;
  max-height: min(36vh, 300px);
  object-fit: contain;
  border-radius: 12px;
  background: #f4f8fb;
}
.tk-question__zoom-hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(39, 55, 70, 0.72);
  color: #fff;
  font-size: 0.95rem;
  pointer-events: none;
}
.tk-lightbox {
  width: min(96vw, 1200px);
  max-width: 96vw;
  max-height: 94vh;
  margin: auto;
  padding: 12px;
  border: 0;
  border-radius: 18px;
  background: #0f1a22;
  color: #fff;
}
.tk-lightbox::backdrop {
  background: rgba(15, 26, 34, 0.78);
}
.tk-lightbox__bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}
.tk-lightbox__img {
  display: block;
  width: 100%;
  max-height: calc(94vh - 72px);
  object-fit: contain;
  border-radius: 12px;
  background: #182832;
}

.tk-options { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: clamp(4px, 0.8vh, 8px); }
.tk-option {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  min-height: 52px;
  padding: clamp(7px, 1.1vh, 11px) 14px;
  border-radius: 14px;
  border: 2px solid #d5e5ef;
  background: #fff;
  cursor: pointer;
  font-size: clamp(0.82rem, 1.7vh, 1.05rem);
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}
.tk-option:hover { border-color: #88bfe3; background: #f5faff; }
.tk-option:active { transform: scale(0.995); }
.tk-option input { width: 24px; height: 24px; margin-top: 3px; flex-shrink: 0; accent-color: var(--tk-accent); }
.tk-option__letter {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--tk-accent-soft);
  font-weight: 800;
  color: var(--tk-accent-2);
}
.tk-option:has(input:checked) {
  border-color: var(--tk-accent);
  background: var(--tk-accent-soft);
  box-shadow: inset 0 0 0 1px var(--tk-accent);
}
.tk-options--reveal .tk-option { cursor: default; }
.tk-option.is-correct { border-color: var(--tk-ok); background: #e7f6ec; }
.tk-option.is-wrong { border-color: var(--tk-bad); background: #fceceb; }
.tk-option.is-chosen { font-weight: 700; }

.tk-explain {
  flex: 1 1 auto;
  min-height: 0;
  padding: clamp(7px, 1vh, 12px) 14px;
  border-radius: 14px;
  background: #fff8e8;
  border: 1px solid #f0dfb0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.tk-explain strong {
  position: sticky;
  top: 0;
  display: block;
  padding-bottom: 2px;
  background: #fff8e8;
}
.tk-explain p { margin: 4px 0 0; font-size: clamp(0.72rem, 1.4vh, 0.95rem); line-height: 1.3; }

.tk-finish-form { margin-top: 8px; }
.tk-flash { list-style: none; margin: 0; padding: 12px 28px; }
.tk-flash__item {
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--tk-accent-soft);
  margin-bottom: 8px;
}
.tk-flash__item--error, .tk-flash__item--error { background: #fceceb; color: var(--tk-bad); }
.tk-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tk-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--tk-surface);
  border: 1px solid var(--tk-line);
  color: inherit;
  transition: border-color 120ms ease, background 120ms ease;
}
.tk-list a:hover { border-color: var(--tk-accent); background: #f5faff; }
.tk-review {
  flex: 1;
  min-height: 0;
  margin-bottom: 8px;
  padding: clamp(8px, 1.5vh, 16px);
  border-radius: var(--tk-radius);
  background: var(--tk-surface);
  border: 1px solid var(--tk-line);
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 44%) minmax(0, 56%);
  gap: clamp(8px, 1.3vw, 18px);
  box-shadow: var(--tk-shadow);
}
.tk-review h3 { margin: 0 0 8px; font-size: clamp(0.82rem, 1.6vh, 1.05rem); }
.tk-review.is-ok { border-color: #9dcbea; }
.tk-review.is-bad { border-color: #e2a39c; }
.tk-section h2 { margin: 0 0 12px; }
.tk-review-head,
.tk-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.tk-review-head h2 { margin: 0; }

.tk-screen-session .tk-main { padding-block: 8px; gap: 7px; }
.tk-screen-session .tk-session-head { flex: 0 0 auto; }
.tk-screen-session .tk-title--sm { font-size: clamp(1rem, 2.2vh, 1.45rem); }
.tk-screen-session .tk-progress { flex: 0 0 6px; }
.tk-screen-session .tk-question .tk-form {
  flex: 1;
  min-height: 0;
  margin-top: 0;
}
.tk-screen-session .tk-question__response { min-height: 0; }
.tk-screen-session .tk-question .tk-options { flex: 1; min-height: 0; }
.tk-screen-session .tk-question .tk-options > li { flex: 1; min-height: 0; }
.tk-screen-session .tk-question .tk-option { height: 100%; align-items: center; }
.tk-screen-session .tk-question .tk-options--reveal { flex: 0 1 auto; overflow-y: auto; }
.tk-screen-session .tk-question .tk-options--reveal > .tk-option { flex: 0 0 auto; height: auto; }
.tk-screen-session .tk-actions { margin-top: 0; }
.tk-screen-session .tk-btn--xl { min-height: 42px; padding-block: 8px; }
.tk-screen-session .tk-finish-form { margin: 0; }

.tk-screen-practice .tk-panel,
.tk-screen-history .tk-panel {
  display: flex;
  flex-direction: column;
}
.tk-ticket-picker { gap: clamp(7px, 1.4vh, 14px); }
.tk-ticket-picker__head,
.tk-ticket-picker__label,
.tk-ticket-picker__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex: 0 0 auto;
}
.tk-ticket-picker__head .tk-lead { font-size: clamp(0.78rem, 1.6vh, 1rem); }
.tk-ticket-picker__label {
  padding-top: clamp(2px, 0.5vh, 8px);
  border-top: 1px solid var(--tk-line);
}
.tk-ticket-picker__label h2 { margin: 0; font-size: 1rem; }
.tk-ticket-picker__label span { color: var(--tk-muted); font-size: 0.82rem; }
.tk-random-ticket { flex: 0 0 auto; }
.tk-random-ticket__icon {
  font-size: 1.5rem;
  line-height: 0;
}
.tk-ticket-picker__foot { min-height: 40px; }
.tk-ticket-picker__foot .tk-btn { min-height: 36px; padding-block: 6px; }
.tk-ticket-picker__foot .tk-muted { font-size: 0.78rem; }
.tk-screen-history .tk-list {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(8, minmax(0, 1fr));
}
.tk-screen-history .tk-list li,
.tk-screen-history .tk-list a { min-height: 0; }
.tk-screen-history .tk-list a { height: 100%; padding-block: 8px; }
.tk-screen-identify .tk-panel { max-width: 760px; width: 100%; margin: auto; }

.tk-screen-result .tk-main { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.tk-screen-result .tk-main > .tk-panel {
  padding-block: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 20px;
}
.tk-screen-result .tk-main > .tk-panel > :not(.tk-actions) { grid-column: 1; }
.tk-screen-result .tk-main > .tk-panel .tk-title { font-size: 1.45rem; }
.tk-screen-result .tk-main > .tk-panel .tk-actions {
  grid-column: 2;
  grid-row: 1 / span 3;
  margin: 0;
}
.tk-screen-result .tk-section {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 6px;
}
.tk-screen-result .tk-question__prompt { padding: 10px; }
.tk-screen-result .tk-question__image { max-height: min(24vh, 190px); }
.tk-screen-result .tk-option { min-height: 34px; }
.tk-screen-result .tk-explain { min-height: clamp(70px, 12vh, 130px); }

@media (max-height: 700px) {
  .tk-top { padding-block: 8px; }
  .tk-brand img { width: 32px; height: 32px; }
  .tk-brand__sub { display: none; }
  .tk-hero .tk-lead { display: none; }
  .tk-title { font-size: 1.45rem; }
  .tk-menu { gap: 8px; }
  .tk-menu-card { gap: 6px; }
  .tk-menu-card strong { font-size: 1.05rem; }
  .tk-menu-card > span:not(.tk-menu-card__icon):not(.tk-menu-card__action) { font-size: 0.8rem; }
  .tk-btn { min-height: 38px; padding-block: 7px; }
  .tk-btn--xl { min-height: 42px; }
  .tk-subtitle { margin: 8px 0 6px; }
  .tk-ticket { min-height: 30px; }
}

:focus-visible {
  outline: 3px solid var(--tk-accent);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .tk-menu { grid-template-columns: 1fr; }
  .tk-menu { grid-template-rows: repeat(4, minmax(0, 1fr)); }
  .tk-top { padding: 12px 16px; }
  .tk-main { padding: 12px 14px; }
  .tk-ticket-grid { grid-template-columns: repeat(10, minmax(0, 1fr)); }
  .tk-question,
  .tk-review {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 40%) minmax(0, 60%);
  }
  .tk-question__prompt {
    display: grid;
    grid-template-columns: minmax(0, 45%) minmax(0, 55%);
    align-items: center;
  }
  .tk-question__prompt:not(:has(img)):not(:has(.tk-question__image-btn)) { grid-template-columns: 1fr; }
  .tk-question__image { height: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
