:root {
  --bg-deep: #070a12;
  --bg-mid: #12182a;
  --accent: #6ee7ff;
  --accent-soft: rgba(110, 231, 255, 0.18);
  --accent-2: #a78bfa;
  --surface: rgba(18, 22, 38, 0.72);
  --surface-elevated: rgba(28, 34, 56, 0.85);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef1ff;
  --text-muted: #9aa4c7;
  --text-dim: #6b7699;
  --danger: #fca5a5;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --shadow-card: 0 24px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  --font-sans: "Instrument Sans", system-ui, sans-serif;
  --font-display: "Instrument Serif", Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-deep);
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 2.5rem);
  position: relative;
  overflow-x: hidden;
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 100% 80% at 50% -20%, rgba(110, 231, 255, 0.12), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 50%, rgba(167, 139, 250, 0.08), transparent 50%),
    radial-gradient(ellipse 60% 40% at 0% 80%, rgba(110, 231, 255, 0.06), transparent 45%),
    linear-gradient(165deg, var(--bg-deep) 0%, var(--bg-mid) 45%, #0a0d16 100%);
  pointer-events: none;
}

.page-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  opacity: 1;
}

.app {
  width: min(820px, 100%);
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 4vw, 2.25rem);
  box-shadow: var(--shadow-card);
}

.app-header {
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 4.5vw, 2.35rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 0%, #c8d4f0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtext {
  margin: 0;
  max-width: 42ch;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.lookup-form {
  display: grid;
  gap: 1.25rem;
}

.form-fields {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  align-items: end;
}

label {
  display: grid;
  gap: 0.45rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

input,
select {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 0.7rem 0.85rem;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface-elevated);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input::placeholder {
  color: var(--text-dim);
}

input:hover,
select:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

input:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn-primary {
  min-width: 200px;
  padding: 0.8rem 1.35rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #0a0c12;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: linear-gradient(135deg, #6ee7ff 0%, #93c5fd 45%, #a78bfa 100%);
  box-shadow:
    0 4px 14px rgba(110, 231, 255, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.25) inset;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow:
    0 8px 24px rgba(110, 231, 255, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.3) inset;
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px var(--accent-soft),
    0 8px 24px rgba(110, 231, 255, 0.35);
}

.status {
  min-height: 1.5rem;
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.status.is-busy {
  color: var(--accent);
}

.status.is-error {
  color: var(--danger);
}

.status:empty {
  margin-top: 0;
  min-height: 0;
}

.results {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 1.25rem;
}

.char-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    0 0 0 1px rgba(110, 231, 255, 0.35),
    0 8px 24px rgba(0, 0, 0, 0.35);
}

.char-title {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3vw, 1.65rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text);
}

.char-meta {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.metrics {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.metric {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  transition: border-color 0.2s ease;
}

.metric:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.metric strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.metric span {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.raid-list {
  margin: 0.35rem 0 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.raid-list li::marker {
  color: var(--accent-2);
}

.raid-list strong {
  color: var(--text);
}

.dungeon-runs {
  margin-top: 0.25rem;
}

.section-head {
  margin: 0 0 0.85rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-head::before {
  content: "";
  width: 4px;
  height: 1em;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.dungeon-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.dungeon-item {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.dungeon-item:hover {
  border-color: rgba(110, 231, 255, 0.25);
  transform: translateX(2px);
}

.dungeon-item strong {
  color: var(--text);
  font-weight: 600;
}

.score-calc {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.score-calc-intro {
  margin: 0 0 1.1rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 62ch;
}

.score-calc-intro a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(110, 231, 255, 0.35);
}

.score-calc-intro a:hover {
  border-bottom-color: var(--accent);
}

.score-calc-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  align-items: end;
  margin-bottom: 1rem;
}

.score-calc-output {
  display: grid;
  gap: 0.65rem;
}

.score-calc-row {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.score-calc-row strong {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.score-calc-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.score-calc-note {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.45;
}

.score-calc-output.is-error .score-calc-value {
  color: var(--danger);
  font-size: 0.95rem;
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .btn-primary,
  .dungeon-item {
    transition: none;
  }

  .btn-primary:hover,
  .dungeon-item:hover {
    transform: none;
  }
}
