:root {
  color-scheme: dark;
  --bg: #0a0a13;
  --bg-panel: #12121f;
  --bg-panel-alt: #171728;
  --border: #26263c;
  --gold: #c9a44c;
  --gold-soft: #e4c878;
  --text: #e9e4d8;
  --text-dim: #9a94a6;
  --success: #2f9e5b;
  --danger: #b43a3a;
  --info: #4c6c9a;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: no-preference) {
  * { transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease; }
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: #0a0a13;
  color: var(--text);
  font-family: "Segoe UI", Georgia, "Times New Roman", serif;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Ambient blurred color blobs behind the glass panels — slowly drifting. */
body::before, body::after {
  content: "";
  position: fixed;
  width: 46vw;
  height: 46vw;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.28;
  z-index: -1;
  pointer-events: none;
  animation: drift 26s ease-in-out infinite alternate;
}
body::before {
  top: -12vw; left: -10vw;
  background: radial-gradient(circle, #c9a44c, transparent 70%);
}
body::after {
  bottom: -16vw; right: -12vw;
  background: radial-gradient(circle, #4c2f9e, transparent 70%);
  animation-duration: 32s;
  animation-direction: alternate-reverse;
}

@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(4vw, 3vw) scale(1.12); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(87, 212, 133, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(87, 212, 133, 0); }
  100% { box-shadow: 0 0 0 0 rgba(87, 212, 133, 0); }
}

@keyframes pulseGold {
  0% { box-shadow: 0 0 0 0 rgba(201, 164, 76, 0.6); }
  70% { box-shadow: 0 0 0 7px rgba(201, 164, 76, 0); }
  100% { box-shadow: 0 0 0 0 rgba(201, 164, 76, 0); }
}

.live-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #57d485;
  animation: pulseDot 1.8s ease-out infinite;
  vertical-align: middle;
}

a { color: var(--gold-soft); text-decoration: none; }
a:hover { text-decoration: underline; }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid rgba(201,164,76,0.35);
  background: rgba(15, 15, 28, 0.6);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav .brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.5px;
}

.nav .links { display: flex; gap: 22px; align-items: center; }
.nav .links a { color: var(--text-dim); font-weight: 600; font-size: 14px; text-decoration: none; }
.nav .links a.active, .nav .links a:hover { color: var(--gold-soft); }

.nav .user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-dim); }
.nav .user img { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--gold); }

main { max-width: 1080px; margin: 0 auto; padding: 32px; }

h1 { color: var(--gold); font-size: 24px; margin: 0 0 6px; }
.subtitle { color: var(--text-dim); font-size: 14px; margin-bottom: 28px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-tile {
  background: rgba(23, 23, 40, 0.55);
  border: 1px solid rgba(201,164,76,0.18);
  border-left: 3px solid var(--gold);
  border-radius: 10px;
  padding: 16px 18px;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  animation: fadeInUp 0.5s ease both;
}
.stat-grid .stat-tile:nth-child(1) { animation-delay: 0.02s; }
.stat-grid .stat-tile:nth-child(2) { animation-delay: 0.06s; }
.stat-grid .stat-tile:nth-child(3) { animation-delay: 0.10s; }
.stat-grid .stat-tile:nth-child(4) { animation-delay: 0.14s; }
.stat-grid .stat-tile:nth-child(5) { animation-delay: 0.18s; }
.stat-grid .stat-tile:nth-child(6) { animation-delay: 0.22s; }
.stat-grid .stat-tile:nth-child(7) { animation-delay: 0.26s; }
.stat-tile:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(0,0,0,0.35); border-color: rgba(201,164,76,0.4); }
.stat-tile .label { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-tile .value { font-size: 26px; font-weight: 700; color: var(--gold-soft); margin-top: 4px; }

.panel {
  background: rgba(18, 18, 31, 0.55);
  border: 1px solid rgba(201,164,76,0.14);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  box-shadow: 0 10px 30px rgba(0,0,0,0.28);
  animation: fadeInUp 0.45s ease both;
}
.panel.glass { background: rgba(18, 18, 31, 0.42); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--gold); padding: 10px 12px; border-bottom: 2px solid var(--border); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
td { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.05); color: var(--text); }
tr td { transition: background-color 0.15s ease, transform 0.15s ease; }
tr:hover td { background: rgba(201,164,76,0.06); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-open { background: rgba(47,158,91,0.15); color: #57d485; }
.badge-closed { background: rgba(180,58,58,0.15); color: #e07a7a; }
.badge-archived { background: rgba(154,148,166,0.15); color: var(--text-dim); }

.leaderboard-row { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,0.06); border-radius: 6px; }
.leaderboard-row:hover { background: rgba(201,164,76,0.05); transform: translateX(3px); }
.leaderboard-rank { width: 32px; text-align: center; font-size: 18px; }
.leaderboard-name { flex: 1; font-weight: 600; }
.leaderboard-meta { color: var(--text-dim); font-size: 13px; }

.search-form { display: flex; gap: 10px; margin-bottom: 20px; }
.search-form input, .search-form select {
  background: rgba(23,23,40,0.6); border: 1px solid var(--border); color: var(--text);
  padding: 9px 12px; border-radius: 5px; font-size: 14px;
  backdrop-filter: blur(8px);
}
.search-form input { flex: 1; }
.btn {
  background: var(--gold); color: #14142a; border: none; padding: 9px 18px;
  border-radius: 6px; font-weight: 700; cursor: pointer; font-size: 14px;
  transform: translateY(0);
}
.btn:hover { background: var(--gold-soft); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(201,164,76,0.35); }
.btn:active { transform: translateY(0); }

.pin-btn { background: rgba(23,23,40,0.6); color: var(--text); border: 1px solid var(--border); }
.pin-btn:hover { background: rgba(23,23,40,0.8); }
.pin-btn.pinned { background: var(--gold); color: #14142a; }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; flex-direction: column; gap: 20px; text-align: center; }
.login-wrap h1 { font-size: 32px; }
.login-card {
  background: rgba(18, 18, 31, 0.5);
  border: 1px solid rgba(201,164,76,0.2);
  border-top: 3px solid var(--gold);
  border-radius: 14px;
  padding: 40px;
  width: 360px;
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  box-shadow: 0 20px 50px rgba(0,0,0,0.4);
  animation: fadeInUp 0.5s ease both;
}
.error-text { color: #e07a7a; font-size: 13px; margin-top: 10px; }

.chart-wrap { position: relative; height: 260px; }

.ticket-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 14px; margin-bottom: 20px; }
.ticket-field .label { color: var(--text-dim); font-size: 12px; text-transform: uppercase; }
.ticket-field .value { font-size: 15px; margin-top: 2px; }

/* -- live chat ------------------------------------------------------- */
.chat-log {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 6px 4px;
  margin-bottom: 14px;
}
.chat-msg { display: flex; gap: 10px; animation: fadeInUp 0.25s ease both; }
.chat-msg img { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.chat-msg-head { display: flex; gap: 8px; align-items: baseline; }
.chat-author { color: var(--gold); font-weight: 600; font-size: 13px; }
.chat-time { color: var(--text-dim); font-size: 11px; }
.chat-text { font-size: 14px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.chat-text .emoji { width: 20px; height: 20px; vertical-align: -5px; }
.chat-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chat-attachment-img {
  max-width: 380px; max-height: 320px; border-radius: 8px; border: 1px solid var(--border); display: block;
  cursor: zoom-in;
}
.chat-attachment-img:hover { border-color: rgba(201,164,76,0.5); }
.chat-attachment-video {
  max-width: 380px; max-height: 320px; border-radius: 8px; border: 1px solid var(--border);
}

.lightbox {
  position: fixed; inset: 0; background: rgba(5,5,10,0.88); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; z-index: 200; cursor: zoom-out;
  animation: fadeInUp 0.15s ease both;
}
.lightbox.hidden { display: none; }
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,0.6); }
.chat-attachment-file {
  display: inline-flex; align-items: center; gap: 6px; background: rgba(23,23,40,0.6);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-size: 13px;
}

/* -- emoji picker -------------------------------------------------------- */
.emoji-picker-wrap { position: relative; }
.emoji-picker {
  position: absolute;
  bottom: 8px;
  left: 0;
  width: 260px;
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px;
  background: rgba(18, 18, 31, 0.92);
  border: 1px solid rgba(201,164,76,0.3);
  border-radius: 10px;
  backdrop-filter: blur(20px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
  z-index: 20;
  animation: fadeInUp 0.15s ease both;
}
.emoji-picker.hidden { display: none; }
.emoji-picker-item {
  width: 36px; height: 36px; padding: 4px; background: transparent; border: 1px solid transparent;
  border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.emoji-picker-item:hover { background: rgba(201,164,76,0.15); border-color: rgba(201,164,76,0.3); }
.emoji-picker-item img { width: 100%; height: 100%; object-fit: contain; }
.emoji-toggle-btn { background: rgba(23,23,40,0.6); color: var(--text); border: 1px solid var(--border); font-size: 16px; padding: 9px 12px; }
.emoji-toggle-btn:hover { background: rgba(23,23,40,0.8); }

/* -- resolved Discord user chip (name + avatar, links to profile) ------- */
.user-chip { display: inline-flex; align-items: center; gap: 7px; color: var(--text); font-weight: 600; }
.user-chip:hover { color: var(--gold-soft); text-decoration: none; }
.user-chip img { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); }
.chat-form { display: flex; gap: 10px; }
.chat-form input {
  flex: 1; background: rgba(23,23,40,0.6); border: 1px solid var(--border); color: var(--text);
  padding: 9px 12px; border-radius: 5px; font-size: 14px;
}

/* -- internal notes ---------------------------------------------------- */
.note-item {
  background: rgba(23,23,40,0.5);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 10px;
}
.note-meta { color: var(--text-dim); font-size: 12px; margin-bottom: 4px; }
.note-content { font-size: 14px; white-space: pre-wrap; word-break: break-word; }

/* -- steam link banner -------------------------------------------------- */
.steam-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-left: 3px solid var(--gold);
  flex-wrap: wrap;
}

/* -- nav "Profil" attention badge --------------------------------------- */
.nav .user a.needs-attention { position: relative; }
.nav .user a.needs-attention::after {
  content: "";
  position: absolute;
  top: -3px;
  right: -8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  animation: pulseGold 1.8s ease-out infinite;
}
