@font-face { font-family: "Kanit"; src: url("assets/fonts/Kanit-Light.ttf") format("truetype"); font-weight: 300; }
@font-face { font-family: "Kanit"; src: url("assets/fonts/Kanit-Regular.ttf") format("truetype"); font-weight: 400; }
@font-face { font-family: "Kanit"; src: url("assets/fonts/Kanit-SemiBold.ttf") format("truetype"); font-weight: 600; }
@font-face { font-family: "Kanit"; src: url("assets/fonts/Kanit-SemiBold.ttf") format("truetype"); font-weight: 700; }

:root {
  --bg: #faf9f6;
  --ink: #2e2e2e;
  --muted: #6b6b6b;
  --card-bg: #ffffff;
  --border: #e7e3dc;
  --teal: #4fc2c0;
  --teal-deep: #2f9c97;
  --gold: #fec566;
  --gold-deep: #e0a73e;
  --dark: #414141;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: "Kanit", "Noto Sans Thai", "Segoe UI", sans-serif;
  font-weight: 300;
  color: var(--ink);
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(254, 197, 102, 0.35), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, #eaf7f6 55%, #d8f0ee 100%);
  background-attachment: fixed;
}

.app { max-width: 880px; margin: 0 auto; padding: 0 20px 80px; }

/* persistent mini brand strip — stays visible through quiz scroll */
.mini-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  background: rgba(250, 249, 246, 0.82);
  backdrop-filter: blur(6px);
  margin: 0 -20px 8px;
  padding-left: 20px;
}
.mini-header img { width: 22px; height: 22px; object-fit: contain; }
.mini-header span { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; color: var(--teal-deep); text-transform: uppercase; }

.app-header { text-align: center; margin: 18px 0 28px; }
.brand-logo { width: 56px; height: auto; margin-bottom: 6px; filter: drop-shadow(0 6px 14px rgba(47, 156, 151, 0.25)); }
.brand { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--teal-deep); font-weight: 700; }
.app-header h1 { font-size: 28px; font-weight: 600; margin: 6px 0 10px; color: var(--dark); }
.subtitle { color: var(--muted); margin: 0; font-size: 15px; font-weight: 300; }

.screen { display: none; }
.screen.active { display: block; }

/* ===== Top-level tabs ===== */
.main-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 0 0 18px;
}
.main-tabs.hidden { display: none; }
.main-tab {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.6);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.main-tab:hover { border-color: var(--teal); color: var(--teal-deep); }
.main-tab.is-active {
  background: linear-gradient(180deg, var(--teal), var(--teal-deep));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px rgba(47, 156, 151, 0.28);
}

.card {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 10px 28px rgba(47, 156, 151, 0.1);
}

.intro-card { text-align: center; }
.intro-card p { color: var(--muted); line-height: 1.6; }

.btn-primary, .btn-secondary {
  display: inline-block;
  font-family: inherit;
  border: none;
  border-radius: 999px;
  padding: 13px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.btn-primary {
  background: linear-gradient(180deg, var(--teal), var(--teal-deep));
  color: #fff;
  box-shadow: 0 8px 20px rgba(47, 156, 151, 0.32);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(47, 156, 151, 0.4); }
.btn-primary:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn-secondary { background: transparent; border: 1.5px solid var(--border); color: var(--dark); }
.btn-secondary:hover { background: #f1efe9; }
.btn-secondary:disabled { opacity: 0.55; cursor: default; }
.btn-link {
  display: block;
  margin: 12px auto 0;
  background: none;
  border: none;
  color: var(--teal-deep);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.progress-track {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  width: 0%;
  transition: width 0.25s ease;
}
.progress-label { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

.question-text { font-size: 19px; font-weight: 600; margin: 0 0 18px; line-height: 1.5; color: var(--dark); }

.option-btn {
  display: block;
  width: 100%;
  font-family: inherit;
  text-align: left;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 300;
  margin-bottom: 10px;
  cursor: pointer;
  color: var(--ink);
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.option-btn:hover { border-color: var(--teal); background: #f0fbfa; transform: translateY(-1px); }

.options-grid-9 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.options-grid-9 .option-btn { text-align: center; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.option-thumb { width: 56px; height: 56px; object-fit: contain; }
.q-note { color: var(--muted); font-size: 12.5px; margin: -10px 0 14px; }

@media (max-width: 720px) {
  .options-grid-9 { grid-template-columns: repeat(2, 1fr); }
}

.results-summary h2 { margin: 0 0 8px; color: var(--dark); font-weight: 600; }
#top-moves-text { color: var(--muted); line-height: 1.6; margin: 0; }

.matrix-card h3 { margin: 0 0 14px; }
#matrix-wrap { display: flex; justify-content: center; overflow-x: auto; }
.matrix-hint { text-align: center; color: var(--muted); font-size: 13px; margin: 14px 0 0; }

#top-detail-card h3, #growth-detail-card h3 { margin: 0 0 14px; font-size: 17px; color: var(--dark); font-weight: 600; }

.detail-row {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.detail-row:first-child { border-top: none; padding-top: 0; }
.detail-thumb { width: 56px; height: 56px; object-fit: contain; flex: none; }
.detail-body { flex: 1; }
.detail-name { font-weight: 600; margin: 0 0 4px; color: var(--dark); }
.detail-guide { color: var(--muted); font-size: 14px; margin: 0 0 8px; line-height: 1.5; font-weight: 300; }
.detail-activity {
  background: #f5fbfa;
  border-left: 3px solid var(--teal);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--dark);
}
#growth-detail-card .detail-activity { background: #fdf6ea; border-left-color: var(--gold); }

.center { text-align: center; }
.sub { color: var(--muted); font-size: 14px; margin: 4px 0 14px; }
.share-actions { display: flex; gap: 10px; justify-content: center; margin-top: 6px; flex-wrap: wrap; }
.share-actions button { margin-top: 0; flex: 1 1 150px; max-width: 220px; }
.share-actions .hidden-share { display: none; }

.ecosystem-card h3 { margin: 0 0 8px; font-size: 17px; color: var(--dark); font-weight: 600; }
.tool-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.tool-links a {
  display: block;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  text-align: left;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.tool-links a:hover { border-color: var(--teal); background: #f0fbfa; transform: translateY(-1px); }
.tool-links strong { display: block; color: var(--teal-deep); font-weight: 700; margin-bottom: 4px; }
.tool-links span { display: block; color: var(--muted); font-size: 13px; line-height: 1.45; }

@media (max-width: 720px) {
  .tool-links { grid-template-columns: 1fr; }
}

/* ===== Matrix grid (3x3, big character cards) ===== */
.matrix-table { border-collapse: collapse; }
.matrix-table th { font-size: 11px; color: var(--muted); font-weight: 700; padding: 8px 4px; }
.matrix-row-label { font-size: 11px; color: var(--muted); font-weight: 700; padding: 4px 8px; max-width: 70px; }
.matrix-cell { width: 108px; padding: 6px; vertical-align: top; text-align: center; }

.matrix-name { font-size: 11px; color: var(--muted); font-weight: 600; margin: 5px 0 0; }

.matrix-bubble {
  position: relative;
  width: 100%;
  height: 108px;
  border-radius: 16px;
  background: #fff;
  border: 3px solid #d9d4c8;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.matrix-bubble img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.matrix-bubble.is-zero img { filter: grayscale(1); opacity: 0.45; }
.matrix-bubble.is-zero::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 13px;
  background: rgba(150, 148, 140, 0.38);
}
.matrix-bubble.is-top {
  border-color: var(--gold);
  border-width: 4px;
  box-shadow: 0 0 0 4px rgba(254, 197, 102, 0.25);
}
.matrix-star {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  z-index: 2;
}

@media (max-width: 720px) {
  .matrix-cell { width: 78px; height: 78px; }
}

#btn-restart { display: block; margin: 0 auto; }

/* ===== Learn screen =====
   Kept at the end of the file: several rules here intentionally refine the
   generic .card styles above, so they must win on source order. */
.card h2 { margin: 0 0 10px; font-size: 21px; font-weight: 600; color: var(--dark); }
.card > h3 { margin: 0 0 12px; font-size: 17px; font-weight: 600; color: var(--dark); }
.card > p { line-height: 1.65; color: var(--muted); }
.card .lead { font-size: 15.5px; color: var(--ink); }
.card strong { color: var(--teal-deep); font-weight: 600; }
.card em { font-style: normal; font-weight: 600; color: var(--dark); }

.matrix-scroll { display: flex; justify-content: center; overflow-x: auto; padding: 4px 0; }

.axis-block { margin-top: 18px; }
.axis-block h4 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--teal-deep);
}
.axis-list { list-style: none; margin: 0; padding: 0; }
.axis-list li {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  padding: 9px 0;
  border-top: 1px solid var(--border);
}
.axis-list li:first-child { border-top: none; padding-top: 0; }
.axis-key {
  display: block;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 2px;
}

.matrix-bubble.is-clickable { cursor: pointer; }
.matrix-bubble.is-clickable:hover,
.matrix-bubble.is-clickable:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(47, 156, 151, 0.25);
  outline: none;
}

.phase-heading { margin: 28px 0 12px; padding: 0 4px; }
.phase-heading h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--teal-deep);
}
.phase-heading p { margin: 0; font-size: 13.5px; color: var(--muted); }

.card.move-card {
  border-top: 4px solid var(--teal);
  scroll-margin-top: 60px;
  transition: box-shadow 0.3s, transform 0.3s;
}
.card.move-card.is-highlighted {
  box-shadow: 0 0 0 3px rgba(254, 197, 102, 0.6), 0 12px 30px rgba(47, 156, 151, 0.18);
  transform: translateY(-2px);
}
.move-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.move-img { width: 64px; height: 64px; object-fit: contain; flex: none; }
.move-name { font-size: 18px; font-weight: 600; color: var(--dark); }
.move-en { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.move-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.move-tags span {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
}
.card .move-guide { margin: 0 0 10px; font-size: 15px; color: var(--ink); line-height: 1.6; }
.card .move-detail { margin: 0 0 14px; font-size: 14px; line-height: 1.7; color: var(--muted); }
.move-activity {
  background: #f5fbfa;
  border-left: 3px solid var(--teal);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--dark);
  line-height: 1.6;
}

/* ===== Site footer ===== */
.site-footer {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.footer-logo { width: 34px; height: 34px; object-fit: contain; opacity: 0.85; }
.footer-lead {
  margin: 8px 0 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--teal-deep);
}
.footer-links {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--dark);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.footer-links a:hover {
  border-color: var(--teal);
  background: #f0fbfa;
  color: var(--teal-deep);
  transform: translateY(-1px);
}
.footer-note {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 720px) {
  .main-tab { font-size: 13px; padding: 8px 14px; }
  .move-img { width: 52px; height: 52px; }
  .move-name { font-size: 16px; }
  .footer-links { gap: 8px; }
  .footer-links a { padding: 10px 14px; font-size: 13px; }
}
