:root {
  font-family:
    Inter,
    Segoe UI,
    system-ui,
    sans-serif;
  color: var(--ink);
  background: var(--bg);
  --bg: #f4f5ef;
  --surface: #fff;
  --ink: #203329;
  --muted: #6b786e;
  --line: #dfe4da;
  --accent: #d8e999;
  --green: #203d2f;
  --soft: #eef2e6;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 44px;
  padding: 10px 15px;
}
button:hover,
a.panel:hover {
  border-color: #819568;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
:focus-visible {
  outline: 3px solid #759839;
  outline-offset: 3px;
}
h1 {
  font-size: 1.65rem;
  letter-spacing: -0.04em;
  font-weight: 650;
  margin: 8px 0;
}
h2 {
  font-size: 1.2rem;
  letter-spacing: -0.025em;
  font-weight: 650;
  margin: 0 0 14px;
}
h3 {
  font-size: 0.9rem;
  margin: 20px 0 8px;
}
p {
  line-height: 1.6;
  margin: 8px 0 18px;
  color: var(--muted);
}
small {
  font-size: 0.75rem;
}
#app {
  display: flex;
  min-height: 100dvh;
}
.sidebar {
  position: fixed;
  width: 226px;
  inset: 0 auto 0 0;
  border-right: 1px solid var(--line);
  padding: 27px 18px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  z-index: 5;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 9px 30px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.brand img {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: contain;
}
.brand small {
  display: block;
  font-weight: 400;
  letter-spacing: 0;
  font-size: 0.62rem;
  color: var(--muted);
  margin-top: 4px;
}
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: auto;
}
.sidebar nav a {
  padding: 10px 13px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: 9px;
  font-size: 0.84rem;
  color: var(--muted);
  min-height: 42px;
}
.sidebar nav a.active {
  background: var(--soft);
  color: var(--ink);
  font-weight: 600;
}
.sidebar nav a span {
  font-size: 1.1rem;
  width: 19px;
  text-align: center;
}
.local-note {
  margin-top: auto;
  padding: 24px 10px 0;
  font-size: 0.74rem;
}
.local-note small {
  display: block;
  font-size: 0.63rem;
  color: var(--muted);
  margin-top: 8px;
}
.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #6a8a42;
  border-radius: 50%;
  margin-right: 7px;
}
.workspace {
  margin-left: 226px;
  width: calc(100% - 226px);
}
header {
  height: 68px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 36px;
  font-size: 0.75rem;
  color: var(--muted);
}
header > div {
  display: flex;
  align-items: center;
  gap: 14px;
}
header button {
  font-size: 1.2rem;
  border: 0;
  background: none;
  padding: 5px;
  width: 44px;
}
main {
  max-width: 1280px;
  margin: auto;
  padding: 30px 36px 40px;
}
.page-heading {
  margin-bottom: 25px;
}
.page-heading > small,
.eyebrow {
  font-size: 0.65rem;
  letter-spacing: 0.13em;
  font-weight: 600;
  color: var(--muted);
}
.page-heading p {
  font-size: 0.85rem;
  margin: 10px 0 0;
}
.hero {
  background: var(--green);
  color: #f9fbee;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 205px;
  padding: 30px 32px;
  overflow: hidden;
  gap: 20px;
}
.hero h2 {
  font-size: 1.5rem;
  margin: 15px 0 10px;
}
.hero p {
  color: #c4cfbf;
  font-size: 0.86rem;
  max-width: 450px;
}
.hero .eyebrow {
  color: #c6d6a2;
}
.primary {
  background: var(--accent);
  color: #253423;
  border: 0;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 12px 18px;
  min-height: 44px;
  font-size: 0.83rem;
  font-weight: 600;
}
.hero-art {
  position: relative;
  flex: 0 0 190px;
  height: 155px;
  font-size: 6rem;
  text-align: center;
  color: var(--accent);
  display: grid;
  place-content: center;
}
.hero-art span {
  font-style: normal;
  border: 2px solid #637b50;
  width: 105px;
  height: 105px;
  font-size: 4rem;
  border-radius: 24px;
  transform: rotate(-12deg);
  display: grid;
  place-content: center;
}
.hero-art i {
  position: absolute;
  border: 1px solid #a8be74;
  border-radius: 50%;
  width: 55px;
  height: 55px;
  top: 4px;
  right: 4px;
}
.hero-art b {
  position: absolute;
  font-size: 2rem;
  bottom: 3px;
  left: 8px;
  font-weight: 300;
}
.hero-art em {
  position: absolute;
  font-size: 2.8rem;
  right: 5px;
  bottom: 0;
  font-style: normal;
}
.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 24px 0;
  gap: 15px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.metric-strip > div {
  padding-left: 20px;
  border-left: 1px solid var(--line);
}
.metric-strip > div:first-child {
  border: 0;
  padding-left: 0;
}
.metric-strip strong {
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  display: block;
}
.metric-strip span {
  font-size: 0.72rem;
  color: var(--muted);
  display: block;
  margin-top: 7px;
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 27px 0 16px;
}
.section-title h2 {
  margin: 0;
}
.section-title a {
  font-size: 0.74rem;
  color: var(--muted);
}
.family-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.family-card {
  padding: 23px 20px;
  text-align: left;
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 11px;
  border-radius: 14px;
  background: var(--surface);
}
.family-icon {
  width: 47px;
  height: 44px;
  border-radius: 12px;
  background: var(--soft);
  font-size: 1rem;
  display: grid;
  place-content: center;
  font-weight: 600;
}
.family-card strong {
  font-size: 0.92rem;
}
.family-card small {
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.76rem;
  flex: 1;
}
.card-footer {
  font-size: 0.64rem;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 5px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}
.card-footer span {
  color: var(--ink);
}
.daily-banner {
  background: var(--soft);
  border: 1px solid var(--line);
  padding: 20px 23px;
  border-radius: 14px;
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.sun {
  font-size: 2rem;
}
.daily-banner strong {
  font-size: 0.86rem;
}
.daily-banner p {
  margin: 6px 0 0;
  font-size: 0.75rem;
}
.daily-banner a {
  margin-left: auto;
}
.secondary {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px 15px;
  min-height: 44px;
  background: var(--surface);
  font-size: 0.8rem;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 18px;
  min-width: 0;
}
.panel p {
  font-size: 0.85rem;
}
.session-options {
  display: flex;
  align-items: end;
  gap: 16px;
  flex-wrap: wrap;
}
.session-options label {
  flex: 1;
  min-width: 155px;
  margin: 0;
}
.two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin: 14px 0;
}
input,
select {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 8px;
  padding: 11px;
  min-height: 44px;
  margin-top: 8px;
  min-width: 0;
}
.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
}
.toggle input {
  width: 20px;
  min-height: 20px;
  margin: 0;
}
.puzzle-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 25px;
}
.puzzle-toolbar > span {
  font-size: 0.74rem;
  color: var(--muted);
}
.text-button {
  background: none;
  border: 0;
  font-size: 0.78rem;
  padding: 6px 0;
}
.puzzle-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 245px;
  gap: 24px;
}
.puzzle-main {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 25px;
  border-radius: 16px;
  min-width: 0;
}
.puzzle-heading small {
  letter-spacing: 0.1em;
  color: var(--muted);
  font-size: 0.64rem;
}
.puzzle-heading h1 {
  font-size: 1.3rem;
}
.puzzle-heading p {
  font-size: 0.8rem;
  margin-bottom: 20px;
}
.puzzle-side {
  padding: 15px 0;
}
.puzzle-side h2 {
  font-size: 1rem;
  margin: 16px 0;
}
.puzzle-side p {
  font-size: 0.78rem;
}
.puzzle-side input {
  font-size: 0.69rem;
}
.fine {
  font-size: 0.7rem !important;
}
.puzzle-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 12px;
}
.puzzle-controls button {
  font-size: 0.74rem;
  padding: 8px 11px;
}
.puzzle-controls .primary {
  margin-left: auto;
}
.sequence {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 36px 0 24px;
}
.sequence > div {
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 63px;
  padding: 10px 14px;
  background: var(--bg);
  text-align: center;
}
.sequence strong {
  display: block;
  font-size: 1.25rem;
  margin: 8px 0;
}
.sequence small {
  color: var(--muted);
  font-size: 0.65rem;
}
.sequence .missing {
  border: 2px dashed #92a75e;
  background: var(--soft);
}
#number-form {
  max-width: 300px;
  margin: 0 auto 25px;
}
.rule-tag {
  display: inline-block;
  font-size: 0.66rem;
  color: var(--muted);
  background: var(--soft);
  border-radius: 6px;
  padding: 8px;
}
.clues {
  font-size: 0.85rem;
  line-height: 1.8;
  padding-left: 20px;
  color: var(--muted);
}
.order-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 20px auto;
  max-width: 420px;
}
.order-item {
  display: flex;
  align-items: center;
  gap: 18px;
  text-align: left;
  touch-action: none;
}
.order-item > span {
  border-radius: 6px;
  background: var(--soft);
  padding: 5px 9px;
  font-size: 0.74rem;
}
.order-item small {
  margin-left: auto;
}
.order-item.selected {
  border: 2px solid #769d47;
  background: var(--soft);
}
.path-board {
  width: 100%;
  height: min(46vh, 410px);
  display: block;
  touch-action: none;
  user-select: none;
}
.path-board line {
  stroke: var(--line);
  stroke-width: 9;
  stroke-linecap: round;
}
.path-board line.used {
  stroke: #779448;
  stroke-width: 10;
}
.node {
  cursor: pointer;
}
.node circle {
  fill: var(--surface);
  stroke: #a4b295;
  stroke-width: 2;
}
.node.visited circle {
  fill: var(--soft);
  stroke: #64833e;
  stroke-width: 3;
}
.node.current circle {
  fill: var(--green);
  stroke: #96b650;
  stroke-width: 4;
}
.node text {
  fill: var(--ink);
  text-anchor: middle;
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
}
.node.current text {
  fill: #f4f5ef;
}
.node .node-label {
  font-size: 9px;
  fill: var(--muted);
}
.path-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.65rem;
  color: var(--muted);
}
#feedback {
  min-height: 30px;
  font-size: 0.82rem;
  color: var(--ink);
  padding: 8px 0;
}
.hint {
  background: var(--soft);
  border-radius: 9px;
  padding: 12px;
  margin: 12px 0;
  font-size: 0.76rem;
}
.hint p {
  margin: 8px 0 0;
}
.result {
  padding: 20px 0 0;
}
.result details {
  font-size: 0.8rem;
  margin: 15px 0;
  line-height: 1.8;
}
.result summary {
  cursor: pointer;
}
.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
}
.stat-row small {
  display: block;
  color: var(--muted);
  font-size: 0.66rem;
  margin-top: 5px;
}
.stat-row progress {
  width: 100%;
  height: 7px;
}
progress {
  accent-color: #78964b;
  max-width: 100%;
}
.evolution {
  height: 100px;
  display: flex;
  align-items: end;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin: 20px 0;
}
.evolution span {
  background: #8ca55e;
  flex: 1;
  max-width: 40px;
  border-radius: 5px 5px 0 0;
}
.history-list article {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
}
.history-list article > div:first-child {
  flex: 1;
}
.history-list small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.67rem;
}
.history-list button {
  font-size: 0.7rem;
}
.history-solution {
  flex-basis: 100%;
  line-height: 1.7;
}
.achievement-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-top: 18px;
}
.achievement {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.achievement > span {
  font-size: 1.5rem;
  color: var(--muted);
}
.achievement.earned {
  border-color: #91ac65;
}
.achievement.earned > span {
  color: #769147;
}
.achievement p {
  margin: 0;
}
.achievement small {
  color: var(--muted);
}
.lesson-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.more-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.more-nav .panel {
  font-size: 0.85rem;
  margin: 0;
}
.mobile-nav {
  display: none;
}
hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 25px 0;
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--green);
  color: #fff;
  box-shadow: 0 5px 30px #0002;
  max-width: 90vw;
  border-radius: 10px;
  padding: 14px 20px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  font-size: 0.8rem;
  transition: 0.2s;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
[data-theme="dark"] {
  --bg: #121c17;
  --surface: #1b2821;
  --ink: #e8efdf;
  --muted: #a7b5a5;
  --line: #344338;
  --green: #293f30;
  --soft: #293a2a;
  color-scheme: dark;
}
[data-motion="reduced"] * {
  transition: none !important;
  animation: none !important;
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
@media (min-width: 1400px) {
  main {
    padding-top: 40px;
  }
  .hero {
    min-height: 230px;
  }
  .family-card {
    padding: 27px 24px;
  }
}
@media (max-width: 1100px) {
  .sidebar {
    width: 196px;
    padding: 25px 12px;
  }
  .workspace {
    margin-left: 196px;
    width: calc(100% - 196px);
  }
  main {
    padding: 25px;
  }
  .puzzle-layout {
    grid-template-columns: 1fr;
  }
  .puzzle-side {
    background: var(--surface);
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
  }
  .lesson-list {
    grid-template-columns: 1fr;
  }
  .hero-art {
    flex-basis: 145px;
  }
  .family-grid {
    gap: 10px;
  }
  .family-card {
    padding: 17px 14px;
  }
  .daily-banner {
    flex-wrap: wrap;
  }
}
@media (max-width: 740px) {
  .sidebar {
    display: none;
  }
  .workspace {
    margin: 0;
    width: 100%;
  }
  header {
    height: 52px;
    padding: 0 18px;
  }
  header > span {
    font-size: 0.65rem;
  }
  header #connection {
    font-size: 0.65rem;
  }
  main {
    padding: 22px 16px 95px;
  }
  .page-heading {
    margin-bottom: 20px;
  }
  h1 {
    font-size: 1.4rem;
  }
  .hero {
    padding: 24px;
    min-height: 190px;
    border-radius: 14px;
  }
  .hero h2 {
    font-size: 1.2rem;
  }
  .hero-art {
    flex-basis: 75px;
    transform: scale(0.7);
    margin-right: -16px;
  }
  .hero-art i,
  .hero-art em,
  .hero-art b {
    display: none;
  }
  .hero p {
    font-size: 0.8rem;
  }
  .metric-strip {
    gap: 9px;
  }
  .metric-strip strong {
    font-size: 1.05rem;
  }
  .metric-strip span {
    font-size: 0.65rem;
  }
  .metric-strip > div {
    padding-left: 10px;
  }
  .family-grid {
    grid-template-columns: 1fr;
  }
  .family-card {
    display: grid;
    grid-template-columns: 45px 1fr;
    column-gap: 15px;
    padding: 18px;
  }
  .family-card .family-icon {
    grid-row: span 3;
  }
  .family-card .card-footer {
    grid-column: 2;
    padding-top: 10px;
    margin: 0;
  }
  .daily-banner {
    padding: 18px;
    gap: 12px;
  }
  .daily-banner > div {
    flex: 1;
  }
  .daily-banner a {
    margin-left: 44px;
  }
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 8px 5px max(8px, env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .mobile-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 54px;
    min-height: 46px;
    font-size: 1.1rem;
    color: var(--muted);
  }
  .mobile-nav small {
    font-size: 0.57rem;
  }
  .mobile-nav a.active {
    color: var(--ink);
    background: var(--soft);
    border-radius: 9px;
  }
  .two-columns {
    grid-template-columns: 1fr;
  }
  .panel {
    padding: 20px;
  }
  .puzzle-main {
    padding: 18px;
  }
  .puzzle-toolbar {
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
  }
  .puzzle-toolbar > span {
    order: 3;
    width: 100%;
  }
  .puzzle-heading h1 {
    font-size: 1.15rem;
  }
  .sequence {
    padding: 25px 0;
    gap: 7px;
  }
  .sequence > div {
    min-width: 48px;
    padding: 8px 10px;
  }
  .sequence strong {
    font-size: 1rem;
  }
  .puzzle-controls button {
    flex: 1 1 auto;
  }
  .puzzle-controls .primary {
    flex-basis: 100%;
    margin: 0;
  }
  .path-board {
    height: 340px;
    max-height: 48vh;
  }
  .achievement-grid {
    grid-template-columns: 1fr 1fr;
  }
  .section-title a {
    font-size: 0.65rem;
  }
  .section-title h2 {
    font-size: 1rem;
  }
  #toast {
    bottom: 85px;
  }
  .session-options label {
    min-width: 100%;
  }
}
@media (max-width: 360px) {
  main {
    padding: 18px 12px 95px;
  }
  .hero {
    padding: 20px;
  }
  .hero-art {
    display: none;
  }
  .daily-banner .sun {
    display: none;
  }
  .daily-banner a {
    margin-left: 0;
  }
  .achievement-grid {
    grid-template-columns: 1fr;
  }
  .puzzle-main {
    padding: 14px;
  }
  .metric-strip span {
    font-size: 0.59rem;
  }
}
button[hidden] {
  display: none;
}

.planning-status {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 15px 0;
}
.towers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 10px 0 25px;
}
.tower {
  position: relative;
  height: 260px;
  padding: 0;
  background: var(--bg);
  overflow: hidden;
}
.tower-label {
  position: absolute;
  top: 14px;
  left: 0;
  right: 0;
  font-size: 0.7rem;
  color: var(--muted);
}
.pole {
  position: absolute;
  top: 65px;
  bottom: 23px;
  left: 48%;
  width: 4%;
  border-radius: 5px;
  background: var(--line);
}
.disk-stack {
  position: absolute;
  bottom: 30px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 5px;
}
.disk {
  display: block;
  min-height: 20px;
  border: 1px solid #658243;
  background: var(--accent);
  color: #203329;
  border-radius: 6px;
  font-size: 0.7rem;
  z-index: 1;
}
.tower-base {
  position: absolute;
  bottom: 20px;
  left: 8%;
  right: 8%;
  height: 8px;
  border-radius: 5px;
  background: var(--green);
}
.selected {
  outline: 3px solid #8ba951;
  outline-offset: 1px;
}
.jugs {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 15px 0;
}
.jug-card {
  flex: 1;
  max-width: 160px;
  min-width: 0;
}
.jug {
  width: 100%;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 14px 10px;
}
.jug strong {
  font-size: 0.9rem;
}
.jug small {
  font-size: 0.68rem;
}
.vessel {
  position: relative;
  width: 80%;
  height: 155px;
  border: 2px solid #8eaa9c;
  border-top: 0;
  border-radius: 0 0 15px 15px;
  background: var(--surface);
  overflow: hidden;
}
.water {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #6b9eb4;
  opacity: 0.65;
  border-top: 3px solid #4f8297;
}
.vessel span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  font-weight: 700;
}
.jug-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.jug-actions button {
  flex: 1;
  padding: 8px 5px;
  font-size: 0.66rem;
}
.nonogram-wrap {
  display: flex;
  justify-content: center;
  margin: 24px 0;
  max-width: 100%;
}
.nonogram {
  display: grid;
  grid-template-columns: 50px repeat(var(--size), minmax(0, 44px));
  gap: 3px;
  width: 100%;
  max-width: calc(50px + var(--size) * 47px);
  align-items: stretch;
}
.column-clue {
  display: flex;
  flex-direction: column;
  justify-content: end;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  font-size: 0.78rem;
  font-weight: 600;
}
.row-clue {
  display: flex;
  align-items: center;
  justify-content: end;
  padding-right: 7px;
  font-size: 0.75rem;
  word-spacing: 4px;
}
.grid-cell {
  position: relative;
  border-radius: 4px;
  padding: 0;
  min-height: 0;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  background: var(--bg);
  font-size: 1rem;
  color: var(--muted);
}
.grid-cell.marked {
  background: var(--green);
  color: var(--accent);
  border-color: var(--green);
}
.grid-cell.fixed:disabled {
  opacity: 1;
}
.fixed-dot {
  position: absolute;
  right: 3px;
  bottom: 0;
  font-size: 0.75rem;
}
.balances {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 22px 0;
}
.balance-equation {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--line);
  padding: 12px 0;
}
.balance-equation > div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.weight-group {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}
.shape {
  font-size: 1.35rem;
  color: var(--ink);
  line-height: 1.25;
}
.shape-1 {
  color: #7b943f;
}
.shape-2 {
  color: #668f9e;
}
.weight-unit {
  font-size: 0.68rem;
  color: var(--muted);
}
.equals {
  font-size: 1.25rem;
  font-weight: 600;
}
.balance-target {
  background: var(--soft);
  border-radius: 10px;
  padding: 16px;
  margin: 20px 0;
}
.balance-target > span {
  font-size: 0.72rem;
  color: var(--muted);
}
.balance-target > div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  align-items: center;
}
#balance-form {
  max-width: 300px;
  margin: auto;
}
.matrix-rule {
  font-size: 0.76rem;
  line-height: 1.6;
  background: var(--soft);
  padding: 13px;
  border-radius: 9px;
}
.matrix-rule p {
  margin: 8px 0;
  font-size: 0.75rem;
}
.matrix-rule summary {
  cursor: pointer;
}
.matrix-grid {
  display: grid;
  grid-template-columns: repeat(var(--size), 1fr);
  gap: 10px;
  max-width: 300px;
  margin: 22px auto;
}
.matrix-grid svg {
  width: 100%;
  display: block;
}
.tile-background {
  fill: var(--bg);
  stroke: var(--line);
}
.quadrant {
  fill: var(--surface);
  stroke: var(--line);
  stroke-width: 1;
}
.quadrant.filled {
  fill: var(--green);
  stroke: #759b43;
}
.matrix-missing {
  display: grid;
  place-content: center;
  font-size: 1.8rem;
  border: 2px dashed #8aa662;
  border-radius: 10px;
  aspect-ratio: 1;
  background: var(--soft);
}
.matrix-options {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 20px 0;
}
.matrix-options button {
  max-width: 80px;
  flex: 1;
  padding: 7px;
}
.matrix-options svg {
  width: 100%;
  display: block;
}
.matrix-options span {
  font-size: 0.7rem;
  display: block;
  margin-top: 6px;
}
.memory-status {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  margin: 20px 0;
}
.memory-grid {
  display: grid;
  grid-template-columns: repeat(var(--size), 1fr);
  gap: 8px;
  max-width: 360px;
  margin: 20px auto;
}
.memory-grid button {
  aspect-ratio: 1;
  min-height: 44px;
  min-width: 0;
  padding: 0;
  background: var(--bg);
  font-size: 1.2rem;
  font-weight: 600;
}
.memory-grid .exposed {
  background: var(--accent);
  color: #203329;
}
.memory-grid .exposed:disabled {
  opacity: 1;
}
.memory-grid .chosen {
  background: var(--green);
  color: var(--accent);
}
.family-grid {
  margin-bottom: 20px;
}
.lesson-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 740px) {
  .lesson-list {
    grid-template-columns: 1fr;
  }
  .towers {
    gap: 8px;
  }
  .tower {
    height: 245px;
  }
  .tower-label {
    font-size: 0.6rem;
  }
  .disk {
    font-size: 0.64rem;
  }
  .jugs {
    gap: 8px;
  }
  .jug {
    padding: 12px 6px;
  }
  .jug-actions {
    flex-direction: column;
  }
  .jug small {
    font-size: 0.57rem;
  }
  .vessel {
    height: 135px;
  }
  .nonogram {
    grid-template-columns: 37px repeat(var(--size), minmax(0, 1fr));
    gap: 2px;
    max-width: calc(37px + var(--size) * 44px);
  }
  .row-clue {
    font-size: 0.66rem;
    word-spacing: 1px;
    padding-right: 5px;
  }
  .column-clue {
    font-size: 0.69rem;
  }
  .matrix-options {
    gap: 8px;
  }
  .memory-grid {
    gap: 6px;
  }
  .memory-grid button {
    min-height: 0;
  }
  .balance-equation {
    gap: 8px;
  }
  .shape {
    font-size: 1.15rem;
  }
}
.resume-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  background: var(--soft);
}
.resume-panel p {
  margin: 0;
}
.timer-label {
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  color: var(--muted);
}
.rings-board {
  width: 100%;
  display: block;
  height: min(48vh, 410px);
  touch-action: none;
  user-select: none;
}
.rings-board g {
  cursor: grab;
}
.rings-board g:active {
  cursor: grabbing;
}
.ring-target {
  stroke: var(--muted);
  stroke-width: 2;
  stroke-dasharray: 4 5;
}
.ring-target-text {
  fill: var(--muted);
  font-size: 9px;
}
.ring-index {
  fill: var(--surface);
  font-size: 11px;
  font-weight: 700;
  text-anchor: middle;
  pointer-events: none;
}
.ring-centre {
  fill: var(--soft);
}
.ring-centre-text {
  fill: var(--ink);
}
.ring-controls {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
}
.ring-controls label {
  margin: 0;
  max-width: 85px;
  flex: 1;
}
.ring-controls button {
  font-size: 0.76rem;
}
.coupling-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
  font-size: 0.68rem;
  color: var(--muted);
}
.coupling-list span {
  background: var(--soft);
  padding: 7px;
  border-radius: 6px;
}
.pair-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 15px 0 24px;
  justify-content: center;
}
.pair-tabs button[data-pair] {
  border-bottom: 4px solid var(--piece-color);
  min-width: 44px;
}
.pair-tabs button {
  font-size: 0.76rem;
}
.dot-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--size), 1fr);
  max-width: 360px;
  aspect-ratio: 1;
  margin: 20px auto;
  touch-action: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  overflow: hidden;
}
.dot-cell {
  position: relative;
  padding: 0;
  border-radius: 0;
  min-height: 0;
  border: 1px solid var(--line);
  background: transparent;
  aspect-ratio: 1;
  z-index: 2;
}
.dot-cell:disabled {
  opacity: 1;
}
.endpoint {
  display: inline-grid;
  place-content: center;
  width: 60%;
  height: 60%;
  border-radius: 50%;
  background: var(--piece-color);
  color: white;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 0 0 3px var(--surface);
}
.path-dot {
  color: white;
  background: var(--piece-color);
  border-radius: 50%;
  width: 25%;
  height: 25%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
}
.empty-dot {
  color: var(--muted);
}
.dot-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}
.dot-lines polyline {
  fill: none;
  stroke-width: 12;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.dot-walls line {
  stroke: var(--ink);
  stroke-width: 5;
  stroke-linecap: round;
}
.fitting-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 18px 0;
}
.fitting-toolbar > span {
  font-size: 0.75rem;
  color: var(--muted);
  margin-right: auto;
}
.fitting-toolbar button {
  font-size: 0.7rem;
  padding: 8px 10px;
}
.fitting-layout {
  display: flex;
  gap: 18px;
  align-items: center;
  margin: 25px 0;
}
.fitting-grid {
  display: grid;
  grid-template-columns: repeat(var(--size), minmax(0, 1fr));
  gap: 3px;
  width: 100%;
  max-width: 350px;
  flex: 1;
}
.fit-cell {
  aspect-ratio: 1;
  min-height: 0;
  min-width: 0;
  padding: 0;
  background: var(--bg);
  border-radius: 4px;
  font-size: 0.8rem;
}
.fit-cell.occupied {
  background: var(--piece-color);
  color: white;
  border-color: var(--piece-color);
}
.fit-cell:disabled {
  opacity: 1;
}
.piece-preview {
  width: 115px;
  text-align: center;
  font-size: 0.7rem;
}
.piece-preview strong {
  font-size: 0.68rem;
}
.piece-preview svg {
  max-height: 115px;
  width: 100%;
  margin: 10px auto;
}
.piece-preview small {
  font-size: 0.6rem;
  line-height: 1.5;
  color: var(--muted);
}
.piece-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: center;
}
.piece-tray button {
  width: 70px;
  height: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px;
  touch-action: none;
}
.piece-tray svg {
  width: 100%;
  height: 52px;
}
.piece-tray span {
  font-size: 0.68rem;
}
@media (max-width: 740px) {
  .fitting-layout {
    flex-direction: column;
    gap: 14px;
  }
  .fitting-grid {
    max-width: 350px;
    flex: auto;
  }
  .piece-preview {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
  }
  .piece-preview svg {
    height: 60px;
    width: 70px;
    margin: 0;
  }
  .piece-preview small {
    max-width: 120px;
  }
  .piece-preview p {
    margin: 0;
    font-size: 0.7rem;
  }
  .piece-tray button {
    width: 60px;
    height: 80px;
  }
  .rings-board {
    height: 330px;
  }
  .ring-controls {
    gap: 7px;
  }
  .ring-controls button {
    padding: 9px;
    font-size: 0.69rem;
  }
  .endpoint {
    font-size: 0.8rem;
  }
}
.traffic-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--size), 1fr);
  grid-template-rows: repeat(var(--size), 1fr);
  max-width: 420px;
  aspect-ratio: 1;
  margin: 24px auto;
  gap: 3px;
  background: var(--line);
  padding: 6px;
  border-radius: 13px;
  overflow: hidden;
}
.road-cell {
  background: var(--bg);
  border-radius: 4px;
}
.vehicle {
  position: relative;
  z-index: 2;
  min-height: 0;
  min-width: 0;
  padding: 0;
  border: 2px solid var(--car-color);
  background: var(--car-color);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  border-radius: 9px;
  box-shadow:
    inset 0 0 0 2px #ffffff22,
    0 2px 3px #0002;
}
.vehicle strong {
  font-size: 0.7rem;
  z-index: 1;
  line-height: 1.1;
}
.car-arrow {
  font-size: 1.15rem;
  line-height: 1.2;
  z-index: 1;
}
.car-window {
  position: absolute;
  inset: 12% 10%;
  border-radius: 5px;
  background: #ffffff19;
  border-top: 4px solid #ffffff66;
  border-bottom: 4px solid #ffffff44;
}
.vehicle-1 .car-window,
.vehicle-3 .car-window {
  inset: 10% 12%;
  border-top: 0;
  border-bottom: 0;
  border-left: 4px solid #ffffff66;
  border-right: 4px solid #ffffff44;
}
.vehicle:disabled {
  opacity: 1;
}
.vehicle.depart {
  animation: car-exit 0.23s ease-in forwards;
  z-index: 4;
}
.vehicle.blocked {
  animation: car-block 0.16s ease-in-out;
}
@keyframes car-exit {
  to {
    transform: translate(var(--exit-x), var(--exit-y));
    opacity: 0.3;
  }
}
@keyframes car-block {
  50% {
    transform: translateY(-3px);
  }
}
@media (max-width: 740px) {
  .traffic-board {
    gap: 2px;
    padding: 4px;
  }
  .vehicle {
    border-width: 1px;
    border-radius: 6px;
  }
  .vehicle strong {
    font-size: 0.56rem;
  }
  .car-arrow {
    font-size: 0.9rem;
  }
  .car-window {
    border-width: 2px;
  }
}
.category-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 22px 0 16px;
}
.category-tabs button {
  font-size: 0.75rem;
  background: var(--surface);
}
.category-tabs button[aria-pressed="true"] {
  background: var(--green);
  color: var(--accent);
  border-color: var(--green);
}
@media (max-width: 740px) {
  .category-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }
  .category-tabs button {
    font-size: 0.68rem;
  }
}
.notes-toggle,
.close-notes {
  display: none;
}
@media (max-width: 740px) {
  .notes-toggle,
  .close-notes {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .close-notes {
    float: right;
    font-size: 0.72rem;
    padding: 7px 12px;
  }
  .puzzle-layout {
    gap: 0;
  }
  .puzzle-side {
    display: none;
  }
  .puzzle-side.open {
    display: block;
    position: fixed;
    bottom: 78px;
    left: 12px;
    right: 12px;
    max-height: 58dvh;
    overflow: auto;
    z-index: 40;
    box-shadow: 0 -10px 60px #0003;
    border: 1px solid var(--line);
    background: var(--surface);
    padding: 20px;
  }
  .puzzle-controls {
    position: sticky;
    bottom: 64px;
    z-index: 10;
    background: var(--surface);
    padding: 12px 0 4px;
    box-shadow: 0 -8px 12px var(--surface);
  }
  .puzzle-toolbar {
    margin-bottom: 12px;
  }
  .puzzle-toolbar > span {
    order: 3;
  }
  .puzzle-toolbar button {
    padding: 9px;
    min-width: 44px;
  }
  .puzzle-toolbar #leave {
    margin-right: auto;
    min-width: 0;
  }
  .puzzle-heading p {
    margin-bottom: 12px;
    font-size: 0.77rem;
    line-height: 1.5;
  }
  .planning-status {
    margin: 12px 0;
  }
  .fitting-toolbar {
    margin: 12px 0;
  }
  .fitting-layout {
    margin: 14px 0;
  }
  .fitting-grid {
    max-width: 280px;
  }
  .fitting-layout .piece-preview {
    min-height: 26px;
  }
  .piece-tray {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: start;
    padding: 5px 2px 10px;
    width: 100%;
  }
  .piece-tray button {
    flex-shrink: 0;
    height: 76px;
    width: 58px;
  }
  .pair-tabs {
    margin: 10px 0 16px;
    gap: 6px;
  }
  .dot-board,
  .traffic-board {
    max-width: 300px;
    margin: 16px auto;
  }
  .puzzle-main {
    border-radius: 13px;
  }
}
@media (max-width: 740px) {
  .puzzle-controls {
    position: static;
    box-shadow: none;
  }
}
.observation-target {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.observation-target span {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
}
.observation-target small {
  margin-left: auto;
}
.observation-grid {
  display: grid;
  grid-template-columns: repeat(var(--observation-size), minmax(0, 1fr));
  gap: 5px;
  max-width: 640px;
  margin: auto;
}
.observation-cell {
  min-width: 0;
  padding: 3px;
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  position: relative;
  aspect-ratio: 1;
}
.observation-cell svg {
  display: block;
  width: 100%;
  height: calc(100% - 12px);
}
.observation-cell small {
  display: block;
  font-size: 10px;
  line-height: 12px;
}
.observation-cell.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.case-clues {
  padding-left: 24px;
  line-height: 1.7;
}
.case-clues li {
  margin-bottom: 10px;
}
.case-people {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
}
.case-person {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  padding: 16px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
}
.case-person strong {
  font-size: 18px;
}
.case-person span {
  font-size: 13px;
}
.case-person.eliminated {
  border-style: dashed;
  opacity: 0.65;
}
.case-person.eliminated strong {
  text-decoration: line-through;
}
.case-person small {
  margin-top: 8px;
}
@media (max-width: 480px) {
  .observation-grid {
    gap: 3px;
  }
  .observation-cell {
    padding: 0;
    border-width: 1px;
  }
  .case-people {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .case-person {
    padding: 10px;
  }
  .observation-target {
    font-size: 13px;
  }
}
@media (max-width: 480px) {
  .observation-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .observation-cell {
    min-height: 58px;
  }
  .observation-cell.selected {
    border-color: var(--green);
    box-shadow: inset 0 0 0 2px var(--green);
  }
}
.spatial-pieces {
  display: grid;
  gap: 20px;
}
.spatial-piece {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.spatial-piece h3 {
  margin: 0 0 12px;
}
.spatial-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 440px;
  margin: auto;
}
.spatial-comparison small {
  display: block;
  margin-bottom: 8px;
}
.spatial-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-size), minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.spatial-symbol {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  background: var(--soft);
  border: 1px solid var(--line);
  font-size: clamp(16px, 4vw, 26px);
  color: var(--ink);
}
.spatial-symbol-0 {
  color: var(--muted);
}
.spatial-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}
.spatial-controls button {
  font-size: 13px;
  padding: 10px 5px;
}
@media (max-width: 480px) {
  .spatial-piece {
    padding: 10px;
  }
  .spatial-comparison {
    gap: 10px;
  }
}
.object-bank,
.letter-terms {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}
.object-bank span,
.letter-terms > span {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}
.association-rows,
.switch-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.operator-lines {
  font-size: 22px;
  overflow-wrap: anywhere;
}
.operator-placeholder {
  padding: 4px 12px;
  border: 1px dashed var(--ink);
  border-radius: 5px;
  font-size: 16px;
}
.rule-card {
  padding: 14px;
  border-left: 4px solid var(--green);
  background: var(--soft);
  border-radius: 8px;
}
.number-pyramid {
  max-width: 660px;
  margin: auto;
}
.pyramid-row {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin: 6px 0;
}
.pyramid-row > * {
  width: calc(100% / 7 - 4px);
  min-width: 0;
  text-align: center;
  padding: 8px 1px;
  min-height: 44px;
  border-radius: 6px;
}
.pyramid-given {
  background: var(--soft);
  border: 1px solid var(--line);
}
.verbal-options {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}
.selected {
  outline: 2px solid var(--green);
  outline-offset: -3px;
  background: var(--soft);
}
.cube-net {
  display: block;
  max-height: 310px;
  max-width: 100%;
  margin: 16px auto;
}
.cube-net rect {
  fill: var(--soft);
  stroke: var(--ink);
  stroke-width: 2;
}
.cube-net text {
  fill: var(--ink);
  font-size: 24px;
}
.height-grid,
.change-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-size), minmax(0, 1fr));
  gap: 4px;
  max-width: 360px;
  margin: auto;
}
.height-grid > span {
  display: grid;
  place-items: center;
  background: var(--soft);
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.construction-plan {
  max-width: 360px;
  margin: auto;
  text-align: center;
}
.views-editor {
  display: grid;
  gap: 18px;
}
.projection-columns {
  display: flex;
  gap: 6px;
  height: 140px;
  max-width: 360px;
  margin: auto;
}
.projection-columns button {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: var(--soft);
}
.projection-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--accent);
  border-top: 2px solid var(--green);
}
.projection-columns b {
  position: relative;
  color: var(--ink);
  z-index: 1;
}
.number-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 280px;
  margin: 16px auto;
}
.change-grid {
  max-width: 520px;
}
.change-grid button {
  display: grid;
  place-items: center;
  font-size: 24px;
  min-width: 0;
  padding: 5px;
  min-height: 48px;
}
.change-grid small {
  font-size: 10px;
}
.investigation-scene {
  display: block;
  max-height: 390px;
  max-width: 100%;
  margin: auto;
  background: var(--soft);
  border-radius: 10px;
}
.investigation-scene g {
  fill: var(--ink);
  cursor: pointer;
}
.investigation-scene text {
  font-size: 14px;
}
.scene-grid-line {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
}
.evidence-hit {
  fill: transparent;
}
.report-list {
  display: grid;
  gap: 8px;
}
.report-list button {
  text-align: left;
  line-height: 1.5;
}
.report-list small {
  display: block;
  margin-top: 4px;
}
.evidence-note {
  padding: 10px;
  background: var(--soft);
  border-radius: 8px;
}
@media (max-width: 480px) {
  .change-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .switch-panel,
  .association-rows {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .operator-lines {
    font-size: 18px;
  }
  .pyramid-row > * {
    font-size: 12px;
  }
  .verbal-options {
    grid-template-columns: 1fr;
  }
  .letter-terms {
    gap: 5px;
  }
}
.vehicle.crate {
  background: #bd9763;
  border-radius: 5px;
  border: 2px solid #755330;
}
.crate-band {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 44%;
  width: 12%;
  background: #e2c89f;
}
.crate .car-arrow,
.crate strong {
  z-index: 1;
}
.level-map {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.level-map button {
  display: grid;
  gap: 8px;
  min-height: 76px;
}
.level-map strong {
  font-size: 22px;
}
.solved-level {
  background: var(--soft);
  border-color: var(--green);
}
.test-family-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 6px;
}
.guide-panel {
  padding: 12px;
  border: 1px solid var(--green);
  border-radius: 10px;
  background: var(--soft);
  margin-bottom: 14px;
}
.guide-panel p {
  margin: 8px 0;
}
.guide-highlight {
  outline: 3px solid var(--green) !important;
  outline-offset: 1px !important;
}
.lesson-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
header #active-profile {
  width: auto;
  max-width: 160px;
  min-height: 36px;
  font-size: 12px;
  padding: 6px 24px 6px 8px;
}
header #connection {
  white-space: nowrap;
}
@media (max-width: 480px) {
  .level-map {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }
  header #active-profile {
    max-width: 105px;
  }
  header > span {
    display: none;
  }
  .test-family-options {
    grid-template-columns: 1fr;
  }
}
.spatial-piece[hidden] {
  display: none;
}
.accessible-exit {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-top: 12px;
}
.accessible-exit label {
  flex: 1;
}
.accessible-exit button {
  margin-bottom: 12px;
}
.report-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 3px;
}
.case-people {
  max-height: 430px;
  overflow-y: auto;
  padding: 3px;
}
.sidebar nav {
  max-height: calc(100dvh - 230px);
  overflow-y: auto;
}
.puzzle-side.open {
  overscroll-behavior: contain;
}
.cube-net + .switch-panel {
  margin-top: 16px;
}
.maze-svg {
  width: 100%;
  max-height: 470px;
  display: block;
  margin: auto;
  touch-action: none;
}
.maze-cell {
  fill: var(--surface);
}
.maze-cell.visited {
  fill: var(--soft);
}
.maze-svg text {
  font-size: 22px;
  fill: var(--ink);
}
.maze-wall,
.maze-border {
  fill: none;
  stroke: var(--ink);
  stroke-width: 3;
  pointer-events: none;
}
.maze-trace {
  fill: none;
  stroke: var(--green);
  stroke-width: 6;
  pointer-events: none;
  stroke-linejoin: round;
}
.maze-arrows {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 12px;
}
.maze-arrows button {
  padding: 10px 3px;
  font-size: 12px;
}
:root {
  --strong: #203d2f;
}
[data-theme="dark"] {
  --strong: #d8e999;
}
.selected,
.guide-highlight {
  outline-color: var(--strong) !important;
}
.maze-trace {
  stroke: var(--strong);
}
.guide-panel,
.solved-level {
  border-color: var(--strong);
}
.rule-card {
  border-left-color: var(--strong);
}
.observation-cell.selected {
  border-color: var(--strong);
  box-shadow: inset 0 0 0 2px var(--strong);
}
[data-theme="dark"] .crate {
  color: #17231b;
}
.history-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}
.history-pagination button {
  font-size: 12px;
  padding: 10px 5px;
}
.history-pagination span {
  font-size: 12px;
}
#notes-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 89;
}
.puzzle-side.open {
  z-index: 90;
}
.pair-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-width: 540px;
  margin: 16px auto;
}
.pair-card-grid button {
  padding: 8px 3px;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  overflow-wrap: anywhere;
}
.pair-card-grid strong {
  font-size: 16px;
}
.pair-card-grid small {
  font-size: 11px;
}
.matched-pair {
  background: var(--soft);
  border-color: var(--strong);
}
:root {
  --muted: #59695c;
}
.pyramid-row > * {
  width: calc((100% - (var(--pyramid-count) - 1) * 4px) / var(--pyramid-count));
  max-width: 64px;
  font-size: 1rem;
}
@media (max-width: 480px) {
  .number-pyramid {
    margin-left: -16px;
    margin-right: -16px;
  }
  .pyramid-row > * {
    font-size: 1rem;
  }
}
/* Interface de jogo: tabuleiro em primeiro plano e ações com contraste. */
:root {
  --bg: #e3f2ff;
  --ink: #122c56;
  --muted: #1744b5;
  --line: #e3f2ff;
  --accent: #1744b5;
  --green: #1744b5;
  --soft: #e3f2ff;
}
[data-theme="dark"] {
  --bg: #122c56;
  --surface: #122c56;
  --ink: #e3f2ff;
  --muted: #e3f2ff;
  --line: #1744b5;
  --accent: #1744b5;
  --green: #1744b5;
  --soft: #122c56;
}
.primary {
  background: #1744b5;
  color: #fff;
  border-color: #1744b5;
  box-shadow: 0 4px 0 #1744b5;
  font-weight: 750;
}
.primary:hover {
  background: #1744b5;
  border-color: #1744b5;
}
.brand small {
  display: none;
}
.sidebar {
  width: 200px;
}
.workspace {
  margin-left: 200px;
}
.hero {
  background: linear-gradient(120deg, #1744b5, #1744b5);
  color: white;
  border: 0;
  border-radius: 26px;
}
.hero p,
.hero .eyebrow {
  color: #e3f2ff;
}
.hero h2 {
  font-size: 2rem;
}
.hero .primary {
  background: #ffcf59;
  color: #382706;
  border-color: #ffcf59;
  box-shadow: 0 4px 0 #cb9622;
}
.hero-art {
  color: #ffcf59;
}
.family-card {
  border-radius: 22px;
  padding: 16px;
  box-shadow: 0 4px 0 #e3f2ff;
  text-align: left;
}
.family-card strong {
  font-size: 1.08rem;
}
.game-preview {
  width: 100%;
  height: 105px;
  background: var(--soft);
  border-radius: 15px;
  display: block;
  margin-bottom: 15px;
}
.card-footer {
  color: var(--green);
  font-weight: 700;
}
#app.playing {
  display: block;
}
.playing .sidebar,
.playing .workspace > header,
.playing .mobile-nav {
  display: none;
}
.playing .workspace {
  margin: 0;
  width: 100%;
}
.playing #main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 18px 24px 32px;
}
.playing .puzzle-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.playing .puzzle-toolbar > span {
  flex: 1;
  font-size: 0.85rem;
}
.playing #leave {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 10px 15px;
  font-size: 0.9rem;
  border-radius: 14px;
}
.playing .puzzle-layout {
  display: block;
}
.playing .puzzle-main {
  border: 0;
  padding: 24px;
  border-radius: 28px;
  box-shadow: 0 6px 24px #1744b50c;
}
.playing .puzzle-heading h1 {
  font-size: 1.8rem;
  margin: 6px 0 12px;
}
.playing .puzzle-heading small {
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 750;
}
.playing .puzzle-heading p {
  font-size: 1rem;
  line-height: 1.5;
  max-width: 720px;
  margin-bottom: 14px;
  color: var(--ink);
}
.play-instruction {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--soft);
  border-radius: 15px;
  padding: 12px 16px;
}
.play-instruction p {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.4;
}
.instruction-icon {
  font-size: 1.7rem;
}
.play-example {
  margin: 10px 0 18px;
}
.play-example summary,
.alternative-control summary {
  cursor: pointer;
  color: var(--green);
  padding: 12px 2px;
  font-size: 0.9rem;
  font-weight: 650;
  min-height: 44px;
}
.example-content {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 20px;
  padding: 20px;
  background: var(--soft);
  border-radius: 16px;
}
.example-content .game-preview {
  margin: 0;
  height: 120px;
}
.example-content h2 {
  margin: 0;
  font-size: 1rem;
}
.example-content h3 {
  margin: 12px 0 4px;
}
.example-content p {
  font-size: 0.95rem;
  margin: 6px 0;
}
.example-text {
  color: var(--ink);
  font-weight: 650;
}
.playing #board {
  margin: 0 auto;
  max-width: 760px;
}
.playing .traffic-board {
  width: 100%;
  max-width: 620px;
  margin: 18px auto;
  border: 3px solid #e3f2ff;
  background: #e3f2ff;
  padding: 7px;
  gap: 5px;
  border-radius: 23px;
}
.playing .road-cell {
  background: #e3f2ff;
  border-radius: 8px;
}
.playing .vehicle.crate {
  background: #ffb43f;
  border: 2px solid #d88614;
  box-shadow:
    inset 0 -5px 0 #dc8b24,
    0 3px 0 #b9771d;
  color: #3a2509;
}
.playing .crate-band {
  opacity: 0.25;
}
.playing .vehicle strong {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: clamp(0.72rem, 2vw, 1.05rem);
  color: inherit;
}
.playing .car-arrow {
  font-size: clamp(1.45rem, 5vw, 3.2rem);
  line-height: 1;
  font-weight: 900;
  color: inherit;
  text-shadow: none;
}
.playing .planning-status {
  font-size: 0.9rem;
  font-weight: 650;
  margin-top: 8px;
}
.playing .alternative-control {
  margin-top: 4px;
}
.playing .puzzle-controls {
  border: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
  padding-top: 8px;
}
.playing .puzzle-controls button {
  font-size: 0.88rem;
  padding: 10px 8px;
  border-radius: 14px;
}
.playing #check {
  grid-column: 1/-1;
  width: 100%;
  min-height: 54px;
  margin: 4px 0;
  font-size: 1.05rem;
}
.playing #redo {
  display: none;
}
.playing .puzzle-side {
  display: none;
}
.playing .puzzle-side.open {
  display: block;
  position: fixed;
  z-index: 90;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: min(440px, calc(100vw - 32px));
  max-height: 85dvh;
  overflow: auto;
  background: var(--surface);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 18px 80px #0004;
}
.playing .close-notes {
  display: block;
  margin-left: auto;
}
#notes-backdrop {
  position: fixed;
  inset: 0;
  background: #122c5699;
  z-index: 89;
}
.playing .memory-grid {
  width: 100%;
  max-width: 580px;
  gap: 8px;
  margin: 18px auto;
}
.playing .memory-grid button {
  font-size: 1.6rem;
  border: 2px solid var(--line);
  border-radius: 14px;
  min-height: 48px;
  aspect-ratio: 1;
  background: var(--soft);
}
.playing .memory-grid button.exposed {
  background: #1744b5;
  border-color: #1744b5;
  color: white;
  opacity: 1;
}
.playing .memory-grid button.chosen {
  background: #24b8ae;
  color: #062f2a;
  border-color: #16867e;
}
.memory-ready {
  background: var(--soft);
  border-radius: 22px;
  padding: 24px;
  text-align: center;
  margin: 18px 0;
}
.memory-ready .game-preview {
  width: 180px;
  margin: 0 auto 16px;
}
.memory-ready h2 {
  font-size: 1.4rem;
}
.memory-ready p {
  color: var(--ink);
}
.memory-ready .primary {
  min-width: 200px;
}
.memory-phase {
  padding: 14px 16px;
  border-radius: 16px;
  background: #e3f2ff;
  color: #1744b5;
  margin: 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.memory-phase strong {
  font-size: 1rem;
  display: block;
}
.memory-phase small {
  display: block;
  margin-top: 5px;
  color: #1744b5;
}
.memory-phase.respond {
  background: #d5f3e9;
  color: #124d3e;
}
.memory-phase button {
  color: #1744b5;
  font-weight: 650;
  border-color: #e3f2ff;
}
.playing .memory-status {
  font-size: 1rem;
  font-weight: 650;
}
.playing .fine {
  font-size: 0.85rem !important;
}
.playing .dot-board,
.playing .fitting-board,
.playing .rings-board,
.playing .path-board {
  max-width: 600px;
  width: 100%;
}
@media (max-width: 740px) {
  .workspace {
    margin-left: 0;
  }
  .playing #main {
    padding: 12px 8px 22px;
  }
  .playing .puzzle-main {
    padding: 16px 8px;
    border-radius: 22px;
  }
  .playing .puzzle-heading,
  .playing .play-instruction,
  .playing .play-example {
    margin-left: 8px;
    margin-right: 8px;
  }
  .playing .puzzle-heading h1 {
    font-size: 1.45rem;
  }
  .playing .puzzle-heading p {
    font-size: 0.95rem;
  }
  .playing .puzzle-toolbar > span {
    order: 5;
    flex-basis: 100%;
    text-align: center;
  }
  .playing .traffic-board {
    padding: 5px;
    gap: 3px;
    border-radius: 17px;
  }
  .playing .car-arrow {
    font-size: clamp(1.35rem, 6vw, 2.3rem);
  }
  .playing .vehicle strong {
    top: 3px;
    left: 4px;
    font-size: 0.75rem;
  }
  .playing .play-instruction {
    padding: 12px;
  }
  .playing .play-instruction p {
    font-size: 0.93rem;
  }
  .example-content {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 12px;
  }
  .example-content .game-preview {
    width: 150px;
    height: 80px;
    margin: 0 auto;
  }
  .playing .puzzle-controls {
    margin: 12px 8px 0;
  }
  .playing .puzzle-controls button {
    font-size: 0.78rem;
    padding: 8px 4px;
  }
  .playing .memory-grid {
    gap: 6px;
  }
  .playing .memory-grid button {
    border-radius: 10px;
  }
  .memory-phase {
    align-items: flex-start;
    flex-direction: column;
  }
}
.journey #favorite,
.journey #clock-toggle,
.journey #redo,
.journey #reset,
.journey #check {
  display: none;
}
.journey .puzzle-controls {
  grid-template-columns: 1fr 1fr;
}
.journey .puzzle-controls #undo,
.journey .puzzle-controls #hint {
  background: var(--soft);
  border: 0;
}
.journey .puzzle-toolbar > span {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--green);
  text-align: center;
}
.journey #leave {
  font-size: 0;
  width: 44px;
}
.journey #leave::after {
  content: "⚙";
  font-size: 1.3rem;
}
.journey .memory-phase #memory-answer {
  display: none;
}
.level-complete {
  background: #d5f3e9;
  color: #124d3e;
  padding: 20px;
  border-radius: 18px;
  margin-top: 16px;
  text-align: center;
}
.level-complete strong {
  font-size: 1.4rem;
}
.level-complete p {
  color: #124d3e;
  margin: 8px 0 0;
}
.playing .car-arrow {
  width: 54%;
  height: 54%;
  min-width: 24px;
  min-height: 24px;
  display: block;
}
.playing .traffic-explanation {
  display: none;
}
.playing .vehicle.crate {
  border-radius: 12px;
}
.playing .vehicle.crate:nth-of-type(4n + 1) {
  background: #ffbd25;
  border-color: #dc8e0a;
  box-shadow: inset 0 -4px 0 #eaa20c;
}
.playing .vehicle.crate:nth-of-type(4n + 2) {
  background: #36d8bb;
  border-color: #129d88;
  box-shadow: inset 0 -4px 0 #13b79a;
}
.playing .vehicle.crate:nth-of-type(4n + 3) {
  background: #ff8290;
  border-color: #df4a63;
  box-shadow: inset 0 -4px 0 #ef596f;
}
.playing .vehicle.crate:nth-of-type(4n) {
  background: #e3f2ff;
  border-color: #1744b5;
  box-shadow: inset 0 -4px 0 #1744b5;
}
.playing .puzzle-heading h1 {
  margin-bottom: 8px;
}
.playing .puzzle-heading p {
  margin-bottom: 10px;
}
.playing .play-example {
  margin-bottom: 4px;
}
.playing .pair-card-grid button {
  border-radius: 15px;
  background: #1744b5;
  color: white;
  box-shadow: inset 0 -4px 0 #1744b5;
  font-size: 1.25rem;
  min-height: 76px;
}
.playing .pair-card-grid button:nth-child(3n + 2) {
  background: #16aaae;
  box-shadow: inset 0 -4px 0 #0d8185;
}
.playing .pair-card-grid button:nth-child(3n) {
  background: #e44c86;
  box-shadow: inset 0 -4px 0 #b32a60;
}
.playing .pair-card-grid button.matched-pair {
  background: #b9f7d5;
  color: #174d31;
  box-shadow: none;
}
.playing .pair-card-grid button:disabled {
  opacity: 1;
}
.playing .puzzle-heading small {
  display: none;
}
.playing .play-instruction {
  border-left: 5px solid #1744b5;
}
:root {
  --bg: #eaf6ff;
  --ink: #122c56;
  --muted: #4a627f;
  --line: #c7dbec;
  --accent: #1744b5;
  --green: #1744b5;
  --soft: #e3f2ff;
}
[data-theme="dark"] {
  --bg: #07172e;
  --surface: #122c4a;
  --ink: #f3f8ff;
  --muted: #a9c8e5;
  --line: #325579;
  --accent: #35acff;
  --green: #56baff;
  --soft: #203f61;
}
.primary {
  background: #1744b5;
  border-color: #1744b5;
  box-shadow: 0 4px 0 #0b2978;
  color: white;
}
.primary:hover {
  background: #103593;
  border-color: #103593;
}
.hero {
  background: linear-gradient(120deg, #123a9d, #168be3);
}
.hero .eyebrow,
.hero p {
  color: #e2f4ff;
}
.family-card {
  box-shadow: 0 4px 0 #c7dfef;
}
.playing .play-instruction {
  background: #fff2a8;
  border-left-color: #ffcd14;
}
.playing .play-instruction p {
  color: #46380a;
}
.playing .traffic-board {
  background: #9ecbec;
  border-color: #68acdd;
}
.playing .road-cell {
  background: #e3f4ff;
}
.playing .vehicle.crate:nth-of-type(4n + 1) {
  background: #ffce16;
  border-color: #d9a909;
  box-shadow: inset 0 -4px 0 #e5b10c;
  color: #372a04;
}
.playing .vehicle.crate:nth-of-type(4n + 2) {
  background: #26be46;
  border-color: #13892c;
  box-shadow: inset 0 -4px 0 #159e32;
  color: white;
}
.playing .vehicle.crate:nth-of-type(4n + 3) {
  background: #ee303a;
  border-color: #b41d2a;
  box-shadow: inset 0 -4px 0 #cd202e;
  color: white;
}
.playing .vehicle.crate:nth-of-type(4n) {
  background: #1744b5;
  border-color: #0d2b7d;
  box-shadow: inset 0 -4px 0 #0e3291;
  color: white;
}
.playing .memory-grid button.exposed {
  background: #1744b5;
  border-color: #1744b5;
  color: white;
}
.playing .memory-grid button.chosen {
  background: #26be46;
  border-color: #148d2b;
  color: white;
}
.playing .pair-card-grid button {
  background: #1744b5;
  box-shadow: inset 0 -4px 0 #0d2b7d;
}
.playing .pair-card-grid button:nth-child(3n + 2) {
  background: #25b83e;
  box-shadow: inset 0 -4px 0 #158528;
}
.playing .pair-card-grid button:nth-child(3n) {
  background: #ee303a;
  box-shadow: inset 0 -4px 0 #ba1a26;
}
.playing .pair-card-grid button.matched-pair {
  background: #c7f3cc;
  color: #155121;
  box-shadow: none;
}
.memory-phase {
  background: #fff2a8;
  color: #46380a;
}
.memory-phase small {
  color: #65510e;
}
.memory-phase button {
  color: #122c56;
  border-color: #dbc756;
}
.memory-phase.respond {
  background: #c7f3cc;
  color: #155121;
}
.memory-phase.respond small {
  color: #155121;
}
.playing .puzzle-side.open {
  right: auto;
  bottom: auto;
}
.playing .notes-toggle {
  display: inline-flex;
}
.return-game {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  font-weight: 750;
  color: var(--green);
  margin-bottom: 16px;
}
.workspace .mobile-nav a[href="#more"] {
  display: none;
}
.playing #hint {
  visibility: hidden;
}
.playing #undo {
  justify-self: start;
}
.journey .puzzle-controls {
  display: flex;
  min-height: 44px;
}
.journey .alternative-control {
  display: none;
}
.vehicle,
.tower,
.jug {
  touch-action: none;
  user-select: none;
}
.dragging-token {
  position: fixed !important;
  z-index: 120 !important;
  pointer-events: none !important;
  transform: translate(-50%, -50%) scale(1.08);
  box-shadow: 0 8px 25px #0004;
  opacity: 0.9;
}
.playing .disk {
  background: #ffcf16;
  color: #342900;
  border: 2px solid #d8a900;
}
.playing .disk:nth-child(2n) {
  background: #25be43;
  color: white;
  border-color: #14892a;
}
.playing .disk:nth-child(3n) {
  background: #ef323b;
  color: white;
  border-color: #b41f28;
}
.playing .water {
  background: #21a9f5;
}
.playing .traffic-board.warehouse-room {
  background: #e3f4ff;
  border: 0;
  padding: 8px;
  box-shadow: inset 0 0 0 2px #c8e4f5;
}
.playing .warehouse-room .vehicle {
  border-radius: 12px;
}
.warehouse-floor {
  width: 100%;
  max-width: 700px;
  display: block;
  margin: 12px auto;
  touch-action: none;
  user-select: none;
}
.warehouse-ground {
  fill: #e3f4ff;
}
.warehouse-walls path,
.warehouse-outer-wall {
  fill: none;
  stroke: #42546b;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.warehouse-door rect {
  fill: #25ba43;
}
.warehouse-door path {
  fill: none;
  stroke: white;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.warehouse-door text {
  font-size: 10px;
  fill: white;
  text-anchor: middle;
  font-weight: 800;
}
.room-crate {
  cursor: grab;
}
.room-crate rect {
  fill: var(--crate-fill);
  stroke: #0003;
  stroke-width: 3;
}
.room-crate path {
  stroke: #fff5;
  stroke-width: 5;
}
.room-crate text {
  fill: var(--crate-ink);
  font-size: 27px;
  font-weight: 850;
  text-anchor: middle;
  pointer-events: none;
}
.room-crate.selected rect {
  stroke: #111e36;
  stroke-width: 5;
}
.room-instruction {
  text-align: center;
  font-size: 0.95rem;
}
.warehouse-water {
  fill: #21a9f5;
}
.water-bridge {
  fill: none;
  stroke: #21a9f5;
  stroke-width: 51;
  stroke-linecap: round;
}
.water-waves {
  fill: none;
  stroke: #b5efff;
  stroke-width: 3;
  stroke-linecap: round;
  pointer-events: none;
}
.falling-crate {
  opacity: 0;
}
.room-crate text.crate-id {
  font-size: 13px;
  text-anchor: start;
}
.room-crate text.crate-key {
  font-size: 17px;
  text-anchor: middle;
}
.room-crate path.crate-direction {
  stroke: var(--crate-ink);
  stroke-width: 6;
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.warehouse-gates path {
  stroke: #ef3138;
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 9 6;
}
.safe-bridge rect {
  fill: #b88843;
  stroke: #7c5528;
  stroke-width: 2;
}
.safe-bridge path {
  stroke: #e9c890;
  stroke-width: 3;
}
.room-crate.crate-leaving {
  animation: crate-go 0.32s ease-in forwards;
  transform-box: fill-box;
}
@keyframes crate-go {
  to {
    translate: var(--crate-exit-x) var(--crate-exit-y);
    opacity: 0;
  }
}
.crate-blocked {
  animation: crate-stop 0.18s ease-in-out;
}
@keyframes crate-stop {
  50% {
    translate: 3px 0;
  }
}
.level-complete.level-failed {
  background: #ffe2e4;
  color: #951b2a;
}
.level-complete.level-failed p {
  color: #951b2a;
}
.warehouse-camera {
  width: 100%;
  overflow: auto;
  border-radius: 22px;
  overscroll-behavior: contain;
}
.warehouse-camera .warehouse-floor {
  touch-action: pan-x pan-y;
}
@media (max-width: 740px) {
  .warehouse-camera {
    max-height: 65dvh;
  }
  .warehouse-camera .warehouse-floor {
    width: max(100%, var(--room-min));
    max-width: none;
  }
}
.playing .pair-card-grid {
  grid-template-columns: repeat(var(--pair-columns, 4), minmax(0, 1fr));
}
.playing .pair-card-grid button:nth-child(n) {
  background: #1744b5;
  color: white;
  border: 3px solid #10358e;
  box-shadow: inset 0 -4px 0 #0d2b7d;
}
.playing .pair-card-grid button.face-up:nth-child(n) {
  background: white;
  color: var(--pair-color);
  border-color: var(--pair-color);
  box-shadow: 0 3px 0 #c8dcec;
}
.playing .pair-card-grid button.matched-pair:nth-child(n) {
  background: #d2f6d6;
  color: #155b27;
  border-color: #26a943;
  box-shadow: none;
}
.playing #pairs-status {
  font-size: 1rem;
  color: var(--ink);
  font-weight: 650;
  min-height: 48px;
}

/* Keep the game area clear; instructions belong in the optional help panel. */
.journey .puzzle-heading {
  padding: 8px 12px;
}
.journey .puzzle-heading h1 {
  font-size: 1.35rem;
  margin: 0 0 6px;
}
.journey .puzzle-main {
  padding: 8px;
  border-radius: 18px;
}
.journey .memory-phase {
  padding: 6px 10px;
  margin: 0 0 8px;
  min-height: 0;
}
.journey .memory-phase small {
  display: none;
}
.journey .memory-phase strong {
  font-size: 1rem;
}
.journey .puzzle-controls {
  margin-top: 12px;
}
.journey #board {
  min-height: 0;
}
.journey .warehouse-floor {
  width: 100%;
  max-width: none;
}
.journey .planning-status {
  font-size: 0.85rem;
  margin: 4px 0;
}
@media (max-width: 740px) {
  .journey #main {
    padding: 4px;
  }
  .journey .warehouse-camera {
    max-height: 72dvh;
  }
  .journey .warehouse-camera .warehouse-floor {
    width: max(100%, var(--room-min));
  }
}

/* Generated game artwork with readable interactive overlays. */
.warehouse-camera {
  background: #d8ba7e;
  box-shadow: inset 0 0 0 3px #bf9961;
}
.warehouse-floor .warehouse-scene {
  pointer-events: none;
}
.room-crate {
  cursor: pointer;
  filter: url(#object-shadow);
}
.room-crate rect.crate-hit {
  fill: transparent;
  stroke: none;
}
.room-crate .crate-art {
  pointer-events: none;
}
.room-crate .crate-arrow-badge {
  fill: var(--crate-fill);
  stroke: #fff;
  stroke-width: 2;
  pointer-events: none;
}
.room-crate text.crate-id {
  font-size: 14px;
  fill: white;
  stroke: #473417;
  stroke-width: 3;
  paint-order: stroke;
  font-weight: 900;
}
.room-crate text.crate-key {
  font-size: 22px;
  fill: #ffef36;
  stroke: #473417;
  stroke-width: 3;
  paint-order: stroke;
}
.warehouse-wall-shadow path,
.warehouse-wall-top path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.warehouse-wall-shadow path {
  stroke: #735c3e;
  stroke-width: 16;
  transform: translate(2px, 5px);
  opacity: 0.5;
}
.warehouse-walls path {
  stroke: #53585b;
  stroke-width: 14;
}
.warehouse-wall-top path {
  stroke: #b6c1c6;
  stroke-width: 8;
  transform: translate(-1px, -2px);
}
.warehouse-water {
  fill: url(#pool-depth);
  stroke: #847954;
  stroke-width: 3;
  filter: url(#object-shadow);
}
.water-bridge {
  stroke: #1cb3ec;
}
.water-waves {
  stroke: #d0f8ff;
  stroke-width: 2;
  opacity: 0.85;
}

.warehouse-water {
  fill: url(#water-art);
  stroke: none;
  filter: none;
}
.warehouse-water .water-bridge {
  stroke: url(#water-art);
}
.warehouse-water-bank {
  fill: #594b32;
  stroke: #93866a;
  stroke-width: 8;
  filter: url(#object-shadow);
}
.warehouse-water-bank .water-bridge {
  stroke: #93866a;
  stroke-width: 59;
}
.water-waves {
  display: none;
}

.fitting-grid,
.fitting-grid button {
  touch-action: none;
  user-select: none;
}
.fitting-drag-ghost {
  position: fixed;
  z-index: 200;
  pointer-events: none;
  opacity: 0.85;
  filter: drop-shadow(0 5px 6px #0005);
}
.fitting-drag-ghost span {
  position: absolute;
  border-radius: 5px;
  box-sizing: border-box;
  border: 3px solid #fff;
}
.fitting-drag-ghost.invalid {
  opacity: 0.55;
}
.fit-cell.fit-drop-valid {
  outline: 4px solid #16863b;
  outline-offset: -5px;
  background: #b5f2bd;
}
.fit-cell.fit-drop-invalid {
  outline: 4px solid #e22d37;
  outline-offset: -5px;
  background: #ffd6d6;
}
.piece-tray .piece-placed {
  opacity: 0.65;
}
.piece-tray .piece-placed.selected {
  opacity: 1;
}

.journey .piece-tray {
  flex-wrap: wrap;
  overflow: visible;
  justify-content: center;
}
.journey .fitting-layout {
  margin: 10px 0;
  gap: 8px;
}
.journey .fitting-grid {
  max-width: 350px;
}
/* Install is always discoverable in the browser, without covering the board. */
.playing .puzzle-toolbar .game-install { order: 10; margin-left: auto; background: #ffe447; color: #17356c; border: 0; border-radius: 12px; padding: 8px 14px; font-size: .85rem; font-weight: 800; min-height: 40px; }
.app-installed [data-install] { display: none !important; }
.install-dialog { position: fixed; inset: 0; margin: auto; width: min(420px, calc(100% - 32px)); max-height: calc(100dvh - 40px); overflow: auto; box-sizing: border-box; background: #fff; color: #17356c; border: 0; border-radius: 24px; padding: 30px 24px 24px; box-shadow: 0 20px 80px #061e4966; text-align: center; }
.install-dialog::backdrop { background: #072a58aa; }
.install-dialog h2 { font-size: 1.6rem; margin: 12px 0; }
.install-dialog p { line-height: 1.55; }
.install-dialog button { min-height: 46px; }
.install-dialog .install-close { position: absolute; top: 8px; right: 8px; border: 0; background: transparent; color: #17356c; font-size: 28px; padding: 4px 12px; }
.install-dialog .primary, .install-continue { width: 100%; margin-top: 12px; }
.install-dialog .primary { background: #1744b5; color: white; }
.install-continue { background: #eaf6ff; border: 0; color: #17356c; }
.install-instructions { text-align: left; background: #fff4ad; border-radius: 14px; padding: 14px; font-size: .95rem; }
.install-instructions:empty { display: none; }
