/* =========================================================
   Variables: Theme Tokens for UltimateMagyarOnline
   ========================================================= */
:root {
  /* Colors - Core Theme */
  --color-bg: #040712;
  --color-bg-alt: #050915;
  --color-bg-elevated: #0c1424;
  --color-bg-soft: rgba(9, 18, 40, 0.9);

  --color-text: #f3f6ff;
  --color-text-muted: #a0acc7;
  --color-text-soft: #7b86a4;

  --color-primary: #2dd4bf; /* Emerald / teal glow */
  --color-primary-soft: rgba(45, 212, 191, 0.14);
  --color-primary-strong: #22b3a0;

  --color-accent: #60a5fa; /* Ethereal blue */
  --color-accent-soft: rgba(96, 165, 250, 0.16);

  --color-success: #22c55e;
  --color-warning: #eab308;
  --color-danger: #ef4444;

  /* Neutral grays (cool, game-UI style) */
  --gray-50: #0b0f1c;
  --gray-100: #111827;
  --gray-200: #1f2933;
  --gray-300: #374151;
  --gray-400: #4b5563;
  --gray-500: #6b7280;
  --gray-600: #9ca3af;
  --gray-700: #d1d5db;
  --gray-800: #e5e7eb;
  --gray-900: #f9fafb;

  --color-border-subtle: rgba(148, 163, 184, 0.25);
  --color-border-strong: rgba(148, 163, 184, 0.6);
  --color-overlay: rgba(3, 7, 18, 0.85);

  /* Gradients & Glows (for hero, buttons, highlights) */
  --gradient-primary: linear-gradient(135deg, #22c1c3 0%, #2dd4bf 40%, #60a5fa 100%);
  --gradient-hero: radial-gradient(circle at top, rgba(56, 189, 248, 0.25) 0, transparent 55%),
                   radial-gradient(circle at 20% 80%, rgba(45, 212, 191, 0.25) 0, transparent 60%),
                   radial-gradient(circle at 80% 40%, rgba(59, 130, 246, 0.3) 0, transparent 55%),
                   #040712;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
               "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  --font-display: "Roboto Condensed", "Oswald", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
               "Liberation Mono", "Courier New", monospace;

  /* Font sizes (rem, mobile-first) */
  --fs-2xs: 0.75rem;   /* 12px */
  --fs-xs: 0.8125rem;  /* 13px */
  --fs-sm: 0.875rem;   /* 14px */
  --fs-md: 1rem;       /* 16px */
  --fs-lg: 1.125rem;   /* 18px */
  --fs-xl: 1.25rem;    /* 20px */
  --fs-2xl: 1.5rem;    /* 24px */
  --fs-3xl: 1.875rem;  /* 30px */
  --fs-4xl: 2.25rem;   /* 36px */
  --fs-5xl: 3rem;      /* 48px */

  /* Line heights */
  --lh-tight: 1.15;
  --lh-snug: 1.25;
  --lh-normal: 1.5;
  --lh-relaxed: 1.7;

  /* Spacing scale (px, mapped to rem for consistency) */
  --space-0: 0;
  --space-1: 0.125rem;  /* 2px */
  --space-2: 0.25rem;   /* 4px */
  --space-3: 0.375rem;  /* 6px */
  --space-4: 0.5rem;    /* 8px */
  --space-5: 0.625rem;  /* 10px */
  --space-6: 0.75rem;   /* 12px */
  --space-8: 1rem;      /* 16px */
  --space-10: 1.25rem;  /* 20px */
  --space-12: 1.5rem;   /* 24px */
  --space-16: 2rem;     /* 32px */
  --space-20: 2.5rem;   /* 40px */
  --space-24: 3rem;     /* 48px */
  --space-32: 4rem;     /* 64px */
  --space-40: 5rem;     /* 80px */
  --space-48: 6rem;     /* 96px */

  /* Radii */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 18px;
  --radius-pill: 999px;

  /* Shadows - subtle glow + depth for fantasy UI */
  --shadow-soft: 0 10px 35px rgba(15, 23, 42, 0.6);
  --shadow-strong: 0 18px 50px rgba(15, 23, 42, 0.9);
  --shadow-glow-primary: 0 0 20px rgba(45, 212, 191, 0.45);
  --shadow-glow-accent: 0 0 24px rgba(96, 165, 250, 0.5);

  /* Transitions & Motion */
  --transition-fast: 120ms ease-out;
  --transition-normal: 200ms ease-out;
  --transition-slow: 320ms ease-out;
  --transition-bounce: 200ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Layout tokens */
  --container-width: 1120px;
  --container-wide-width: 1280px;
  --container-padding-x: 1.25rem; /* 20px */

  /* Z-index scale */
  --z-base: 1;
  --z-header: 40;
  --z-overlay: 60;
  --z-modal: 80;
  --z-toast: 90;
}

/* Larger screens: slightly upscale headings & container */
@media (min-width: 768px) {
  :root {
    --fs-3xl: 2.125rem;
    --fs-4xl: 2.5rem;
    --fs-5xl: 3.25rem;
    --container-padding-x: 1.5rem;
  }
}

@media (min-width: 1024px) {
  :root {
    --fs-4xl: 2.75rem;
    --fs-5xl: 3.5rem;
  }
}


/* =========================================================
   Reset & Normalize
   ========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  margin: 0;
  padding: 0;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  margin: 0;
}

/* Remove default margin from common typographic elements */
h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

button,
input,
select,
textarea {
  margin: 0;
  font: inherit;
  color: inherit;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  padding: 0;
}

/* Remove list styles by default; can be re-enabled per component */
ul,
ol {
  list-style: none;
}

/* Make sure hidden attribute works as expected */
[hidden] {
  display: none !important;
}

/* Smooth scrolling preference override */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}


/* =========================================================
   Base Styles: Typography, Layout, Elements
   ========================================================= */
body {
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-relaxed);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main {
  min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-text);
  line-height: var(--lh-snug);
  letter-spacing: 0.02em;
}

h1 {
  font-size: var(--fs-4xl);
  margin-bottom: var(--space-12);
}

h2 {
  font-size: var(--fs-3xl);
  margin-bottom: var(--space-10);
}

h3 {
  font-size: var(--fs-2xl);
  margin-bottom: var(--space-8);
}

h4 {
  font-size: var(--fs-xl);
  margin-bottom: var(--space-6);
}

h5 {
  font-size: var(--fs-lg);
  margin-bottom: var(--space-4);
}

h6 {
  font-size: var(--fs-md);
  margin-bottom: var(--space-3);
}

p {
  margin-bottom: var(--space-6);
  color: var(--color-text-muted);
}

p:last-child {
  margin-bottom: 0;
}

strong,
b {
  font-weight: 600;
}

em,
i {
  font-style: italic;
}

code,
pre,
kbd,
samp {
  font-family: var(--font-mono);
}

pre {
  margin: 0;
  white-space: pre-wrap;
}

a {
  position: relative;
  color: var(--color-primary);
  transition: color var(--transition-normal), text-shadow var(--transition-normal);
}

a:hover {
  color: var(--color-accent);
  text-shadow: 0 0 12px rgba(96, 165, 250, 0.55);
}

a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

/* Base section spacing */
section {
  padding-top: var(--space-24);
  padding-bottom: var(--space-24);
}

@media (min-width: 768px) {
  section {
    padding-top: var(--space-32);
    padding-bottom: var(--space-32);
  }
}


/* =========================================================
   Accessibility: Focus & Screen Reader Helpers
   ========================================================= */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

/* Screen reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sr-only-focusable:active,
.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}


/* =========================================================
   Layout Utilities: Containers, Flex, Grid
   ========================================================= */
.container {
  width: 100%;
  max-width: calc(var(--container-width) + var(--container-padding-x) * 2);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding-x);
  padding-right: var(--container-padding-x);
}

.container--wide {
  max-width: calc(var(--container-wide-width) + var(--container-padding-x) * 2);
}

/* Flex utilities */
.flex {
  display: flex;
}

.inline-flex {
  display: inline-flex;
}

.flex-row {
  flex-direction: row;
}

.flex-column {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-around {
  justify-content: space-around;
}

.justify-end {
  justify-content: flex-end;
}

.gap-xs {
  gap: var(--space-4);
}

.gap-sm {
  gap: var(--space-6);
}

.gap-md {
  gap: var(--space-8);
}

.gap-lg {
  gap: var(--space-12);
}

.gap-xl {
  gap: var(--space-16);
}

/* Grid utilities */
.grid {
  display: grid;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-10);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-12);
}

.grid-auto-fit-min-240 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-8);
}

@media (max-width: 767px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Utility: text alignment */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

/* Utility: spacing */
.mt-0 { margin-top: 0 !important; }
.mt-xs { margin-top: var(--space-4) !important; }
.mt-sm { margin-top: var(--space-6) !important; }
.mt-md { margin-top: var(--space-8) !important; }
.mt-lg { margin-top: var(--space-12) !important; }
.mt-xl { margin-top: var(--space-16) !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-xs { margin-bottom: var(--space-4) !important; }
.mb-sm { margin-bottom: var(--space-6) !important; }
.mb-md { margin-bottom: var(--space-8) !important; }
.mb-lg { margin-bottom: var(--space-12) !important; }
.mb-xl { margin-bottom: var(--space-16) !important; }

.pt-0 { padding-top: 0 !important; }
.pt-sm { padding-top: var(--space-6) !important; }
.pt-md { padding-top: var(--space-8) !important; }
.pt-lg { padding-top: var(--space-12) !important; }
.pt-xl { padding-top: var(--space-16) !important; }

.pb-0 { padding-bottom: 0 !important; }
.pb-sm { padding-bottom: var(--space-6) !important; }
.pb-md { padding-bottom: var(--space-8) !important; }
.pb-lg { padding-bottom: var(--space-12) !important; }
.pb-xl { padding-bottom: var(--space-16) !important; }

/* Utility: max-width for readable text blocks */
/* =========================================================
   Components: Buttons, Inputs, Cards
   ========================================================= */

/* --- Buttons --- */
.button,
button,
input[type="button"],
input[type="submit"],
input[type="reset"] {
  --btn-bg: var(--gradient-primary);
  --btn-border: transparent;
  --btn-color: #0b1020;
  --btn-shadow: var(--shadow-soft);

  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-color);
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--btn-shadow), var(--shadow-glow-primary);
  transition:
    transform var(--transition-bounce),
    box-shadow var(--transition-normal),
    background var(--transition-normal),
    opacity var(--transition-fast),
    filter var(--transition-fast);
  white-space: nowrap;
}

.button--secondary {
  --btn-bg: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 64, 175, 0.85));
  --btn-border: rgba(148, 163, 184, 0.55);
  --btn-color: var(--color-text);
  --btn-shadow: var(--shadow-soft);
}

.button--ghost {
  --btn-bg: rgba(15, 23, 42, 0.5);
  --btn-border: rgba(148, 163, 184, 0.4);
  --btn-color: var(--color-text);
  --btn-shadow: none;
  backdrop-filter: blur(16px);
}

.button--danger {
  --btn-bg: linear-gradient(135deg, #f97373, #ef4444);
  --btn-border: rgba(248, 113, 113, 0.7);
  --btn-color: #111827;
}

.button:hover,
button:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
input[type="reset"]:hover {
  transform: translateY(-1px) scale(1.01);
  box-shadow: var(--shadow-strong), var(--shadow-glow-accent);
  filter: brightness(1.05);
}

.button:active,
button:active,
input[type="button"]:active,
input[type="submit"]:active,
input[type="reset"]:active {
  transform: translateY(0) scale(0.99);
  box-shadow: var(--shadow-soft);
}

.button:disabled,
button:disabled,
input[type="button"]:disabled,
input[type="submit"]:disabled,
input[type="reset"]:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.button:focus-visible,
button:focus-visible,
input[type="button"]:focus-visible,
input[type="submit"]:focus-visible,
input[type="reset"]:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}


/* --- Form Inputs --- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.85));
  color: var(--color-text);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.8);
  transition:
    border-color var(--transition-normal),
    box-shadow var(--transition-normal),
    background-color var(--transition-normal),
    transform var(--transition-fast);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-soft);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.6), var(--shadow-glow-primary);
  transform: translateY(-1px);
}

input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

label {
  display: inline-block;
  margin-bottom: var(--space-3);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--color-text);
}

/* Simple field hint / error styles */
.form-hint {
  margin-top: var(--space-2);
  font-size: var(--fs-xs);
  color: var(--color-text-soft);
}

.form-error {
  margin-top: var(--space-2);
  font-size: var(--fs-xs);
  color: var(--color-danger);
}


/* --- Card Component: for lore, guides, updates, etc. --- */
.card {
  position: relative;
  padding: var(--space-10);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.18), transparent 55%),
    radial-gradient(circle at bottom right, rgba(45, 212, 191, 0.18), transparent 55%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.96));
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  backdrop-filter: blur(22px);
  transition:
    transform var(--transition-bounce),
    box-shadow var(--transition-normal),
    border-color var(--transition-normal),
    background var(--transition-normal);
}

.card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: radial-gradient(circle at top, rgba(96, 165, 250, 0.22), transparent 55%);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.card:hover {
  transform: translateY(-3px);
  border-color: rgba(45, 212, 191, 0.55);
  box-shadow: var(--shadow-strong), var(--shadow-glow-accent);
}

.card:hover::before {
  opacity: 1;
}

.card--soft {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.9));
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.85);
}

.card-header {
  margin-bottom: var(--space-6);
}

.card-title {
  font-size: var(--fs-xl);
  margin-bottom: var(--space-3);
}

.card-subtitle {
  font-size: var(--fs-sm);
  color: var(--color-text-soft);
}

.card-body {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}

.card-footer {
  margin-top: var(--space-8);
}


/* =========================================================
   Immersive / Thematic Helpers for Fantasy RPG Style
   ========================================================= */

/* Cinematic section backgrounds */
.section--hero {
  position: relative;
  background: var(--gradient-hero);
  color: var(--color-text);
  overflow: hidden;
}

.section--hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 10% 20%, rgba(148, 163, 184, 0.08) 0, transparent 55%),
                    radial-gradient(circle at 80% 60%, rgba(148, 163, 184, 0.12) 0, transparent 55%);
  mix-blend-mode: screen;
  opacity: 0.75;
  pointer-events: none;
}

.section--dark {
  background: radial-gradient(circle at top, rgba(15, 118, 110, 0.12), transparent 60%), var(--color-bg-alt);
}

.section--muted {
  background: radial-gradient(circle at top, rgba(37, 99, 235, 0.08), transparent 65%), #050816;
}

/* Frosted glass panels for in-world UIs (maps, stats, etc.) */
.glass-panel {
  position: relative;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.78));
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px);
}

.glass-panel--thin {
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.85));
}

/* Subtle hover lift for interactive tiles */
.tile-hover {
  transition:
    transform var(--transition-bounce),
    box-shadow var(--transition-normal),
    border-color var(--transition-normal),
    background var(--transition-normal);
}

.tile-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-strong);
}

/* Tag / pill (for quests, classes, difficulty, etc.) */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.8);
  font-size: var(--fs-2xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-soft);
}

.tag--primary {
  border-color: rgba(45, 212, 191, 0.7);
  background: rgba(15, 23, 42, 0.95);
  color: var(--color-primary);
}

.tag--danger {
  border-color: rgba(239, 68, 68, 0.7);
  color: var(--color-danger);
}

/* Status dots (online, guild, difficulty, etc.) */
.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--gray-400);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.9);
}

.status-dot--online {
  background: var(--color-success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.7);
}

.status-dot--danger {
  background: var(--color-danger);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.7);
}


/* =========================================================
   Motion Preferences: Subtle Global Animations
   ========================================================= */

/* Subtle floating effect for magical objects / cards */
.float-soft {
  animation: float-soft 6s ease-in-out infinite;
}

@keyframes float-soft {
  0% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
  100% { transform: translateY(0); }
}

/* Pulsing glow for key CTAs or magical highlights */
.glow-pulse {
  animation: glow-pulse 2.6s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% {
    box-shadow: 0 0 0 rgba(45, 212, 191, 0.0);
  }
  50% {
    box-shadow: 0 0 26px rgba(45, 212, 191, 0.55);
  }
}

@media (prefers-reduced-motion: reduce) {
  .float-soft,
  .glow-pulse {
    animation: none !important;
  }
}
