:root {
  --bg: #f3f7f8;
  --surface: #ffffff;
  --ink: #1a2744;
  --muted: #6b7a90;
  --teal: #0d7a6f;
  --teal-dark: #0a5f57;
  --mint: #e5f3ef;
  --mint-hover: #d4ebe5;
  --blue: #2f6fed;
  --blue-soft: #e8f0fe;
  --danger: #c0392b;
  --ok: #1e9e6a;
  --warn: #d68910;
  --border: #d9e2ec;
  --shadow: 0 10px 30px rgba(26, 39, 68, 0.08);
  --radius: 14px;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
}

body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, #d9efe9 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #dce8f8 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 18px;
}

.app-shell {
  width: 100%;
  max-width: 760px;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 640px;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 10px;
  border-bottom: 3px solid var(--teal);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
}

.brand svg {
  width: 28px;
  height: 28px;
  color: var(--teal);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.timer-chip {
  display: none;
  align-items: center;
  gap: 6px;
  background: #eef3f6;
  padding: 6px 10px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.timer-chip.visible {
  display: inline-flex;
}

.progress-track {
  height: 4px;
  background: #e7eef3;
  width: 100%;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--teal);
  transition: width 0.25s ease;
}

#app {
  flex: 1;
  padding: 28px 22px 18px;
  display: flex;
  flex-direction: column;
}

.app-footer {
  padding: 12px 18px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid #eef2f5;
}

h1, h2 {
  color: var(--ink);
  line-height: 1.25;
}

h1 {
  font-size: 1.45rem;
  margin-bottom: 10px;
  text-align: center;
}

h2 {
  font-size: 1.25rem;
  margin-bottom: 12px;
  text-align: center;
}

.badge {
  display: inline-block;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  margin: 0 auto 14px;
}

.center {
  text-align: center;
}

.description {
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 18px;
  text-align: center;
  font-size: 1.05rem;
}

.prompt {
  font-size: 1.35rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 22px;
  color: var(--ink);
  line-height: 1.35;
}

.btn {
  background: var(--teal);
  color: #fff;
  border: none;
  padding: 14px 22px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn:hover {
  background: var(--teal-dark);
}

.btn:active {
  transform: scale(0.99);
}

.btn-level {
  background: #2c3e50;
  margin-bottom: 10px;
}

.btn-level:hover {
  background: #1a252f;
}

.btn-ghost {
  background: transparent;
  color: var(--teal);
  border: 2px solid var(--teal);
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 0 18px;
}

.opt-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--mint);
  color: var(--ink);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.opt-btn:hover {
  background: var(--mint-hover);
  border-color: #b7ddd4;
}

.opt-btn.selected {
  border-color: var(--teal);
  background: #d8efe9;
}

.stimulus-card {
  margin: 10px auto 16px;
  max-width: 420px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.stimulus-word,
.stimulus-digits {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--ink);
}

.stimulus-note {
  color: var(--muted);
  margin-top: 8px;
  text-align: center;
}

.matrix-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  align-items: start;
}

.matrix-board {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  gap: 8px;
}

.matrix-board.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.matrix-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5ebf0;
  border-radius: 10px;
  font-size: 1.4rem;
  font-weight: 700;
  background: #fafcfd;
}

.matrix-cell.blank {
  border: 2px solid var(--blue);
  color: var(--blue);
  font-size: 2rem;
}

.matrix-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.matrix-options .opt-btn {
  text-align: center;
  min-height: 58px;
}

.find-grid {
  display: grid;
  gap: 10px;
  margin: 12px 0 8px;
}

.find-cell {
  min-height: 64px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fbfc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.find-cell:hover {
  background: var(--mint);
  border-color: #b7ddd4;
}

.find-cell svg {
  width: 42px;
  height: 42px;
}

.reaction-stage {
  flex: 1;
  min-height: 280px;
  border-radius: var(--radius);
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f7fafb;
  cursor: pointer;
  user-select: none;
  margin: 12px 0 16px;
  position: relative;
}

.reaction-stage.waiting {
  cursor: default;
}

.reaction-stage .hint {
  color: var(--muted);
  font-size: 1.05rem;
  text-align: center;
  padding: 20px;
}

.reaction-stimulus {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
}

.reaction-stimulus.green { background: #1e9e6a; }
.reaction-stimulus.red { background: #e74c3c; }
.reaction-stimulus.blue { background: #3498db; }
.reaction-stimulus.star,
.reaction-stimulus.heart {
  background: transparent;
  color: var(--ink);
  width: 120px;
  height: 120px;
}

.reaction-stimulus.star svg,
.reaction-stimulus.heart svg {
  width: 100%;
  height: 100%;
}

input[type="text"] {
  width: 100%;
  padding: 14px;
  font-size: 1.15rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  margin: 10px 0 16px;
}

input[type="text"]:focus {
  border-color: var(--teal);
}

.results-box {
  text-align: left;
}

.score-big {
  text-align: center;
  font-size: 1.7rem;
  font-weight: 800;
  margin: 10px 0 6px;
}

.category-list {
  list-style: none;
  margin: 18px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.category-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.05rem;
  font-weight: 600;
}

.check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid #c5d0db;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.check.done {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.check.done::after {
  content: "✓";
  font-size: 0.85rem;
  font-weight: 800;
}

.calc-bar {
  height: 14px;
  background: #e7eef5;
  border-radius: 999px;
  overflow: hidden;
  margin: 16px 0 20px;
  position: relative;
}

.calc-fill {
  height: 100%;
  width: 0%;
  background: var(--blue);
  transition: width 0.2s linear;
}

.calc-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  mix-blend-mode: difference;
}

.cat-scores {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.cat-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  background: #f7fafc;
  border-radius: 10px;
}

.cat-bar {
  grid-column: 1 / -1;
  height: 6px;
  background: #e5ebf0;
  border-radius: 999px;
  overflow: hidden;
}

.cat-bar > span {
  display: block;
  height: 100%;
  background: var(--teal);
}

.recommendations {
  background: #fff9e6;
  border-left: 4px solid #f1c40f;
  padding: 12px;
  margin-top: 14px;
  border-radius: 6px;
  font-size: 0.92rem;
  line-height: 1.5;
}

.recommendations ul {
  margin: 8px 0 0 18px;
}

.disclaimer {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 18px;
  border-top: 1px solid #eee;
  padding-top: 10px;
  line-height: 1.45;
}

.home-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 8px 0 18px;
}

.home-cats span {
  background: var(--mint);
  color: var(--teal-dark);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
}

@media (max-width: 700px) {
  body { padding: 8px; }
  .app-shell { min-height: calc(100vh - 16px); border-radius: 12px; }
  .matrix-layout { grid-template-columns: 1fr; }
  .prompt { font-size: 1.15rem; }
  #app { padding: 20px 14px 12px; }
}
