:root {
  color-scheme: light;
  --ink: #1d252c;
  --muted: #65727c;
  --paper: #fbfaf6;
  --line: #d9d4ca;
  --react: #d84b45;
  --react-soft: #fff0ee;
  --reframe: #f0c84b;
  --reframe-soft: #fff8d8;
  --respond: #3f9d6f;
  --respond-soft: #e8f8ed;
  --clinical: #2f7187;
  --companion: #775ca8;
  --community: #9a6a2d;
  --shadow: 0 14px 36px rgba(40, 37, 31, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  color-scheme: light;
  background: var(--paper);
}

body {
  margin: 0;
  min-width: 0;
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  background:
    linear-gradient(rgba(251, 250, 246, 0.92), rgba(251, 250, 246, 0.96)),
    url("wordicine-logo.jpeg") center top / 760px auto fixed;
}

button,
a {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(16px, 3vw, 36px);
  background: rgba(251, 250, 246, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand img {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  object-fit: contain;
  border: 1px solid var(--line);
  background: #fffefa;
}

.brand p,
.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand h1,
.intro h2,
.game-header h2 {
  margin: 0;
  line-height: 1.05;
}

.brand h1 {
  font-size: clamp(1.08rem, 2.3vw, 1.85rem);
}

nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

nav button,
.filter,
#nextBtn {
  min-height: 38px;
  padding: 8px 13px;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  cursor: pointer;
}

nav button:hover,
.filter:hover,
#nextBtn:hover {
  border-color: #a9a197;
}

.nav-tab.active {
  color: #fff;
  border-color: var(--ink);
  background: var(--ink);
}

main {
  padding: 24px clamp(14px, 3vw, 40px) 60px;
}

.intro,
.game-shell,
.page-heading,
.section-preview,
#sectionPage {
  max-width: 1500px;
  margin: 0 auto 22px;
}

.view {
  display: none;
}

.view.active-view {
  display: block;
}

.intro {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
}

.intro h2,
.game-header h2 {
  font-size: clamp(1.5rem, 3vw, 3rem);
}

.legend,
.filters,
.game-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.86);
  font-weight: 700;
}

.swatch {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  display: inline-block;
}

.swatch.react {
  background: var(--react);
}

.swatch.reframe {
  background: var(--reframe);
}

.swatch.respond {
  background: var(--respond);
}

.wall,
.section-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(300px, 1fr));
  gap: 18px;
  max-width: 1500px;
  margin: 0 auto 36px;
}

.section-preview {
  margin-bottom: 22px;
}

.section {
  background: rgba(255, 254, 250, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.preview-section,
.section-page {
  background: rgba(255, 254, 250, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.section-header {
  padding: 15px;
  color: #fff;
}

.section-header button,
.section-actions button {
  min-height: 38px;
  padding: 8px 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  cursor: pointer;
}

.section-actions {
  display: flex;
  justify-content: center;
  padding: 0 14px 16px;
}

.section-actions button {
  font-weight: 800;
}

.section-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.section-header p {
  margin: 5px 0 0;
  opacity: 0.9;
}

.clinical .section-header {
  background: var(--clinical);
}

.companion .section-header {
  background: var(--companion);
}

.community .section-header {
  background: var(--community);
}

.triples {
  display: grid;
  gap: 13px;
  padding: 14px;
  overflow: visible;
}

.section-page .triples {
  grid-template-columns: repeat(3, minmax(250px, 1fr));
}

.triple {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px;
  border: 1px solid #e5e0d7;
  border-radius: 8px;
  background: #fffefa;
}

.preview-section .triple {
  margin: 14px;
}

.hidden-card {
  display: none;
}

.code-strip {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.79rem;
  font-weight: 800;
}

.mini-card,
.prompt-card,
.choice {
  border-radius: 8px;
  border: 2px solid transparent;
  padding: 11px;
}

.mini-card strong,
.prompt-card span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.76rem;
  text-transform: uppercase;
}

.mini-card p,
.prompt-card p {
  margin: 0;
  line-height: 1.36;
}

.mini-card em {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
  line-height: 1.25;
}

.mini-card.react-card,
.prompt-card.react-card {
  background: var(--react-soft);
  border-color: var(--react);
}

.mini-card.reframe-card,
.choice.reframe-card {
  background: var(--reframe-soft);
  border-color: var(--reframe);
}

.mini-card.respond-card,
.choice.respond-card {
  background: var(--respond-soft);
  border-color: var(--respond);
}

.game-shell {
  position: relative;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.92);
  box-shadow: var(--shadow);
}

.game-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.filter.active {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.game-board {
  display: grid;
  grid-template-columns: minmax(230px, 0.8fr) minmax(300px, 1.7fr);
  gap: 16px;
  align-items: stretch;
}

.prompt-card {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.prompt-card h3 {
  margin: 0 0 12px;
  font-size: clamp(1.35rem, 2.6vw, 2.2rem);
  line-height: 1.08;
}

.prompt-card p {
  color: var(--muted);
  font-weight: 800;
}

.choice-zone {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.choice-column {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 9px;
}

.choice-column h3 {
  margin: 0;
  font-size: 1rem;
}

.choices {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.choice {
  min-height: 86px;
  text-align: left;
  line-height: 1.32;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.choice:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(35, 34, 29, 0.12);
}

.choice.selected {
  outline: 3px solid rgba(29, 37, 44, 0.28);
}

.choice.correct {
  animation: hinge 420ms ease;
  box-shadow: 0 0 0 4px rgba(35, 145, 88, 0.18);
}

.choice.wrong {
  animation: shake 260ms ease;
  border-color: #b92f2f;
  box-shadow: 0 0 0 4px rgba(185, 47, 47, 0.16);
}

.choice:disabled {
  cursor: default;
  opacity: 0.86;
}

.choice:disabled:hover {
  transform: none;
  box-shadow: none;
}

.game-status {
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.game-status span {
  color: var(--muted);
}

.result-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  color: var(--muted);
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.result-panel strong {
  min-width: 74px;
  color: var(--ink);
  font-size: 0.92rem;
  text-align: center;
}

.result-panel.correct {
  border-color: var(--respond);
  background: #e6f8ed;
  color: #1f6644;
}

.result-panel.wrong {
  border-color: var(--react);
  background: #fff0ee;
  color: #96322e;
}

.result-panel.retry {
  border-color: var(--reframe);
  background: #fff8d8;
  color: #795e0e;
}

.burst {
  position: fixed;
  left: 50%;
  top: 45%;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.7);
  font-size: clamp(4rem, 12vw, 9rem);
  font-weight: 900;
  color: #1c9157;
  text-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
}

.burst.show {
  animation: burst 1800ms ease;
}

@keyframes burst {
  0% {
    opacity: 0;
    transform: translate(-50%, -45%) scale(0.5) rotate(-7deg);
  }
  35% {
    opacity: 1;
    transform: translate(-50%, -55%) scale(1.08) rotate(4deg);
  }
  72% {
    opacity: 1;
    transform: translate(-50%, -58%) scale(1) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -75%) scale(0.9) rotate(0deg);
  }
}

@keyframes hinge {
  0%,
  100% {
    transform: rotate(0);
  }
  35% {
    transform: rotate(-2deg);
  }
  70% {
    transform: rotate(2deg);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

@media (max-width: 1100px) {
  .wall,
  .section-preview,
  .section-page .triples {
    grid-template-columns: 1fr;
  }

  .triples {
    max-height: none;
  }
}

@media (max-width: 760px) {
  .topbar,
  .intro,
  .game-header,
  .game-board,
  .choice-zone {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar {
    position: static;
  }

  .section-header {
    position: static;
  }

  .game-board,
  .choice-zone {
    display: grid;
  }

  nav a,
  nav button,
  .filter,
  #nextBtn {
    flex: 1 1 auto;
  }
}

@media (prefers-color-scheme: dark) {
  :root,
  html,
  body {
    color-scheme: light;
    color: var(--ink);
    background-color: var(--paper);
  }
}
