/* Mobile-first visual foundation for the country personality H5. */
:root {
  --page: #faf9ff;
  --surface: #ffffff;
  --ink: #18243a;
  --muted: #64748b;
  --brand: #1a58b7;
  --brand-light: #5b8def;
  --blue-wash: #dcebff;
  --blue-soft: #edf4ff;
  --line: #d9e5f8;
  --success: #2e9a76;
  --radius-lg: 24px;
  --radius-md: 16px;
  --shadow: 0 16px 40px rgb(45 93 165 / 12%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #eaf2ff;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 4%, rgb(218 235 255 / 95%), transparent 29rem),
    radial-gradient(circle at 100% 48%, rgb(227 238 255 / 90%), transparent 27rem),
    var(--page);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgb(91 141 239 / 45%);
  outline-offset: 3px;
}

.app-shell {
  width: min(100%, 430px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
  overflow: hidden;
}

/* Common screen elements used by the app module. */
.screen {
  display: flex;
  min-height: calc(100svh - 48px);
  flex-direction: column;
}

.password-screen {
  position: relative;
  align-items: center;
  justify-content: center;
  isolation: isolate;
}

.password-background {
  position: absolute;
  z-index: -2;
  inset: -42px;
  width: calc(100% + 84px);
  height: calc(100% + 84px);
  object-fit: cover;
  filter: blur(18px) saturate(.75) brightness(1.08);
  opacity: .64;
}

.password-screen::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  background: rgb(250 249 255 / 52%);
}

.password-card {
  width: 100%;
  padding: 30px 24px 24px;
  border: 1px solid rgb(255 255 255 / 80%);
  border-radius: var(--radius-lg);
  background: rgb(255 255 255 / 75%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.password-card .page-title {
  margin-top: 18px;
}

.password-form {
  display: grid;
  gap: 10px;
  margin-top: 30px;
}

.password-form label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.password-form input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  outline: none;
  color: var(--ink);
  background: rgb(255 255 255 / 90%);
  font-size: 18px;
  letter-spacing: .15em;
}

.password-form input:focus {
  border-color: var(--brand-light);
  box-shadow: 0 0 0 4px rgb(91 141 239 / 15%);
}

.password-error {
  min-height: 18px;
  margin: 0;
  color: #ba1a1a;
  font-size: 13px;
}

.topbar,
.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow,
.dimension-tag {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--brand);
  background: var(--blue-soft);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgb(26 88 183 / 12%);
}

.progress-bar {
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-light));
  transition: width 260ms ease;
}

.hero-illustration {
  width: min(100%, 350px);
  margin: 26px auto 20px;
  filter: drop-shadow(0 18px 20px rgb(48 106 180 / 13%));
}

.intro-copy,
.result-copy {
  max-width: 32ch;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.page-title {
  margin: 0;
  font-size: clamp(31px, 9vw, 38px);
  line-height: 1.18;
  letter-spacing: -.045em;
}

.question-title {
  margin: 18px 0 26px;
  font-size: clamp(24px, 6.5vw, 29px);
  line-height: 1.45;
  letter-spacing: -.035em;
}

.primary-button,
.secondary-button,
.icon-button {
  min-height: 48px;
  border: 0;
  border-radius: var(--radius-md);
  font-weight: 700;
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.primary-button {
  width: 100%;
  margin-top: auto;
  padding: 13px 20px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-light));
  box-shadow: 0 12px 22px rgb(26 88 183 / 27%);
}

.secondary-button {
  padding: 12px 18px;
  color: var(--brand);
  background: var(--blue-soft);
}

.icon-button {
  display: grid;
  width: 44px;
  place-items: center;
  color: var(--brand);
  background: transparent;
}

.primary-button:hover,
.secondary-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.primary-button:active,
.secondary-button:active,
.icon-button:active {
  transform: translateY(1px);
}

.choice-list {
  display: grid;
  gap: 12px;
}

.choice-card {
  display: flex;
  width: 100%;
  min-height: 64px;
  align-items: center;
  gap: 13px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 5px 14px rgb(39 85 148 / 5%);
  text-align: left;
}

.choice-card[aria-pressed="true"] {
  border-color: var(--brand-light);
  background: var(--blue-soft);
  box-shadow: 0 8px 20px rgb(44 102 180 / 13%);
}

.choice-key {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border-radius: 50%;
  color: var(--brand);
  background: var(--blue-soft);
  font-size: 14px;
  font-weight: 800;
}

.choice-card[aria-pressed="true"] .choice-key {
  color: #fff;
  background: var(--brand);
}

.choice-text {
  font-size: 16px;
  line-height: 1.45;
}

.navigation-row {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 12px;
  margin-top: auto;
  padding-top: 24px;
}

button:disabled {
  cursor: not-allowed;
  opacity: .42;
  transform: none;
  box-shadow: none;
}

.result-card {
  padding: 22px;
  border: 1px solid rgb(255 255 255 / 72%);
  border-radius: var(--radius-lg);
  background: rgb(255 255 255 / 83%);
  box-shadow: var(--shadow);
}

/* Result screen: real country record, local landscape, radar and two actions. */
.brand-mark,
.question-number {
  color: var(--brand);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .04em;
}

.question-count,
.result-region,
.country-english,
.match-label,
.section-heading span,
.save-status {
  color: var(--muted);
  font-size: 13px;
}

.question-screen .progress-track,
.start-screen .progress-track {
  margin-top: 14px;
}

.question-screen .dimension-tag {
  margin-top: 28px;
}

.navigation-button,
.result-actions .primary-button {
  margin-top: 0;
}

.result-screen {
  gap: 18px;
}

.result-header {
  padding: 2px 2px 0;
}

.result-region {
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--surface);
}

.country-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}

.country-flag {
  display: grid;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  place-items: center;
  border-radius: 18px;
  background: var(--blue-soft);
  font-size: 40px;
}

.country-name {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -.04em;
}

.country-english {
  margin: 6px 0 0;
  font-size: 14px;
}

.country-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 20px 0;
  overflow: hidden;
  border-radius: 18px;
  border: 5px solid #fff;
  box-shadow: 0 12px 24px rgb(48 106 180 / 13%);
  object-fit: cover;
}

.match-label {
  margin: 0 0 4px;
}

.personality-name {
  margin: 0;
  color: var(--brand);
  font-size: 24px;
}

.keyword-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 13px;
}

.keyword-list span {
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--brand);
  background: var(--blue-soft);
  font-size: 12px;
}

.radar-section {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
}

.radar-chart {
  display: block;
  width: min(100%, 320px);
  height: auto;
  margin: 4px auto 0;
  overflow: visible;
}

.radar-chart text {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.score-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
}

.score-grid div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--blue-soft);
}

.score-grid dt {
  color: var(--muted);
  font-size: 12px;
}

.score-grid dd {
  margin: 0;
  color: var(--brand);
  font-size: 14px;
  font-weight: 800;
}

.result-actions {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 12px;
}

.result-actions .secondary-button {
  min-height: 48px;
}

.save-status {
  min-height: 20px;
  margin: -8px 0 0;
  text-align: center;
}

.error-screen {
  justify-content: center;
}

.error-screen .primary-button {
  margin-top: 30px;
}

@media (min-width: 431px) {
  .app-shell {
    box-shadow: 0 0 0 1px rgb(142 174 221 / 20%), 0 20px 70px rgb(62 105 160 / 15%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
