/* ════════════════════════════════════════════
   STAR CROSSED — stylesheet
   ════════════════════════════════════════════ */


/* ── Variables ── */
:root {
  --bg-main:      #131b2e;
  --bg-footer:    #131b2e;
  --ink-gold:     #A98B2D;
  --ink-lavender: #B6B8FF;
  --arch-stroke:  #A98B2D;
  --arch-shadow:  #0B1425;
  --line-a:       #B6B8FF;
  --line-b:       rgba(255, 210, 130, 0.3);
  --line-active:  #ffffff;
  --line-cross:   #532D3B;
}


/* ── Reset ── */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg-main);
  background-size: cover;
  overflow-x: hidden;
}


/* ════════════════════════════════════════════
   TYPOGRAPHY
   ════════════════════════════════════════════ */

/* Title: Charmonman with SVG ink-distort filter and stroke to mimic
   a hand-inked brush look */
.ink-title {
  font-family: 'Charmonman', cursive;
  font-weight: 700;
  color: var(--ink-gold);
  font-size: clamp(36px, 7vw, 70px);
  line-height: 0.95;
  letter-spacing: 0.5px;
  filter: url(#inkDistortTitle);
  -webkit-text-stroke: 2px var(--ink-gold);
  paint-order: stroke fill;
  width: fit-content;
}

/* Body ink text: shared style for all secondary text elements */
.ink-text {
  font-family: 'Averia Serif Libre', serif;
  color: var(--ink-lavender);
  filter: url(#inkDistortBody);
  -webkit-text-stroke: 1px var(--ink-lavender);
  paint-order: stroke fill;
  width: fit-content;
}

.day-number {
  font-size: clamp(16px, 2.2vw, 28px);
  font-weight: 400;
}

.streak-text {
  font-family: 'Averia Serif Libre', serif;
  color: var(--ink-gold);
  filter: url(#inkDistortBody);
  -webkit-text-stroke: 1px var(--ink-gold);
  font-size: clamp(16px, 2.2vw, 28px);
  font-weight: 400;
  paint-order: stroke fill;
  width: fit-content;
  white-space: nowrap;
  position: relative;
}

.moves-text {
  font-family: 'Averia Serif Libre', serif;
  color: var(--ink-gold);
  filter: url(#inkDistortBody);
  -webkit-text-stroke: 1px var(--ink-gold);
  font-size: 20px;
  paint-order: stroke fill;
  text-align: center;
  position: static;
  pointer-events: none;
}

.reset-label {
  font-family: 'Averia Serif Libre', serif;
  color: var(--ink-gold);
  filter: url(#inkDistortBody);
  -webkit-text-stroke: 1px var(--ink-gold);
  font-size: clamp(13px, 1.6vw, 20px);
  paint-order: stroke fill;
  pointer-events: none;
}


/* ════════════════════════════════════════════
   PAGE LAYOUT
   ════════════════════════════════════════════ */

.page {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 88vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  padding: 2rem 6vw 0;
  gap: 2rem;
  z-index: 1;
}

/* Left column: title, puzzle number, streak, win reveal */
.left-col {
  display: flex;
  flex-direction: column;
  gap: 5rem;
  padding-top: 1rem;
}

/* Title stacks vertically on desktop */
.title-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5rem;
}

/* Day number and streak sit together below the title */
.hrow {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Right column: game board */
.right-col {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 6rem;
}

.bg-lines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: visible;
}

@keyframes twinkle {
  0%   { opacity: 0; }
  30%  { opacity: 0.2; }
  50%  { opacity: 0.4; }
  70%  { opacity: 0.2; }
  100% { opacity: 0; }
}

/* ════════════════════════════════════════════
   WIN REVEAL — DESKTOP (left column)
   ════════════════════════════════════════════ */

.win-reveal {
  display: none;
  flex-direction: column;
  gap: 0.6rem;
}
.win-reveal.show { display: flex; }

.win-subheading {
  font-family: 'Charmonman', cursive;
  font-size: clamp(22px, 2.5vw, 36px);
  color: var(--ink-gold);
  -webkit-text-stroke: 1px var(--ink-gold);
}

.avg-text {
  font-size: clamp(14px, 1.5vw, 20px);
  color: var(--ink-lavender);
}

.star-rating {
  display: flex;
  gap: 6px;
  align-items: center;
}
.star-rating img { width: 35px; height: 35px; }


/* ════════════════════════════════════════════
   GAME BOARD
   ════════════════════════════════════════════ */

/* Outer container that stacks board + slots vertically */
.board-stack {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Controls the rendered size of the SVG board */
.board-svg-wrap {
  position: relative;
  width: min(80vw, 500px);
  aspect-ratio: 1 / 1;
}

.board-svg-wrap svg {
  width: 100%;
  height: 100%;
  overflow: visible; /* rings intentionally bleed outside the wrapper */
}

/* SVG circle elements */
.circle-fill    { fill: var(--arch-shadow); filter: url(#archInnerShadow); }
.circle-outline { fill: none; stroke: var(--arch-stroke); stroke-width: 1.6; filter: url(#inkDistortArch); opacity: 0.85; }


/* ── SVG foreignObject slots ──
   Content embedded in SVG at ring-relative coordinates.
   justify-content is redundant here since svg-slot already centres,
   but kept for explicitness per element. */

.svg-slot {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  text-align: center;
}

.svg-reset  { display: flex; justify-content: center; align-items: center; }
.svg-moves {
  justify-content: center;
  align-items: center;
  width: 100%;
  position: static;
  text-align: center;
  display: flex;
}
.svg-avg    { justify-content: center; }
.svg-stars  { justify-content: center; }
.svg-win-label { justify-content: center; }


/* ── Content slots above/below the board (used on mobile) ── */

.slot-above {
  width: 100%;
  display: flex;
  justify-content: center;
  padding-bottom: 0.5rem;
  min-height: 44px;
}

.slot-below {
  width: 100%;
  display: flex;
  justify-content: center;
  padding-top: 0.5rem;
  min-height: 1.5em;
}

/* Win subheading sits between the middle ring and board top in the SVG */
.win-mid-label {
  position: static;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

/* ── Win reveal — mobile (inside SVG foreignObjects) ── */

/* Hidden by default; opacity toggled via .show on parent or self */
.win-subheading-mobile {
  font-family: 'Charmonman', cursive;
  font-size: clamp(18px, 3.5vw, 28px);
  color: var(--ink-gold);
  -webkit-text-stroke: 1px var(--ink-gold);
  filter: url(#inkDistortBody);
  paint-order: stroke fill;
  text-align: center;
  opacity: 0;
  transition: opacity 0.4s;
}
.win-mid-label.show .win-subheading-mobile,
.win-subheading-mobile.show { opacity: 1; }

.star-rating-mobile {
  display: flex;
  gap: 6px;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s;
}
.star-rating-mobile img { width: 60px; height: 60px; }
.slot-above.show .star-rating-mobile,
.star-rating-mobile.show { opacity: 1; }

/* avg-text-mobile has two declarations in source — merged here.
   display:none is the default; .show switches to block + opacity 1. */
.avg-text-mobile {
  display: none;
  font-size: clamp(18px, 4vw, 18px);
  color: var(--ink-lavender);
  text-align: center;
  position: relative;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.4s;
  white-space: nowrap;
}
.avg-text-mobile.show {
  display: block;
  opacity: 1;
}
.slot-below.show .avg-text-mobile { opacity: 1; }

/* Legacy mobile win-reveal (kept in case referenced elsewhere) */
.win-reveal-mobile {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  position: absolute;
  top: -22%;
  left: 0; right: 0;
  z-index: 3;
}
.win-reveal-mobile.show { display: flex; }


/* ════════════════════════════════════════════
   RESET BUTTON
   ════════════════════════════════════════════ */

/* Mobile reset — sits inside SVG foreignObject at 12 o'clock on middle ring */
.reset-btn {
  position: static;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0;
  z-index: 4;
}

.reset-btn img {
  width: clamp(28px, 3.5vw, 44px);
  height: clamp(28px, 3.5vw, 44px);
  object-fit: contain;
}

.reset-btn .btn-default           { display: block; }
.reset-btn .btn-hover             { display: none; }
.reset-btn:hover .btn-default     { display: none; }
.reset-btn:hover .btn-hover       { display: block; }
.reset-btn:hover .reset-label     { opacity: 0.7; }
.reset-btn.disabled               { display: none; }

/* Desktop reset — absolutely positioned to the left of the middle ring */
.reset-btn-desktop {
  position: absolute;
  top: 50%;
  left: -28.5%;
  transform: translate(-50%, -50%);
  background: none;
  border: none;
  cursor: pointer;
  display: none; /* shown via desktop media query */
  flex-direction: row-reverse;
  align-items: center;
  gap: 8px;
  padding: 0;
  z-index: 4;
}

.reset-btn-desktop .btn-default         { display: block; }
.reset-btn-desktop .btn-hover           { display: none; }
.reset-btn-desktop:hover .btn-default   { display: none; }
.reset-btn-desktop:hover .btn-hover     { display: block; }


/* ════════════════════════════════════════════
   DESKTOP OVERRIDES  (min-width: 761px)
   ════════════════════════════════════════════ */

@media (min-width: 761px) {
  /* Show desktop reset, hide SVG-embedded mobile one */
  .reset-btn-desktop { display: flex; }
  .svg-reset         { display: none; }

  /* Hide mobile SVG slots — win content lives in left-col on desktop */
  .svg-stars    { display: none; }
  .svg-win-label { display: none; }
  .svg-avg      { display: none; }
  .slot-above   { display: none; }
  .slot-below   { display: none; }
  .win-mid-label { display: none; }
}


/* ════════════════════════════════════════════
   MOBILE OVERRIDES  (max-width: 760px)
   ════════════════════════════════════════════ */

@media (max-width: 760px) {
  html, body { min-height: 100dvh; }

  .page {
    grid-template-columns: 1fr;
    padding: 1.5rem 6vw 0;
    width: 100%;
    min-height: 100dvh;
    overflow-x: hidden;
    gap: 0.5rem;
    align-items: start;
  }

  /* Column order: title above board */
  .left-col  { order: 1; gap: 0.5rem; }
  .right-col {
    order: 2;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 0;
    overflow: visible;
  }

  /* Title row: title left, day number + streak stacked right */
  .title-row {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .hrow {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    text-align: right;
  }

  /* Hide desktop win elements */
  .win-reveal  { display: none !important; }
  .avg-text    { display: none !important; }

  /* Reset button stacks vertically on mobile */
  .reset-btn         { flex-direction: column; gap: 4px; }
  .reset-btn span    { font-size: clamp(14px, 4vw, 18px); }
  .reset-btn-desktop { display: none; }

  /* vbox: utility flex column used for stacking below-board elements */
  .vbox {
    display: flex;
    flex-direction: column;
    gap: 26px;
    position: absolute;
    bottom: -24%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    text-align: center;
  }
}