:root {
  --cream: #f7efe1;
  --cream-deep: #efe1ca;
  --paper: #fff9ef;
  --forest: #294737;
  --forest-deep: #1e3529;
  --red: #a94f48;
  --red-deep: #8f403b;
  --gold: #c69a53;
  --gold-light: #e5c789;
  --ink: #342b24;
  --muted: #74695e;
  --line: rgba(67, 48, 33, 0.14);
  --shadow: 0 18px 46px rgba(62, 44, 31, 0.13);
  --shadow-soft: 0 10px 24px rgba(62, 44, 31, 0.10);
  --radius-lg: 32px;
  --radius-md: 22px;
  --radius-sm: 15px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--cream);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  color: var(--ink);
  font-family: Inter, ui-rounded, "Avenir Next", Avenir, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(255,255,255,0.9), transparent 34rem),
    linear-gradient(180deg, #fbf5eb 0%, var(--cream) 72%);
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 4px solid rgba(198, 154, 83, 0.38);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: clamp(18px, 3vw, 38px) 0 54px;
}

.screen {
  animation: screenIn 360ms ease both;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  margin: 0;
  color: var(--forest);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}

h1,
h2 {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--forest-deep);
}

.button {
  min-height: 52px;
  border: 0;
  border-radius: 999px;
  padding: 0 24px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.button:active {
  transform: translateY(1px) scale(0.99);
}

.button-primary {
  color: #fffaf1;
  background: var(--forest);
  box-shadow: 0 8px 18px rgba(41, 71, 55, 0.20);
}

.button-secondary {
  color: var(--forest-deep);
  background: var(--cream-deep);
}

@media (hover: hover) and (pointer: fine) {
  .button-primary:hover {
    background: var(--forest-deep);
    box-shadow: 0 11px 22px rgba(41, 71, 55, 0.24);
    transform: translateY(-1px);
  }

  .button-secondary:hover {
    background: #e8d6bb;
  }
}

/* Access */
.screen-access {
  min-height: calc(100vh - 92px);
  display: grid;
  grid-template-columns: minmax(440px, 1.18fr) minmax(370px, 0.82fr);
  gap: clamp(26px, 6vw, 84px);
  align-items: center;
  padding: 10px clamp(0px, 2vw, 24px);
}

.access-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.sleigh-hero {
  width: min(100%, 760px);
  padding: 18px 0 10px;
}

.sleigh-hero-image {
  display: block;
  width: 100%;
  height: auto;
}

.access-copy {
  max-width: 620px;
}

.access-copy h1 {
  margin: 12px 0 16px;
  font-size: clamp(3.1rem, 7vw, 6rem);
  line-height: 0.92;
  letter-spacing: -0.055em;
  font-weight: 700;
}

.access-lead {
  max-width: 520px;
  margin: 0 0 32px;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.55;
}

.code-form {
  max-width: 590px;
  padding: clamp(20px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 249, 239, 0.78);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
}

.code-form label {
  display: block;
  margin-bottom: 4px;
  color: var(--forest-deep);
  font-weight: 850;
  font-size: 1.02rem;
}

.field-help {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.code-row input {
  min-width: 0;
  min-height: 52px;
  border: 1.5px solid rgba(73, 59, 47, 0.20);
  border-radius: 999px;
  padding: 0 19px;
  color: var(--ink);
  background: #fffdf8;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.code-row input::placeholder {
  color: #aa9e90;
  opacity: 1;
}

.form-message {
  min-height: 1.35em;
  margin: 10px 4px 0;
  color: var(--red-deep);
  font-size: 0.88rem;
  font-weight: 700;
}

.form-message.success {
  color: var(--forest);
}

.tiny-note {
  margin: 16px 2px 0;
  color: #8b7d6f;
  font-size: 0.82rem;
}

/* Home */
.screen-home {
  max-width: 940px;
  margin: 0 auto;
  padding-top: 8px;
}

.home-top {
  text-align: center;
}

.home-hero {
  display: block;
  width: min(100%, 760px);
  height: auto;
  margin: 0 auto 18px;
  object-fit: contain;
  margin-bottom: 17px;
}

.home-top h1 {
  margin: 9px auto 8px;
  font-size: clamp(2.6rem, 7vw, 5.1rem);
  line-height: 0.98;
  letter-spacing: -0.048em;
}

.home-lead {
  margin: 0 auto;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.04rem, 2vw, 1.28rem);
}

.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: clamp(26px, 5vw, 44px);
}

.difficulty-card {
  position: relative;
  min-height: 245px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 28px 26px 24px;
  text-align: left;
  color: var(--ink);
  background:
    radial-gradient(circle at 100% 0%, rgba(198, 154, 83, 0.14), transparent 15rem),
    rgba(255, 249, 239, 0.94);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.difficulty-card-featured {
  border-color: rgba(41, 71, 55, 0.26);
  background:
    radial-gradient(circle at 100% 0%, rgba(169, 79, 72, 0.12), transparent 15rem),
    rgba(255, 249, 239, 0.96);
}

.difficulty-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 20px;
  border-radius: 50%;
  color: #fff9ee;
  background: var(--red);
  font-size: 1.25rem;
  box-shadow: 0 8px 18px rgba(169, 79, 72, 0.18);
}

.difficulty-card-featured .difficulty-icon {
  background: var(--forest);
}

.difficulty-name,
.difficulty-detail,
.difficulty-caption,
.difficulty-cta {
  display: block;
}

.difficulty-name {
  color: var(--forest-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 700;
}

.difficulty-detail {
  margin-top: 4px;
  color: var(--red-deep);
  font-weight: 850;
}

.difficulty-caption {
  margin-top: 11px;
  color: var(--muted);
  font-size: 0.92rem;
}

.difficulty-cta {
  margin-top: 24px;
  color: var(--forest);
  font-weight: 850;
}

.difficulty-ribbon {
  position: absolute;
  top: 18px;
  right: 18px;
  border-radius: 999px;
  padding: 7px 10px 6px;
  color: var(--forest-deep);
  background: #ead7ae;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.09em;
}

@media (hover: hover) and (pointer: fine) {
  .difficulty-card:hover {
    transform: translateY(-3px);
    border-color: rgba(41, 71, 55, 0.28);
    box-shadow: 0 16px 32px rgba(62, 44, 31, 0.13);
  }
}

.how-to {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
  padding: 14px 4px 0;
}

.how-step {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 12px;
}

.how-number {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(41, 71, 55, 0.18);
  border-radius: 50%;
  color: var(--forest);
  background: rgba(255,255,255,0.45);
  font-weight: 900;
}

.how-step strong,
.how-step span:last-child {
  display: block;
}

.how-step strong {
  color: var(--forest-deep);
  font-size: 0.92rem;
}

.how-step span:last-child {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

/* Game */
.screen-game {
  max-width: 1080px;
  margin: 0 auto;
}

.game-header {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.icon-button,
.text-button {
  min-height: 46px;
  border: 1px solid var(--line);
  color: var(--forest-deep);
  background: rgba(255, 249, 239, 0.74);
  cursor: pointer;
}

.icon-button {
  width: 46px;
  border-radius: 50%;
  font-size: 2rem;
  line-height: 1;
}

.text-button {
  border-radius: 999px;
  padding: 0 16px;
  font-size: 0.84rem;
  font-weight: 800;
}

.game-heading {
  min-width: 0;
}

.game-heading h1 {
  margin: 2px 0 0;
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  line-height: 1;
}

.game-status-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 18px 0 16px;
}

.stat-pill {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  background: rgba(255, 249, 239, 0.78);
}

.stat-label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-pill strong {
  color: var(--forest-deep);
  font-size: 1rem;
}

.game-hint {
  margin: 0;
  text-align: center;
  color: var(--forest-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.98rem, 2vw, 1.14rem);
}

.board-wrap {
  width: 100%;
  border-radius: 30px;
  padding: clamp(10px, 2vw, 18px);
  background:
    radial-gradient(circle at 50% 0%, rgba(255,255,255,0.60), transparent 32rem),
    rgba(239, 225, 202, 0.56);
  border: 1px solid rgba(103, 77, 51, 0.10);
}

.memory-board {
  display: grid;
  gap: clamp(6px, 1.3vw, 12px);
  width: 100%;
  margin: 0 auto;
}

.memory-board.mode-easy {
  max-width: 650px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.memory-board.mode-classic {
  max-width: 930px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.memory-card {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
  border: 0;
  border-radius: clamp(10px, 1.8vw, 18px);
  padding: 0;
  background: transparent;
  perspective: 900px;
  cursor: pointer;
}

.memory-card[disabled] {
  cursor: default;
}

.card-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 440ms cubic-bezier(.2,.75,.3,1);
}

.memory-card.is-flipped .card-inner,
.memory-card.is-matched .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 5px 13px rgba(69, 50, 35, 0.14);
}

.card-back {
  display: grid;
  place-items: center;
  border: 2px solid rgba(229, 199, 137, 0.88);
  background:
    radial-gradient(circle at 18% 18%, rgba(255,255,255,0.08) 0 2px, transparent 2.6px),
    radial-gradient(circle at 82% 70%, rgba(229,199,137,0.17) 0 2px, transparent 2.6px),
    linear-gradient(145deg, var(--forest) 0%, var(--forest-deep) 100%);
  background-size: 30px 30px, 36px 36px, auto;
}

.card-back::before {
  content: "✦";
  display: grid;
  width: 46%;
  aspect-ratio: 1;
  place-items: center;
  border: 1.5px solid rgba(229, 199, 137, 0.82);
  border-radius: 50%;
  color: var(--gold-light);
  background: rgba(255, 249, 239, 0.04);
  font-size: clamp(1.1rem, 4vw, 2.1rem);
  box-shadow: inset 0 0 0 5px rgba(255,255,255,0.025);
}

.card-front {
  transform: rotateY(180deg);
  border: 1px solid rgba(107, 75, 48, 0.14);
  background: var(--paper);
}

.card-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.memory-card.is-matched .card-front {
  box-shadow: 0 0 0 3px rgba(198, 154, 83, 0.50), 0 7px 16px rgba(69, 50, 35, 0.13);
  animation: matchPulse 420ms ease;
}

@keyframes matchPulse {
  0% { transform: rotateY(180deg) scale(1); }
  50% { transform: rotateY(180deg) scale(1.045); }
  100% { transform: rotateY(180deg) scale(1); }
}

/* Win */
.win-layer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(30, 53, 41, 0.70);
  backdrop-filter: blur(7px);
}

.win-card {
  position: relative;
  z-index: 2;
  width: min(470px, 100%);
  border: 1px solid rgba(255,255,255,0.50);
  border-radius: 34px;
  padding: 30px clamp(22px, 5vw, 38px) 32px;
  text-align: center;
  background: var(--paper);
  box-shadow: 0 30px 70px rgba(19, 30, 24, 0.28);
  animation: winPop 420ms cubic-bezier(.2,.9,.3,1.1) both;
}

@keyframes winPop {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.win-cracker {
  display: block;
  width: min(340px, 88%);
  height: auto;
  object-fit: contain;
  margin: 0 auto 14px;
}

.win-card h2 {
  margin: 8px 0 4px;
  font-size: clamp(2.1rem, 7vw, 3.4rem);
  line-height: 1;
}

.win-copy {
  margin: 8px 0 18px;
  color: var(--muted);
}

.win-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 22px;
  border-radius: 999px;
  padding: 9px 17px;
  color: var(--forest-deep);
  background: var(--cream-deep);
}

.win-stat span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.win-stat strong {
  font-size: 1.2rem;
}

.win-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: -24px;
  width: 9px;
  height: 15px;
  border-radius: 3px;
  background: var(--gold-light);
  animation: confettiFall 2200ms linear forwards;
}

.confetti-piece:nth-child(3n) { background: #b4544c; }
.confetti-piece:nth-child(4n) { background: #f1e3bd; }
.confetti-piece:nth-child(5n) { background: #496b53; }

@keyframes confettiFall {
  to {
    transform: translate3d(var(--drift, 20px), calc(100vh + 60px), 0) rotate(720deg);
    opacity: 0.9;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 700px);
    padding-top: 12px;
  }

  .screen-access {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 6px 0 30px;
  }

  .access-visual {
    order: 0;
  }

  .sleigh-hero {
    width: min(100%, 650px);
    padding: 2px 0 0;
  }

  .sleigh-hero-image {
  }

  .access-copy {
    text-align: center;
    margin: 0 auto;
  }

  .access-copy h1 {
    font-size: clamp(2.75rem, 14vw, 4.35rem);
  }

  .access-lead {
    margin-left: auto;
    margin-right: auto;
  }

  .code-form {
    text-align: left;
  }

  .code-row {
    grid-template-columns: 1fr;
  }

  .code-row .button {
    width: 100%;
  }

  .tiny-note {
    text-align: center;
  }

  .difficulty-grid {
    grid-template-columns: 1fr;
  }

  .difficulty-card {
    min-height: 0;
  }

  .how-to {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0;
  }

  .how-step {
    flex-direction: column;
    gap: 7px;
    text-align: center;
    padding: 10px 4px;
  }

  .game-status-bar {
    grid-template-columns: auto auto;
    justify-content: space-between;
  }

  .game-hint {
    grid-column: 1 / -1;
    grid-row: 2;
    order: 3;
    min-height: 1.4em;
  }

  .memory-board.mode-classic {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .memory-board.mode-easy {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 430px) {
  .game-header {
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .game-heading .eyebrow {
    font-size: 0.61rem;
    letter-spacing: 0.12em;
  }

  .game-heading h1 {
    font-size: 1.45rem;
  }

  .text-button {
    padding: 0 12px;
    font-size: 0.78rem;
  }

  .stat-pill {
    padding: 8px 11px;
  }

  .board-wrap {
    padding: 8px;
    border-radius: 20px;
  }

  .memory-board {
    gap: 6px;
  }

  .win-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}


/* Plum & Kite brand footer */
.brand-footer{display:flex;justify-content:center;align-items:center;padding:8px 16px 28px;margin:0 auto;min-height:54px}
.brand-footer img{display:block;width:120px;max-width:34vw;height:auto;opacity:.72}
@media(max-width:600px){.brand-footer{padding:5px 12px 22px}.brand-footer img{width:100px;max-width:42vw}}
