/* =========================================================
   PICTURE SEQUENCE — SIMON MEMORY GAME
   Matching stylesheet for index.html
   ========================================================= */

:root {
  --blue-50: #eef9ff;
  --blue-100: #d9f2ff;
  --blue-200: #b5e7ff;
  --blue-400: #27b3ff;
  --blue-500: #079cf3;
  --blue-600: #007fd4;
  --blue-700: #0066ad;

  --purple-400: #a45cf2;
  --purple-500: #8438dc;
  --pink-400: #ff4da0;
  --pink-500: #ed1987;
  --yellow-400: #ffcf27;
  --orange-400: #ff8a00;
  --green-400: #62cb17;

  --ink: #17243a;
  --ink-soft: #52627b;
  --ink-muted: #7d8aa0;

  --white: #ffffff;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-soft: #f7fbff;
  --surface-blue: #eef9ff;

  --border: #d9eaf5;
  --border-strong: #b8ddf4;

  --success: #3dbb58;
  --warning: #ffb10a;
  --danger: #ef476f;

  --shadow-small: 0 8px 22px rgba(20, 91, 137, 0.12);
  --shadow-medium: 0 16px 40px rgba(20, 91, 137, 0.16);
  --shadow-large: 0 26px 70px rgba(20, 91, 137, 0.2);

  --radius-small: 14px;
  --radius-medium: 22px;
  --radius-large: 34px;
  --radius-pill: 999px;

  --focus-ring: 0 0 0 4px rgba(7, 156, 243, 0.2);
}

/* =========================================================
   RESET
   ========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family:
    "Fredoka",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background:
    radial-gradient(
      circle at 8% 10%,
      rgba(255, 207, 39, 0.28),
      transparent 24%
    ),
    radial-gradient(
      circle at 92% 15%,
      rgba(164, 92, 242, 0.16),
      transparent 28%
    ),
    radial-gradient(
      circle at 86% 88%,
      rgba(255, 77, 160, 0.14),
      transparent 25%
    ),
    linear-gradient(145deg, #f8fdff 0%, #eaf8ff 48%, #fff8fc 100%);
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -3;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.7)),
    radial-gradient(circle, rgba(7, 156, 243, 0.12) 1px, transparent 1px);
  background-size:
    auto,
    28px 28px;
  pointer-events: none;
}

button,
select,
input {
  font: inherit;
}

button,
select,
input[type="radio"] {
  cursor: pointer;
}

button {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

/* =========================================================
   ACCESSIBILITY
   ========================================================= */

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  color: var(--white);
  background: var(--blue-700);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  margin: -1px !important;
  white-space: nowrap !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
}

/* =========================================================
   APP SHELL
   ========================================================= */

.app-shell {
  position: relative;
  width: min(1480px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px;
}

main {
  position: relative;
  z-index: 2;
}

.screen {
  width: min(1240px, 100%);
  margin: 0 auto;
  animation: screenEnter 420ms ease both;
}

.screen.is-active {
  display: block;
}

/* =========================================================
   DECORATIVE BACKGROUND
   ========================================================= */

.background-decoration {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.background-star {
  position: absolute;
  display: block;
  line-height: 1;
  filter: drop-shadow(0 8px 12px rgba(32, 100, 155, 0.12));
  animation: floatingStar 6s ease-in-out infinite;
}

.background-star--one {
  top: 14%;
  left: 3%;
  color: var(--yellow-400);
  font-size: clamp(2.8rem, 6vw, 5.2rem);
  transform: rotate(-12deg);
}

.background-star--two {
  top: 24%;
  right: 3%;
  color: var(--purple-400);
  font-size: clamp(2.2rem, 4vw, 4rem);
  animation-delay: -2s;
  transform: rotate(13deg);
}

.background-star--three {
  right: 7%;
  bottom: 8%;
  color: var(--pink-400);
  font-size: clamp(2.4rem, 5vw, 4.5rem);
  animation-delay: -4s;
  transform: rotate(-8deg);
}

.background-dot {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: 0 5px 12px rgba(23, 36, 58, 0.12);
  animation: floatingDot 5s ease-in-out infinite;
}

.background-dot--one {
  top: 10%;
  right: 19%;
  background: var(--pink-400);
}

.background-dot--two {
  top: 47%;
  left: 4%;
  width: 15px;
  height: 15px;
  background: var(--green-400);
  animation-delay: -1.5s;
}

.background-dot--three {
  right: 5%;
  bottom: 30%;
  width: 13px;
  height: 13px;
  background: var(--blue-500);
  animation-delay: -3s;
}

.background-dot--four {
  bottom: 10%;
  left: 13%;
  width: 16px;
  height: 16px;
  background: var(--orange-400);
  animation-delay: -4s;
}

/* =========================================================
   HEADER
   ========================================================= */

.site-header {
  position: relative;
  z-index: 5;
  width: min(1240px, 100%);
  margin: 0 auto 24px;
  padding: 12px 16px;
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: var(--radius-medium);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-small);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.brand__icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 17px;
  color: var(--white);
  background:
    linear-gradient(145deg, var(--blue-400), var(--blue-600));
  box-shadow:
    inset 0 -4px 0 rgba(0, 88, 152, 0.2),
    0 9px 18px rgba(7, 156, 243, 0.24);
  font-size: 1.6rem;
  transform: rotate(-5deg);
}

.brand__text {
  display: grid;
  gap: 2px;
}

.brand__text strong {
  font-size: 1.08rem;
  line-height: 1.1;
}

.brand__text small {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.icon-button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 2px solid var(--border);
  border-radius: 15px;
  color: var(--blue-700);
  background: var(--white);
  box-shadow: 0 5px 12px rgba(20, 91, 137, 0.09);
  font-size: 1.15rem;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.icon-button:hover {
  border-color: var(--blue-400);
  transform: translateY(-2px);
}

.icon-button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.icon-button__off {
  display: none;
}

.icon-button[aria-pressed="false"] .icon-button__on {
  display: none;
}

.icon-button[aria-pressed="false"] .icon-button__off {
  display: inline;
}

/* =========================================================
   SHARED TYPOGRAPHY
   ========================================================= */

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue-600);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.settings-card__header h1,
.game-heading h1 {
  margin: 0;
  line-height: 1;
  letter-spacing: -0.045em;
}

.settings-card__header h1 {
  font-size: clamp(2.6rem, 6vw, 5.5rem);
}

.settings-card__header h1 span {
  display: block;
  color: var(--blue-500);
}

.settings-card__intro {
  max-width: 670px;
  margin: 20px auto 0;
  color: var(--ink-soft);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.65;
}

/* =========================================================
   SETTINGS SCREEN
   ========================================================= */

.settings-card {
  position: relative;
  padding: clamp(24px, 5vw, 58px);
  overflow: hidden;
  border: 7px solid var(--blue-500);
  border-radius: 48px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.97), rgba(255, 255, 255, 0.97)),
    radial-gradient(circle at top right, #fff0ba, transparent 36%);
  box-shadow:
    inset 0 0 0 5px rgba(255, 255, 255, 0.88),
    var(--shadow-large);
}

.settings-card::before,
.settings-card::after {
  position: absolute;
  z-index: 0;
  content: "★";
  line-height: 1;
  pointer-events: none;
}

.settings-card::before {
  top: 26px;
  left: 35px;
  color: var(--yellow-400);
  font-size: clamp(2.7rem, 5vw, 4.5rem);
  transform: rotate(-10deg);
}

.settings-card::after {
  top: 34px;
  right: 40px;
  color: var(--purple-400);
  font-size: clamp(2.2rem, 4vw, 3.8rem);
  transform: rotate(11deg);
}

.settings-card__header,
.settings-form {
  position: relative;
  z-index: 1;
}

.settings-card__header {
  max-width: 820px;
  margin: 0 auto 42px;
  text-align: center;
}

.settings-form {
  display: grid;
  gap: 30px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.form-field {
  min-width: 0;
}

.form-field > label,
.form-field legend {
  display: block;
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
}

.form-field legend {
  padding: 0;
}

.speed-field {
  padding: 0;
  border: 0;
  margin: 0;
}

.select-control {
  position: relative;
}

.select-control select {
  width: 100%;
  min-height: 60px;
  padding: 0 52px 0 18px;
  border: 2px solid var(--border);
  border-radius: 16px;
  outline: none;
  color: var(--ink);
  background: var(--white);
  appearance: none;
  font-weight: 600;
  box-shadow: inset 0 -2px 0 rgba(16, 97, 146, 0.04);
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.select-control select:hover {
  border-color: var(--blue-400);
}

.select-control select:focus-visible {
  border-color: var(--blue-500);
  box-shadow: var(--focus-ring);
}

.select-control__arrow {
  position: absolute;
  top: 50%;
  right: 18px;
  color: var(--blue-500);
  font-size: 0.78rem;
  pointer-events: none;
  transform: translateY(-50%);
}

.field-help {
  min-height: 20px;
  margin: 9px 0 0;
  color: var(--ink-muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.segment-option {
  position: relative;
  min-width: 0;
}

.segment-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segment-option span {
  min-height: 60px;
  padding: 8px;
  display: grid;
  place-content: center;
  gap: 2px;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: var(--white);
  text-align: center;
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.segment-option strong {
  font-size: 0.9rem;
}

.segment-option small {
  color: var(--ink-muted);
  font-size: 0.72rem;
}

.segment-option:hover span {
  transform: translateY(-2px);
}

.segment-option input:checked + span {
  border-color: var(--blue-500);
  color: var(--blue-700);
  background: var(--blue-50);
  box-shadow: 0 7px 16px rgba(7, 156, 243, 0.14);
}

.segment-option input:focus-visible + span {
  box-shadow: var(--focus-ring);
}

/* =========================================================
   SETTINGS PREVIEW
   ========================================================= */

.settings-preview {
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1.3fr);
  gap: 28px;
  align-items: center;
  border: 2px solid var(--border);
  border-radius: 26px;
  background:
    radial-gradient(
      circle at top left,
      rgba(255, 207, 39, 0.2),
      transparent 32%
    ),
    var(--surface-soft);
}

.settings-preview__label {
  display: block;
  margin-bottom: 7px;
  color: var(--pink-500);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.settings-preview__copy h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.settings-preview__copy p {
  margin: 10px 0 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.mini-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(74px, 1fr));
  gap: 12px;
}

.mini-card {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 4px solid var(--blue-500);
  border-radius: 20px;
  background: var(--white);
  box-shadow: var(--shadow-small);
}

.mini-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mini-card--placeholder {
  display: grid;
  place-items: center;
  border-style: dashed;
  color: var(--blue-600);
  background:
    radial-gradient(circle, rgba(7, 156, 243, 0.08) 2px, transparent 2px),
    var(--blue-50);
  background-size: 16px 16px;
  text-align: center;
}

.mini-card--placeholder span {
  padding: 8px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* =========================================================
   BUTTONS
   ========================================================= */

.primary-button,
.secondary-button,
.back-button {
  border: 0;
  font-weight: 700;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    filter 150ms ease;
}

.primary-button {
  min-height: 62px;
  padding: 0 25px;
  display: inline-flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  color: var(--white);
  background:
    linear-gradient(145deg, var(--blue-400), var(--blue-600));
  box-shadow:
    inset 0 -4px 0 rgba(0, 87, 151, 0.22),
    0 14px 28px rgba(7, 156, 243, 0.27);
  font-size: 1.05rem;
}

.settings-form > .primary-button {
  width: min(420px, 100%);
  justify-self: center;
}

.primary-button:hover {
  filter: saturate(1.08);
  transform: translateY(-3px);
  box-shadow:
    inset 0 -4px 0 rgba(0, 87, 151, 0.22),
    0 18px 34px rgba(7, 156, 243, 0.32);
}

.primary-button:active {
  transform: translateY(0);
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.back-button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.primary-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.35);
  opacity: 0.55;
  transform: none;
}

.primary-button__icon {
  font-size: 0.86rem;
}

.secondary-button,
.back-button {
  min-height: 46px;
  padding: 0 16px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border);
  border-radius: 14px;
  color: var(--blue-700);
  background: var(--white);
  box-shadow: 0 5px 12px rgba(20, 91, 137, 0.08);
}

.secondary-button:hover,
.back-button:hover {
  border-color: var(--blue-400);
  transform: translateY(-2px);
}

.form-message {
  min-height: 22px;
  margin: -12px 0 0;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

/* =========================================================
   GAME SCREEN
   ========================================================= */

.game-panel {
  padding: clamp(18px, 4vw, 38px);
  border: 7px solid var(--blue-500);
  border-radius: 44px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow:
    inset 0 0 0 5px rgba(255, 255, 255, 0.86),
    var(--shadow-large);
}

.game-toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 22px;
  align-items: center;
}

.game-heading {
  text-align: center;
}

.game-heading .eyebrow {
  margin-bottom: 4px;
}

.game-heading h1 {
  font-size: clamp(1.8rem, 4vw, 3.4rem);
}

.game-status {
  margin-top: 26px;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: minmax(90px, auto) 1fr minmax(90px, auto);
  gap: 18px;
  align-items: center;
  border: 2px solid var(--border);
  border-radius: 21px;
  background: var(--surface-soft);
}

.status-item {
  display: grid;
  gap: 2px;
  text-align: center;
}

.status-item__label {
  color: var(--ink-muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-item strong {
  color: var(--blue-700);
  font-size: 1.2rem;
}

.status-message {
  min-width: 0;
  padding: 10px 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 5px 14px rgba(20, 91, 137, 0.08);
  text-align: center;
}

.status-message__indicator {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 5px rgba(255, 177, 10, 0.16);
}

.status-message.is-watching .status-message__indicator {
  background: var(--blue-500);
  box-shadow: 0 0 0 5px rgba(7, 156, 243, 0.16);
  animation: statusPulse 1s ease-in-out infinite;
}

.status-message.is-playing .status-message__indicator {
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(61, 187, 88, 0.16);
}

.status-message.is-error .status-message__indicator {
  background: var(--danger);
  box-shadow: 0 0 0 5px rgba(239, 71, 111, 0.16);
}

.progress-track {
  height: 14px;
  margin-top: 16px;
  overflow: hidden;
  border: 2px solid var(--border);
  border-radius: var(--radius-pill);
  background: #e8f2f8;
}

.progress-track__fill {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background:
    linear-gradient(
      90deg,
      var(--blue-500),
      var(--purple-400),
      var(--pink-400)
    );
  transition: width 350ms ease;
}

/* =========================================================
   MEMORY CARD GRID
   ========================================================= */

.memory-grid {
  width: min(920px, 100%);
  margin: 30px auto 0;
  display: grid;
  gap: clamp(12px, 2vw, 22px);
}

.memory-grid--4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.memory-grid--6 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.memory-grid--8 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.memory-card {
  position: relative;
  min-width: 0;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 6px solid var(--blue-500);
  border-radius: clamp(22px, 4vw, 34px);
  outline: none;
  background: var(--white);
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, 0.9),
    0 13px 25px rgba(20, 91, 137, 0.16);
  isolation: isolate;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease,
    filter 150ms ease;
}

.memory-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.memory-card:not(:disabled):hover {
  transform: translateY(-5px) scale(1.01);
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, 0.9),
    0 19px 35px rgba(20, 91, 137, 0.22);
}

.memory-card:not(:disabled):active {
  transform: scale(0.97);
}

.memory-card:focus-visible {
  box-shadow:
    var(--focus-ring),
    0 19px 35px rgba(20, 91, 137, 0.22);
}

.memory-card:disabled {
  cursor: default;
}

.memory-card__glow {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  background:
    radial-gradient(
      circle at center,
      rgba(255, 255, 255, 0.55),
      transparent 48%
    ),
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.18),
      rgba(7, 156, 243, 0.42)
    );
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
}

.memory-card.is-active {
  z-index: 3;
  border-color: var(--yellow-400);
  filter: saturate(1.15) brightness(1.04);
  transform: scale(1.055);
  box-shadow:
    0 0 0 8px rgba(255, 207, 39, 0.2),
    0 0 34px rgba(255, 207, 39, 0.75),
    0 22px 38px rgba(20, 91, 137, 0.25);
  animation: cardFlash 520ms ease;
}

.memory-card.is-active .memory-card__glow {
  opacity: 1;
}

.memory-card.is-correct {
  border-color: var(--success);
  box-shadow:
    0 0 0 7px rgba(61, 187, 88, 0.16),
    0 0 26px rgba(61, 187, 88, 0.35);
  animation: correctCard 380ms ease;
}

.memory-card.is-incorrect {
  border-color: var(--danger);
  box-shadow:
    0 0 0 7px rgba(239, 71, 111, 0.16),
    0 0 26px rgba(239, 71, 111, 0.36);
  animation: incorrectCard 380ms ease;
}

.memory-card--placeholder {
  display: grid;
  place-items: center;
  color: var(--blue-600);
  background:
    radial-gradient(circle, rgba(7, 156, 243, 0.11) 2px, transparent 2px),
    linear-gradient(145deg, #ffffff, #e9f8ff);
  background-size:
    20px 20px,
    auto;
}

.placeholder-content {
  display: grid;
  gap: 10px;
  place-items: center;
}

.placeholder-content__star {
  color: var(--yellow-400);
  font-size: clamp(2.4rem, 6vw, 5rem);
  filter: drop-shadow(0 7px 10px rgba(255, 177, 10, 0.22));
}

.placeholder-content strong {
  font-size: clamp(0.9rem, 2vw, 1.25rem);
}

/* =========================================================
   GAME CONTROLS
   ========================================================= */

.game-controls {
  margin-top: 28px;
  display: grid;
  justify-items: center;
  gap: 13px;
}

.play-button {
  min-width: min(320px, 100%);
}

.game-instruction {
  max-width: 620px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.5;
  text-align: center;
}

/* =========================================================
   DIALOGS
   ========================================================= */

.result-dialog {
  width: min(520px, calc(100% - 28px));
  padding: 36px;
  overflow: hidden;
  border: 6px solid var(--blue-500);
  border-radius: 32px;
  color: var(--ink);
  background: var(--white);
  box-shadow: var(--shadow-large);
  text-align: center;
}

.result-dialog::backdrop {
  background: rgba(19, 41, 65, 0.58);
  backdrop-filter: blur(8px);
}

.result-dialog[open] {
  animation: dialogEnter 280ms ease both;
}

.result-dialog__icon {
  width: 90px;
  height: 90px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  background:
    linear-gradient(145deg, #fff7ce, #ffe27a);
  box-shadow:
    inset 0 -5px 0 rgba(205, 144, 0, 0.15),
    0 13px 25px rgba(205, 144, 0, 0.18);
  font-size: 3rem;
  transform: rotate(-4deg);
}

.result-dialog h2 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3rem);
  letter-spacing: -0.035em;
}

.result-dialog > p:not(.eyebrow) {
  margin: 14px auto 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

.result-dialog__decoration span {
  position: absolute;
  line-height: 1;
}

.result-dialog__decoration span:nth-child(1) {
  top: 24px;
  left: 28px;
  color: var(--yellow-400);
  font-size: 2.4rem;
}

.result-dialog__decoration span:nth-child(2) {
  top: 45px;
  right: 40px;
  color: var(--pink-400);
  font-size: 1.3rem;
}

.result-dialog__decoration span:nth-child(3) {
  right: 22px;
  bottom: 25px;
  color: var(--purple-400);
  font-size: 2rem;
}

.dialog-actions {
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.dialog-actions .primary-button,
.dialog-actions .secondary-button {
  flex: 1 1 190px;
}

/* =========================================================
   FULLSCREEN
   ========================================================= */

:fullscreen .app-shell {
  width: 100%;
  padding: 18px;
}

:fullscreen body {
  background: linear-gradient(145deg, #f8fdff, #e8f7ff);
}

:fullscreen .site-header {
  margin-bottom: 16px;
}

/* =========================================================
   RESPONSIVE DESIGN
   ========================================================= */

@media (max-width: 900px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-preview {
    grid-template-columns: 1fr;
  }

  .settings-preview__copy {
    text-align: center;
  }

  .game-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .game-heading {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .back-button {
    justify-self: start;
  }

  .game-toolbar .secondary-button {
    justify-self: end;
  }

  .game-status {
    grid-template-columns: repeat(2, 1fr);
  }

  .status-message {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .memory-grid--8 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 10px;
  }

  .site-header {
    margin-bottom: 12px;
    padding: 10px;
    border-radius: 18px;
  }

  .brand__icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .brand__text strong {
    font-size: 0.96rem;
  }

  .brand__text small {
    display: none;
  }

  .icon-button {
    width: 42px;
    height: 42px;
  }

  .settings-card,
  .game-panel {
    border-width: 5px;
    border-radius: 29px;
  }

  .settings-card {
    padding: 26px 16px;
  }

  .settings-card::before,
  .settings-card::after {
    opacity: 0.42;
  }

  .settings-card__header {
    margin-bottom: 28px;
  }

  .settings-preview {
    padding: 18px;
  }

  .mini-card-grid {
    grid-template-columns: repeat(2, minmax(85px, 1fr));
  }

  .segmented-control {
    grid-template-columns: 1fr;
  }

  .segment-option span {
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-inline: 18px;
    text-align: left;
  }

  .game-toolbar {
    gap: 12px;
  }

  .game-heading h1 {
    font-size: 1.8rem;
  }

  .back-button,
  .game-toolbar .secondary-button {
    min-height: 42px;
    padding-inline: 12px;
    font-size: 0.82rem;
  }

  .game-status {
    margin-top: 18px;
    padding: 12px;
    gap: 10px;
  }

  .status-message {
    padding: 9px 12px;
    font-size: 0.84rem;
  }

  .memory-grid {
    margin-top: 22px;
    gap: 10px;
  }

  .memory-grid--6,
  .memory-grid--8 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .memory-card {
    border-width: 4px;
    border-radius: 20px;
  }

  .result-dialog {
    padding: 28px 18px;
    border-width: 5px;
    border-radius: 26px;
  }

  .dialog-actions {
    display: grid;
  }
}

@media (max-width: 420px) {
  .brand__text strong {
    font-size: 0.84rem;
  }

  .header-actions {
    gap: 6px;
  }

  .settings-card__header h1 {
    font-size: 2.55rem;
  }

  .settings-card__intro {
    font-size: 0.93rem;
  }

  .game-panel {
    padding: 16px 12px 22px;
  }

  .game-heading .eyebrow {
    font-size: 0.68rem;
  }

  .game-heading h1 {
    font-size: 1.55rem;
  }

  .back-button span:last-child,
  .game-toolbar .secondary-button span:last-child {
    display: none;
  }

  .status-item strong {
    font-size: 1rem;
  }

  .memory-grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* =========================================================
   MOTION
   ========================================================= */

@keyframes screenEnter {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes floatingStar {
  0%,
  100% {
    transform: translateY(0) rotate(-8deg);
  }

  50% {
    transform: translateY(-14px) rotate(4deg);
  }
}

@keyframes floatingDot {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

@keyframes cardFlash {
  0% {
    transform: scale(1);
  }

  35% {
    transform: scale(1.07);
  }

  100% {
    transform: scale(1.055);
  }
}

@keyframes correctCard {
  0%,
  100% {
    transform: scale(1);
  }

  45% {
    transform: scale(1.07) rotate(1deg);
  }
}

@keyframes incorrectCard {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-8px);
  }

  50% {
    transform: translateX(8px);
  }

  75% {
    transform: translateX(-5px);
  }
}

@keyframes statusPulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.25);
  }
}

@keyframes dialogEnter {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

