

@font-face {
  font-family: 'Quicksand';
  src: url('/fonts/Quicksand-VariableFont_wght.ttf') format('truetype');
  font-display: swap;
  font-weight: 1 999;
}

:root {
  --color-text-light: #e0d5c4;
  --color-text-dark: #2a1a3a;
  --color-text-muted-light: #b0a594;
  --color-text-muted-dark: #5a4630;
  --color-bg-dark-primary: #1a0e2a;
  --color-bg-dark-secondary: #1f122e;
  --color-border-themed: #5a4630;

  /* Rarity Colors */
  --rarity-common-color: rgba(200, 200, 200, 0.4);
  --rarity-rare-color: rgba(58, 124, 255, 0.6);
  --rarity-epic-color: rgba(163, 58, 255, 0.6);
  --rarity-legendary-color: rgba(255, 180, 58, 0.7);

  /* Rarity Text Colors */
  --rarity-text-common: #dcdcdc;
  --rarity-text-rare: #75aaff;
  --rarity-text-epic: #d275ff;
  --rarity-text-legendary: #ffc94a;

  /* Rarity Background Colors */
  --rarity-common-bg-color: rgba(204, 204, 204, 0.2);
  --rarity-rare-bg-color: rgba(51, 153, 255, 0.2);
  --rarity-epic-bg-color: rgba(179, 51, 255, 0.2);
  --rarity-legendary-bg-color: rgba(255, 204, 0, 0.2);

  /* Best Practice: Define sprite properties as variables for maintainability */
  --sprite-url: url('/textures/border-image.png');
  --sprite-grid-size: 140px; /* Each grid cell is 140x140 */
  --sprite-total-width: 420px;
  --sprite-total-height: 420px;
  
  /* Y-positions for rows in the 3x3 sprite sheet */
  --sprite-footer-row-y: 0px; /* Top row */
  --sprite-header-row-y: -280px; /* Bottom row (2 * 140px) */

  /* X-positions for columns */
  --sprite-left-col-x: 0px;
  --sprite-middle-col-x: -140px;
  --sprite-right-col-x: -280px;

  /* --- Background & Star Effects Configuration --- */
  /* Controls the 'wobble' displacement of the main background. Increase for a more intense effect. */
  --wobble-strength: 0.1%;
  /* Controls the speed of the wobble. Decrease for a faster effect. */
  --wobble-duration: 25s;
  /* Controls the tiling size of the stars texture. Smaller values = denser starfield. */
  --stars-background-size: 256px;
  /* The overall opacity of the star layer. */
  --stars-base-opacity: 0.8;
  /* Controls the speed of the shimmering noise effect. Lower is faster. */
  --stars-shimmer-duration: 20s;
}

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden; /* Body doesn't scroll; .ui-layer does */
}
body {
  font-family: 'Quicksand', sans-serif;
  background-color: var(--color-bg-dark-primary);
  display: flex;
  flex-direction: column;
  font-weight: 500;
}

@keyframes heat-wobble {
  0%   { background-position: 50% 50%; }
  25%  { background-position: calc(50% + var(--wobble-strength)) calc(50% - var(--wobble-strength)); }
  50%  { background-position: calc(50% - var(--wobble-strength)) calc(50% + var(--wobble-strength)); }
  75%  { background-position: calc(50% + var(--wobble-strength)) calc(50% + var(--wobble-strength)); }
  100% { background-position: 50% 50%; }
}

@keyframes scroll-mask {
  from { mask-position: 0 0; -webkit-mask-position: 0 0; }
  to   { mask-position: -512px -512px; -webkit-mask-position: -512px -512px; }
}

@keyframes pulse {
  50% {
    opacity: 0.5;
  }
}

@keyframes gentle-float {
  0% { transform: translate(0, 0) rotate(-2deg); }
  25% { transform: translate(5px, 10px) rotate(0deg); }
  50% { transform: translate(0, 20px) rotate(3deg); }
  75% { transform: translate(-5px, 10px) rotate(0deg); }
  100% { transform: translate(0, 0) rotate(-2deg); }
}

.background-layer {
  background-image: url('/textures/background.png');
  background-repeat: repeat;
  animation: heat-wobble var(--wobble-duration) ease-in-out infinite;
  position: fixed;
  inset: 0;
  z-index: 0;
  will-change: transform; /* Performance hint for parallax */
}

.background-stars-layer {
  /* This is the visible layer of stars */
  background-image: url('/textures/background_stars.png');
  background-repeat: repeat;
  background-size: var(--stars-background-size) var(--stars-background-size);

  /* --- Procedural Shimmer using a MASK --- */
  /* The noise texture is used as a mask, not a visible background.
     Its brightness values control the opacity of the star layer. */
  mask-image: url('/textures/noise_texture.png');
  mask-mode: luminance; /* Use the brightness of the mask */
  mask-repeat: repeat;
  mask-size: 512px;

  /* Prefixes for full browser compatibility */
  -webkit-mask-image: url('/textures/noise_texture.png');
  -webkit-mask-mode: luminance;
  -webkit-mask-repeat: repeat;
  -webkit-mask-size: 512px;

  /* Animate the MASK's position to create the shimmer effect */
  animation: scroll-mask var(--stars-shimmer-duration) linear infinite;
  
  /* Use opacity to control the overall intensity of the final masked layer */
  opacity: var(--stars-base-opacity);
  
  /* --- Positioning & Parallax --- */
  position: fixed;
  inset: 0;
  z-index: 1; /* Sits on top of main background */
  will-change: transform; /* Performance hint for parallax */
}

.ui-layer {
  position: absolute;
  inset: 0;
  z-index: 5; /* Sits above all effects */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on mobile */
}

#root {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  /* position: relative;  <- This was causing the background to scroll with the content. Removing it fixes the issue. */
}
/* Ensure form elements inherit the global font */
input, button, textarea, select {
  font-family: inherit;
}
img {
  /* Prevent users from dragging or selecting images */
  -webkit-user-drag: none;
  user-drag: none;
  user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  pointer-events: none;
}
.nine-slice-button {
  /* Slicing the image */
  border-image-source: url('/textures/button_idle.png');
  border-image-slice: 38 fill; /* 'fill' makes the center piece visible */
  border-image-width: 19px; /* Scaled down border */
  border-image-repeat: round;

  /* Basic styling */
  border-style: solid;
  background-color: transparent; /* Center piece from image is background */
  padding: 0 1.5rem; /* Horizontal padding */
  height: 48px; /* Vertical padding is controlled by border-width and height */
  
  /* Text styling */
  color: var(--color-text-light);
  font-family: var(--font-family-main);
  font-weight: 700;
  font-size: 1.125rem; /* 18px */
  text-decoration: none; /* for links */

  /* Layout */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  
  /* Transitions and interaction */
  transition: all 0.2s ease-in-out;
  cursor: pointer;
  position: relative; /* For pseudo-elements or child positioning */
}

.nine-slice-button:hover:not(:disabled) {
  border-image-source: url('/textures/button_hover.png');
  color: #ffffff;
  transform: translateY(-2px);
}

.nine-slice-button:active:not(:disabled) {
  transform: translateY(0px);
  filter: brightness(0.95);
}

.nine-slice-button:disabled {
  filter: grayscale(80%) brightness(0.7);
  cursor: not-allowed;
  transform: none;
}

.nine-slice-button > span {
  position: relative;
}

.nine-slice-button-square {
  /* Slicing based on user request: 36px slice */
  border-image-source: url('/textures/buttonsquare_idle.png');
  border-image-slice: 36 fill;
  border-image-width: 18px; /* Half of slice for good scaling */
  border-image-repeat: round;

  /* Basic styling */
  border-style: solid;
  background-color: transparent; /* Center piece from image is background */
  padding: 0 1.5rem; /* Horizontal padding */
  height: 48px;
  
  /* Text styling */
  color: var(--color-text-light);
  font-family: var(--font-family-main);
  font-weight: 700;
  font-size: 1.125rem; /* 18px */
  text-decoration: none;

  /* Layout */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.75rem; /* For spacing icon and text */
  
  /* Transitions and interaction */
  transition: all 0.2s ease-in-out;
  cursor: pointer;
  position: relative;

  /* Sizing from previous login button */
  width: 100%;
  max-width: 320px;
}

.nine-slice-button-square:hover:not(:disabled) {
  border-image-source: url('/textures/buttonsquare_hover.png');
  color: #ffffff;
  transform: translateY(-2px);
}

.nine-slice-button-square:active:not(:disabled) {
  transform: translateY(0px);
  filter: brightness(0.95);
}

.nine-slice-button-square:disabled {
  filter: grayscale(80%) brightness(0.7);
  cursor: not-allowed;
  transform: none;
}

/* Apply manual font alignment to both icon and text */
.nine-slice-button-square > span, 
.nine-slice-button-square > svg,
.nine-slice-button-square > img {
  position: relative;
}

.nine-slice-card {
  /* Slicing the image */
  border-image-source: url('/textures/card_normal.png');
  border-image-slice: 140 fill; /* 'fill' makes the center piece visible */
  border-image-width: 70px;
  border-image-repeat: round;

  /* Basic styling */
  border-style: solid;
  background-color: transparent; /* Center piece from image is background */
  padding: 2.5rem; /* Generous padding to complement the thick border */
  
  /* Set text color to light yellow for readability on textured background */
  color: var(--color-text-light);
}

.nine-slice-item-box {
  /* Slicing the image */
  border-image-source: url('/textures/card_normal.png');
  border-image-slice: 140 fill;
  border-image-width: 10px;
  border-image-repeat: round;

  /* Basic styling */
  border-style: solid;
  background-color: transparent; /* Center piece from image is background */
  padding: 0.25rem;
  position: relative; /* For tooltip positioning */
  isolation: isolate; /* Create new stacking context for blend modes and z-indexing */
}

/* New overlay for rarity color tint */
.nine-slice-item-box::before {
  content: '';
  position: absolute;
  top: 10px;  /* Inside the border */
  left: 10px;
  right: 10px;
  bottom: 10px;
  background-color: var(--rarity-tint-color, transparent);
  mix-blend-mode: multiply; /* This will tint the background texture */
  z-index: -1; /* Sits behind content, on top of parent background fill */
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

.nine-slice-tooltip {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  
  border-image-source: url('/textures/card_normal.png');
  border-image-slice: 140 fill;
  border-image-width: 20px;
  border-image-repeat: round;
  border-style: solid;
  
  padding: 0 1rem;
  height: 40px;
  white-space: nowrap;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  
  color: var(--color-text-light);
  background-color: transparent;

  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.5));
  
  /* Make opacity and position transitions smooth */
  transition: opacity 0.1s ease-in-out, left 0.05s linear, top 0.05s linear;
  opacity: 0;
}


/* --- Rarity Glow Effects for Item Boxes --- */
.item-box-rarity-common {
  --rarity-tint-color: var(--rarity-common-bg-color);
  --rarity-ray-color: rgba(200, 200, 200, 0.5);
  --rarity-glow-effect: 0 0 5px 1px var(--rarity-common-color);
  --rarity-text-color: var(--rarity-text-common);
}
.item-box-rarity-rare {
  --rarity-tint-color: var(--rarity-rare-bg-color);
  --rarity-ray-color: rgba(58, 124, 255, 0.7);
  --rarity-glow-effect: 0 0 7px 1px var(--rarity-rare-color);
  --rarity-text-color: var(--rarity-text-rare);
}
.item-box-rarity-epic {
  --rarity-tint-color: var(--rarity-epic-bg-color);
  --rarity-ray-color: rgba(163, 58, 255, 0.7);
  --rarity-glow-effect: 0 0 9px 2px var(--rarity-epic-color);
  --rarity-text-color: var(--rarity-text-epic);
}
.item-box-rarity-legendary {
  --rarity-tint-color: var(--rarity-legendary-bg-color);
  --rarity-ray-color: rgba(255, 180, 58, 0.8);
  --rarity-glow-effect: 0 0 10px 2px var(--rarity-legendary-color);
  --rarity-text-color: var(--rarity-text-legendary);
}

/* When an owned item is hovered, apply its rarity glow */
.nine-slice-item-box.cursor-pointer:hover {
  box-shadow: var(--rarity-glow-effect, none);
}

/* --- Locked Item Styles --- */
.item-locked {
  cursor: default;
}

.item-locked:hover {
  transform: none;
}

/* Common setup for header and footer background frames */
.site-header, .site-footer {
  position: relative;
  height: var(--sprite-grid-size);
  background-image: var(--sprite-url);
  background-repeat: repeat-x;
  background-size: var(--sprite-total-width) var(--sprite-total-height);
  border-style: none;
  padding: 0; /* Padding is handled by the inner content container now */
}

/* Corner pseudo-elements */
.site-header::before, .site-header::after,
.site-footer::before, .site-footer::after {
  content: '';
  position: absolute;
  top: 0;
  width: var(--sprite-grid-size);
  height: var(--sprite-grid-size);
  background-image: var(--sprite-url);
  background-repeat: no-repeat;
  background-size: var(--sprite-total-width) var(--sprite-total-height);
  z-index: 1; /* Place corners above repeating background */
}

.site-header::before, .site-footer::before {
  left: 0;
}

.site-header::after, .site-footer::after {
  right: 0;
}

/* Ensure content is visible above the background frame */
.site-header > *, .site-footer > * {
  position: relative;
  z-index: 2;
  height: 100%; /* Ensure content container fills the bar */
}

/* === Header specific styles (uses BOTTOM row of sprite) === */
.site-header {
  background-position: var(--sprite-middle-col-x) var(--sprite-header-row-y);
}
.site-header::before {
  background-position: var(--sprite-left-col-x) var(--sprite-header-row-y);
}
.site-header::after {
  background-position: var(--sprite-right-col-x) var(--sprite-header-row-y);
}

/* === Footer specific styles (uses TOP row of sprite) === */
.site-footer {
  display: flex; /* Re-apply for content centering */
  justify-content: center;
  background-position: var(--sprite-middle-col-x) var(--sprite-footer-row-y);
  padding-top: 48px; /* Position content correctly inside the frame */
  box-sizing: border-box; /* Ensure padding is included in height */
}
.site-footer::before {
  background-position: var(--sprite-left-col-x) var(--sprite-footer-row-y);
}
.site-footer::after {
  background-position: var(--sprite-right-col-x) var(--sprite-footer-row-y);
}

.textured-underline {
  display: inline-block;
  padding-bottom: 4px; /* Space between text and underline */
  text-decoration: none !important;
  border-style: solid;
  border-width: 0 16px 16px 16px;
  border-color: transparent;
  border-image-source: url('/textures/underline.png');
  border-image-slice: 0 33 33;
  border-image-repeat: round;
}

.search-wrapper {
  position: relative;
  display: inline-block;
}
.search-input-container {
  border-style: solid;
  border-width: 0 28px;
  border-image-source: url('/textures/searchbar.png');
  border-image-slice: 0 114 0 114 fill;
  border-image-repeat: stretch;
  height: 48px;
  display: flex;
  align-items: center;
  background-clip: padding-box;
  width: 280px;
}
.search-input {
  background: transparent;
  border: none;
  outline: none;
  width: 100%;
  height: 100%;
  color: var(--color-text-light);
  font-family: inherit;
  font-size: 1rem;
  padding: 0 10px;
  position: relative;
}
.search-input::placeholder {
  color: var(--color-text-muted-light);
  opacity: 0.7;
}
.search-results-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: -4px;
  background-color: var(--color-bg-dark-secondary);
  border: 2px solid var(--color-border-themed);
  border-top: none;
  border-radius: 0 0 8px 8px;
  z-index: 100;
  max-height: 300px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-themed) var(--color-bg-dark-primary);
}
.search-result-item {
  padding: 10px 16px;
  cursor: pointer;
  color: var(--color-text-light);
  transition: background-color 0.2s, color 0.2s;
  border-bottom: 1px solid var(--color-border-themed);
}
.search-result-item:last-child {
  border-bottom: none;
}
.search-result-item:hover {
  background-color: var(--color-border-themed);
  color: white;
}
.mobile-menu-button {
  color: var(--color-text-light);
  transition: color 0.2s;
}
.mobile-menu-button:hover {
  color: white;
}
@keyframes fade-in-down {
  from { opacity: 0; transform: translate(-50%, -20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.animate-fade-in-down {
  animation: fade-in-down 0.5s ease-out forwards;
}

/* --- Intro Animation Styles --- */
.intro-overlay {
  position: fixed;
  inset: 0;
  background-color: black;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease-in-out;
  pointer-events: none;
}
.animate-intro-logo {
  animation: intro-logo-anim 2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.animate-intro-slogan {
  opacity: 0;
  animation: intro-slogan-anim 1s ease-out 1s forwards;
}
@keyframes intro-logo-anim {
  from {
    opacity: 0;
    filter: blur(12px);
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
  }
}
@keyframes intro-slogan-anim {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nine-slice-button.disconnect-button,
.nine-slice-button-square.disconnect-button {
  /* No new image, use filters on the existing ones */
  --disconnect-hue-rotate: 340deg; /* shifts yellow towards red */
  --disconnect-saturate: 1.5;
  --disconnect-brightness: 0.9;
  filter: hue-rotate(var(--disconnect-hue-rotate)) saturate(var(--disconnect-saturate)) brightness(var(--disconnect-brightness));
  /* Override the text color to ensure contrast */
  color: #ffdddd;
  text-shadow: 1px 1px 2px rgba(96, 12, 12, 0.7);
}

.nine-slice-button.disconnect-button:hover:not(:disabled),
.nine-slice-button-square.disconnect-button:hover:not(:disabled) {
  /* Keep the hover image but apply the same filter and increase brightness */
  filter: hue-rotate(var(--disconnect-hue-rotate)) saturate(var(--disconnect-saturate)) brightness(1.1);
  color: #ffffff;
}

/* Also need to reset default filter on disabled */
.nine-slice-button.disconnect-button:disabled,
.nine-slice-button-square.disconnect-button:disabled {
  filter: grayscale(80%) brightness(0.7);
  color: var(--color-text-light);
  text-shadow: none;
}

/* --- User Profile Styles --- */
.user-profile-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 4px;
  border-radius: 9999px; /* pill shape */
  background-color: rgba(0,0,0,0.25);
  transition: background-color 0.2s ease-in-out, transform 0.2s ease-in-out;
  cursor: pointer;
  border: 1px solid rgba(90, 70, 48, 0.5); /* var(--color-border-themed) with alpha */
  height: 48px;
  box-sizing: border-box;
}

.user-profile-button:hover {
  background-color: rgba(0,0,0,0.4);
  transform: translateY(-1px);
}

.user-profile-button .profile-name {
  color: var(--color-text-light);
  font-weight: 700;
  font-size: 1rem;
  padding-right: 12px;
  position: relative;
}

.profile-pic-container {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  background-image: url('/textures/profilepic_background.png');
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
  padding: 2px;
  box-sizing: border-box;
}

.profile-pic-image {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--color-bg-dark-primary);
}

/* --- Shooting Star & Portrait Containers --- */
.shooting-star-container,
.floating-portraits-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 2; /* Sits on top of background layers, but behind UI */
  will-change: transform; /* Performance hint for parallax */
}

/* This is a fix for the AppRouter change. It ensures the portraits fade in/out when navigating */
.floating-portraits-container {
  opacity: 0;
  transition: opacity 1.5s ease-in-out;
}
.floating-portraits-container.is-visible {
  opacity: 1;
}


.shooting-star {
  position: absolute;
  display: flex;
  align-items: center;
  /* Head is on the right, so pivot from there */
  transform-origin: right center;
  /* Puts head on the right of the container, tail on the left */
  flex-direction: row-reverse;

  /* Deceleration via 'ease-out'. Duration from --duration var. */
  transition:
    left var(--duration, 2s) ease-out,
    top var(--duration, 2s) ease-out,
    opacity 0.4s ease-in-out;
}

.shooting-star-head {
  height: 15px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(255, 255, 220, 0.9)) drop-shadow(0 0 12px rgba(255, 180, 80, 0.4));
  animation: star-flicker 1.5s infinite ease-in-out;
  
  /* Transition for the yellow color shift during burnout */
  transition: filter 0.6s ease-in;
}

.shooting-star-tail {
  /* Use CSS vars for dynamic sizing from React */
  height: var(--tail-width, 2px);
  width: var(--tail-length, 250px);
  
  /* Create a "hot core" effect, whiter in the middle and fading to yellow at the edges */
  background: linear-gradient(
    to left,
    rgba(255, 255, 220, 0.8), /* Bright head of the tail */
    rgba(255, 216, 138, 0.3) 70%, /* Fades to a warmer, more transparent color */
    transparent
  );

  /* Use a mask to create the tapered, fading shape instead of a hard rectangle */
  mask-image: linear-gradient(to left, black 50%, transparent 100%);
  -webkit-mask-image: linear-gradient(to left, black 50%, transparent 100%);

  /* Add a soft blur for a more ethereal, "glowy" effect */
  filter: blur(0.5px) drop-shadow(0 0 6px rgba(255, 255, 220, 0.7));

  /* Remove border-radius, as the tapered mask handles the shape */
  border-radius: 0; 

  /* Transition all the properties for a smooth animation */
  transition:
    width 0.6s ease-out,
    height 0.6s ease-out,
    background 0.6s ease-in,
    filter 0.6s ease-in;
}

/* --- Burnout Phase --- */
.shooting-star.is-burning-out .shooting-star-head {
  /* Shift hue towards yellow/orange and brighten */
  filter: drop-shadow(0 0 10px #fff8e1) drop-shadow(0 0 15px #ffc107) hue-rotate(-20deg) brightness(1.2);
}

.shooting-star.is-burning-out .shooting-star-tail {
  /* Change color to a more intense yellow/orange */
  background: linear-gradient(to left, #ffc107, transparent);
  filter: blur(0.5px) drop-shadow(0 0 8px #ffc107);
  /* Note: width and height are set via inline styles from React during burnout */
}

/* --- Explosion --- */
.star-explosion {
  /* Positioned at the pivot point (right center) of the parent */
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff8e1, #ffc107, rgba(255, 193, 7, 0));
  animation: star-explode-anim 0.5s ease-out forwards;
}

/* --- Floating Portraits --- */
.floating-portrait {
  position: absolute;
  opacity: 0;
  transition: opacity 2s ease-in-out;
  animation-name: gentle-float;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

.floating-portrait.is-visible {
  opacity: 0.7;
}

.floating-portrait img {
  max-width: 25vw;
  max-height: 40vh;
  height: auto;
  filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.5)) blur(1px) brightness(0.9);
  pointer-events: none;
}


/* --- Star Animations --- */
@keyframes star-flicker {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.8); opacity: 0.7; }
}

@keyframes star-explode-anim {
  from {
    transform: scale(0);
    opacity: 1;
  }
  to {
    transform: scale(2.5);
    opacity: 0;
  }
}

/* --- News Markers --- */
@keyframes gentle-bob {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px); /* Reduced bobbing for smaller icon */
  }
}

.new-news-marker-menu {
  position: absolute;
  top: -10px;    /* Adjusted position for smaller size */
  right: -12px;   /* Adjusted position for smaller size */
  width: 22px;    /* Made ~3x smaller (from 64px) */
  height: 22px;   /* Made ~3x smaller (from 64px) */
  pointer-events: none; /* So it doesn't block clicks on the link */
  animation: gentle-bob 2.5s ease-in-out infinite;
}

.new-news-marker-menu-mobile {
    position: absolute;
    top: -6px;   /* Adjusted position for smaller size */
    right: -6px;  /* Adjusted position for smaller size */
    width: 16px; /* Made 3x smaller (from 48px) */
    height: 16px;/* Made 3x smaller (from 48px) */
    pointer-events: none;
    animation: gentle-bob 2.5s ease-in-out infinite;
}

.news-post-marker {
  position: absolute;
  top: -15px; /* Adjusted for smaller size */
  right: -15px; /* Adjusted for smaller size */
  width: 35px; /* Roughly 4x smaller than original 139px */
  height: auto;
  transform: rotate(10deg);
  pointer-events: none;
  filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.3)); /* Reduced shadow for smaller element */
}

/* --- Custom text styles from user request --- */
.slogan-text {
  font-size: 2.25rem; /* 36px, Tailwind's text-4xl */
  line-height: 2.5rem;
  color: #f5eecf; /* A soft, pastel yellow */
  font-style: italic;
}

@media (min-width: 768px) { /* Corresponds to md: breakpoint */
  .slogan-text {
    font-size: 3rem; /* 48px, Tailwind's text-5xl */
    line-height: 1;
  }
}

.main-body-text {
  font-size: 19.5px;
  line-height: 1.5;
  color: var(--color-text-light); /* Keep existing text color */
}

/* --- Worlds Page Styles --- */
.nine-slice-world-card {
  border-style: solid;
  border-image-source: url('/textures/worldcard_card1.png');
  border-image-slice: 53 fill;
  border-image-width: 27px;
  border-image-repeat: round;
  background-color: transparent;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.world-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0;
  color: var(--color-text-light);
}

.world-card-title {
  font-size: 1.5rem; /* 24px */
  font-weight: bold;
}

.world-status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem; /* 8px */
  font-weight: bold;
  font-size: 1rem; /* 16px */
}

.world-status-indicator .dot {
  width: 12px;
  height: 12px;
  border-radius: 9999px;
}

.world-card-image-container {
  position: relative;
  aspect-ratio: 16 / 9;
  padding: 0;
  /* Add overflow hidden and border radius to clip the blurred background */
  overflow: hidden;
  border-radius: 6px;
}

/* NEW: Blurred background to fill empty space behind non-16:9 images */
.world-card-image-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(8px) brightness(0.6);
  transform: scale(1.1); /* Scale up to prevent blurred edges from showing */
}

.world-card-image {
  position: absolute;
  z-index: 1; /* Sit on top of the blurred background */
  /* Inset the image by 5px on each side to make it appear smaller than the border frame */
  top: 5px;
  left: 5px;
  right: 5px;
  bottom: 5px;
  /* Let the absolute positioning handle the size, overriding any explicit width/height */
  width: auto;
  height: auto;
  object-fit: contain; /* Keep contain to prevent cropping the main image */
  background-color: transparent; /* Remove black bars */
  display: block;
  /* The container now handles the radius */
  border-radius: 0;
}

.world-card-border-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-style: solid;
  border-width: 32px;
  border-image-source: url('/textures/worldcard_border1.png');
  border-image-slice: 64;
  border-image-repeat: round;
  pointer-events: none;
  z-index: 2; /* Ensure the border is on top of all images */
}

.world-card-content {
  padding: 0;
}

.world-card-description {
  color: var(--color-text-muted-light);
  font-size: 1rem;
  line-height: 1.5;
}

/* --- Archive Page Additions --- */
.title-with-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

.title-icon {
    width: 4rem; /* ~36px */
    height: 4rem; /* ~36px */
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));
    object-fit: contain;
}
.progress-bar-container {
  width: 100%;
  height: 24px;
  background-color: var(--color-bg-dark-primary);
  border: 2px solid var(--color-border-themed);
  border-radius: 12px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--rarity-rare-color) 0%, var(--rarity-epic-color) 100%);
  transition: width 0.5s ease-out;
  border-radius: 10px 0 0 10px;
}

.filter-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.filter-select {
  background-color: var(--color-bg-dark-secondary);
  border: 2px solid var(--color-border-themed);
  color: var(--color-text-light);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e0d5c4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem; /* Make space for arrow */
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th, .leaderboard-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 2px solid var(--color-border-themed);
  vertical-align: middle;
}

.leaderboard-table th {
  font-size: 1.125rem;
  color: var(--color-text-light);
}

.leaderboard-table td {
  font-size: 1rem;
  color: var(--color-text-muted-light);
}

.leaderboard-table tr:last-child td {
  border-bottom: none;
}

.leaderboard-table .rank {
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  color: var(--color-text-light);
  width: 5rem; /* Give rank column a fixed width for alignment */
}

.leaderboard-table .username {
  font-weight: 700;
  color: var(--color-text-light);
}

.leaderboard-table .username img {
  pointer-events: auto; /* Allow image inside link to be part of the link */
}

/* --- Tooltip Text Rarity Colors --- */
.tooltip-rarity-unknown {
  color: var(--color-text-light);
}
.tooltip-rarity-common {
  color: var(--rarity-text-common);
  text-shadow: 0 0 4px rgba(200, 200, 200, 0.4);
}
.tooltip-rarity-rare {
  color: var(--rarity-text-rare);
  text-shadow: 0 0 5px rgba(58, 124, 255, 0.6);
}
.tooltip-rarity-epic {
  color: var(--rarity-text-epic);
  text-shadow: 0 0 6px rgba(163, 58, 255, 0.6);
}
.tooltip-rarity-legendary {
  color: var(--rarity-text-legendary);
  text-shadow: 0 0 7px rgba(255, 180, 58, 0.7);
}

/* --- Admin Panel Styles --- */
.admin-form-label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: bold;
    color: var(--color-text-muted-light);
}

.admin-form-input,
.admin-form-textarea {
    width: 100%;
    padding: 0.5rem;
    background-color: var(--color-bg-dark-primary);
    border: 2px solid var(--color-border-themed);
    border-radius: 0.375rem; /* rounded-md */
    color: var(--color-text-light);
    font-family: inherit;
}

.admin-form-textarea {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
}

.admin-image-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: 0.375rem;
    border: 2px solid var(--color-border-themed);
    margin-bottom: 0.5rem;
    object-fit: contain;
}