/* Shared visual rhythm: playful color, quiet surfaces and stable controls. */
body:not(.home-view) {
  background: radial-gradient(ellipse at 8% 0%, #eee7fa, transparent 48%),
    radial-gradient(ellipse at 98% 70%, #e7f1e8, transparent 40%), #faf8f3;
}
body:not(.home-view) main {
  border: 1px solid var(--app-line);
  box-shadow: 0 16px 54px rgb(57 53 91 / 7%);
}
.games-title, .memory-title { text-wrap: balance; line-height: 1.17; }
.game-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem;
  margin: 0 0 1.5rem;
}
.game-filters button {
  min-height: 44px;
  padding: .55rem .9rem;
  border: 1px solid var(--app-line);
  border-radius: 999px;
  background: var(--app-surface-solid);
  color: var(--app-muted);
  font: inherit;
  font-size: .86rem;
  font-weight: 750;
  cursor: pointer;
  touch-action: manipulation;
}
.game-filters button[aria-pressed="true"] {
  background: var(--app-primary-strong);
  border-color: var(--app-primary-strong);
  color: #fff;
}
.game-filters button:focus-visible { outline: 3px solid #d39b29; outline-offset: 3px; }
.games-list { gap: 1rem; }
.game-card {
  min-height: 8rem;
  padding: 1.15rem;
  border-radius: 1.35rem;
  box-shadow: 0 4px 14px rgb(40 43 73 / 4%);
  background: linear-gradient(120deg, var(--app-surface-solid), var(--card-soft));
}
.game-card::after { bottom: 1rem; right: .8rem; font-size: 1.3rem; }
.game-name { line-height: 1.22; font-weight: 850; }
.game-description { line-height: 1.45; font-size: .85rem; }
.game-icon { border-radius: 1.15rem; box-shadow: none; }
.game-card-flag { letter-spacing: .035em !important; }
.game-card:has(.game-card-flag) { grid-template-rows: auto auto auto; }
.game-card > .game-card-flag {
  position: static;
  grid-column: 2;
  grid-row: 1;
  justify-self: start;
  margin: 0 0 .4rem;
}
.game-card:has(.game-card-flag) > .game-icon { grid-column: 1; grid-row: 1 / 4; align-self: center; }
.game-card:has(.game-card-flag) > .game-name { grid-column: 2; grid-row: 2; }
.game-card:has(.game-card-flag) > .game-description { grid-column: 2; grid-row: 3; }
.memory-header { gap: .9rem; }
.level-badge { white-space: nowrap; border-radius: 999px; }
.grandpa-message { box-shadow: 3px 4px 0 color-mix(in srgb, var(--app-yellow) 65%, transparent); }
.grandpa-message p { line-height: 1.6; }
.action-button, .word-option, .number-option, .adventure-choice, .relation-item {
  touch-action: manipulation;
}
.action-button { border-radius: .95rem; }
.adventure-stage { border-radius: 1.4rem; box-shadow: 0 5px 20px rgb(40 43 73 / 5%); }
.adventure-choice { border-radius: 1rem; }
.adventure-prompt { line-height: 1.45; text-wrap: balance; }
.order-help { margin: 0 0 .65rem; color: var(--app-muted); font-size: .85rem; line-height: 1.5; }
.order-answer:empty::before { content: "1 → 2 → 3"; align-self: center; color: var(--app-muted); font-size: 1.2rem; letter-spacing: .15em; }
.order-card { font-size: .8rem; line-height: 1.3; touch-action: manipulation; }
.market-stepper { grid-template-columns: 44px minmax(1.5rem, 1fr) 44px; }
.market-stepper button { min-width: 44px; min-height: 44px; touch-action: manipulation; }
.path-controls { grid-template-columns: repeat(3, 2.75rem); grid-template-rows: repeat(3, 2.75rem); }
#adventure-message { min-height: 3.5rem; }
.memory-card { min-height: 0; }
.memory-card.revealed, .memory-card.matched { transform: none; }
.rainbow-ttt-turn { min-height: 2.8em; display: grid; place-items: center; margin-block: .4rem; }
.rainbow-ttt-intro-copy { line-height: 1.6; }

/* Spot the difference: the drawings, not the controls, are the main event. */
.differences-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  width: min(100%, 68rem);
  margin: 0 auto;
  padding: .8rem 1rem;
  border: 1px solid var(--app-line);
  border-radius: 1rem;
  background: var(--app-surface-soft);
  text-align: left;
}
.differences-counter strong { font-size: .92rem; color: var(--app-ink); }
#differences-progress-dots { display: flex; gap: .35rem; margin-top: .4rem; }
#differences-progress-dots span {
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border: 2px solid #c4c7ce;
  border-radius: 50%;
  color: white;
  font-size: .85rem;
  font-weight: 900;
}
#differences-progress-dots .is-found { background: #298064; border-color: #298064; }
#differences-error-status { margin: 0; font-size: .83rem; color: var(--app-muted); }
#differences-error-status strong { white-space: nowrap; }
#differences-error-status[data-warning="true"] { color: #9b501c; }
.differences-rule { margin: .65rem 0 0; color: var(--app-muted); font-size: .82rem; line-height: 1.5; }
.differences-scenes { gap: 1rem; margin-top: .9rem; align-items: start; }
.difference-picture {
  padding: .6rem;
  border: 1px solid var(--app-line);
  border-radius: 1.2rem;
  background: var(--app-surface-solid);
  box-shadow: 0 5px 20px rgb(40 43 73 / 5%);
}
.difference-picture-title { margin: .1rem 0 .55rem; color: var(--app-muted); font-size: .82rem; font-weight: 750; }
.difference-panel { aspect-ratio: 3 / 2; border: 0; border-radius: .75rem; box-shadow: none; }
.difference-scene-svg { cursor: pointer; touch-action: manipulation; user-select: none; }
.difference-zone { outline: none; }
.difference-zone-ring { stroke: transparent; stroke-width: 4; }
.difference-zone:focus-visible .difference-zone-ring { stroke: #514095; stroke-dasharray: 6 4; fill: rgb(255 255 255 / 12%); }
.difference-zone.found .difference-zone-ring { stroke: #196b53; fill: rgb(255 255 255 / 6%); stroke-dasharray: none; paint-order: stroke; }
.difference-check {
  font: 900 28px system-ui, sans-serif;
  fill: #196b53;
  stroke: #fff9ed;
  stroke-width: 7;
  paint-order: stroke;
  pointer-events: none;
}
.difference-miss { font: 800 43px system-ui, sans-serif; fill: #a8463c; stroke: #fff7e7; stroke-width: 5; paint-order: stroke; pointer-events: none; }
#differences-message { min-height: 4.1rem; color: var(--app-muted); font-size: .96rem; }
#differences-message[data-tone="success"] { color: #207455; }
#differences-message[data-tone="retry"] { color: #985220; }
.differences-scenes[aria-busy="true"] { opacity: .65; }
html[data-theme="dark"] body:not(.home-view) { background: #14192b; }
html[data-theme="dark"] .game-card { background: linear-gradient(120deg, #232940, color-mix(in srgb, var(--card-accent) 14%, #232940)); }
html[data-theme="dark"] #differences-message[data-tone="success"] { color: #a4dfc5; }
html[data-theme="dark"] #differences-error-status[data-warning="true"],
html[data-theme="dark"] #differences-message[data-tone="retry"] { color: #f0c296; }
@media (max-width: 48rem) {
  .differences-scenes { grid-template-columns: 1fr; max-width: 34rem; }
}
@media (min-width: 64rem) {
  main:has(#games-screen:not([hidden])) { width: min(100%, 76rem); }
  #games-screen .games-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 38rem) {
  .market-grid { grid-template-columns: 1fr; }
  .market-item { display: grid; grid-template-columns: minmax(0, 1fr) 8rem; align-items: center; column-gap: .6rem; padding: .6rem; }
  .market-item-emoji, .market-item-name, .market-item-price { grid-column: 1; }
  .market-stepper { grid-column: 2; grid-row: 1 / 4; margin: 0; }
  .rainbow-ttt-player { grid-template-columns: minmax(0, 1fr) auto; gap: .3rem; }
  .rainbow-ttt-player-mark { display: none; }
  .rainbow-ttt-player small { display: none; }
  .rainbow-ttt-player strong { font-size: .95rem; }
  .rainbow-ttt-header { align-items: start; }
  .rainbow-ttt-header h2 { font-size: clamp(1.4rem, 6vw, 2rem); text-align: left; }
  .rainbow-ttt-kicker { text-align: left; }
  .game-card { min-height: 6.6rem; padding: .9rem; }
  .game-description { font-size: .82rem; }
  .games-list { gap: .75rem; }
  .game-filters { gap: .4rem; margin-bottom: 1.1rem; }
  .game-filters button { padding: .5rem .7rem; font-size: .8rem; }
  .differences-toolbar { padding: .7rem; }
  .differences-counter strong { font-size: .85rem; }
  #differences-error-status { max-width: 7rem; text-align: right; }
  .difference-picture { padding: .35rem; border-radius: .9rem; }
  .difference-picture-title { font-size: .75rem; margin: .15rem 0 .4rem; }
  .differences-scenes { gap: .65rem; }
  #differences-message { font-size: .86rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
  .game-card, .memory-card, .adventure-choice, .action-button { animation: none; transition: none; }
}
