:root {
  --ink: #fffaf0;
  --muted: #d8d2ee;
  --night: #090725;
  --navy: #111342;
  --violet: #3a176b;
  --violet-2: #6f45b7;
  --aqua: #79f4ef;
  --gold: #ffdb63;
  --coral: #ff708d;
  --glass: rgba(12, 10, 48, 0.76);
  --edge: rgba(255, 255, 255, 0.2);
  --card-w: clamp(70px, 7.35vw, 112px);
  --card-h: calc(var(--card-w) * 1.4);
  --col-gap: clamp(7px, 0.9vw, 15px);
  --ease: cubic-bezier(0.2, 0.82, 0.2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--night);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(4, 4, 28, 0.12), rgba(5, 3, 25, 0.52)),
    url("assets/solitaire/starfall-observatory.webp") center / cover fixed,
    #0a0929;
  font-family: ui-rounded, "Avenir Next Rounded", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 46%, transparent 0 36%, rgba(5, 4, 28, 0.22) 76%),
    linear-gradient(180deg, rgba(8, 6, 32, 0.15), rgba(8, 5, 28, 0.58));
}

button, select { font: inherit; }
button { color: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, select:focus-visible {
  outline: 4px solid #fff49a;
  outline-offset: 3px;
}

.sky-glow {
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.sky-glow i {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff6b6;
  box-shadow: 0 0 12px 4px rgba(255, 225, 106, 0.65);
  animation: star-breathe 3.8s ease-in-out infinite alternate;
}

.sky-glow i:nth-child(1) { left: 16%; top: 19%; }
.sky-glow i:nth-child(2) { right: 14%; top: 31%; animation-delay: -1.2s; }
.sky-glow i:nth-child(3) { left: 43%; top: 11%; animation-delay: -2.5s; }
.sky-glow i:nth-child(4) { right: 33%; top: 22%; animation-delay: -0.7s; }

@keyframes star-breathe { to { opacity: 0.28; transform: scale(0.65); } }

.game-header {
  position: relative;
  z-index: 40;
  min-height: 78px;
  padding: max(10px, env(safe-area-inset-top)) clamp(16px, 2.3vw, 38px) 10px;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto minmax(420px, 1fr);
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(180deg, rgba(10, 7, 41, 0.94), rgba(16, 10, 52, 0.78));
  box-shadow: 0 16px 38px rgba(3, 2, 21, 0.35);
  backdrop-filter: blur(20px) saturate(1.2);
}

.brand {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  justify-self: start;
}

.brand-gem {
  position: relative;
  width: 49px;
  height: 49px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 3px solid #fff1a7;
  border-radius: 17px 21px 16px 22px;
  color: #40205c;
  background: linear-gradient(145deg, #fff9b2, #ffc53f 68%, #e78524);
  box-shadow: inset 0 4px 8px rgba(255, 255, 255, 0.7), 0 6px 0 #9b501f, 0 11px 24px rgba(3, 2, 20, 0.5);
  font-size: 27px;
  font-weight: 1000;
  transform: rotate(-4deg);
}

.brand-gem::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 12px 16px 11px 17px;
}

.brand-copy strong, .brand-copy small { display: block; }
.brand-copy strong { font-size: 22px; line-height: .95; letter-spacing: -.045em; }
.brand-copy small { margin-top: 6px; color: var(--gold); font-size: 9px; font-weight: 1000; letter-spacing: .14em; text-transform: uppercase; }

.title-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: left;
}

.title-star {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(121,244,239,.62);
  border-radius: 50%;
  color: var(--gold);
  background: radial-gradient(circle, rgba(52,186,205,.45), rgba(42,19,91,.75));
  box-shadow: 0 0 24px rgba(92,232,237,.25), inset 0 0 13px rgba(255,255,255,.16);
  font-size: 22px;
}

.title-lockup span:last-child { display: grid; }
.title-lockup small { color: var(--aqua); font-size: 8px; font-weight: 1000; letter-spacing: .18em; }
.title-lockup h1 { margin: 0; font-size: clamp(17px, 1.5vw, 24px); letter-spacing: -.035em; }

.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.glass-button, .gold-button {
  min-height: 48px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 16px;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(255,255,255,.13), rgba(255,255,255,.06));
  box-shadow: inset 0 1px rgba(255,255,255,.15), 0 8px 18px rgba(3,2,22,.22);
  transition: transform .2s var(--ease), background .2s ease, opacity .2s ease;
}

.glass-button:hover, .gold-button:hover { transform: translateY(-2px); background-color: rgba(255,255,255,.08); }
.glass-button:active, .gold-button:active { transform: translateY(1px) scale(.98); }
.glass-button:disabled { cursor: default; opacity: .38; transform: none; }
.glass-button span, .gold-button span { font-size: 20px; line-height: 1; }
.glass-button b, .gold-button b { font-size: 12px; white-space: nowrap; }

.hint-button { border-color: rgba(121,244,239,.32); color: #dffeff; }
.gold-button {
  border-color: #fff2a0;
  color: #31125b;
  background: linear-gradient(180deg, #fff49b 0%, #ffc949 62%, #ec8a28 100%);
  box-shadow: inset 0 3px 6px rgba(255,255,255,.6), 0 4px 0 #9f4e22, 0 10px 24px rgba(4,2,23,.42);
}

.solitaire-layout {
  position: relative;
  z-index: 2;
  width: min(1840px, 100%);
  min-height: calc(100dvh - 78px);
  margin: 0 auto;
  padding: clamp(14px, 1.4vw, 24px);
  display: grid;
  grid-template-columns: minmax(760px, 1fr) minmax(240px, 310px);
  gap: clamp(14px, 1.2vw, 22px);
  align-items: stretch;
}

.game-table, .nova-panel {
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: 0 24px 65px rgba(1,1,18,.43), inset 0 1px rgba(255,255,255,.16);
  backdrop-filter: blur(12px) saturate(1.12);
}

.game-table {
  position: relative;
  min-height: min(850px, calc(100dvh - 106px));
  padding: clamp(54px, 5.2vw, 78px) clamp(14px, 2vw, 34px) 18px;
  overflow: hidden;
  border-radius: 38px 31px 42px 28px;
  background:
    radial-gradient(circle at 50% 18%, rgba(98, 236, 238, .13), transparent 34%),
    linear-gradient(155deg, rgba(18, 13, 67, .78), rgba(26, 9, 55, .83));
}

.game-table::before {
  content: "";
  position: absolute;
  inset: 7px;
  pointer-events: none;
  border: 2px solid rgba(255,222,105,.48);
  border-radius: 31px 25px 35px 22px;
  box-shadow: inset 0 0 40px rgba(10, 190, 211, .08);
}

.game-table::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: .16;
  background-image:
    radial-gradient(circle, #fff 0 1px, transparent 1.5px),
    linear-gradient(120deg, transparent 49.5%, rgba(255,255,255,.18) 50%, transparent 50.5%);
  background-size: 76px 76px, 94px 94px;
}

.table-plaque {
  position: absolute;
  top: 0;
  left: 50%;
  min-width: min(440px, 58%);
  height: 43px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border: 1px solid rgba(255,242,161,.8);
  border-top: 0;
  border-radius: 0 0 20px 20px;
  color: #3c1a61;
  background: linear-gradient(180deg, #fff1a0, #f4b63c);
  box-shadow: inset 0 2px rgba(255,255,255,.65), 0 6px 0 #a14e28, 0 15px 28px rgba(3,2,20,.38);
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: .15em;
  transform: translateX(-50%);
}

.table-plaque span { color: #7b3a8f; font-size: 17px; }

.upper-board {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(12px, 2vw, 32px);
}

.pile-cluster, .foundation-piles { display: flex; gap: var(--col-gap); }
.labeled-pile { display: grid; gap: 6px; }
.pile-label {
  color: #b9f8f4;
  font-size: 8px;
  font-weight: 1000;
  letter-spacing: .15em;
  text-align: center;
}

.pile-slot, .foundation-slot {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  flex: 0 0 auto;
  border: 2px dashed rgba(196,241,241,.3);
  border-radius: calc(var(--card-w) * .12);
  background: linear-gradient(145deg, rgba(52,191,197,.12), rgba(33,17,74,.28));
  box-shadow: inset 0 0 24px rgba(6,3,28,.32), 0 8px 18px rgba(3,2,20,.18);
}

.foundation-slot::before {
  content: attr(data-suit-symbol);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(207,251,247,.25);
  font-size: calc(var(--card-w) * .43);
  font-weight: 1000;
}

.foundation-slot.red::before { color: rgba(255,139,158,.28); }
.foundation-slot.is-valid-target, .tableau-column.is-valid-target {
  border-color: var(--gold);
  background-color: rgba(255,217,87,.1);
  box-shadow: inset 0 0 20px rgba(255,219,99,.2), 0 0 20px rgba(255,219,99,.28);
}

.mission-chip {
  min-width: 188px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(121,244,239,.26);
  border-radius: 999px;
  background: rgba(8,9,43,.48);
  box-shadow: inset 0 1px rgba(255,255,255,.1);
  justify-self: center;
}

.mission-chip > span:last-child { display: grid; gap: 2px; }
.mission-chip small { color: var(--aqua); font-size: 8px; font-weight: 1000; letter-spacing: .13em; text-transform: uppercase; }
.mission-chip b { font-size: 10px; }
.mission-orbit {
  position: relative;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,220,99,.55);
  border-radius: 50%;
}
.mission-orbit::before { content: "✦"; color: var(--gold); }
.mission-orbit i { position: absolute; inset: 4px -3px; border: 1px solid rgba(121,244,239,.6); border-radius: 50%; transform: rotate(-28deg); }

.tableau {
  position: relative;
  margin-top: clamp(18px, 2vw, 32px);
  display: grid;
  grid-template-columns: repeat(7, var(--card-w));
  justify-content: space-between;
  gap: var(--col-gap);
}

.tableau-column {
  position: relative;
  min-width: var(--card-w);
  min-height: calc(var(--card-h) * 3.55);
  border: 2px solid transparent;
  border-radius: 14px;
  transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
}

.tableau-column::before {
  content: attr(data-column-label);
  position: absolute;
  inset: 0 0 auto;
  height: var(--card-h);
  display: grid;
  place-items: center;
  border: 2px dashed rgba(207,251,247,.16);
  border-radius: calc(var(--card-w) * .12);
  color: rgba(207,251,247,.16);
  font-size: calc(var(--card-w) * .27);
  font-weight: 1000;
}

.card {
  position: absolute;
  z-index: var(--z, 1);
  top: var(--card-top, 0);
  left: 0;
  width: var(--card-w);
  height: var(--card-h);
  margin: 0;
  padding: 0;
  display: block;
  overflow: hidden;
  border: 1px solid rgba(28,16,60,.5);
  border-radius: calc(var(--card-w) * .12);
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transform: translateZ(0);
  transform-origin: center;
  transition: transform .2s var(--ease), filter .2s ease, box-shadow .2s ease;
}

.pile-slot > .card, .foundation-slot > .card { top: 0; }
.card:hover { z-index: 200 !important; transform: translateY(-5px) rotate(.6deg); filter: brightness(1.06); }
.card:active { transform: translateY(-1px) scale(.98); }
.card.is-selected {
  z-index: 210 !important;
  box-shadow: 0 0 0 4px #fff5a4, 0 0 0 8px rgba(114,244,239,.64), 0 16px 30px rgba(2,1,22,.48) !important;
  transform: translateY(-8px) rotate(-1deg);
}

.card.is-hinted { animation: hint-pulse .76s ease-in-out 3; }
.card.is-flipping { animation: card-flip .55s var(--ease); }

@keyframes hint-pulse {
  50% { transform: translateY(-10px) scale(1.06); box-shadow: 0 0 0 5px #fff19a, 0 0 34px 15px rgba(121,244,239,.66); }
}
@keyframes card-flip { 0% { transform: rotateY(90deg) scale(.86); } 100% { transform: rotateY(0) scale(1); } }

.card-face {
  color: #1b1740;
  background:
    radial-gradient(circle at 28% 20%, rgba(255,255,255,.9), transparent 18%),
    linear-gradient(145deg, #fffefa 0%, #fff7dd 66%, #e9dbbd 100%);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.72), inset 0 0 0 5px rgba(61,33,97,.12), 0 5px 0 #92809d, 0 12px 20px rgba(1,1,20,.4);
}

.card-face.red { color: #da365e; }
.card-face::before {
  content: "";
  position: absolute;
  inset: 5px;
  pointer-events: none;
  border: 1px solid currentColor;
  border-radius: calc(var(--card-w) * .085);
  opacity: .18;
}
.card-face::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(125deg, rgba(255,255,255,.62), transparent 30% 74%, rgba(39,17,81,.08));
}

.card-back {
  border: 2px solid #ffe58a;
  background: #17134e url("assets/solitaire/star-card-back.webp") center / 100% 100% no-repeat;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.4), 0 5px 0 #76509b, 0 12px 20px rgba(1,1,20,.46);
}

.card-back::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, rgba(255,255,255,.32), transparent 28% 72%, rgba(1,2,21,.18));
}

.card-corner {
  position: absolute;
  z-index: 2;
  top: calc(var(--card-w) * .08);
  left: calc(var(--card-w) * .09);
  display: grid;
  justify-items: center;
  font-weight: 1000;
  line-height: .8;
}
.card-corner.bottom { inset: auto calc(var(--card-w) * .09) calc(var(--card-w) * .08) auto; transform: rotate(180deg); }
.card-rank { font-size: calc(var(--card-w) * .26); letter-spacing: -.05em; }
.card-suit { margin-top: calc(var(--card-w) * .04); font-size: calc(var(--card-w) * .2); }
.card-center {
  position: absolute;
  inset: 20% 18%;
  display: grid;
  place-items: center;
  text-align: center;
}
.card-center .big-suit {
  text-shadow: 0 2px rgba(255,255,255,.72), 0 5px 10px rgba(21,10,44,.18);
  font-size: calc(var(--card-w) * .5);
  line-height: 1;
}
.card-center .face-symbol { font-size: calc(var(--card-w) * .46); line-height: 1; }
.card-center small {
  margin-top: 2px;
  color: #50426f;
  font-size: calc(var(--card-w) * .085);
  font-weight: 1000;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.card-face.red .card-center small { color: #a63355; }

.stock-count {
  position: absolute;
  z-index: 230;
  right: -7px;
  bottom: -7px;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border: 2px solid #fff2a2;
  border-radius: 999px;
  color: #351659;
  background: linear-gradient(#fff29a, #f5b53b);
  box-shadow: 0 4px 9px rgba(2,1,18,.44);
  font-size: 10px;
  font-style: normal;
  font-weight: 1000;
}

.empty-stock-button {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: inherit;
  cursor: pointer;
  color: #c2fffa;
  background: transparent;
  font-size: calc(var(--card-w) * .37);
}

.table-footer {
  position: absolute;
  z-index: 10;
  left: clamp(20px, 2.2vw, 38px);
  right: clamp(20px, 2.2vw, 38px);
  bottom: 14px;
  min-height: 58px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 20px;
  background: rgba(7,7,38,.67);
  box-shadow: inset 0 1px rgba(255,255,255,.1), 0 10px 24px rgba(2,1,18,.24);
  backdrop-filter: blur(12px);
}

.stat {
  min-width: 96px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-right: 1px solid rgba(255,255,255,.12);
}
.stat > span:first-child { color: var(--gold); font-size: 20px; }
.stat > span:last-child { display: grid; }
.stat small, .draw-mode-chip small { color: #b8aece; font-size: 7px; font-weight: 1000; letter-spacing: .12em; text-transform: uppercase; }
.stat b, .draw-mode-chip b { font-size: 12px; }

.draw-mode-chip {
  min-height: 44px;
  margin-left: auto;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(121,244,239,.24);
  border-radius: 14px;
  cursor: pointer;
  color: inherit;
  background: rgba(50,29,97,.54);
}
.draw-mode-chip > span:nth-child(2) { display: grid; text-align: left; }
.draw-mode-chip > span:first-child { color: var(--aqua); font-size: 18px; }
.draw-mode-chip em { color: var(--gold); font-size: 8px; font-style: normal; font-weight: 1000; text-transform: uppercase; }

.nova-panel {
  position: relative;
  min-height: 720px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 31px 38px 28px 42px;
  background:
    radial-gradient(circle at 50% 12%, rgba(98, 235, 234, .19), transparent 30%),
    linear-gradient(165deg, rgba(22,13,73,.88), rgba(15,8,48,.91));
}

.nova-panel::before {
  content: "";
  position: absolute;
  inset: 7px;
  pointer-events: none;
  border: 1px solid rgba(255,220,99,.34);
  border-radius: 24px 31px 21px 35px;
}

.nova-portrait {
  position: relative;
  height: clamp(180px, 24vh, 256px);
  display: grid;
  place-items: end center;
}
.nova-portrait img {
  position: relative;
  z-index: 2;
  width: min(250px, 112%);
  max-height: 268px;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 18px 15px rgba(3,2,22,.48));
  animation: nova-float 3.8s ease-in-out infinite alternate;
}
@keyframes nova-float { to { transform: translateY(-5px) rotate(.7deg); } }
.nova-aura {
  position: absolute;
  width: 190px;
  height: 190px;
  bottom: 0;
  border: 1px solid rgba(121,244,239,.38);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(102,226,236,.2), transparent 66%);
  box-shadow: 0 0 58px rgba(95,231,236,.18);
}
.guide-badge {
  position: absolute;
  z-index: 5;
  right: 0;
  bottom: 10px;
  padding: 7px 10px;
  border: 1px solid #ffeba0;
  border-radius: 999px;
  color: #3a185f;
  background: linear-gradient(#fff29b, #f3b23a);
  box-shadow: 0 4px 0 #944d27;
  font-size: 7px;
  font-weight: 1000;
  letter-spacing: .13em;
}

.nova-copy { position: relative; z-index: 2; text-align: center; }
.eyebrow { margin: 5px 0 3px; color: var(--aqua); font-size: 8px; font-weight: 1000; letter-spacing: .17em; }
.nova-copy h2 { margin: 0; font-size: clamp(23px, 2vw, 31px); letter-spacing: -.05em; }
.coach-bubble {
  position: relative;
  min-height: 86px;
  margin-top: 12px;
  padding: 14px 14px 13px 37px;
  display: flex;
  align-items: center;
  border: 1px solid rgba(255,255,255,.17);
  border-radius: 18px 18px 18px 5px;
  background: linear-gradient(145deg, rgba(255,255,255,.13), rgba(255,255,255,.06));
  box-shadow: inset 0 1px rgba(255,255,255,.12), 0 8px 20px rgba(2,1,20,.18);
  text-align: left;
}
.coach-bubble p { margin: 0; color: #f7f1ff; font-size: 12px; font-weight: 800; line-height: 1.42; }
.coach-bubble > div { min-width: 0; }
.astronomer-name { display: block; margin-bottom: 4px; overflow: hidden; color: var(--aqua); font-size: 8px; font-weight: 1000; letter-spacing: .08em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.coach-spark { position: absolute; left: 14px; color: var(--gold); font-size: 15px; }
.speak-button {
  min-height: 44px;
  margin-top: 9px;
  padding: 8px 13px;
  border: 1px solid rgba(121,244,239,.22);
  border-radius: 13px;
  cursor: pointer;
  color: #dffffb;
  background: rgba(42,32,100,.6);
  font-size: 10px;
  font-weight: 1000;
}

.lesson-card, .progress-card, .save-note {
  position: relative;
  z-index: 2;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(7,7,38,.58);
  box-shadow: inset 0 1px rgba(255,255,255,.08);
}
.lesson-card {
  margin-top: 16px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-radius: 17px;
}
.lesson-icon {
  width: 49px;
  height: 49px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid rgba(255,222,102,.82);
  border-radius: 13px;
  color: #221141;
  background: linear-gradient(145deg, #fffdf4, #f8e6bd);
  box-shadow: 0 4px 0 #766080;
  font-size: 16px;
  font-weight: 1000;
}
.lesson-card > span:last-child { display: grid; gap: 3px; text-align: left; }
.lesson-card small { color: var(--aqua); font-size: 7px; font-weight: 1000; letter-spacing: .15em; }
.lesson-card b { font-size: 11px; line-height: 1.3; }
.progress-card { margin-top: 11px; padding: 13px; border-radius: 17px; }
.progress-heading { display: flex; justify-content: space-between; font-size: 10px; font-weight: 1000; }
.progress-heading b { color: var(--gold); }
.progress-track { height: 9px; margin-top: 9px; overflow: hidden; border-radius: 999px; background: rgba(4,3,25,.7); box-shadow: inset 0 2px 4px rgba(0,0,0,.38); }
.progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #51d7dc, #8ff8ed 48%, #ffdc66); box-shadow: 0 0 13px rgba(121,244,239,.45); transition: width .5s var(--ease); }
.progress-card p { margin: 8px 0 0; color: #c8c0db; font-size: 9px; line-height: 1.35; }
.save-note {
  margin: auto 0 0;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-radius: 15px;
  color: #c9c1db;
}
.save-note > span:first-child { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: var(--aqua); background: rgba(121,244,239,.1); font-size: 18px; }
.save-note > span:last-child { display: grid; gap: 2px; }
.save-note b { color: #eee9f8; font-size: 9px; }
.save-note small { font-size: 8px; line-height: 1.35; }

.toast {
  position: fixed;
  z-index: 120;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  max-width: min(520px, calc(100vw - 28px));
  min-height: 46px;
  padding: 12px 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,242,160,.7);
  border-radius: 16px;
  color: #2c1350;
  background: linear-gradient(180deg, #fff4a6, #f4bb44);
  box-shadow: 0 6px 0 #984c27, 0 18px 38px rgba(2,1,20,.46);
  font-size: 11px;
  font-weight: 1000;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 18px) scale(.96);
  transition: opacity .25s ease, transform .3s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0) scale(1); }

.star-dialog {
  width: min(700px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  padding: 0;
  overflow: visible;
  border: 0;
  color: var(--ink);
  background: transparent;
}
.star-dialog::backdrop { background: rgba(3,2,22,.74); backdrop-filter: blur(9px); }
.dialog-card {
  position: relative;
  max-height: calc(100dvh - 28px);
  padding: clamp(24px, 4vw, 42px);
  overflow: auto;
  border: 2px solid rgba(255,230,126,.68);
  border-radius: 31px;
  background:
    radial-gradient(circle at 50% -10%, rgba(92,225,231,.2), transparent 38%),
    linear-gradient(155deg, #21115d, #100936 72%);
  box-shadow: inset 0 1px rgba(255,255,255,.18), 0 28px 70px rgba(1,1,18,.64);
  text-align: center;
}
.dialog-close {
  position: absolute;
  z-index: 3;
  top: 14px;
  right: 14px;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 15px;
  cursor: pointer;
  background: rgba(255,255,255,.1);
  font-size: 26px;
}
.dialog-kicker { margin: 0 0 7px; color: var(--aqua); font-size: 9px; font-weight: 1000; letter-spacing: .17em; }
.dialog-card h2 { margin: 0; font-size: clamp(26px, 5vw, 42px); letter-spacing: -.05em; }
.dialog-intro { max-width: 540px; margin: 12px auto 22px; color: #dcd5ed; font-size: 13px; font-weight: 700; line-height: 1.5; }
.rules-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rules-grid article {
  min-height: 112px;
  padding: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 17px;
  background: rgba(255,255,255,.06);
  text-align: left;
}
.rules-grid article > div { display: grid; gap: 4px; }
.rules-grid b { font-size: 12px; }
.rules-grid p { margin: 0; color: #cbc3de; font-size: 10px; line-height: 1.4; }
.rule-art {
  position: relative;
  width: 54px;
  height: 74px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid #fff;
  border-radius: 9px;
  color: #211540;
  background: #fff9e9;
  box-shadow: 0 4px 0 #786785, 0 8px 13px rgba(2,1,18,.28);
  font-size: 20px;
  font-weight: 1000;
}
.rule-art.red, .rule-art.king { color: #d83d61; }
.rule-art i { position: absolute; right: -12px; bottom: -5px; width: 37px; height: 51px; display: grid; place-items: center; border: 2px solid #fff; border-radius: 7px; color: #1b2444; background: #fff9e9; box-shadow: 0 4px 0 #786785; font-size: 15px; font-style: normal; }
.rule-art.back { color: var(--gold); background: #18104e url("assets/solitaire/star-card-back.webp") center / cover; }
.touch-tip { margin-top: 11px; padding: 11px 14px; display: flex; align-items: center; gap: 11px; border-radius: 15px; background: rgba(121,244,239,.09); text-align: left; }
.touch-tip span { font-size: 24px; }
.touch-tip p { margin: 0; font-size: 10px; line-height: 1.4; }
.draw-setting { margin-top: 11px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid rgba(255,255,255,.13); border-radius: 15px; background: rgba(255,255,255,.06); text-align: left; }
.draw-setting > span { display: grid; gap: 3px; }
.draw-setting b { font-size: 11px; }
.draw-setting small { color: #c8c0db; font-size: 9px; }
.draw-setting select { min-height: 46px; padding: 8px 36px 8px 12px; border: 1px solid rgba(255,230,126,.45); border-radius: 12px; color: #fff; background: #2d1764; font-size: 11px; font-weight: 900; }
.dialog-primary {
  min-width: 190px;
  min-height: 50px;
  margin-top: 18px;
  padding: 12px 22px;
  border: 1px solid #fff3a8;
  border-radius: 16px;
  cursor: pointer;
  color: #341653;
  background: linear-gradient(#fff4a4, #f5bc43 65%, #e98328);
  box-shadow: inset 0 3px rgba(255,255,255,.55), 0 5px 0 #974b25;
  font-size: 12px;
  font-weight: 1000;
}

.math-dialog { width: min(520px, calc(100vw - 28px)); }
.math-answers { margin-top: 20px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.math-answer {
  min-height: 70px;
  border: 1px solid rgba(121,244,239,.4);
  border-radius: 17px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(145deg, rgba(99,67,178,.8), rgba(43,28,101,.85));
  box-shadow: inset 0 2px rgba(255,255,255,.17), 0 5px 0 #1a0f50;
  font-size: 22px;
  font-weight: 1000;
}
.math-answer:hover { transform: translateY(-2px); }
.math-feedback { min-height: 20px; margin: 14px 0 0; color: #d9d2ea; font-size: 10px; font-weight: 800; }

.win-dialog { width: min(540px, calc(100vw - 28px)); }
.win-star { width: 94px; height: 94px; margin: -2px auto 15px; display: grid; place-items: center; border: 2px solid #fff3a5; border-radius: 50%; color: var(--gold); background: radial-gradient(circle, rgba(121,244,239,.36), rgba(77,37,151,.65)); box-shadow: 0 0 44px rgba(121,244,239,.34), inset 0 0 26px rgba(255,255,255,.16); font-size: 49px; animation: win-spin 4s linear infinite; }
@keyframes win-spin { to { transform: rotate(360deg); } }
.win-stats { display: flex; justify-content: center; gap: 10px; }
.win-stats span { min-width: 120px; padding: 12px; display: grid; gap: 2px; border: 1px solid rgba(255,255,255,.15); border-radius: 15px; background: rgba(255,255,255,.07); }
.win-stats small { color: var(--aqua); font-size: 8px; font-weight: 1000; letter-spacing: .14em; text-transform: uppercase; }
.win-stats b { font-size: 22px; }

.celebration-layer { position: absolute; z-index: 90; inset: 0; overflow: hidden; pointer-events: none; }
.confetti {
  position: absolute;
  top: -30px;
  left: var(--x);
  width: var(--size);
  height: calc(var(--size) * 1.6);
  border-radius: 3px;
  background: var(--color);
  box-shadow: 0 0 9px var(--color);
  animation: confetti-fall var(--duration) cubic-bezier(.1,.64,.3,1) var(--delay) forwards;
}
@keyframes confetti-fall { to { transform: translate(var(--drift), 950px) rotate(900deg); opacity: .15; } }

.is-dealing .tableau .card { animation: deal-in .62s var(--ease) both; animation-delay: calc(var(--deal-index, 0) * 28ms); }
@keyframes deal-in { from { opacity: 0; transform: translate(-60vw, -40vh) rotate(-18deg) scale(.75); } }

html[data-codekin-text-size="large"] { --card-w: clamp(72px, 7.5vw, 115px); }
html[data-codekin-text-size="large"] .coach-bubble p,
html[data-codekin-text-size="large"] .lesson-card b { font-size: 13px; }

@media (max-width: 1260px) {
  :root { --card-w: clamp(66px, 7.8vw, 95px); --col-gap: clamp(5px, .65vw, 10px); }
  .game-header { grid-template-columns: auto 1fr auto; }
  .title-lockup { display: none; }
  .solitaire-layout { grid-template-columns: minmax(650px, 1fr) 240px; }
  .mission-chip { display: none; }
  .upper-board { grid-template-columns: auto 1fr; }
  .foundation-piles { justify-self: end; }
  .nova-panel { padding: 13px; }
  .nova-portrait { height: 190px; }
  .nova-portrait img { max-height: 215px; }
}

@media (max-width: 980px) {
  :root { --card-w: clamp(59px, 8.7vw, 84px); --col-gap: 5px; }
  body { background-attachment: scroll; }
  .game-header { min-height: 70px; padding-inline: 12px; }
  .brand-copy small { display: none; }
  .header-actions b { display: none; }
  .glass-button, .gold-button { width: 46px; min-width: 46px; padding: 8px; }
  .solitaire-layout { min-height: calc(100dvh - 70px); padding: 10px; grid-template-columns: 1fr; }
  .game-table { min-height: 760px; border-radius: 28px; }
  .nova-panel {
    min-height: 0;
    padding: 12px;
    display: grid;
    grid-template-columns: 108px 1fr auto;
    align-items: center;
    gap: 10px;
    border-radius: 24px;
  }
  .nova-portrait { height: 105px; }
  .nova-portrait img { width: 122px; max-height: 123px; }
  .nova-aura { width: 92px; height: 92px; }
  .guide-badge, .eyebrow, .lesson-card, .progress-card, .save-note { display: none; }
  .nova-copy { display: contents; }
  .nova-copy h2 { display: none; }
  .coach-bubble { min-height: 74px; margin: 0; }
  .speak-button { min-width: 72px; margin: 0; }
}

@media (max-width: 700px) {
  :root { --card-w: clamp(44px, 12.2vw, 82px); --col-gap: clamp(2px, .7vw, 5px); }
  .game-header { position: sticky; top: 0; min-height: 61px; grid-template-columns: auto 1fr; gap: 6px; }
  .brand { min-width: 48px; }
  .brand-gem { width: 44px; height: 44px; font-size: 24px; }
  .brand-copy { display: none; }
  .header-actions { gap: 4px; }
  .glass-button, .gold-button { width: 44px; min-width: 44px; min-height: 44px; border-radius: 13px; }
  .solitaire-layout { padding: 5px; gap: 6px; }
  .game-table { min-height: max(650px, calc(100dvh - 132px)); padding: 51px 5px 72px; border-radius: 22px; }
  .game-table::before { inset: 3px; border-radius: 19px; }
  .table-plaque { min-width: 70%; height: 38px; padding: 0 10px; font-size: 7px; border-radius: 0 0 14px 14px; }
  .table-plaque span { font-size: 12px; }
  .upper-board { grid-template-columns: 1fr 1fr; gap: 8px; }
  .pile-cluster { justify-self: start; }
  .foundation-piles { justify-self: end; }
  .pile-label { font-size: 6px; letter-spacing: .08em; }
  .tableau { margin-top: 13px; justify-content: center; }
  .tableau-column { min-height: calc(var(--card-h) * 4.8); }
  .card-rank { font-size: calc(var(--card-w) * .3); }
  .card-suit { font-size: calc(var(--card-w) * .22); }
  .card-center .big-suit, .card-center .face-symbol { font-size: calc(var(--card-w) * .45); }
  .card-center small, .card-corner.bottom { display: none; }
  .table-footer { left: 8px; right: 8px; bottom: 7px; min-height: 54px; padding: 6px; }
  .stat { min-width: 0; flex: 1; padding: 5px; justify-content: center; }
  .stat > span:first-child { display: none; }
  .stat small { font-size: 6px; }
  .stat b { font-size: 10px; }
  .draw-mode-chip { margin-left: 0; padding: 5px 7px; }
  .draw-mode-chip > span:first-child, .draw-mode-chip em { display: none; }
  .nova-panel { grid-template-columns: 66px 1fr 54px; min-height: 78px; padding: 6px; border-radius: 17px; }
  .nova-portrait { height: 66px; }
  .nova-portrait img { width: 78px; height: 78px; }
  .nova-aura { width: 58px; height: 58px; }
  .coach-bubble { min-height: 60px; padding: 8px 7px 8px 26px; border-radius: 12px; }
  .coach-bubble p { font-size: 9px; line-height: 1.3; }
  .astronomer-name { margin-bottom: 2px; font-size: 7px; }
  .coach-spark { left: 9px; font-size: 11px; }
  .speak-button { width: 50px; min-width: 50px; min-height: 48px; padding: 5px; font-size: 0; }
  .speak-button span { font-size: 19px; }
  .rules-grid { grid-template-columns: 1fr; }
  .rules-grid article { min-height: 94px; }
  .dialog-card { padding: 28px 16px 20px; border-radius: 22px; }
  .draw-setting { align-items: stretch; flex-direction: column; }
  .draw-setting select { width: 100%; }
}

@media (max-height: 760px) and (min-width: 981px) {
  :root { --card-w: clamp(64px, 6.5vw, 92px); }
  .game-header { min-height: 64px; padding-block: 6px; }
  .solitaire-layout { height: calc(100dvh - 64px); min-height: 0; padding: 8px 12px; gap: 12px; }
  .game-table, .nova-panel { height: 100%; min-height: 0; }
  .game-table { padding: 47px 18px 72px; }
  .tableau { margin-top: 10px; }
  .tableau-column { min-height: calc(var(--card-h) * 3.05); }
  .nova-portrait { height: 165px; }
  .nova-portrait img { max-height: 190px; }
  .coach-bubble { min-height: 70px; }
  .lesson-card { margin-top: 10px; }
  .save-note { display: none; }
}

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

@media (min-width: 1101px) {
  body > .ck-settings-launcher {
    top: 12px;
    bottom: auto;
    left: 350px;
    min-height: 44px;
  }
}

html[data-codekin-motion="calm"] *,
html[data-codekin-motion="calm"] *::before,
html[data-codekin-motion="calm"] *::after {
  animation-duration: .01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .12s !important;
}
