@import url('https://fonts.googleapis.com/css2?family=Libre+Franklin:wght@400;600;700&display=swap');

:root {
  --bg: #f7f4ef;
  --bg-accent: #f0e6d6;
  --ink: #1d1b16;
  --muted: #5b544b;
  --panel: #ffffff;
  --accent: #c45f2a;
  --accent-dark: #8f3f1b;
  --line: #dfd2bf;
  --focus: #152536;
  --shadow: 0 20px 48px rgba(29, 27, 22, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "interstate-mono", "Libre Franklin", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fff5e6 0%, var(--bg) 40%),
    repeating-linear-gradient(45deg, rgba(196, 95, 42, 0.08) 0 6px, rgba(255, 255, 255, 0) 6px 12px);
}

.page {
  max-width: 980px;
  margin: 0 auto 2rem;
  padding: 0 20px 24px;
}

.tcb-flags {
  text-align: center;
  margin: 1rem auto 0.5rem;
  display: flex;
  justify-content: center;
}

.flag {
  width: 14px;
  height: 14px;
  display: inline-block;
  position: relative;
  overflow: hidden;
  padding: 4px;
  margin: 2px;
  border: 1px solid #eee;
}

.flag::before,
.flag::after {
  content: "";
  position: absolute;
  inset: 0;
}

.c {
  background: #152536;
}

.c::before {
  top: 20%;
  bottom: 20%;
  background: #faf7f4;
}

.c::after {
  top: 40%;
  bottom: 40%;
  background: #f2916b;
}

.o {
  background: #f2916b;
}

.o::before {
  background: #ffe882;
  right: 35%;
  bottom: -100%;
  transform: rotate(-45deg);
  left: -100%;
}

.k {
  background: #ffe882;
}

.k::before {
  background: #152536;
  left: 50%;
}

.app-header {
  text-align: center;
  padding: 0.5rem 0 1.1rem;
}

h1 {
  font-family: "matrix-ii-ext-semi-narrow", Georgia, serif;
  font-size: 3rem;
  font-weight: 500;
  line-height: 1.1;
  margin: 0 0 0.5rem;
}

.title-accent {
  color: #f2916b;
}

h2 {
  font-family: "matrix-ii-ext-semi-narrow", Georgia, serif;
  font-size: 2rem;
  font-weight: 500;
  margin: 0.35rem 0 0.9rem;
}

.persona-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem;
  background: #fffdf9;
  margin-bottom: 0.8rem;
}

.persona-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08rem;
  font-size: 0.73rem;
  color: var(--muted);
}

#persona-name {
  margin: 0.2rem 0 0.4rem;
  font-size: 1.35rem;
  font-family: "matrix-ii-ext-semi-narrow", Georgia, serif;
  font-weight: 500;
}

.persona-summary {
  margin: 0;
  color: #403a32;
}

.subtitle {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08rem;
  font-size: 0.78rem;
  color: #726969;
}

.view {
  background: var(--panel);
  border-radius: 16px;
  padding: 1.1rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.view + .view {
  margin-top: 1rem;
}

.hidden {
  display: none;
}

.question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.progress {
  margin: 0;
  font-weight: 700;
  color: var(--accent-dark);
}

.answers-form {
  display: grid;
  gap: 0.62rem;
  margin: 1rem 0 1.2rem;
}

.answer-option {
  display: flex;
  align-items: center;
  gap: 0.62rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.72rem 0.82rem;
  background: #fffdf9;
}

.answer-option:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.button-row {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 0.62rem 0.92rem;
  font-family: "interstate-mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.07rem;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}

button.secondary {
  background: transparent;
  color: #152536;
  border: 1px solid #d7c6b3;
}

button:hover {
  filter: brightness(0.96);
}

button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.review-list {
  padding-left: 1.2rem;
}

.review-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  margin: 0 0 0.75rem;
  background: #fffdf9;
}

.review-question,
.review-answer {
  margin: 0 0 0.35rem;
}

.review-answer {
  color: var(--muted);
}

.inline-button {
  border: 0;
  padding: 0;
  background: transparent;
  text-transform: none;
  letter-spacing: normal;
  color: #1f4d72;
  text-decoration: underline;
}

.results-note {
  margin: 0 0 0.7rem;
  color: var(--muted);
  font-size: 0.9rem;
}

#results-chart {
  display: block;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

.results-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  margin: 1rem 0;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem;
  background: #fffdf9;
}

.result-card h3 {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
}

.result-meter {
  height: 8px;
  border-radius: 999px;
  background: #ece4d5;
  position: relative;
  margin-top: 0.5rem;
}

.result-meter::after {
  content: "";
  position: absolute;
  top: -3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #152536;
  left: calc(var(--score) * 1% - 6px);
}

.result-ends {
  margin-top: 0.42rem;
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.78rem;
  color: #4b4a45;
}

.result-end-low,
.result-end-high {
  max-width: 48%;
}

.result-end-high {
  text-align: right;
}

.result-lean {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.table-wrap {
  overflow-x: auto;
  margin: 0.75rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 0.6rem 0.5rem;
  vertical-align: top;
}

.feedback {
  min-height: 1.25rem;
  margin: 0.6rem 0 0;
  color: #1f4d72;
  font-weight: 700;
}

@media (max-width: 720px) {
  .page {
    padding: 0 12px 20px;
  }

  h1 {
    font-size: 2.25rem;
  }

  h2 {
    font-size: 1.6rem;
  }

  .question-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .button-row {
    width: 100%;
  }

  button {
    width: 100%;
  }
}
