:root {
  --wfg-ink: #172133;
  --wfg-muted: #647087;
  --wfg-orange: #b84d00;
  --wfg-blue: #1f73d2;
  --wfg-blue-dark: #114f9b;
  --wfg-green: #168b55;
  --wfg-green-soft: #e6f7ee;
  --wfg-red: #c63f3f;
  --wfg-red-soft: #fff0ee;
  --wfg-line: #d9e0ea;
  --wfg-card: rgba(255, 255, 255, .96);
  --wfg-shadow: 0 20px 52px rgba(33, 54, 83, .12);
}

* {
  box-sizing: border-box;
}

html {
  background: #fffdf8;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 4% 9%, rgba(244, 122, 34, .12), transparent 32rem),
    radial-gradient(circle at 94% 24%, rgba(31, 115, 210, .12), transparent 34rem),
    #fffdf8;
  color: var(--wfg-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.wfg-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.wfg-header-action {
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid #ddd5ca;
  border-radius: 999px;
  background: #fff;
  color: #28231f;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.wfg-header-action:hover {
  border-color: var(--wfg-blue);
  color: var(--wfg-blue-dark);
}

.wfg-main {
  width: min(1180px, calc(100% - 40px));
  min-height: calc(100vh - 150px);
  margin: 0 auto;
  padding: 44px 0 58px;
}

.wfg-storage-status {
  margin: 0 auto 20px;
  padding: 13px 18px;
  border: 1px solid #b9d3f3;
  border-radius: 14px;
  background: #eef6ff;
  color: #24527f;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.6;
}

.wfg-storage-status[data-tone="warning"] {
  border-color: #e6bd5d;
  background: #fff7dd;
  color: #75550f;
}

.wfg-storage-status[data-tone="error"] {
  border-color: #efaaa3;
  background: #fff1ef;
  color: #942e28;
}

.wfg-screen {
  animation: wfg-screen-in .28s ease-out both;
}

.wfg-start {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(470px, 1.1fr);
  gap: clamp(36px, 6vw, 86px);
  align-items: center;
  min-height: 620px;
}

.wfg-eyebrow,
.wfg-question-label {
  margin: 0 0 12px;
  color: var(--wfg-orange);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .14em;
}

.wfg-start h1,
.wfg-result > h1 {
  margin: 0;
  font-size: clamp(46px, 7vw, 78px);
  line-height: 1.08;
  letter-spacing: -.055em;
  text-wrap: balance;
}

.wfg-start__subtitle {
  margin: 24px 0 0;
  color: #4f5d71;
  font-size: clamp(19px, 2.2vw, 24px);
  font-weight: 800;
  line-height: 1.7;
}

.wfg-feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 30px 0 0;
  padding: 0;
  list-style: none;
}

.wfg-feature-list li {
  padding: 9px 13px;
  border: 1px solid rgba(217, 224, 234, .9);
  border-radius: 999px;
  background: rgba(255, 255, 255, .75);
  color: #4e5a6b;
  font-size: 13px;
  font-weight: 800;
}

.wfg-start__panel {
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid rgba(217, 224, 234, .95);
  border-radius: 28px;
  background: var(--wfg-card);
  box-shadow: var(--wfg-shadow);
}

.wfg-mode-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.wfg-mode-fieldset legend {
  margin-bottom: 18px;
  font-size: 20px;
  font-weight: 900;
}

.wfg-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.wfg-mode-card {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 88px;
  padding: 15px 14px;
  border: 2px solid #d9e0ea;
  border-radius: 17px;
  background: #fff;
  cursor: pointer;
  transition: border-color .18s ease, background-color .18s ease, transform .18s ease;
}

.wfg-mode-card:hover {
  border-color: #8eb9ec;
  transform: translateY(-1px);
}

.wfg-mode-card:has(input:checked) {
  border-color: var(--wfg-blue);
  background: #edf5ff;
  box-shadow: 0 0 0 2px rgba(31, 115, 210, .08);
}

.wfg-mode-card input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.wfg-mode-card:has(input:focus-visible) {
  outline: 4px solid #f4b400;
  outline-offset: 3px;
}

.wfg-mode-card input:focus-visible {
  outline: 0;
}

.wfg-mode-card__icon {
  font-size: 24px;
  text-align: center;
}

.wfg-mode-card strong,
.wfg-mode-card small {
  display: block;
}

.wfg-mode-card strong {
  font-size: 16px;
  line-height: 1.35;
}

.wfg-mode-card small {
  margin-top: 4px;
  color: var(--wfg-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.wfg-selection-indicator {
  display: none;
  margin-top: 5px;
  color: var(--wfg-blue-dark);
  font-size: 12px;
  font-weight: 900;
}

.wfg-mode-card:has(input:checked) .wfg-selection-indicator {
  display: block;
}

.wfg-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 52px;
  padding: 13px 21px;
  border: 2px solid transparent;
  border-radius: 15px;
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.wfg-button:hover:not(:disabled) {
  transform: translateY(-2px);
}

.wfg-button:disabled {
  cursor: not-allowed;
  opacity: .5;
}

.wfg-button--primary {
  background: var(--wfg-blue);
  color: #fff;
  box-shadow: 0 8px 18px rgba(31, 115, 210, .22);
}

.wfg-button--primary:hover:not(:disabled) {
  background: var(--wfg-blue-dark);
}

.wfg-button--quiet {
  border-color: #cfd8e5;
  background: #fff;
  color: var(--wfg-ink);
}

.wfg-button--review {
  border-color: #e4b74f;
  background: #fff6d9;
  color: #684c0a;
}

.wfg-button--danger {
  background: var(--wfg-red);
  color: #fff;
}

.wfg-button--small {
  min-height: 44px;
  padding: 9px 14px;
  font-size: 13px;
}

.wfg-start-button {
  width: 100%;
  min-height: 58px;
  margin-top: 20px;
  font-size: 17px;
}

.wfg-load-message,
.wfg-start-note {
  margin: 12px 0 0;
  color: var(--wfg-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
  text-align: center;
}

.wfg-load-message[data-ready="true"] {
  color: var(--wfg-green);
}

.wfg-load-message[data-error="true"] {
  color: var(--wfg-red);
}

.wfg-resume {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #8eb9ec;
  border-radius: 16px;
  background: #edf5ff;
}

.wfg-resume strong {
  font-size: 15px;
}

.wfg-resume p {
  margin: 4px 0 0;
  color: var(--wfg-muted);
  font-size: 13px;
  font-weight: 700;
}

.wfg-resume__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.wfg-quiz {
  max-width: 1100px;
  margin: 0 auto;
}

.wfg-quiz-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 900;
}

.wfg-quiz-status > div {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wfg-mode-badge {
  padding: 7px 11px;
  border: 1px solid #b9d3f3;
  border-radius: 999px;
  background: #edf5ff;
  color: #175da9;
  font-size: 12px;
}

.wfg-progress {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4e9f0;
}

.wfg-progress span {
  display: block;
  width: 10%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--wfg-blue), #4d9cec);
  transition: width .25s ease;
}

.wfg-quiz-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr);
  gap: 24px;
  align-items: start;
  margin-top: 22px;
}

.wfg-flag-card,
.wfg-answer-column,
.wfg-result-summary,
.wfg-result-lists > section {
  border: 1px solid var(--wfg-line);
  border-radius: 25px;
  background: var(--wfg-card);
  box-shadow: var(--wfg-shadow);
}

.wfg-flag-card {
  padding: clamp(20px, 3vw, 30px);
}

.wfg-flag-card h1 {
  margin: 0 0 18px;
  font-size: clamp(27px, 4vw, 39px);
  letter-spacing: -.03em;
}

.wfg-flag-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 390px;
  padding: clamp(22px, 5vw, 54px);
  overflow: hidden;
  border: 1px solid #e0e5ec;
  border-radius: 19px;
  background:
    linear-gradient(45deg, #f5f7fa 25%, transparent 25%),
    linear-gradient(-45deg, #f5f7fa 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f5f7fa 75%),
    linear-gradient(-45deg, transparent 75%, #f5f7fa 75%),
    #fff;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
}

.wfg-flag-stage img {
  display: block;
  width: 100%;
  height: 280px;
  object-fit: contain;
  filter: drop-shadow(0 10px 12px rgba(30, 39, 51, .18));
}

.wfg-flag-loading,
.wfg-flag-error {
  max-width: 320px;
  margin: 0;
  padding: 14px 18px;
  border-radius: 13px;
  background: rgba(255, 255, 255, .94);
  color: var(--wfg-muted);
  font-weight: 800;
  line-height: 1.65;
  text-align: center;
}

.wfg-flag-error {
  color: var(--wfg-red);
}

.wfg-answer-column {
  padding: clamp(19px, 3vw, 26px);
}

.wfg-completion-status {
  margin: 16px 0;
  padding: 12px 16px;
  border: 1px solid #b9d3f3;
  border-radius: 14px;
  background: #eef6ff;
  color: var(--wfg-blue-dark);
  font-size: 14px;
  line-height: 1.6;
}

.wfg-completion-status:has(#completion-message:empty) { display: none; }
.wfg-completion-status p { margin: 0; }
.wfg-completion-status button { margin-top: 10px; }

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

.wfg-answer-button {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 62px;
  padding: 13px 50px 13px 17px;
  border: 2px solid #cfd8e5;
  border-radius: 15px;
  background: #fff;
  color: var(--wfg-ink);
  font-size: 16px;
  font-weight: 900;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease, transform .16s ease;
}

.wfg-answer-button:hover:not(:disabled) {
  border-color: var(--wfg-blue);
  background: #f2f7ff;
  transform: translateX(2px);
}

.wfg-answer-button:disabled {
  color: var(--wfg-ink);
  cursor: default;
  opacity: 1;
}

.wfg-answer-button.is-correct {
  border-color: var(--wfg-green);
  background: var(--wfg-green-soft);
  color: #0d613b;
  animation: wfg-correct-pop .3s ease-out;
}

.wfg-answer-button.is-wrong {
  border-color: var(--wfg-red);
  background: var(--wfg-red-soft);
  color: #8c2929;
}

.wfg-answer-button.is-correct::after,
.wfg-answer-button.is-wrong::after {
  position: absolute;
  right: 16px;
  top: 50%;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  transform: translateY(-50%);
  color: #fff;
  font-size: 17px;
  font-weight: 900;
}

.wfg-answer-button.is-correct::after {
  content: "✓";
  background: var(--wfg-green);
}

.wfg-answer-button.is-wrong::after {
  content: "×";
  background: var(--wfg-red);
}

.wfg-answer-panel {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--wfg-line);
  border-radius: 18px;
  background: #fff;
}

/* Older cached scripts toggle the existing feedback, not its new wrapper. */
.wfg-answer-panel:has(.wfg-feedback[hidden]) {
  display: none;
}

.wfg-feedback {
  padding: 15px 17px;
  border-radius: 15px;
  background: var(--wfg-green-soft);
  color: #0d613b;
  line-height: 1.55;
}

.wfg-feedback[data-result="wrong"] {
  background: var(--wfg-red-soft);
  color: #8c2929;
}

.wfg-feedback strong,
.wfg-feedback span {
  display: block;
}

.wfg-feedback strong {
  font-size: 21px;
}

.wfg-feedback span {
  margin-top: 3px;
  font-size: 14px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.wfg-country-info {
  margin-top: 16px;
  padding: 17px;
  border: 1px solid #cfd8e5;
  border-radius: 17px;
  background: #f7f9fc;
}

.wfg-country-info__heading {
  display: flex;
  gap: 11px;
  align-items: center;
}

.wfg-country-info__heading > span {
  font-size: 25px;
}

.wfg-country-info__heading p {
  margin: 0;
  color: var(--wfg-muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .12em;
}

.wfg-country-info h2 {
  margin: 2px 0 0;
  font-size: 22px;
}

.wfg-country-info dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 0;
}

.wfg-country-info dl div {
  padding: 11px;
  border-radius: 12px;
  background: #fff;
}

.wfg-country-info dt {
  color: var(--wfg-muted);
  font-size: 11px;
  font-weight: 800;
}

.wfg-country-info dd {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.45;
}

.wfg-country-info__note {
  margin: 12px 0 0;
  padding-top: 11px;
  border-top: 1px solid #dce3ec;
  color: #526078;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.65;
}

.wfg-next-button {
  width: 100%;
  margin-top: 16px;
}

.wfg-result {
  max-width: 1050px;
  margin: 0 auto;
}

.wfg-result > h1 {
  font-size: clamp(42px, 6vw, 68px);
}

.wfg-result-message {
  margin: 15px 0 26px;
  color: var(--wfg-muted);
  font-size: 18px;
  font-weight: 800;
}

.wfg-result-summary {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 30px;
  align-items: center;
  padding: 26px;
}

.wfg-score-ring {
  display: grid;
  place-content: center;
  width: 150px;
  height: 150px;
  margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle closest-side, #fff 78%, transparent 79%), conic-gradient(var(--wfg-green) var(--result-angle, 0deg), #e2e8f0 0);
  text-align: center;
}

.wfg-score-ring strong,
.wfg-score-ring span {
  display: block;
}

.wfg-score-ring strong {
  font-size: 35px;
}

.wfg-score-ring span {
  color: var(--wfg-muted);
  font-size: 12px;
  font-weight: 800;
}

.wfg-result-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  border: 1px solid var(--wfg-line);
  border-radius: 17px;
  background: #f8fafc;
}

.wfg-result-stats div {
  min-width: 0;
  padding: 18px 15px;
}

.wfg-result-stats div + div {
  border-left: 1px solid var(--wfg-line);
}

.wfg-result-stats dt {
  color: var(--wfg-muted);
  font-size: 11px;
  font-weight: 800;
}

.wfg-result-stats dd {
  margin: 6px 0 0;
  font-size: 19px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.wfg-result-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.wfg-result-lists > section {
  padding: 22px;
}

.wfg-result-lists h2 {
  margin: 0 0 15px;
  font-size: 20px;
}

.wfg-result-lists h2 span {
  color: var(--wfg-green);
}

.wfg-result-lists > section:last-child h2 span {
  color: var(--wfg-red);
}

.wfg-country-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.wfg-country-chips li {
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--wfg-green-soft);
  color: #0d613b;
  font-size: 13px;
  font-weight: 800;
}

.wfg-country-chips--wrong li {
  background: var(--wfg-red-soft);
  color: #8c2929;
}

.wfg-country-chips li.wfg-empty-item {
  background: #f1f4f8;
  color: var(--wfg-muted);
}

.wfg-result-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.wfg-small-label {
  margin: 0 0 4px;
  color: var(--wfg-blue-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
}

.wfg-learning-hub {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--wfg-line);
}

.wfg-learning-hub__heading {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.wfg-learning-hub h2 {
  margin: 0;
  font-size: 20px;
}

.wfg-learning-hub__heading > strong,
.wfg-discovery-total {
  padding: 8px 12px;
  border-radius: 999px;
  background: #edf5ff;
  color: var(--wfg-blue-dark);
  font-size: 12px;
  white-space: nowrap;
}

.wfg-learning-hub__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 14px;
}

.wfg-learning-hub__actions .wfg-button {
  min-height: 48px;
  padding: 10px;
  font-size: 12px;
}

.wfg-learning-hub__actions .wfg-button span {
  display: inline-grid;
  place-content: center;
  min-width: 24px;
  height: 24px;
  margin-left: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .75);
}

.wfg-learning-hub__empty {
  margin: 10px 0 0;
  color: var(--wfg-muted);
  font-size: 12px;
  font-weight: 700;
}

.wfg-screen-heading {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 26px;
}

.wfg-screen-heading h1 {
  margin: 0;
  font-size: clamp(42px, 7vw, 72px);
  line-height: 1.08;
  letter-spacing: -.05em;
}

.wfg-screen-heading p:last-child {
  max-width: 720px;
  margin: 13px 0 0;
  color: var(--wfg-muted);
  font-weight: 700;
  line-height: 1.75;
}

.wfg-discovery-total {
  flex: 0 0 auto;
  padding: 11px 15px;
  font-size: 14px;
}

.wfg-catalog-tools {
  display: grid;
  grid-template-columns: minmax(220px, .75fr) minmax(0, 1.25fr);
  gap: 16px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--wfg-line);
  border-radius: 20px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 10px 30px rgba(33, 54, 83, .07);
}

.wfg-search-field {
  display: grid;
  gap: 7px;
  color: #45546a;
  font-size: 12px;
  font-weight: 900;
}

.wfg-search-field input {
  width: 100%;
  min-height: 48px;
  padding: 10px 13px;
  border: 2px solid #ccd6e4;
  border-radius: 13px;
  background: #fff;
  color: var(--wfg-ink);
}

.wfg-filter-group {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.wfg-filter-group button {
  min-height: 48px;
  padding: 8px;
  border: 2px solid #d7dfe9;
  border-radius: 13px;
  background: #fff;
  color: #45546a;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.wfg-filter-group button[aria-pressed="true"] {
  border-color: var(--wfg-blue);
  background: #edf5ff;
  color: var(--wfg-blue-dark);
}

.wfg-filter-selected {
  display: none;
}

.wfg-filter-group button[aria-pressed="true"] .wfg-filter-selected {
  display: inline;
}

.wfg-catalog-status {
  min-height: 24px;
  margin: 14px 2px;
  color: var(--wfg-muted);
  font-size: 13px;
  font-weight: 800;
}

.wfg-country-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.wfg-country-card {
  min-width: 0;
  padding: 0;
  border: 2px solid var(--wfg-line);
  border-radius: 18px;
  background: #fff;
  color: var(--wfg-ink);
  text-align: left;
  box-shadow: 0 8px 24px rgba(33, 54, 83, .07);
  cursor: pointer;
  overflow: hidden;
  content-visibility: auto;
  contain-intrinsic-size: 260px;
}

.wfg-country-card:hover {
  border-color: #8eb9ec;
  transform: translateY(-1px);
}

.wfg-country-card__flag {
  display: grid;
  place-content: center;
  height: 132px;
  padding: 14px;
  border-bottom: 1px solid var(--wfg-line);
  background: #f3f6fa;
}

.wfg-country-card__flag img {
  display: block;
  width: 100%;
  height: 100px;
  object-fit: contain;
}

.wfg-country-card__flag span {
  color: var(--wfg-muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.wfg-country-card__body {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 14px;
}

.wfg-country-card__body strong {
  overflow-wrap: anywhere;
}

.wfg-country-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wfg-state-badge {
  padding: 5px 7px;
  border-radius: 999px;
  background: #f1f4f8;
  color: #59667a;
  font-size: 10px;
  font-weight: 900;
}

.wfg-state-badge[data-state="discovered"] {
  background: var(--wfg-green-soft);
  color: #0d613b;
}

.wfg-state-badge[data-state="weak"] {
  background: #fff1d8;
  color: #7b5300;
}

.wfg-country-card__score {
  color: var(--wfg-muted);
  font-size: 11px;
  font-weight: 800;
}

.wfg-load-more-wrap {
  display: grid;
  place-content: center;
  margin-top: 20px;
}

.wfg-page-actions,
.wfg-record-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.wfg-page-actions .wfg-button,
.wfg-record-review-actions .wfg-button {
  min-width: 180px;
}

.wfg-learning-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  border: 1px solid var(--wfg-line);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--wfg-shadow);
  overflow: hidden;
}

.wfg-learning-summary div {
  min-width: 0;
  padding: 22px 18px;
  border-right: 1px solid var(--wfg-line);
  border-bottom: 1px solid var(--wfg-line);
}

.wfg-learning-summary div:nth-child(4n) {
  border-right: 0;
}

.wfg-learning-summary dt {
  color: var(--wfg-muted);
  font-size: 11px;
  font-weight: 800;
}

.wfg-learning-summary dd {
  margin: 7px 0 0;
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.wfg-record-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 22px;
}

.wfg-record-columns > section {
  padding: 22px;
  border: 1px solid var(--wfg-line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(33, 54, 83, .07);
}

.wfg-record-columns h2 {
  margin: 0 0 15px;
  font-size: 21px;
}

.wfg-record-list {
  display: grid;
  gap: 9px;
}

.wfg-record-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 12px;
  border-radius: 12px;
  background: #f3f6fa;
}

.wfg-record-row strong {
  overflow-wrap: anywhere;
}

.wfg-record-row span {
  color: var(--wfg-muted);
  font-size: 11px;
  font-weight: 800;
  text-align: right;
}

.wfg-record-empty {
  margin: 0;
  padding: 18px;
  border-radius: 12px;
  background: #f3f6fa;
  color: var(--wfg-muted);
  font-size: 13px;
  font-weight: 800;
}

.wfg-country-dialog {
  width: min(680px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: 24px;
  box-shadow: 0 28px 80px rgba(14, 24, 38, .35);
  overflow: auto;
}

.wfg-country-dialog::backdrop {
  background: rgba(17, 29, 46, .65);
  backdrop-filter: blur(2px);
}

.wfg-country-dialog__body {
  position: relative;
  padding: clamp(20px, 5vw, 34px);
}

.wfg-country-dialog__close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--wfg-line);
  border-radius: 50%;
  background: #fff;
  color: var(--wfg-ink);
  font-size: 24px;
  cursor: pointer;
}

.wfg-country-detail__flag {
  display: grid;
  place-content: center;
  min-height: 210px;
  padding: 58px 22px 22px;
  border-radius: 18px;
  background: #f3f6fa;
}

.wfg-country-detail__flag img {
  width: 100%;
  height: 180px;
  object-fit: contain;
}

.wfg-country-detail__flag p {
  margin: 0;
  color: var(--wfg-muted);
  font-weight: 800;
  text-align: center;
}

.wfg-country-detail__status {
  display: inline-block;
  margin: 18px 0 8px;
  padding: 6px 9px;
  border-radius: 999px;
  background: #edf5ff;
  color: var(--wfg-blue-dark);
  font-size: 11px;
  font-weight: 900;
}

.wfg-country-dialog h2 {
  margin: 0;
  font-size: clamp(30px, 6vw, 44px);
  overflow-wrap: anywhere;
}

.wfg-country-detail__official {
  margin: 7px 0 20px;
  color: var(--wfg-muted);
  font-weight: 700;
}

.wfg-country-detail__facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border: 1px solid var(--wfg-line);
  border-radius: 15px;
  overflow: hidden;
}

.wfg-country-detail__facts div {
  min-width: 0;
  padding: 13px;
  border-right: 1px solid var(--wfg-line);
  border-bottom: 1px solid var(--wfg-line);
}

.wfg-country-detail__facts div:nth-child(even) {
  border-right: 0;
}

.wfg-country-detail__facts dt {
  color: var(--wfg-muted);
  font-size: 10px;
  font-weight: 800;
}

.wfg-country-detail__facts dd {
  margin: 5px 0 0;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.wfg-country-detail__note {
  margin: 18px 0 0;
  padding: 14px;
  border-radius: 13px;
  background: #fff7dd;
  color: #75550f;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.7;
}

.wfg-footer {
  padding: 22px 20px 36px;
  border-top: 1px solid #e7dfd4;
  text-align: center;
}

.wfg-footer a {
  color: #5b6574;
  font-size: 12px;
  font-weight: 700;
}

.wfg-dialog {
  width: min(440px, calc(100% - 30px));
  padding: 0;
  border: 0;
  border-radius: 22px;
  box-shadow: 0 28px 80px rgba(14, 24, 38, .35);
}

.wfg-dialog::backdrop {
  background: rgba(17, 29, 46, .65);
  backdrop-filter: blur(2px);
}

.wfg-dialog form {
  padding: 28px;
  text-align: center;
}

.wfg-dialog__icon {
  margin: 0;
  font-size: 36px;
}

.wfg-dialog h2 {
  margin: 9px 0;
  font-size: 24px;
}

.wfg-dialog #confirm-description {
  margin: 0;
  color: var(--wfg-muted);
  font-weight: 700;
  line-height: 1.65;
}

.wfg-dialog__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.wfg-button:focus-visible,
.wfg-answer-button:focus-visible,
.wfg-header-action:focus-visible,
.wfg-country-card:focus-visible,
.wfg-filter-group button:focus-visible,
.wfg-search-field input:focus-visible,
.wfg-country-dialog__close:focus-visible,
.wfg-footer a:focus-visible {
  outline: 4px solid #f4b400;
  outline-offset: 3px;
}

.wfg-feedback:focus {
  outline: 4px solid #f4b400;
  outline-offset: 3px;
}

@keyframes wfg-screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes wfg-correct-pop {
  50% { transform: scale(1.025); }
}

@media (max-width: 940px) {
  .wfg-start {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .wfg-start__copy {
    max-width: 720px;
  }

  .wfg-quiz-layout {
    grid-template-columns: 1fr;
  }

  .wfg-flag-stage {
    min-height: 340px;
  }

  .wfg-flag-stage img {
    height: 240px;
  }

  .wfg-country-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .wfg-learning-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wfg-learning-summary div,
  .wfg-learning-summary div:nth-child(4n) {
    border-right: 1px solid var(--wfg-line);
  }

  .wfg-learning-summary div:nth-child(even) {
    border-right: 0;
  }
}

/* Keep the verdict and action together. Sticky preserves the panel's actual
   flow height, so details remain reachable even with wrapped/zoomed text. */
@media (max-width: 940px), (max-height: 540px) and (pointer: coarse) {
  .wfg-answer-panel {
    position: sticky;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 3;
    padding: 10px;
    box-shadow: 0 8px 24px rgba(17, 79, 155, .2);
  }

  .wfg-answer-panel .wfg-feedback {
    padding: 9px 12px;
  }

  .wfg-answer-panel .wfg-feedback strong {
    font-size: 18px;
  }

  .wfg-answer-panel .wfg-next-button {
    margin-top: 8px;
    min-height: 48px;
  }
}

@media (max-width: 680px) {
  .wfg-main {
    width: min(100% - 24px, 1180px);
    padding: 28px 0 42px;
  }

  .wfg-start {
    gap: 28px;
  }

  .wfg-start h1 {
    font-size: clamp(43px, 14vw, 62px);
  }

  .wfg-feature-list {
    display: grid;
  }

  .wfg-mode-grid {
    grid-template-columns: 1fr;
  }

  .wfg-mode-card {
    min-height: 76px;
  }

  .wfg-quiz-status {
    align-items: flex-end;
  }

  .wfg-quiz-status > div {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .wfg-flag-card,
  .wfg-answer-column {
    border-radius: 20px;
  }

  .wfg-flag-stage {
    min-height: 250px;
    padding: 20px;
  }

  .wfg-flag-stage img {
    height: 205px;
  }

  .wfg-answer-button {
    min-height: 60px;
    font-size: 15px;
  }

  .wfg-country-info dl {
    grid-template-columns: 1fr;
  }

  .wfg-result-summary {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .wfg-result-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wfg-result-stats div + div {
    border-left: 0;
  }

  .wfg-result-stats div:nth-child(even) {
    border-left: 1px solid var(--wfg-line);
  }

  .wfg-result-stats div:nth-child(n+3) {
    border-top: 1px solid var(--wfg-line);
  }

  .wfg-result-lists {
    grid-template-columns: 1fr;
  }

  .wfg-result-actions {
    grid-template-columns: 1fr;
  }

  .wfg-screen-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .wfg-catalog-tools {
    grid-template-columns: 1fr;
  }

  .wfg-filter-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wfg-country-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wfg-record-columns {
    grid-template-columns: 1fr;
  }

  .wfg-page-actions,
  .wfg-record-review-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .wfg-page-actions .wfg-button,
  .wfg-record-review-actions .wfg-button {
    min-width: 0;
  }

  .wfg-header-action {
    min-height: 44px;
    padding: 6px 9px;
    font-size: 11px;
  }
}

@media (max-width: 390px) {
  .wfg-start__panel,
  .wfg-flag-card,
  .wfg-answer-column,
  .wfg-result-summary,
  .wfg-result-lists > section {
    border-radius: 17px;
  }

  .wfg-start__panel {
    padding: 18px;
  }

  .wfg-flag-stage {
    min-height: 215px;
  }

  .wfg-flag-stage img {
    height: 175px;
  }

  .wfg-dialog__actions {
    grid-template-columns: 1fr;
  }

  .wfg-learning-hub__heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .wfg-learning-hub__actions,
  .wfg-country-grid,
  .wfg-learning-summary,
  .wfg-country-detail__facts {
    grid-template-columns: 1fr;
  }

  .wfg-learning-summary div,
  .wfg-learning-summary div:nth-child(even),
  .wfg-learning-summary div:nth-child(4n),
  .wfg-country-detail__facts div,
  .wfg-country-detail__facts div:nth-child(even) {
    border-right: 0;
  }

  .wfg-country-card__flag {
    height: 145px;
  }

  .wfg-country-card__flag img {
    height: 110px;
  }

  .wfg-record-row {
    grid-template-columns: 1fr;
  }

  .wfg-record-row span {
    text-align: left;
  }
}

@media (min-width: 681px) and (max-height: 620px) and (orientation: landscape) {
  .wfg-main {
    padding-top: 22px;
  }

  .wfg-quiz-layout {
    grid-template-columns: minmax(0, .95fr) minmax(380px, 1.05fr);
  }

  .wfg-flag-stage {
    min-height: 260px;
  }

  .wfg-flag-stage img {
    height: 205px;
  }
}

/* Keep the flag and all four choices together, including when the browser's
   address bar is open. Extra text may grow naturally; never clip an answer. */
@media (max-width: 940px), (max-height: 540px) and (orientation: landscape) {
  .wfg-main:has(#screen-quiz:not([hidden])) {
    display: flex;
    flex-direction: column;
    width: min(1100px, calc(100% - 24px));
    min-height: 0;
    padding: 8px 0 20px;
  }

  /* Discovery notices must not push the next question below the viewport.
     Storage warnings retain their prominent position above the game. */
  .wfg-main:has(#screen-quiz:not([hidden])) .wfg-storage-status[data-tone="info"] {
    order: 1;
    margin: 12px 0 0;
  }

  .wfg-quiz-status {
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
  }

  .wfg-quiz-status > div {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
  }

  .wfg-mode-badge {
    padding: 5px 8px;
    font-size: 11px;
  }

  .wfg-progress { height: 6px; }

  .wfg-quiz-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin-top: 10px;
  }

  .wfg-flag-card,
  .wfg-answer-column {
    min-width: 0;
    padding: 10px;
    border-radius: 18px;
  }

  .wfg-question-label { display: none; }

  .wfg-flag-card h1 {
    margin: 0 0 8px;
    font-size: 20px;
    line-height: 1.2;
  }

  .wfg-flag-stage {
    height: clamp(96px, calc(100vh - var(--dm-common-header-height, 98px) - 390px), 240px);
    height: clamp(96px, calc(100svh - var(--dm-common-header-height, 98px) - 390px), 240px);
    min-height: 0;
    padding: 8px;
    border-radius: 12px;
  }

  .wfg-flag-stage img {
    height: 100%;
    min-height: 0;
    max-height: 100%;
    filter: drop-shadow(0 3px 5px rgba(30, 39, 51, .16));
  }

  .wfg-flag-loading,
  .wfg-flag-error {
    padding: 6px;
    font-size: 13px;
    line-height: 1.4;
  }

  .wfg-answer-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .wfg-answer-button {
    min-height: 60px;
    padding: 10px 28px 10px 10px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }

  .wfg-answer-button.is-correct::after,
  .wfg-answer-button.is-wrong::after {
    right: 5px;
    width: 20px;
    height: 20px;
    font-size: 14px;
  }

  .wfg-answer-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 6px;
    border-radius: 12px;
  }

  .wfg-answer-panel .wfg-feedback {
    min-width: 0;
    padding: 6px;
    line-height: 1.4;
  }

  .wfg-answer-panel .wfg-feedback strong { font-size: 16px; }
  .wfg-answer-panel .wfg-feedback span { font-size: 13px; }

  .wfg-answer-panel .wfg-next-button {
    min-height: 48px;
    margin-top: 0;
    padding: 10px;
    font-size: 13px;
  }
}

@media (min-width: 540px) and (max-height: 540px) and (orientation: landscape) {
  .wfg-quiz-layout {
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  }

  .wfg-flag-stage {
    height: clamp(80px, calc(100vh - var(--dm-common-header-height, 58px) - 150px), 240px);
    height: clamp(80px, calc(100svh - var(--dm-common-header-height, 58px) - 150px), 240px);
  }

  .wfg-answer-button { min-height: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
