/* Soundbook web player - visual identity mirrors Theme.lua's V3 "Arcane"
   design tokens (Deep Navy / Arcane Blue / restrained gold), recreated in
   plain CSS for the browser rather than reusing any WoW UI texture. */

:root {
  --deep-navy: #07111f;
  --raised-navy: #0b1b2d;
  --card-bg: #0a1624;
  --hover-raised: #102b44;
  --text-primary: #e8f0ff;
  --text-secondary: #8fa6bf;
  --arcane-blue: #5980ff;
  --arcane-cyan: #4db0eb;
  --gold: #ebad47;
  --gold-dim: #7a5a26;
  --danger: #e2645a;
  --radius-m: 10px;
  --radius-l: 14px;
  --gap: 12px;
  --header-h: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--deep-navy);
  color: var(--text-primary);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  min-height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: var(--arcane-blue);
  color: #06101d;
  padding: 8px 14px;
  border-radius: var(--radius-m);
  z-index: 100;
}
.skip-link:focus {
  left: 12px;
  top: 12px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: var(--gap);
  min-height: var(--header-h);
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--raised-navy);
  border-bottom: 1px solid rgba(89, 128, 255, 0.25);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--arcane-cyan);
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand-mark { display: inline-flex; color: var(--gold); }
.brand-name { color: var(--text-primary); font-size: 1.05rem; }
.brand-version {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--card-bg);
  border: 1px solid rgba(235, 173, 71, 0.35);
  border-radius: 999px;
  padding: 2px 8px;
}

.search-wrap { flex: 1 1 220px; min-width: 140px; }
#search {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-m);
  border: 1px solid rgba(89, 128, 255, 0.35);
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 0.95rem;
}
#search::placeholder { color: var(--text-secondary); }
#search:focus-visible {
  outline: 2px solid var(--arcane-blue);
  outline-offset: 1px;
}

.curseforge-link {
  color: var(--gold);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-m);
  padding: 6px 10px;
}
.curseforge-link:hover,
.curseforge-link:focus-visible { background: rgba(235, 173, 71, 0.12); }

.tabs {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  overflow-x: auto;
  background: var(--deep-navy);
  border-bottom: 1px solid rgba(89, 128, 255, 0.12);
}
.tab-btn {
  flex: 0 0 auto;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(89, 128, 255, 0.3);
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.tab-btn:hover { background: var(--hover-raised); color: var(--text-primary); }
.tab-btn[aria-pressed="true"] {
  background: var(--arcane-blue);
  border-color: var(--arcane-blue);
  color: #06101d;
}
.tab-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

#content { flex: 1 1 auto; padding: 16px; }

.status-message {
  color: var(--text-secondary);
  text-align: center;
  padding: 40px 16px;
  font-size: 0.95rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--gap);
}

.card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid rgba(89, 128, 255, 0.18);
  border-radius: var(--radius-l);
  overflow: hidden;
}

.card-fav {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(235, 173, 71, 0.4);
  background: rgba(7, 17, 31, 0.75);
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.card-fav[aria-pressed="true"] { color: var(--gold); border-color: var(--gold); }
.card-fav:hover { color: var(--gold); }
.card-fav:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.card-play {
  width: 100%;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 18px 10px 14px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  position: relative;
}
.card-play:hover { background: var(--hover-raised); }
.card-play:focus-visible { outline: 2px solid var(--arcane-blue); outline-offset: -2px; }
.card-play[aria-pressed="true"] { background: rgba(89, 128, 255, 0.14); }

.card-icon { color: var(--arcane-cyan); display: inline-flex; }
.card-play[aria-pressed="true"] .card-icon { color: var(--gold); }

.card-name {
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.card-category {
  font-size: 0.68rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--arcane-blue), var(--gold));
  transition: width 0.12s linear;
}

.card-error .card-icon { color: var(--danger); }
.card-error .card-name::after {
  content: " (unavailable)";
  color: var(--danger);
  font-weight: 500;
  font-size: 0.75rem;
}

.app-footer {
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.78rem;
  border-top: 1px solid rgba(89, 128, 255, 0.12);
}

@media (max-width: 480px) {
  .topbar { padding: 8px 12px; }
  .brand-name { font-size: 0.98rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
  .card-play { min-height: 100px; padding: 14px 8px 10px; }
}
