/* Tokens (1) and Base (2, 3). Shared by the player and the CMS, loaded first on
   every page. Parts 1 and 2 are exported from Unity's Tokens.uss and Base.uss
   (Documents/WEB_EXPORT.md in the Unity repo) and never edited here. Part 3 is
   written by hand. */

/* ==============================
   1. TOKENS
   ============================== */
/* =====================================================
   COLOR PALETTE — Single source of truth
   =====================================================
   All colors in the app MUST use these variables.
   Never use raw rgba/hex values outside this block.
   ===================================================== */
/* generated:tokens:start */
:root {
  /* ── Accent ─────────────────────────────────────── */
  --accent:                 rgba(247, 26, 152, 1);
  --accent-light:           rgba(248, 124, 248, 1);
  --accent-secondary:       rgba(32, 10, 61, 1);
  --accent-secondary-deep:  rgba(26, 8, 49, 1);
  --accent-secondary-mid:   rgba(77, 59, 100, 1);
  --accent-secondary-light: rgba(186, 7, 252, 1);
  --accent-50:              rgba(247, 26, 152, 0.5);
  --accent-secondary-50:    rgba(32, 10, 61, 0.5);

  /* ── White / Black ──────────────────────────────── */
  --white:    rgba(255, 255, 255, 1);
  --white-10: rgba(255, 255, 255, 0.1);
  --white-50: rgba(255, 255, 255, 0.5);

  --black:    rgba(0, 0, 0, 1);
  --black-10: rgba(0, 0, 0, 0.1);
  --black-40: rgba(0, 0, 0, 0.4);
  --black-50: rgba(0, 0, 0, 0.5);
  --black-85: rgba(0, 0, 0, 0.85);

  /* ── Semantic ───────────────────────────────────── */
  --success:    rgba(40, 167, 69, 1);
  --success-50: rgba(40, 167, 69, 0.5);
  --danger:     rgba(239, 68, 68, 1);
  --danger-50:  rgba(239, 68, 68, 0.5);
  --info:       rgba(126, 244, 245, 1);
  --info-50:    rgba(126, 244, 245, 0.5);
  --warning:    rgba(255, 193, 7, 1);
  --warning-50: rgba(255, 193, 7, 0.5);
  --neutral:    rgba(173, 181, 189, 1);

  /* ── Currencies (Credits / Hearts / PocketWatches chips) ── */
  --stat-hearts:  rgba(255, 76, 178, 1);
  --stat-stamina: rgba(76, 220, 178, 1);
  --stat-gold:    rgba(255, 200, 76, 1);

  /* ── Typography ─────────────────────────────────── */
  --font-family-sans: 'Nunito Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

  --font-size-xs:      0.75rem;
  --font-size-sm:      0.875rem;
  --font-size-base:    1rem;
  --font-size-lg:      1.25rem;
  --font-size-xl:      1.75rem;
  --font-size-display: 2.5rem;

  --font-weight-normal: 400;
  --font-weight-bold:   700;
  --font-style-italic:  italic;

  --line-height-tight: 1.2;
  --line-height-base:  1.5;

  /* ── Interactive state ──────────────────────────── */
  --disabled-opacity:  0.5;
  --active-scale:      0.97;
  --transition-fast:   0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow:   0.4s ease;

  /* ── Spacing ────────────────────────────────────── */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 64px;
  --space-8: 128px;
  --space-9: 256px;
  --space-10: 512px;

  /* ── Borders ────────────────────────────────────── */
  --border-width-base:  1px;
  --border-width-thick: 2px;
  --border-width-xl:    3px;

  --radius-sm:     4px;
  --radius-md:     8px;
  --radius-pill:   22px;
  --radius-circle: 50%;

  /* ── Z-index ────────────────────────────────────── */
  --z-overlay:  500;
  --z-dropdown: 1000;
  --z-modal:    1500;
  --z-reward:   2000;   /* Reward moment: vignette, overlay, flash */
  --z-toast:    2500;
  --z-loading:  3000;
  --z-popup:    3500;   /* Interactive overlays that render above the loading screen */
  --z-blocker:  4000;   /* Landscape blocker — used only by the CMS (cms-components.css); the player has no blocker */
}
/* generated:tokens:end */


/* ==============================
   2. BASE: COMMON
   ============================== */
/* Exported from the "Common" part of Unity's Base.uss, section by section. */

/* generated:base:start */

/* ── Disabled and locked ── */
:is(:disabled, [disabled]) {
  opacity: var(--disabled-opacity);
}

.locked {
  opacity: var(--disabled-opacity);
}


/* ── Body ── */
body {
  color: var(--white);
  font-size: var(--font-size-base);
}


/* ── Text ── */
.label {
  flex-shrink: 0;
  white-space: nowrap;
}


/* ── Button ── */
button {
  --btn-bg: var(--accent-50);
  --btn-bg-hover: var(--accent);
  --btn-color: var(--white);
  --btn-color-hover: var(--white);
  color: var(--btn-color);
  border-width: var(--border-width-thick);
  flex-shrink: 0;
  white-space: nowrap;
  text-align: center;
}

button:hover,
button:active {
  color: var(--btn-color-hover);
}

button:active {
  scale: var(--active-scale);
}

button:focus {
  border-color: var(--accent-50);
}


/* ── Dropdown ── */
select {
  flex-direction: row;
  white-space: nowrap;
  text-align: left;
}


/* ── Checkbox ── */
input[type="checkbox"] {
  width: var(--space-5);
  height: var(--space-5);
  flex-shrink: 0;
  align-self: center;
  background-color: var(--white);
  border-width: var(--border-width-base);
  border-color: var(--accent);
}

input[type="checkbox"]:checked {
  background-color: var(--accent);
  background-image: url("../assets/ui/Checkmark.png");
  background-size: contain;
}


/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: var(--space-2);
}

::-webkit-scrollbar {
  height: var(--space-2);
}

::-webkit-scrollbar-track {
  background-color: var(--white-10);
}

::-webkit-scrollbar-thumb {
  background-color: var(--accent);
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--accent-light);
}
/* generated:base:end */


/* ==============================
   3. BASE: WEB ONLY
   ============================== */
/* Hand-written: what browsers need and Unity does itself. Same section names as
   the "Unity only" part of Unity's Base.uss; a section with no rules says what
   handles it instead. */

/* ── Disabled and locked ── */
/* Unity: UI Toolkit blocks input on a disabled element itself. */
:disabled,
[disabled] {
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Body ── */
/* --app-height is set by player JS from window.visualViewport.height so the
   frame shrinks when the mobile soft keyboard opens (100dvh stays full-screen
   on iOS Safari). Unity: the font file and the panel root. */
body {
  background: url('../assets/background.png') no-repeat center center fixed;
  background-size: cover;
  height: var(--app-height, 100dvh);
  overflow: hidden;
  margin: 0;
  font-family: var(--font-family-sans);
}

/* ── Text ── */
/* No rules: the Text section is all common. */

/* ── Button ── */
/* The browser's own button border becomes a solid one with no colour, which the
   common focus rule colours. Buttons take the page font with the Field rule below. */
button {
  border-style: solid;
  border-color: transparent;
}

/* ── Field ── */
/* Unity: the inner layout of its own fields. The browser lays these out; they only take the page font. */
button,
select,
input,
textarea {
  font: inherit;
}

/* ── Text field ── */
/* Read-only: focusable and selectable but not editable. USS has no read-only state. */
input[readonly],
textarea[readonly] {
  opacity: var(--disabled-opacity);
  cursor: not-allowed;
}

/* ── Dropdown ── */
/* No rules: the browser draws the arrow and the option list of a <select>. */

/* ── Checkbox ── */
/* The browser's own checkbox is switched off so the common box and tick show.
   Unity: the box and its label in a row. */
input[type="checkbox"] {
  appearance: none;
  border-style: solid;
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer;
}

/* ── Radio ── */
/* Unity: the dot colour on .unity-radio-button__checkmark. */
input[type="radio"] {
  cursor: pointer;
  accent-color: var(--accent);
}

/* ── Scroll view ── */
/* No rules: the browser scrolls an element with overflow. */

/* ── Scrollbar ── */
/* Unity: no arrow buttons, and the thumb placed on the track. */
::-webkit-scrollbar-corner {
  background: transparent;
}

/* Firefox has no ::-webkit-scrollbar. Chrome, Edge and Safari drop it when the
   standard properties are set, so those stay scoped to Firefox. */
@supports (-moz-appearance: none) {
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--white-10);
  }
}

/* ── Box sizing ── */
/* Unity: UI Toolkit always sizes an element with its border and padding. */
* {
  box-sizing: border-box;
}

/* ── Images ── */
/* Discourage drag-save / long-press save / accidental selection on rendered images.
   Bypassable via DevTools; pairs with draggable="false" + oncontextmenu in the JS templates.
   Unity: nothing to protect. */
img {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

/* ── Animations ── */
/* Unity: USS has no keyframes; played from C# (ClassPulse, FadeIn, Pulse, PopIn, AccentPulse, Shake, TypingIndicator). */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(var(--fade-from, var(--space-2)));
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: scale(0);
  }

  40% {
    transform: scale(1);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: var(--disabled-opacity);
  }
}

.pulse {
  animation: pulse var(--transition-slow) infinite;
}

@keyframes message-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(var(--active-scale)); }
}

@keyframes portrait-pulse {
  0%   { border-color: var(--accent-50); box-shadow: none; transform: scale(1); }
  25%  { border-color: var(--accent); box-shadow: 0 0 var(--space-4) var(--accent), 0 0 var(--space-6) var(--accent-50); transform: scale(var(--active-scale)); }
  50%  { border-color: var(--accent-light); box-shadow: 0 0 var(--space-5) var(--accent-light), 0 0 var(--space-6) var(--accent-50); transform: scale(var(--active-scale)); }
  75%  { border-color: var(--accent); box-shadow: 0 0 var(--space-3) var(--accent-50); transform: scale(var(--active-scale)); }
  100% { border-color: var(--accent-50); box-shadow: none; transform: scale(1); }
}

@keyframes card-glow {
  0%   { box-shadow: 0 0 0 0 transparent; }
  25%  { box-shadow: 0 0 var(--space-4) var(--accent), 0 0 var(--space-6) var(--accent-50), inset 0 0 var(--space-3) var(--accent-50); }
  50%  { box-shadow: 0 0 var(--space-5) var(--accent-light), 0 0 var(--space-6) var(--accent-50), inset 0 0 var(--space-4) var(--accent-50); }
  75%  { box-shadow: 0 0 var(--space-2) var(--accent-50), inset 0 0 var(--space-1) var(--accent-50); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

@keyframes stat-pop {
  0%   { color: var(--white); text-shadow: none; filter: brightness(1); }
  20%  { color: var(--accent-light); text-shadow: 0 0 var(--space-3) var(--accent), 0 0 var(--space-5) var(--accent-50); filter: brightness(1); }
  50%  { color: var(--accent); text-shadow: 0 0 var(--space-2) var(--accent-50); filter: brightness(1); }
  75%  { color: var(--accent-light); text-shadow: 0 0 var(--space-1) var(--accent-50); filter: brightness(1); }
  100% { color: var(--white); text-shadow: none; filter: brightness(1); }
}

/* Continuous soft glow + scale, anchored in the pink accent. For attention
   on a single inline element (e.g. the turn count in the arrival popup). */
@keyframes accent-pulse {
  0%, 100% { transform: scale(1);     text-shadow: 0 0 var(--space-2) var(--accent-50); }
  50%      { transform: scale(var(--active-scale));  text-shadow: 0 0 var(--space-4) var(--accent), 0 0 var(--space-5) var(--accent-50); }
}

@keyframes pulse-recording {
  0%, 100% { box-shadow: 0 0 0 0 var(--danger-50); }
  50%      { box-shadow: 0 0 0 var(--space-2) transparent; }
}

@keyframes pulse-recording-ending {
  0%, 100% { box-shadow: 0 0 0 0 var(--warning); }
  50%      { box-shadow: 0 0 0 var(--space-3) transparent; }
}

/* Reward effects (reward-effects.css) */
@keyframes rewardOverlayFadeOut {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes dismissHintPulse {
  0%, 100% { opacity: var(--disabled-opacity); }
  50%      { opacity: 1; }
}

@keyframes gachaAppear {
  0%   { opacity: 0; transform: scale(0); }
  70%  { opacity: 1; transform: scale(var(--active-scale)); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes gachaShake1 {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  20%      { transform: translateX(calc(var(--space-1) * -1)) rotate(-2deg); }
  40%      { transform: translateX(var(--space-1)) rotate(2deg); }
  60%      { transform: translateX(calc(var(--space-1) * -1)) rotate(-1deg); }
  80%      { transform: translateX(var(--space-1)) rotate(1deg); }
}

@keyframes gachaShake2 {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  25%      { transform: translateX(calc(var(--space-2) * -1)) rotate(-4deg); }
  75%      { transform: translateX(var(--space-2)) rotate(4deg); }
}

@keyframes gachaCrack {
  0%   { transform: scale(1); opacity: 1; }
  50%  { transform: scale(var(--active-scale)); opacity: var(--disabled-opacity); }
  100% { transform: scale(var(--active-scale)); opacity: 0; }
}

@keyframes whiteFlash {
  0%   { opacity: var(--disabled-opacity); }
  100% { opacity: 0; }
}

@keyframes rewardReveal {
  0%   { opacity: 0; transform: scale(var(--active-scale)); }
  60%  { opacity: 1; transform: scale(var(--active-scale)); }
  80%  { transform: scale(var(--active-scale)); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes rewardFadeIn {
  0%   { opacity: 0; transform: scale(var(--active-scale)); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes rewardGlow {
  0%   { opacity: var(--disabled-opacity); transform: scale(var(--active-scale)); }
  100% { opacity: 1; transform: scale(var(--active-scale)); }
}
