/* Pop-up panels: the settings menu (see settings.js), the color picker, and the end screen. */

/* A white panel in the middle of a dimmed screen */
.panel-dialog {
  border: none;
  padding: 0;
  background: none;
  overflow: visible;
  max-width: calc(100vw - 32px);
}
.panel-dialog::backdrop { background: rgba(10, 14, 25, 0.6); }

/* The panel pops in; the dialog itself stays still so the confetti can cover the screen */
.panel {
  border-radius: 24px;
  padding: 40px 48px;
  background: white;
  color: var(--night);
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.panel-dialog[open] .panel { animation: pop-in 0.35s cubic-bezier(0.2, 1.4, 0.4, 1); }

@keyframes pop-in {
  from { transform: scale(0.6); opacity: 0; }
}

/* Settings menu */
.settings-panel {
  display: flex;
  flex-direction: column;
  /* Every setting spans the panel, so the switches all line up down its left edge */
  align-items: stretch;
  gap: 24px;
  padding: 32px 40px;
  /* Scrolls on short screens, so Done can always be reached */
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}
.panel-title { margin: 0; font-size: 2rem; }
.setting { margin: 0; padding: 0; border: none; font-size: 1.15rem; }
.setting-name { margin: 0 auto 10px; padding: 0; font-weight: bold; }
.toggle > span:last-child { text-align: left; }
.settings-panel > .button { align-self: center; }
.deck-options, .house-rules { display: flex; flex-direction: column; gap: 14px; }
.setting-hint { display: block; max-width: 220px; margin-top: 2px; font-size: 0.9rem; color: #6b7388; }
/* A rule that's part of the one above it: indented, and greyed out while that one is off */
.sub-toggle { margin-left: 28px; }
.sub-toggle:has(input:disabled) { opacity: 0.45; cursor: default; }

/* A row of buttons to pick exactly one from (radio buttons). The real inputs are hidden */
.segmented { display: flex; justify-content: center; gap: 10px; }
.segmented input { position: absolute; opacity: 0; width: 0; height: 0; }
.segmented span {
  display: grid;
  place-items: center;
  width: 58px;
  height: 52px;
  border-radius: 14px;
  background: #e8ebf2;
  font-size: 1.4rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.segmented input:checked + span { background: var(--yellow); box-shadow: 0 4px 0 var(--yellow-ledge); }
.segmented input:focus-visible + span { outline: 3px solid var(--night); outline-offset: 2px; }
.segmented input:disabled + span { cursor: default; }

/* Tick boxes, for the generations: the real checkbox is hidden, the span draws the box */
.generations { display: flex; justify-content: center; gap: 20px; }
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
}
.checkbox:has(input:disabled) { cursor: default; }
.checkbox input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkbox-box {
  position: relative;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--switched-off);
  transition: background 0.15s;
}
/* The tick: two sides of a box, turned */
.checkbox-box::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 5px;
  width: 7px;
  height: 13px;
  border: solid white;
  border-width: 0 4px 4px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.15s;
}
.checkbox input:checked + .checkbox-box { background: var(--yellow); }
.checkbox input:checked + .checkbox-box::after { transform: rotate(45deg) scale(1); }
.checkbox input:focus-visible + .checkbox-box { outline: 3px solid var(--night); outline-offset: 2px; }
.deck-size { margin: 0; font-size: 0.95rem; font-weight: bold; color: #6b7388; }

/* On/off switch: the real checkbox is hidden, the span draws the switch */
.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-switch {
  position: relative;
  flex-shrink: 0;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: var(--switched-off);
  transition: background 0.2s;
}
.toggle-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s;
}
.toggle input:checked + .toggle-switch { background: var(--yellow); }
.toggle input:checked + .toggle-switch::after { transform: translateX(22px); }
.toggle input:focus-visible + .toggle-switch { outline: 3px solid var(--night); outline-offset: 2px; }

/* Color picker: four big round buttons */
.color-panel {
  padding: 28px 36px 36px;
  outline: none;
  /* Scrolls on short screens, when it's showing your evolutions too */
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}
.color-choices {
  display: grid;
  grid-template-columns: repeat(2, auto);
  justify-content: center;
  gap: 18px;
  margin-top: 22px;
}
.color-choice {
  width: 96px;
  height: 96px;
  border: none;
  border-radius: 50%;
  background: var(--glow);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.1s;
}
.color-choice:hover { transform: scale(1.06); }
.color-choice:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); }
.color-choice:focus-visible { outline: 4px solid var(--night); outline-offset: 3px; }

/* Under the colors: your cards that can evolve the wild, glowing purple like they would in your hand */
.picker-evolutions { margin-top: 24px; padding-top: 22px; border-top: 2px solid #e8ebf2; }
.evolution-choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.evolution-choice {
  padding: 0;
  border: none;
  border-radius: 7px;
  background: none;
  cursor: pointer;
  transition: transform 0.1s;
}
.evolution-choice .card {
  --card-width: 76px;
  box-shadow: 0 0 0 4px var(--evolve-glow), 0 0 16px 4px rgba(183, 124, 255, 0.6);
}
.evolution-choice:hover { transform: translateY(-4px); }
.evolution-choice:focus-visible { outline: 4px solid var(--night); outline-offset: 5px; }

/* End screen */
.end-title { margin: 0; font-size: 3rem; }
.end-screen.won .end-title { color: var(--alert); }
.end-subtitle { margin: 12px 0 28px; font-size: 1.3rem; }

/* Covers the whole screen; clicks go straight through to the panel */
.confetti {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
}
