/* ══════════════════════════════════════════
   VARIABLES
══════════════════════════════════════════ */
:root {
  --bg:           #050810;
  --bg2:          #090e1a;
  --bg3:          #0d1424;
  --border:       rgba(100, 180, 255, 0.12);
  --border-glow:  rgba(100, 180, 255, 0.35);
  --accent-blue:  #5ab4ff;
  --accent-cyan:  #00e5cc;
  --accent-gold:  #f0c040;
  --accent-red:   #ff5555;
  --accent-green: #44ffaa;
  --accent-orange:#ffaa44;
  --text:         #c8d8f0;
  --text-dim:     #6a80a0;
  --text-bright:  #eaf2ff;
  --glow-blue:    0 0 20px rgba(90, 180, 255, 0.4);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 17px;
  line-height: 1.7;
  overflow-x: hidden;
}

/* ── BG ── */
#stars {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(0,80,180,.12) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(0,200,180,.08) 0%, transparent 50%);
}

/* ── HEADER ── */
header {
  position: relative; z-index: 10;
  text-align: center;
  padding: 70px 20px 50px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(to bottom, rgba(0,20,60,.8), transparent);
}
.header-logo {
  width: 90px;
  height: 90px;
  margin-bottom: 14px;
  filter: drop-shadow(0 0 16px rgba(240,192,64,0.5));
  animation: pulse-gold 3s ease-in-out infinite;
}

.header-triforce {
  font-size: 44px; margin-bottom: 14px;
  filter: drop-shadow(0 0 16px var(--accent-gold));
  animation: pulse-gold 3s ease-in-out infinite;
}
@keyframes pulse-gold {
  0%,100% { filter: drop-shadow(0 0 10px rgba(240,192,64,.5)); }
  50%      { filter: drop-shadow(0 0 28px rgba(240,192,64,.9)); }
}
h1 {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(1.6rem, 5vw, 3.2rem);
  font-weight: 700; color: var(--text-bright);
  letter-spacing: .05em; text-shadow: var(--glow-blue); line-height: 1.2;
}
.subtitle {
  font-family: 'Cinzel', serif; font-size: .82rem;
  letter-spacing: .3em; color: var(--accent-cyan);
  margin-top: 8px; text-transform: uppercase;
}
.header-desc { max-width: 600px; margin: 20px auto 0; font-style: italic; color: var(--text-dim); font-size: .95rem; }

/* STATS */
.stats-row { display: flex; justify-content: center; gap: 30px; margin-top: 28px; flex-wrap: wrap; }
.stat-item  { text-align: center; }
.stat-num   { font-family: 'Cinzel Decorative', serif; font-size: 1.8rem; color: var(--text-bright); line-height: 1; }
.stat-num.blue   { color: var(--accent-blue);   text-shadow: 0 0 14px rgba(90,180,255,.5); }
.stat-num.cyan   { color: var(--accent-cyan);   text-shadow: 0 0 14px rgba(0,229,204,.5); }
.stat-num.gold   { color: var(--accent-gold);   text-shadow: 0 0 14px rgba(240,192,64,.5); }
.stat-num.orange { color: var(--accent-orange); text-shadow: 0 0 14px rgba(255,170,68,.5); }
.stat-label { font-family: 'Source Code Pro', monospace; font-size: .65rem; color: var(--text-dim); letter-spacing: .12em; text-transform: uppercase; margin-top: 2px; }

/* ── CONTROLS ── */
.controls {
  position: sticky; top: 0; z-index: 20;
  background: rgba(5,8,16,.93); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex; flex-wrap: wrap; gap: 10px;
  align-items: center; justify-content: center;
}
.search-wrap { position: relative; flex: 1; min-width: 180px; max-width: 320px; }
.search-wrap::before {
  content: '⌕'; position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-dim); font-size: 1rem; pointer-events: none;
}
#searchInput {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  color: var(--text-bright); padding: 7px 10px 7px 32px;
  border-radius: 6px; font-family: 'Source Code Pro', monospace;
  font-size: .82rem; outline: none; transition: border-color .2s;
}
#searchInput:focus { border-color: var(--accent-blue); }
#searchInput::placeholder { color: var(--text-dim); }

.filter-group { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filter-btn {
  font-family: 'Cinzel', serif; font-size: .68rem; letter-spacing: .08em;
  padding: 5px 12px; border-radius: 18px; border: 1px solid var(--border);
  background: transparent; color: var(--text-dim); cursor: pointer; transition: all .2s;
}
.filter-btn:hover { border-color: var(--accent-blue); color: var(--accent-blue); }
.filter-btn.active { background: var(--accent-blue); border-color: var(--accent-blue); color: #000; font-weight: 600; }
.filter-btn[data-filter="totk"].active    { background: var(--accent-cyan);   border-color: var(--accent-cyan); }
.filter-btn[data-filter="both"].active    { background: var(--accent-gold);   border-color: var(--accent-gold); }
.filter-btn[data-filter="patched"].active { background: var(--accent-red);    border-color: var(--accent-red); color: #fff; }
.filter-btn[data-filter="speedrun"].active{ background: var(--accent-orange); border-color: var(--accent-orange); color: #000; }
.filter-sep { width: 1px; height: 22px; background: var(--border); }
.count-badge { font-family: 'Source Code Pro', monospace; font-size: .72rem; color: var(--text-dim); padding: 0 4px; }

/* ── CATEGORIES ── */
.cat-row {
  display: flex; justify-content: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 20px; border-bottom: 1px solid var(--border);
  background: rgba(5,8,16,.7); position: sticky; top: 49px; z-index: 19;
}
.cat-btn {
  font-family: 'Source Code Pro', monospace; font-size: .68rem;
  padding: 4px 11px; border-radius: 4px; border: 1px solid var(--border);
  background: transparent; color: var(--text-dim); cursor: pointer;
  transition: all .2s; letter-spacing: .05em;
}
.cat-btn:hover { border-color: rgba(100,180,255,.4); color: var(--text); }
.cat-btn.active { background: rgba(100,180,255,.12); border-color: var(--border-glow); color: var(--accent-blue); }

/* ── MAIN ── */
main {
  position: relative; z-index: 5;
  max-width: 1240px; margin: 0 auto; padding: 36px 20px 80px;
}

/* Loading */
.loading-state {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 60px 20px; color: var(--text-dim);
  font-family: 'Source Code Pro', monospace; font-size: .85rem;
}
.loading-spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── GRID ── */
.glitch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 18px; }

/* ── CARDS ── */
.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 20px; cursor: pointer;
  transition: all .22s; position: relative; overflow: hidden;
}
.card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  opacity: 0; transition: opacity .3s;
}
.card.botw::before { background: linear-gradient(to right, transparent, var(--accent-blue), transparent); }
.card.totk::before { background: linear-gradient(to right, transparent, var(--accent-cyan), transparent); }
.card.both::before { background: linear-gradient(to right, transparent, var(--accent-gold), transparent); }
.card:hover { border-color: var(--border-glow); background: var(--bg3); transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,.4); }
.card:hover::before { opacity: 1; }

.card-header  { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-name    { font-family: 'Cinzel', serif; font-size: .95rem; font-weight: 600; color: var(--text-bright); line-height: 1.3; }
.card-badges  { display: flex; gap: 5px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.card-summary { font-size: .88rem; color: var(--text-dim); font-style: italic; margin-bottom: 10px; line-height: 1.5; }
.card-footer  { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.card-tags    { display: flex; flex-wrap: wrap; gap: 5px; }
.card-icons   { display: flex; gap: 6px; align-items: center; }

/* ── BADGES ── */
.game-badge { font-size: .62rem; padding: 2px 8px; border-radius: 10px; letter-spacing: .12em; font-family: 'Cinzel', serif; }
.badge-botw { background: rgba(90,180,255,.15); color: var(--accent-blue); border: 1px solid rgba(90,180,255,.3); }
.badge-totk { background: rgba(0,229,204,.12);  color: var(--accent-cyan); border: 1px solid rgba(0,229,204,.3); }
.badge-both { background: rgba(240,192,64,.12); color: var(--accent-gold); border: 1px solid rgba(240,192,64,.3); }

.difficulty  { font-family: 'Source Code Pro', monospace; font-size: .62rem; padding: 2px 7px; border-radius: 4px; }
.diff-easy   { background: rgba(68,255,170,.1);  color: var(--accent-green);  border: 1px solid rgba(68,255,170,.25); }
.diff-medium { background: rgba(240,192,64,.1);  color: var(--accent-gold);   border: 1px solid rgba(240,192,64,.25); }
.diff-hard   { background: rgba(255,85,85,.1);   color: var(--accent-red);    border: 1px solid rgba(255,85,85,.25); }

.tag { font-family: 'Source Code Pro', monospace; font-size: .62rem; padding: 2px 7px; background: rgba(100,130,180,.08); border: 1px solid rgba(100,130,180,.18); border-radius: 3px; color: var(--text-dim); }

.patch-badge   { font-family: 'Source Code Pro', monospace; font-size: .6rem; padding: 2px 7px; border-radius: 3px; letter-spacing: .06em; }
.patch-works   { background: rgba(68,255,170,.08); color: #55cc88; border: 1px solid rgba(68,255,170,.2); }
.patch-patched { background: rgba(255,85,85,.08);  color: #cc5555; border: 1px solid rgba(255,85,85,.2); }
.patch-version { background: rgba(255,170,68,.08); color: var(--accent-orange); border: 1px solid rgba(255,170,68,.2); }
.patch-speedrun{ background: rgba(255,170,68,.08); color: var(--accent-orange); border: 1px solid rgba(255,170,68,.25); }

.speedrun-icon { font-size: .75rem; color: var(--accent-orange); }
.video-icon    { font-size: .75rem; color: var(--accent-red); }

/* ── MODAL ── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.78); backdrop-filter: blur(6px);
  align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg2); border: 1px solid var(--border-glow);
  border-radius: 14px; max-width: 720px; width: 100%; max-height: 88vh;
  overflow-y: auto; box-shadow: 0 0 60px rgba(0,80,200,.22);
  animation: modal-in .22s ease;
}
@keyframes modal-in { from { opacity:0; transform: scale(.95) translateY(14px); } to { opacity:1; transform:none; } }
.modal-top    { padding: 26px 26px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.modal-close  { background: transparent; border: 1px solid var(--border); color: var(--text-dim); font-size: 1.1rem; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; flex-shrink: 0; transition: all .2s; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { border-color: var(--accent-red); color: var(--accent-red); }
.modal-title  { font-family: 'Cinzel', serif; font-size: 1.3rem; color: var(--text-bright); line-height: 1.3; }
.modal-body   { padding: 18px 26px 26px; }
.modal-meta   { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0 18px; }

.modal-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.info-cell       { background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; }
.info-cell-label { font-family: 'Source Code Pro', monospace; font-size: .6rem; color: var(--text-dim); letter-spacing: .1em; text-transform: uppercase; margin-bottom: 2px; }
.info-cell-value { font-size: .85rem; color: var(--text-bright); display: flex; flex-wrap: wrap; gap: 4px; }

.modal-section    { margin-bottom: 18px; }
.modal-section h3 { font-family: 'Cinzel', serif; font-size: .78rem; letter-spacing: .15em; color: var(--accent-blue); text-transform: uppercase; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.modal-section h3::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.modal-section p  { font-size: .92rem; line-height: 1.75; color: var(--text); }

.steps    { list-style: none; counter-reset: step; }
.steps li { counter-increment: step; display: flex; gap: 10px; font-size: .88rem; color: var(--text); margin-bottom: 7px; line-height: 1.6; }
.steps li::before {
  content: counter(step);
  font-family: 'Source Code Pro', monospace; font-size: .68rem;
  background: rgba(90,180,255,.13); color: var(--accent-blue);
  border: 1px solid rgba(90,180,255,.3);
  min-width: 22px; height: 22px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 2px;
}

.warning-box { background: rgba(255,85,85,.07); border: 1px solid rgba(255,85,85,.22); border-radius: 6px; padding: 9px 13px; font-size: .83rem; color: #ff9999; display: flex; gap: 8px; margin-bottom: 10px; }
.tip-box     { background: rgba(68,255,170,.05); border: 1px solid rgba(68,255,170,.18); border-radius: 6px; padding: 9px 13px; font-size: .83rem; color: #88ffcc; display: flex; gap: 8px; margin-bottom: 10px; }

/* Video */
.video-wrap { position: relative; width: 100%; padding-top: 56.25%; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; }

/* No results */
#noResults { display: none; text-align: center; padding: 60px 20px; color: var(--text-dim); font-style: italic; }
#noResults .nope { font-size: 2.8rem; margin-bottom: 10px; }

/* ── FOOTER ── */
footer { position: relative; z-index: 5; text-align: center; padding: 28px; border-top: 1px solid var(--border); font-size: .75rem; color: var(--text-dim); font-family: 'Source Code Pro', monospace; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-glow); border-radius: 3px; }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .glitch-grid { grid-template-columns: 1fr; }
  .modal-info-grid { grid-template-columns: 1fr; }
  .modal-top, .modal-body { padding-left: 16px; padding-right: 16px; }
  .modal-title { font-size: 1.1rem; }
  .cat-row { top: 45px; }
}