* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --tyca-navy: #102f61;
  --tyca-blue: #1557a0;
  --tyca-cyan: #25a8e0;
  --tyca-ink: #202b3c;
  --tyca-muted: #66758a;
  --tyca-border: #d8e2ef;
  --tyca-bg: #f3f6fb;
  --tyca-font: "DB Helvethaica X", Tahoma, Arial, sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 32px 18px 56px;
  background: var(--tyca-bg);
  color: var(--tyca-ink);
  font-family: var(--tyca-font);
}

.tyca-shell {
  width: min(100%, 960px);
  margin: 0 auto;
}
.back-link {
  color: var(--tyca-blue);
  font-weight: 700;
  text-decoration: none;
}
.back-link:hover {
  text-decoration: underline;
}
.page-heading {
  margin: 26px 0 20px;
}
.eyebrow {
  color: var(--tyca-blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
}
.page-heading h1,
.report-heading h1 {
  margin: 7px 0;
  color: var(--tyca-navy);
  font-size: clamp(28px, 4vw, 38px);
}
.page-heading p,
.report-heading p {
  margin: 0;
  color: var(--tyca-muted);
  font-size: 17px;
}

.rules-note {
  display: grid;
  gap: 4px;
  margin-bottom: 20px;
  padding: 15px 18px;
  border: 1px solid #c9d9ef;
  border-left: 4px solid var(--tyca-cyan);
  border-radius: 10px;
  background: #edf6ff;
  line-height: 1.55;
}
.rules-note strong {
  color: var(--tyca-navy);
}
.rules-note span {
  color: #46566d;
}
.error-box {
  margin-bottom: 18px;
  padding: 13px 16px;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: #fff1f2;
  color: #991b1b;
}

.tyca-form,
.report-card,
.not-found {
  overflow: hidden;
  border: 1px solid var(--tyca-border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 36px rgba(16, 47, 97, 0.08);
}
.form-section {
  padding: 25px 28px;
}
.form-section + .form-section {
  border-top: 1px solid #e8edf4;
}
.form-section h2,
.report-scores h2 {
  margin: 0 0 17px;
  color: var(--tyca-navy);
  font-size: 21px;
}
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px;
}
.field {
  display: grid;
  gap: 7px;
  color: #34445a;
  font-weight: 700;
}
.field-wide {
  grid-column: 1 / -1;
}
.field-hint {
  color: var(--tyca-muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
}
.field input,
.field textarea,
.score-control input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #c9d5e3;
  border-radius: 9px;
  background: #fff;
  color: var(--tyca-ink);
  font: inherit;
  font-size: 16px;
}
.field input:focus,
.field textarea:focus,
.score-control input:focus {
  outline: 3px solid rgba(37, 168, 224, 0.2);
  border-color: var(--tyca-cyan);
}
.token-import {
  margin-bottom: 20px;
}
.token-import textarea {
  min-height: 100px;
  resize: vertical;
  font-family: Consolas, monospace;
  font-weight: 400;
  overflow-wrap: anywhere;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 17px;
}
.section-heading h2 {
  margin-bottom: 4px;
}
.section-heading p {
  margin: 0;
  color: var(--tyca-muted);
}
.count-pill {
  flex: 0 0 auto;
  padding: 7px 11px;
  border-radius: 999px;
  background: #eaf4ff;
  color: var(--tyca-blue);
  font-size: 13px;
  font-weight: 800;
}
.competency-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.competency-card {
  display: grid;
  gap: 6px;
  padding: 17px;
  border: 1px solid var(--tyca-border);
  border-radius: 12px;
  background: linear-gradient(145deg, #fff, #f8fbff);
}
.competency-name {
  color: var(--tyca-navy);
  font-weight: 800;
  line-height: 1.4;
}
.competency-english {
  min-height: 35px;
  color: var(--tyca-muted);
  font-size: 13px;
  line-height: 1.35;
}
.score-control {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 9px;
  margin-top: 7px;
}
.score-control span {
  color: var(--tyca-muted);
  font-size: 14px;
}
.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border: 0;
  border-radius: 9px;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.primary-button {
  width: calc(100% - 56px);
  margin: 0 28px 28px;
  background: linear-gradient(100deg, var(--tyca-navy), var(--tyca-blue));
  color: #fff;
}
.primary-button:hover {
  background: var(--tyca-blue);
}
.link-button {
  width: auto;
  margin: 10px 0 0;
}
.secondary-button {
  border: 1px solid var(--tyca-border);
  background: #fff;
  color: var(--tyca-navy);
}
.secondary-button:hover {
  background: #f1f6fd;
}
.template-preview {
  margin-top: 18px;
  padding: 15px 18px;
  border: 1px solid var(--tyca-border);
  border-radius: 12px;
  background: #fff;
}
.template-preview summary {
  color: var(--tyca-blue);
  font-weight: 800;
  cursor: pointer;
}
.template-preview img {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 15px;
  border: 1px solid var(--tyca-border);
  border-radius: 8px;
}

.report-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.action-buttons {
  display: flex;
  gap: 8px;
}
.report-card {
  padding: 34px;
}
.report-heading {
  padding-bottom: 22px;
  border-bottom: 2px solid #e7eff9;
}
.candidate-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 22px;
  padding: 22px 0;
}
.candidate-summary div {
  display: grid;
  gap: 4px;
}
.candidate-summary span {
  color: var(--tyca-muted);
  font-size: 14px;
}
.candidate-summary strong {
  color: var(--tyca-ink);
  font-size: 17px;
  overflow-wrap: anywhere;
}
.report-note {
  margin: 0 0 22px;
}
.report-scores h2 {
  margin-bottom: 12px;
}
.report-score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.report-score-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px;
  border: 1px solid var(--tyca-border);
  border-radius: 10px;
  background: #f9fbfe;
}
.report-score-item span {
  line-height: 1.45;
}
.report-score-item strong {
  flex: 0 0 auto;
  color: var(--tyca-blue);
  font-size: 22px;
}
.report-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid #e7edf5;
  color: var(--tyca-muted);
  font-size: 13px;
}
.not-found {
  padding: 32px;
}
.not-found h1 {
  margin-top: 0;
  color: var(--tyca-navy);
}

@media (max-width: 640px) {
  body {
    padding: 22px 12px 36px;
  }
  .form-section {
    padding: 21px 18px;
  }
  .field-grid,
  .competency-grid,
  .candidate-summary,
  .report-score-grid {
    grid-template-columns: 1fr;
  }
  .field-wide {
    grid-column: auto;
  }
  .section-heading,
  .report-actions {
    align-items: flex-start;
    flex-direction: column;
  }
  .report-card {
    padding: 22px 18px;
  }
  .action-buttons {
    width: 100%;
    flex-wrap: wrap;
  }
  .action-buttons > * {
    flex: 1;
  }
  .primary-button {
    width: calc(100% - 36px);
    margin: 0 18px 22px;
  }
  .report-footer {
    flex-direction: column;
  }
}

@media print {
  body {
    padding: 0;
    background: #fff;
  }
  .tyca-shell {
    width: 100%;
  }
  .report-card {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .no-print,
  .template-preview {
    display: none !important;
  }
  .rules-note {
    break-inside: avoid;
  }
}

.report-body {
  padding: 24px 16px;
  background: linear-gradient(135deg, #eef2ff, #f8fafc 48%, #fdf2f8);
  font-family: var(--tyca-font);
}
.preview.tyca-preview {
  width: min(100%, 980px);
  max-width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 14px;
  text-align: center;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 22px;
  box-shadow: 0 20px 55px rgba(30, 41, 59, 0.12);
}
.toolbar {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  padding: 12px 14px;
  text-align: left;
  background: linear-gradient(135deg, #fff, #f8fafc);
  border: 1px solid #e2e8f0;
  border-radius: 14px;
}
.toolbar-eyebrow {
  display: block;
  margin-bottom: 2px;
  color: #ec1760;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.toolbar h1 {
  margin: 0;
  color: #27364d;
  font-size: 21px;
  letter-spacing: 0.2px;
}
.toolbar-actions {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin: 0;
}
.toolbar-actions a,
.toolbar-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 17px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}
.toolbar-actions a:hover,
.toolbar-actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 12px rgba(31, 41, 55, 0.16);
}
.toolbar-download {
  background: #16a34a;
}
.toolbar-print {
  background: #2563eb;
}
.template-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 12px;
  container-type: inline-size;
}
.tyca-report-page {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 2480 / 3508;
  margin: 0 auto;
  overflow: hidden;
  container-type: inline-size;
  background: #fff;
}
.report-background {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}
.report-overlay {
  position: absolute;
  z-index: 2;
  color: #252a33;
  font-family: var(--tyca-font);
  font-size: min(1.5vw, 14.25px);
  font-weight: 400;
  line-height: 1.12;
  white-space: nowrap;
  letter-spacing: 0.05em;
}
.candidate-name,
.exam-date,
.candidate-class,
.test-id {
  font-size: min(2.4vw, 22.8px);
  font-weight: 400;
  text-align: left;
  text-indent: 0;
}
.candidate-name {
  top: 16.65%;
  left: 21.2%;
  width: 28%;
  overflow: hidden;
}
.exam-date {
  top: 16.6%;
  left: 75.2%;
  width: 19%;
  overflow: hidden;
}
.candidate-class {
  top: 19.67%;
  left: 21.2%;
  width: 28%;
  overflow: hidden;
}
.test-id {
  top: 19.67%;
  left: 63.1%;
  width: 30.5%;
  overflow: hidden;
}
.score-value {
  display: flex;
  width: 8%;
  height: 1.62%;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: min(2vw, 19px);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-align: center;
}
.score-cognitive {
  top: 37.95%;
  left: 9.1%;
}
.score-socio {
  top: 37.95%;
  left: 74.5%;
}
.score-resilience {
  top: 55.50%;
  left: 9.1%;
}
.score-digital {
  top: 59.12%;
  left: 74.5%;
}
.report-radar {
  top: 31.08%;
  left: 29.45%;
  z-index: 1;
  width: 41.1%;
  height: auto;
  overflow: visible;
}
.radar-grid circle,
.radar-grid line {
  fill: none;
  stroke: #555b63;
  stroke-width: 1.7;
  stroke-opacity: 0.55;
}
.radar-area {
  fill: url(#radarFill);
  stroke: #16a9e4;
  stroke-width: 1;
  fill-opacity: 0.85;
}
.radar-point {
  fill: url(#radarPoint);
  stroke: #0872d2;
  stroke-width: 2;
}
.archetype-heading,
.blueprint-detail {
  font-family: var(--tyca-font);
  letter-spacing: normal;
  word-spacing: normal;
}
.archetype-heading {
  top: 76.2%;
  left: 39.4%;
  transform: translateX(-50%);
  display: grid;
  width: 19.2%;
  gap: 0.35em;
  color: #252a33;
  line-height: 1.17;
  text-align: center;
  white-space: normal;
}
.archetype-name,
.archetype-name-th {
  position: static;
  display: block;
  width: 100%;
  color: #252a33;
  line-height: 1.17;
  white-space: nowrap;
}
.archetype-name {
  font-size: min(2.4vw, 22.8px);
  font-weight: 400;
}
.archetype-name-th {
  font-size: min(2.4vw, 22.8px);
  font-weight: 400;
}
.total-score {
  top: 69.65%;
  left: 74.2%;
  color: #252a33;
  font-size: min(2.5vw, 23.75px);
  font-weight: 700;
}
.percentile {
  top: 72.2%;
  left: 66.9%;
  width: 21.2%;
  color: #344052;
  font-size: min(1.7vw, 16.15px);
  font-weight: 300;
}
.exchange-rights {
  top: 75.1%;
  left: 74.3%;
  max-width: 22%;
  color: #344052;
  white-space: normal;
}
.blueprint-detail {
  top: 84.25%;
  left: 4.8%;
  width: 44.5%;
  height: 14.6%;
  color: #4b4b4b;
  text-align: left;
  white-space: normal;
}
.blueprint-detail h2 {
  margin: 0 0 0.45em;
  color: #252a33;
  font-size: min(1.75vw, 16.625px);
  font-weight: 400;
  line-height: 1.25;
}
.blueprint-detail h2 span {
  color: #124780;
}
.blueprint-detail p {
  margin: 0;
  font-size: min(1.56vw, 14.82px);
  font-weight: 300;
  line-height: 1.5;
  text-align: justify;
  text-align-last: left;
  text-justify: inter-word;
  text-indent: 2.4em;
}
.blueprint-detail p + p {
  margin-top: 0.5em;
}
.blueprint-detail p strong {
  font-weight: 700;
}

[data-report-fit] {
  --fit-scale: 1;
  overflow: hidden;
  white-space: nowrap;
}

@supports (font-size: 1cqw) {
  .report-overlay {
    font-size: 1.5cqw;
  }
  .report-overlay.candidate-name,
  .report-overlay.exam-date,
  .report-overlay.candidate-class,
  .report-overlay.test-id {
    font-size: calc(2.4cqw * var(--fit-scale, 1));
  }
  .score-value {
    font-size: calc(1.8cqw * var(--fit-scale, 1.5));
  }
  .archetype-name {
    font-size: calc(2.4cqw * var(--fit-scale, 1));
  }
  .archetype-name-th {
    font-size: calc(2.4cqw * var(--fit-scale, 1));
  }
  .total-score {
    font-size: 2.5cqw;
  }
  .percentile {
    font-size: calc(1.7cqw * var(--fit-scale, 1));
  }
  .blueprint-detail h2 {
    font-size: 1.75cqw;
  }
  .blueprint-detail p {
    font-size: calc(1.56cqw * var(--detail-scale, 1));
  }
}

.not-found {
  padding: 30px;
  text-align: left;
}

@media (max-width: 600px) {
  .report-body {
    padding: 8px 5px;
  }
  .preview.tyca-preview {
    padding: 8px;
    border-radius: 14px;
  }
  .toolbar {
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 10px;
  }
  .toolbar > div:first-child {
    min-width: 0;
  }
  .toolbar-eyebrow {
    display: none;
  }
  .toolbar h1 {
    font-size: 16px;
  }
  .toolbar-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    margin-left: 0;
  }
  .toolbar-actions a,
  .toolbar-actions button {
    padding: 7px 10px;
    font-size: 12px;
  }
  .template-wrap {
    border-radius: 8px;
  }
  .not-found {
    padding: 18px;
  }
}

@page {
  size: A4 portrait;
  margin: 0;
}
@media print {
  body.report-body {
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    padding: 0;
    background: #fff;
  }
  .preview.tyca-preview {
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .toolbar {
    display: none !important;
  }
  .template-wrap {
    width: 100%;
    border-radius: 0;
  }
  .tyca-report-page {
    width: 100%;
    height: auto;
    margin: 0;
    break-inside: avoid;
  }
  .report-overlay {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}
