/* Fruit Slash: glowing night-party skin over the shared header. Mobile
   first. Page frame, option chips, cards, buttons and overlays here; the
   start screen in start.css, the play stage in stage.css. Sizes grow with
   the screen (vmin) up to a 4K TV. */
[hidden] {
  display: none !important;
}

html {
  font-size: clamp(16px, 2.4vmin, 64px);
}

html,
body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 0;
  background: #1b0a4a;
  color: #fdf7ff;
}

.game-nav {
  flex: 0 0 auto;
  background: #1b0a4a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.nav-title {
  background: linear-gradient(90deg, #ff4d6d, #ffd23f, #4cd964, #4cc9f0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 900;
}

.options-panel-sheet {
  color: #1f2937;
}

.fs-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fs-chip {
  min-width: 3.5rem;
  min-height: 2.75rem;
  padding: 0.5rem 0.9rem;
  border: 2px solid #d1d5db;
  border-radius: 0.75rem;
  background: #ffffff;
  color: #1f2937;
  font-weight: 700;
  cursor: pointer;
}

.fs-chip.active,
.fs-chip[aria-pressed="true"] {
  border-color: #b15cff;
  background: #f1e4ff;
}

.fs-app {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  box-sizing: border-box;
  /* Android bars can cover the bottom even when the safe-area inset is 0. */
  padding: 8px max(24px, env(safe-area-inset-right, 0px))
    max(40px, calc(env(safe-area-inset-bottom, 0px) + 24px))
    max(24px, env(safe-area-inset-left, 0px));
  background:
    radial-gradient(
      circle at 20% 15%,
      rgba(255, 77, 109, 0.35),
      transparent 40%
    ),
    radial-gradient(
      circle at 85% 30%,
      rgba(76, 201, 240, 0.3),
      transparent 40%
    ),
    radial-gradient(
      circle at 50% 95%,
      rgba(255, 210, 63, 0.25),
      transparent 45%
    ),
    linear-gradient(160deg, #1b0a4a, #3c0f86 55%, #7a1aa8);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.fs-app button:focus-visible {
  outline: 3px solid #fff275;
  outline-offset: 2px;
}

.fs-card {
  box-sizing: border-box;
  width: min(100%, 26rem);
  padding: 0.9rem 0.9rem 1rem;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: 1.5rem;
  background: rgba(22, 8, 56, 0.88);
  text-align: center;
  box-shadow:
    0 0 32px rgba(255, 92, 200, 0.35),
    0 18px 40px rgba(0, 0, 0, 0.4);
}

.fs-card p {
  margin: 0 0 10px;
  line-height: 1.4;
}

.fs-button {
  min-width: 11rem;
  min-height: 3.25rem;
  margin-top: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 1.1rem;
  background: linear-gradient(135deg, #ff4d6d, #ff9f1c);
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 900;
  box-shadow:
    0 4px 0 #a3163a,
    0 0 20px rgba(255, 110, 90, 0.5);
  cursor: pointer;
  touch-action: manipulation;
}

.fs-button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #a3163a;
}

.fs-card > .fs-button {
  display: block;
  margin: 0.6rem auto 0;
}

.fs-button-soft {
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
}

.fs-best {
  margin-top: 12px !important;
  font-weight: 800;
  color: #ffd23f;
}

.fs-new-best {
  display: block;
}

/* Inside the padded .fs-app, so the 40px / 24px margins already hold. */
.fs-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 0.75rem;
  overflow-y: auto;
  border-radius: 1rem;
  background: rgba(12, 4, 32, 0.6);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.fs-overlay-title {
  margin: 0 0 10px;
  font-size: 1.8rem;
  font-weight: 900;
  color: #ffffff;
}

.fs-stars {
  font-size: 2.6rem;
  letter-spacing: 0.1em;
  color: #ffd23f;
  filter: drop-shadow(0 0 10px rgba(255, 210, 63, 0.7));
}

.fs-score-line {
  font-size: 1.6rem;
  font-weight: 900;
  color: #fff275;
}

@media (min-width: 700px) {
  .fs-card {
    width: min(100%, 34rem);
    padding: 1.5rem 1.75rem;
  }
}

/* Short landscape screens: the end card must fit in ~300px. */
@media (orientation: landscape) and (max-height: 500px) {
  .fs-app {
    padding-top: 4px;
  }

  .fs-card {
    width: min(100%, 40rem);
    padding: 0.6rem 1rem 0.75rem;
  }

  .fs-button {
    min-height: 2.75rem;
    padding: 0.4rem 1.2rem;
  }

  /* End card: stars, title and score left; stats and buttons right. */
  .fs-end-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-auto-flow: dense;
    align-items: center;
    column-gap: 1rem;
  }

  .fs-end-card > * {
    grid-column: 1;
  }

  .fs-end-card > .fs-button,
  .fs-end-card > .fs-best {
    grid-column: 2;
    margin: 0.3rem auto 0;
  }

  .fs-end-card > .fs-best {
    grid-row: 1 / span 2;
  }

  .fs-score-line {
    font-size: 1.3rem;
  }

  .fs-stars {
    font-size: 1.8rem;
  }

  .fs-overlay-title {
    margin-bottom: 4px;
    font-size: 1.4rem;
  }

  .fs-card p {
    margin-bottom: 4px;
  }
}

/* Desktop and TV, 960x540 up to 3840x2160: the header grows with the
   screen and everything stays 3% away from the edges (TV overscan). */
@media (min-width: 960px) and (min-height: 500px) {
  .game-nav {
    height: auto;
    padding: 3dvh max(3vw, env(safe-area-inset-right, 0px)) 1dvh
      max(3vw, env(safe-area-inset-left, 0px));
  }

  .nav-title {
    font-size: max(1.1rem, 3.4dvh);
  }

  .back-button,
  .options-button {
    width: max(36px, 6dvh);
    height: max(36px, 6dvh);
    font-size: max(1rem, 3dvh);
  }

  .back-button svg,
  .options-button svg {
    width: 50%;
    height: 50%;
  }

  .fs-app {
    padding: 2dvh max(3vw, env(safe-area-inset-right, 0px)) max(40px, 4dvh)
      max(3vw, env(safe-area-inset-left, 0px));
  }
}

/* TV remote: a thick, high-contrast ring on the focused control. */
html.tv :focus {
  outline: 0.3rem solid #fff275 !important;
  outline-offset: 0.2rem;
  box-shadow: 0 0 0 0.6rem rgba(177, 92, 255, 0.85);
}
