/* ══ CSS Variables (full palette from PLAN.md) ══ */
:root {
  /* Backgrounds */
  --bg:            #0c0b12;
  --bg-gradient:   linear-gradient(180deg, #0c0b12 0%, #08070e 50%, #06060a 100%);
  --bg-subtle:     #0e0d14;
  --overlay-bg:    rgba(4, 4, 8, 0.92);

  /* Borders */
  --border:        #1e1b16;
  --border-light:  #2a2418;
  --border-hover:  rgba(196, 163, 90, 0.25);

  /* Text hierarchy */
  --text:          #dcc070;
  --text-bright:   #f8f0d8;
  --text-muted:    #7a6a50;
  --text-dim:      #5a4e38;
  --text-ghost:    #1e1b16;

  /* Special text */
  --desc:          #5a5a6a;
  --accent:        #dcc070;
  --you-tag:       #c4a85a;

  /* Bars */
  --bar-fill:      #dcc070;
  --bar-empty:     #1e1b16;
  --bar-label:     #6a5e48;
  --hp-fill:       #a05040;
  --hp-label:      #7a4538;
  --mp-fill:       #4a6a90;
  --mp-label:      #3a5570;

  /* Rarity -- label */
  --rarity-common:      #5a4e38;
  --rarity-uncommon:    #60b070;
  --rarity-rare:        #d0b840;
  --rarity-epic:        #80a8e0;
  --rarity-legendary:   #f0a030;

  /* Rarity -- name */
  --name-common:        #f8f0d8;
  --name-uncommon:      #90e0a0;
  --name-rare:          #f8e070;
  --name-epic:          #b0d0f8;
  --name-legendary:     #ffd060;

  /* Rarity -- avatar */
  --avatar-common:      #a89060;
  --avatar-uncommon:    #5aaa6a;
  --avatar-rare:        #c8b040;
  --avatar-epic:        #7a9fd4;
  --avatar-legendary:   #e0a030;

  /* Rank medals */
  --rank-gold:     #d4af37;
  --rank-silver:   #a0a0a8;
  --rank-bronze:   #b07430;
  --rank-default:  #5a4e38;

  /* States */
  --error:         #cc4444;
  --success:       #4a8a55;
  --focus:         #d4b860;
  --hover-bg:      rgba(196, 163, 90, 0.04);
  --hibernating:   #2a2a2a;

  /* Profile / misc */
  --close-btn:         #a0906a;
  --profile-stat-label:#b4a06c;
  --profile-rpg-label: #8a7a56;
  --rpg-bar-fill:      #b4a06c;
  --rpg-bar-val:       #9a8a60;
  --shiny-color:       rgba(255, 215, 0, 0.8);

  /* Typography */
  --font-mono:     "Courier New", Courier, monospace;
  --font-serif:    Georgia, "Times New Roman", serif;
}

/* ══ Reset ══ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Remove focus outlines globally — dark UI, outlines look broken */
*:focus {
  outline: none;
}
*:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
button, [role="button"] {
  -webkit-tap-highlight-color: transparent;
}
dialog {
  outline: none;
}
body.dialog-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  left: 0;
}

html {
  background: #06060a;
  color-scheme: dark;
  scrollbar-gutter: stable;
}

body {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background: #06060a;
  background: var(--bg-gradient);
  background-attachment: scroll;
  color: var(--text);
  overscroll-behavior-y: none;
}

/* ══ Typography ══ */
body {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  font-family: inherit;
  font-size: inherit;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
}

a {
  color: var(--accent);
  text-decoration: none;
}

/* ══ Accessibility ══ */
.hidden {
  display: none !important;
}

.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;
}

/* ══ Skeleton loading ══ */
@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

.skeleton-entry {
  cursor: default !important;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-text {
  color: var(--text-ghost) !important;
}

.skeleton-avatar {
  color: var(--text-ghost) !important;
}

/* ══ Error state ══ */
.error-state {
  text-align: center;
  padding: 48px 16px;
  font-family: var(--font-mono);
}

.error-icon {
  font-size: 28px;
  margin-bottom: 12px;
  color: var(--error);
}

.error-message {
  font: 400 16px/1.4 var(--font-mono);
  color: var(--text-muted);
  margin-bottom: 8px;
}

.error-hint {
  font: 400 12px/1.6 var(--font-mono);
  color: var(--text-dim);
}

/* ══ Shiny animation ══ */
@keyframes shimmer {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.shiny {
  color: var(--shiny-color);
  animation: shimmer 2s ease-in-out infinite;
}

/* ══ Reduced Motion ══ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
