/* =========================================================
   MÖRK BORG × BLOODBORNE — Eldritch Gothic Variant
   Rusted divinity. Grave-soot velvet. Hungry borders.
   ========================================================= */

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

/* --- Root Palette: Cathedral rot + cosmic rot --- */
:root {
  --color-bg:         #050506;
  --color-bg-2:       #0a0a0d;
  --color-surface:    #101014;
  --color-surface-2:  #16131a;
  --color-border:     #2a2226;
  --color-border-2:   #3d3137;

  --color-text:       #d8cfba;
  --color-muted:      #7f7466;

  --color-accent:     #b59a48;   /* old brass / relic gold */
  --color-accent-2:   #d7bf73;
  --color-blood:      #6f1d22;
  --color-blood-2:    #92262c;
  --color-violet:     #58417d;   /* eldritch arcana */
  --color-ichor:      #2f5a46;   /* sickly alchemical green */
  --color-bone:       #b9ab8d;
  --color-shadow:     rgba(0,0,0,0.72);

  --font-main:   'Georgia', 'Times New Roman', serif;
  --font-mono:   'Courier New', Courier, monospace;

  --radius: 2px;
  --gap: 1.25rem;
}

/* --- Motion --- */
@keyframes titleFlicker {
  0%, 100% { opacity: 1; text-shadow: 0 0 4px rgba(215,191,115,0.18), 0 0 18px rgba(111,29,34,0.08); }
  49% { opacity: 0.96; }
  50% { opacity: 0.82; }
  52% { opacity: 0.98; }
}

@keyframes ritualPulse {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02), 0 0 0 rgba(0,0,0,0); }
  50% { box-shadow: inset 0 0 0 1px rgba(215,191,115,0.05), 0 0 18px rgba(88,65,125,0.08); }
}

@keyframes mistShift {
  0%   { transform: translate3d(0,0,0) scale(1); opacity: 0.22; }
  50%  { transform: translate3d(-1.5%, 1%, 0) scale(1.04); opacity: 0.32; }
  100% { transform: translate3d(1.5%, -1%, 0) scale(1); opacity: 0.22; }
}

@keyframes tentacleCreep {
  0%   { transform: translateX(0) scaleY(1); opacity: 0.45; }
  25%  { transform: translateX(1px) scaleY(1.08); opacity: 0.62; }
  50%  { transform: translateX(-1px) scaleY(0.96); opacity: 0.5; }
  75%  { transform: translateX(1px) scaleY(1.04); opacity: 0.68; }
  100% { transform: translateX(0) scaleY(1); opacity: 0.45; }
}

@keyframes borderThrob {
  0%, 100% { filter: drop-shadow(0 0 1px rgba(88,65,125,0.25)); }
  50% { filter: drop-shadow(0 0 5px rgba(111,29,34,0.22)); }
}

@keyframes candleBreath {
  0%,100% { opacity: 0.75; }
  50% { opacity: 1; }
}

/* --- Page --- */
html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background:
    radial-gradient(circle at 50% 10%, rgba(88,65,125,0.08), transparent 32%),
    radial-gradient(circle at 15% 20%, rgba(111,29,34,0.10), transparent 28%),
    radial-gradient(circle at 85% 80%, rgba(181,154,72,0.05), transparent 20%),
    linear-gradient(180deg, var(--color-bg), var(--color-bg-2) 45%, #030304 100%);
  color: var(--color-text);
  font-family: var(--font-main);
  line-height: 1.65;
  min-height: 100vh;
  padding: 0 1rem 4rem;
  position: relative;
  overflow-x: hidden;
}

/* drifting fog */
body::before {
  content: "";
  position: fixed;
  inset: -5%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,0.025), transparent 18%),
    radial-gradient(circle at 70% 60%, rgba(88,65,125,0.05), transparent 24%),
    radial-gradient(circle at 45% 75%, rgba(111,29,34,0.04), transparent 20%);
  filter: blur(26px);
  animation: mistShift 18s ease-in-out infinite;
}

/* subtle grime / film */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.14;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.01) 1px, transparent 1px);
  background-size: 3px 3px, 3px 3px;
  mix-blend-mode: soft-light;
}

/* --- Layout --- */
.site-wrapper {
  max-width: 700px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* --- Header --- */
.site-header {
  padding: 3rem 0 1.75rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 2rem;
  position: relative;
}

.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 40%;
  height: 1px;
  background: linear-gradient(90deg, var(--color-accent), transparent);
  opacity: 0.75;
}

.site-title {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  color: var(--color-accent);
  letter-spacing: 0.08em;
  line-height: 1.05;
  text-transform: uppercase;
  text-shadow:
    0 0 2px rgba(255,255,255,0.06),
    0 0 8px rgba(181,154,72,0.16),
    0 0 18px rgba(111,29,34,0.10);
  animation: titleFlicker 7s infinite alternate;
}

.site-tagline {
  margin-top: 0.65rem;
  color: var(--color-muted);
  font-style: italic;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

/* --- Controls --- */
.controls-section {
  margin-bottom: 2rem;
}

/* Main gothic panels */
fieldset,
#resultSection {
  position: relative;
  border: 1px solid var(--color-border);
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.02), transparent 22%),
    linear-gradient(145deg, var(--color-surface), var(--color-surface-2));
  box-shadow:
    0 10px 30px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.03),
    inset 0 0 20px rgba(0,0,0,0.35);
  overflow: hidden;
  animation: ritualPulse 9s ease-in-out infinite;
}

/* Animated tentacle-like side borders */
fieldset::before,
#resultSection::before {
  content: "";
  position: absolute;
  left: -10px;
  top: -8%;
  width: 22px;
  height: 116%;
  pointer-events: none;
  opacity: 0.65;
  background:
    radial-gradient(ellipse at 60% 8%, rgba(88,65,125,0.65) 0 10%, transparent 11%),
    radial-gradient(ellipse at 45% 20%, rgba(15,15,20,0.95) 0 16%, transparent 17%),
    radial-gradient(ellipse at 60% 36%, rgba(111,29,34,0.35) 0 9%, transparent 10%),
    radial-gradient(ellipse at 42% 50%, rgba(14,14,18,0.92) 0 15%, transparent 16%),
    radial-gradient(ellipse at 58% 68%, rgba(88,65,125,0.35) 0 8%, transparent 9%),
    radial-gradient(ellipse at 46% 82%, rgba(10,10,14,0.92) 0 14%, transparent 15%),
    linear-gradient(180deg,
      rgba(15,15,20,0.0) 0%,
      rgba(15,15,20,0.95) 10%,
      rgba(36,25,46,0.92) 28%,
      rgba(10,10,14,0.98) 46%,
      rgba(53,20,26,0.72) 60%,
      rgba(12,12,16,0.95) 82%,
      rgba(15,15,20,0.0) 100%);
  filter: blur(0.6px);
  transform-origin: center;
  animation: tentacleCreep 8s ease-in-out infinite, borderThrob 6s ease-in-out infinite;
}

fieldset::after,
#resultSection::after {
  content: "";
  position: absolute;
  right: -10px;
  top: -8%;
  width: 22px;
  height: 116%;
  pointer-events: none;
  opacity: 0.58;
  background:
    radial-gradient(ellipse at 40% 14%, rgba(111,29,34,0.42) 0 8%, transparent 9%),
    radial-gradient(ellipse at 56% 24%, rgba(12,12,16,0.94) 0 15%, transparent 16%),
    radial-gradient(ellipse at 40% 44%, rgba(88,65,125,0.42) 0 9%, transparent 10%),
    radial-gradient(ellipse at 54% 56%, rgba(12,12,16,0.94) 0 15%, transparent 16%),
    radial-gradient(ellipse at 42% 76%, rgba(47,90,70,0.28) 0 7%, transparent 8%),
    linear-gradient(180deg,
      rgba(15,15,20,0.0) 0%,
      rgba(13,13,18,0.95) 10%,
      rgba(29,22,36,0.92) 34%,
      rgba(11,11,15,0.98) 52%,
      rgba(50,17,22,0.66) 70%,
      rgba(15,15,20,0.0) 100%);
  filter: blur(0.8px);
  transform-origin: center;
  animation: tentacleCreep 9.5s ease-in-out infinite reverse, borderThrob 7s ease-in-out infinite;
}

legend {
  padding: 0 0.5rem;
  color: var(--color-accent);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-shadow: 0 0 6px rgba(181,154,72,0.14);
}

.control-group {
  margin-bottom: 1rem;
}

.control-group:last-child {
  margin-bottom: 0;
}

.control-group__label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--color-muted);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* --- Checkboxes --- */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.checkbox-label:hover {
  color: var(--color-bone);
  text-shadow: 0 0 8px rgba(181,154,72,0.12);
}

.checkbox-label input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--color-accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* --- Radio buttons --- */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s, box-shadow 0.15s;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.015), transparent),
    var(--color-bg-2);
}

.radio-label:hover {
  border-color: var(--color-border-2);
  color: var(--color-bone);
}

.radio-label:has(input:checked) {
  border-color: var(--color-accent);
  background:
    linear-gradient(180deg, rgba(181,154,72,0.08), rgba(111,29,34,0.04)),
    #151015;
  color: var(--color-accent-2);
  box-shadow:
    inset 0 0 10px rgba(181,154,72,0.05),
    0 0 10px rgba(88,65,125,0.08);
}

.radio-label input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* --- Generate Button: hunter’s reliquary --- */
.generate-btn {
  display: block;
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.95rem 1.5rem;
  background:
    linear-gradient(180deg, var(--color-accent-2), var(--color-accent) 55%, #7f6830 100%);
  color: #120f0a;
  border: 1px solid #8e7639;
  border-radius: var(--radius);
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: bold;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.05) inset,
    0 0 12px rgba(181,154,72,0.18),
    0 6px 14px rgba(0,0,0,0.28);
  transition: transform 0.12s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.generate-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.06) inset,
    0 0 18px rgba(181,154,72,0.28),
    0 0 28px rgba(111,29,34,0.12),
    0 8px 16px rgba(0,0,0,0.34);
  filter: brightness(1.03);
}

.generate-btn:active {
  transform: scale(0.985);
}

/* --- Placeholder --- */
#resultPlaceholder {
  color: var(--color-muted);
  font-style: italic;
  text-align: center;
  padding: 2rem 1rem;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 50%, rgba(88,65,125,0.06), transparent 68%);
  animation: candleBreath 7s infinite ease-in-out;
}

/* --- Result Card --- */
#resultSection {
  padding: 1.5rem;
}

#resultSection[hidden] {
  display: none;
}

.item-header {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  position: relative;
}

.item-header::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 32%;
  height: 1px;
  background: linear-gradient(90deg, var(--color-blood-2), transparent);
}

#itemName {
  font-size: clamp(1.2rem, 4vw, 1.7rem);
  color: var(--color-accent-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.18;
  text-shadow:
    0 0 5px rgba(181,154,72,0.16),
    0 0 14px rgba(88,65,125,0.10);
}

#itemTags {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* --- Description --- */
.item-description {
  margin-bottom: 1.25rem;
  font-style: italic;
  color: #bfb39a;
  text-shadow: 0 0 1px rgba(255,255,255,0.04);
}

/* --- Stats block --- */
#statsBlock {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.2rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

#statsBlock dt {
  color: var(--color-muted);
  font-style: normal;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  padding-top: 0.1rem;
}

#statsBlock dd {
  color: var(--color-text);
  font-family: var(--font-mono);
  text-shadow: 0 0 4px rgba(255,255,255,0.03);
}

/* --- Features --- */
#featuresBlock {
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
  margin-top: 0.5rem;
}

#featuresBlock[hidden] {
  display: none;
}

.feature {
  margin-bottom: 0.9rem;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid var(--color-border);
  border-radius: 0 var(--radius) var(--radius) 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.02), rgba(0,0,0,0.18));
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.015),
    inset 0 0 20px rgba(0,0,0,0.22);
  position: relative;
  overflow: hidden;
}

.feature::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.025) 18%, transparent 36%);
  opacity: 0.45;
  pointer-events: none;
}

.feature:last-child {
  margin-bottom: 0;
}

.feature--magic {
  border-left-color: var(--color-violet);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.015),
    inset 0 0 18px rgba(88,65,125,0.16);
}

.feature--gun {
  border-left-color: var(--color-ichor);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.015),
    inset 0 0 18px rgba(47,90,70,0.12);
}

.feature--drawback {
  border-left-color: var(--color-blood-2);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.015),
    inset 0 0 18px rgba(111,29,34,0.15);
}

.feature--ancient {
  border-left-color: var(--color-bone);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.015),
    inset 0 0 18px rgba(185,171,141,0.08);
}

.feature--shitty {
  border-left-color: var(--color-muted);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.015),
    inset 0 0 18px rgba(127,116,102,0.08);
}

.feature--feature {
  border-left-color: var(--color-border-2);
}

.feature__label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-muted);
  margin-bottom: 0.25rem;
  font-weight: normal;
}

.feature--magic .feature__label   { color: #9f8bc8; }
.feature--gun .feature__label     { color: #78a289; }
.feature--drawback .feature__label { color: #c06267; }
.feature--ancient .feature__label  { color: var(--color-bone); }
.feature--shitty .feature__label   { color: var(--color-muted); }

.feature__description {
  font-size: 0.9rem;
  line-height: 1.5;
}

/* --- Action Buttons --- */
.item-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.action-btn {
  padding: 0.55rem 1rem;
  border: 1px solid var(--color-border);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.015), transparent),
    var(--color-bg-2);
  color: var(--color-text);
  font-family: var(--font-main);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  border-radius: var(--radius);
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s, background 0.15s;
}

.action-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent-2);
  box-shadow:
    0 0 10px rgba(181,154,72,0.12),
    inset 0 0 10px rgba(88,65,125,0.05);
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.action-btn[hidden] {
  display: none;
}

/* --- Footer --- */
.site-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.8rem;
  color: var(--color-muted);
  line-height: 1.7;
  opacity: 0.82;
}

.site-footer a {
  color: var(--color-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-footer a:hover {
  color: var(--color-text);
}

/* --- Accessibility --- */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* --- Responsive --- */
@media (max-width: 480px) {
  body {
    padding: 0 0.75rem 3rem;
  }

  fieldset {
    padding: 1rem;
  }

  .item-actions {
    flex-direction: column;
  }

  .action-btn {
    width: 100%;
    text-align: center;
  }
}
