/* ============================================================================
   GRIMGOR: BLUT & DONNER - Dark-Fantasy ARPG Stylesheet
   ============================================================================ */

:root {
  --bg-obsidian: #0a080c;
  --panel-iron: rgba(18, 14, 19, 0.92);
  --border-bronze: #8c6d3b;
  --border-gold: #d4a84f;
  --blood-crimson: #b81814;
  --blood-bright: #ff3b1f;
  --rage-amber: #ff881a;
  --text-bone: #ede2d0;
  --text-muted: #a89987;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-obsidian);
  color: var(--text-bone);
  font-family: 'Rajdhani', 'Segoe UI', sans-serif;
}

#game-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: crosshair;
}

.hidden {
  display: none !important;
}

/* ============================================================================
   IN-GAME HUD LAYER
   ============================================================================ */
#hud-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 24px 18px;
  z-index: 10;
}

.hud-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.hud-stat-plaque {
  pointer-events: auto;
  background: linear-gradient(180deg, rgba(28, 21, 26, 0.94), rgba(12, 9, 13, 0.94));
  border: 2px solid var(--border-bronze);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.8), inset 0 0 14px rgba(180, 30, 20, 0.18);
  padding: 8px 18px;
  min-width: 165px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.plaque-label {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--text-muted);
  font-weight: 700;
}

.plaque-value {
  font-family: 'Cinzel', serif;
  font-size: 21px;
  font-weight: 900;
  color: #f7e6c4;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95);
}

.plaque-sub {
  font-size: 13px;
  font-weight: 700;
  color: #ff6b4a;
  letter-spacing: 1px;
}

.plaque-record {
  font-size: 11px;
  font-weight: 700;
  color: #e0b354;
  letter-spacing: 0.8px;
}

.plaque-record.new-record {
  color: #ffe866;
  text-shadow: 0 0 8px rgba(255, 200, 30, 0.85);
}

.hud-right-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.audio-btn {
  margin-top: 4px;
  background: #241a1d;
  color: var(--text-bone);
  border: 1px solid var(--border-bronze);
  font-family: 'Rajdhani', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.audio-btn:hover {
  border-color: var(--border-gold);
  background: #3b2422;
}

/* Schlächter-Kombo-Anzeige */
.hud-combo-box {
  background: radial-gradient(circle, rgba(145, 18, 12, 0.9), rgba(28, 8, 8, 0.92));
  border: 2px solid #ff5522;
  padding: 6px 16px;
  text-align: center;
  transform: scale(0.85);
  opacity: 0;
  transition: all 0.18s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  box-shadow: 0 0 22px rgba(255, 60, 20, 0.45);
}

.hud-combo-box.active {
  transform: scale(1);
  opacity: 1;
}

.combo-number {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 26px;
  font-weight: 900;
  color: #ffe066;
  line-height: 1;
}

.combo-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #ffccb3;
}

/* Boss-Lebensleiste oben */
.boss-hud {
  flex: 1;
  max-width: 620px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(14, 9, 12, 0.94);
  border: 2px solid #c93b22;
  padding: 8px 16px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.85), 0 0 25px rgba(200, 30, 15, 0.35);
}

.boss-portrait-img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border: 2px solid var(--border-gold);
  box-shadow: 0 0 12px rgba(255, 60, 20, 0.55);
  flex-shrink: 0;
}

.boss-hud-main {
  flex: 1;
}

.boss-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

#boss-hud-name {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  font-weight: 900;
  color: #ff5533;
  letter-spacing: 1.5px;
}

#boss-hud-title {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.boss-bar-frame {
  width: 100%;
  height: 14px;
  background: #090608;
  border: 1px solid #6e2b22;
  overflow: hidden;
}

.boss-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #7a0909, #e02819, #ff7722);
  transition: width 0.12s ease-out;
}

/* Dramatisches Wellen-Banner */
.wave-banner {
  position: fixed;
  top: 96px;
  left: 50%;
  text-align: center;
  background: linear-gradient(90deg, rgba(0,0,0,0), rgba(20, 10, 12, 0.92) 20%, rgba(20, 10, 12, 0.92) 80%, rgba(0,0,0,0));
  padding: 12px 58px;
  opacity: 0;
  transform: translate(-50%, -14px) scale(0.96);
  transition: all 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.wave-banner.visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.wave-banner-ornament {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--border-gold), transparent);
  margin: 6px 0;
}

#wave-banner-title {
  font-family: 'Cinzel', serif;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 3px;
  color: #f7dfc0;
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.95), 0 0 18px rgba(220, 45, 20, 0.6);
}

.wave-banner.boss-wave #wave-banner-title {
  color: #ff5522;
  text-shadow: 0 0 24px rgba(255, 60, 10, 0.9);
}

#wave-banner-sub {
  font-size: 16px;
  color: #d4c0ab;
  letter-spacing: 1px;
}

/* ============================================================================
   UNTERES KOMMANDO-DOCK (Lebenskraft, Blutwut & 4 Canvas-Skill-Icons)
   ============================================================================ */
.hud-bottom-dock {
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.hud-command-frame {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 22px;
  background: linear-gradient(180deg, rgba(27, 21, 26, 0.96), rgba(11, 8, 12, 0.98));
  border: 2px solid var(--border-bronze);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.92), inset 0 1px 0 rgba(255, 225, 180, 0.18);
  padding: 12px 22px;
}

/* Higgsfield AI Kriegsherr-Medaillon im HUD */
.hud-portrait-frame {
  width: 78px;
  height: 78px;
  border: 2px solid var(--border-gold);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.9), inset 0 0 12px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.hud-portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hud-portrait-frame.berserk {
  border-color: #ff4411;
  box-shadow: 0 0 22px rgba(255, 65, 15, 0.95);
}

/* Linkes Vital-Panel */
.hud-vitals-panel {
  width: 255px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.vital-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hero-name {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 1.2px;
  color: #f0dec2;
}

.rage-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  letter-spacing: 1px;
  background: #21181c;
  border: 1px solid #4d3b3f;
  color: var(--text-muted);
}

.rage-badge.ready {
  background: #4d220c;
  border-color: #ff8822;
  color: #ffcc66;
}

.rage-badge.active-berserk {
  background: #801108;
  border-color: #ffdd44;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(255, 60, 10, 0.8);
}

.vital-bar-outer {
  position: relative;
  height: 22px;
  background: #090608;
  border: 1px solid #4f3d36;
  overflow: hidden;
}

.vital-bar-fill {
  height: 100%;
  transition: width 0.1s ease-out;
}

.hp-fill {
  background: linear-gradient(90deg, #590707, #b81414, #e62e1f);
  box-shadow: inset 0 2px 4px rgba(255, 180, 160, 0.25);
}

.rage-fill {
  background: linear-gradient(90deg, #7a2806, #d95b12, #ffaa22);
  box-shadow: inset 0 2px 4px rgba(255, 240, 150, 0.35);
}

.vital-bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #fff6eb;
  text-shadow: 0 1px 4px #000000;
}

/* Prozedurale Canvas-Skill-Bar */
.hud-skill-bar {
  display: flex;
  gap: 16px;
}

.skill-slot {
  position: relative;
  width: 98px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.12s ease;
}

.skill-slot:hover {
  transform: translateY(-3px);
}

.skill-icon-canvas {
  width: 72px;
  height: 72px;
  display: block;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.85);
}

.skill-slot.empowered .skill-icon-canvas {
  box-shadow: 0 0 18px rgba(255, 135, 30, 0.85);
}

.skill-key-badge {
  position: absolute;
  top: -6px;
  right: 9px;
  background: #171115;
  border: 1px solid var(--border-gold);
  color: #ffe3b3;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 5px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
}

.skill-name-label {
  margin-top: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #dfd0be;
  text-align: center;
  line-height: 1.15;
}

/* Rechte Steuerungs-Legende */
.hud-controls-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 1px solid rgba(140, 109, 59, 0.35);
  padding-left: 18px;
  min-width: 175px;
}

.legend-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  gap: 10px;
}

.legend-row strong {
  color: #f0c878;
  font-weight: 700;
}

.legend-row span {
  color: var(--text-muted);
}

/* Fähigkeits-Tooltip */
.skill-tooltip {
  position: fixed;
  bottom: 132px;
  width: 320px;
  background: rgba(14, 10, 14, 0.97);
  border: 2px solid var(--border-gold);
  padding: 12px 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.95);
  z-index: 30;
}

.tt-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3px;
}

.tt-title {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  font-weight: 900;
  color: #ffcc66;
}

.tt-cooldown {
  font-size: 12px;
  color: #ff8855;
  font-weight: 700;
}

.tt-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 7px;
  font-weight: 600;
}

.tt-desc {
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--text-bone);
}

/* ============================================================================
   MODALS: TITELBILDSCHIRM, BLUTALTAR, SIEG & NIEDERLAGE
   ============================================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle, rgba(18, 8, 10, 0.78), rgba(4, 2, 5, 0.94));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.title-modal,
.blessing-dialog,
.result-dialog {
  background: linear-gradient(180deg, rgba(28, 20, 25, 0.97), rgba(11, 8, 12, 0.99));
  border: 2px solid var(--border-gold);
  box-shadow: 0 20px 65px rgba(0, 0, 0, 0.95), 0 0 40px rgba(180, 30, 15, 0.28);
  padding: 22px 32px;
  max-width: 900px;
  width: 100%;
  text-align: center;
}

.title-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #ff9944;
  background: rgba(90, 22, 12, 0.65);
  border: 1px solid #9e4724;
  padding: 3px 12px;
  margin-bottom: 6px;
}

.main-game-title {
  font-family: 'Cinzel', serif;
  font-size: 44px;
  font-weight: 900;
  letter-spacing: 5px;
  color: #f7e6c4;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.95), 0 0 26px rgba(220, 40, 15, 0.65);
  line-height: 1.02;
  margin-bottom: 14px;
}

.main-game-title span {
  display: block;
  font-size: 20px;
  letter-spacing: 8px;
  color: #ff4d22;
  margin-top: 4px;
}

.title-hero-showcase {
  display: flex;
  align-items: center;
  gap: 20px;
  text-align: left;
  background: rgba(10, 7, 10, 0.78);
  border: 1px solid rgba(140, 109, 59, 0.45);
  padding: 14px 18px;
  margin-bottom: 14px;
}

.title-visual-pair {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  align-items: center;
}

.title-higgsfield-portrait {
  width: 146px;
  height: 146px;
  object-fit: cover;
  border: 2px solid var(--border-gold);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.9);
}

#title-hero-preview {
  flex-shrink: 0;
  width: 146px;
  height: 146px;
  background: radial-gradient(circle, rgba(50, 16, 14, 0.6), rgba(10, 7, 10, 0.9));
  border: 1px solid var(--border-bronze);
}

.lore-quote {
  font-style: italic;
  font-size: 15.5px;
  line-height: 1.48;
  color: #dfd0be;
  margin-bottom: 14px;
}

.lore-features {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.feature-pill {
  font-size: 13.5px;
  color: #cbb8a3;
  background: rgba(32, 22, 26, 0.8);
  border-left: 3px solid #ff5522;
  padding: 5px 10px;
}

.grim-btn {
  font-family: 'Cinzel', serif;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff3db;
  background: linear-gradient(180deg, #8c1d14, #4d0c08);
  border: 2px solid var(--border-gold);
  padding: 13px 34px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.85), 0 0 18px rgba(220, 45, 20, 0.45);
  transition: all 0.16s ease;
}

.grim-btn:hover {
  transform: translateY(-2px);
  background: linear-gradient(180deg, #b5261b, #69110b);
  box-shadow: 0 8px 26px rgba(255, 70, 25, 0.65);
}

/* Blutaltar-Segnungskarten */
.blessing-dialog h2,
.result-dialog h2 {
  font-family: 'Cinzel', serif;
  font-size: 32px;
  color: #f7dfc0;
  margin-bottom: 8px;
}

.blessing-intro {
  color: var(--text-muted);
  font-size: 16px;
  margin-bottom: 22px;
}

.blessing-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.blessing-card {
  background: linear-gradient(180deg, rgba(36, 24, 29, 0.95), rgba(15, 10, 14, 0.98));
  border: 2px solid var(--border-bronze);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.blessing-card:hover {
  transform: translateY(-5px);
  border-color: #ffaa33;
  box-shadow: 0 10px 28px rgba(255, 80, 20, 0.35);
}

.blessing-card h3 {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  color: #ffe0a3;
}

.blessing-rank {
  font-size: 11px;
  background: #6e1c14;
  color: #ffcc66;
  padding: 1px 6px;
  border-radius: 2px;
}

.blessing-sub {
  font-size: 13px;
  font-weight: 700;
  color: #ff7733;
}

.blessing-card p {
  font-size: 13.5px;
  color: #cfc0b0;
  line-height: 1.38;
  flex: 1;
  margin-bottom: 8px;
}

.blessing-select-btn {
  width: 100%;
  font-size: 13px;
  padding: 8px 12px;
}

.result-stats {
  font-size: 18px;
  line-height: 1.7;
  color: #e3d3c1;
  margin: 18px 0 26px;
}

.victory-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* ============================================================================
   ONLINE-RUHMESHALLE (LEADERBOARD & KRIEGSHERR-NAME)
   ============================================================================ */
.title-online-grid {
  display: grid;
  grid-template-columns: 295px 1fr;
  gap: 16px;
  align-items: stretch;
  text-align: left;
}

.warlord-name-panel {
  background: rgba(12, 8, 12, 0.85);
  border: 1px solid rgba(140, 109, 59, 0.55);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.warlord-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #e0b870;
}

.warlord-input {
  user-select: text;
  width: 100%;
  background: #080508;
  border: 1.5px solid var(--border-bronze);
  color: #fff3db;
  font-family: 'Cinzel', serif;
  font-size: 16px;
  font-weight: 700;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s ease;
}

.warlord-input:focus {
  border-color: var(--border-gold);
  box-shadow: 0 0 12px rgba(212, 168, 79, 0.35);
}

.warlord-input.compact {
  max-width: 240px;
  font-size: 14px;
  padding: 7px 10px;
}

.full-width-btn {
  width: 100%;
  padding: 12px 16px;
  font-size: 15.5px;
}

.compact-btn {
  font-size: 13px;
  padding: 8px 16px;
}

.leaderboard-panel {
  background: rgba(10, 7, 10, 0.88);
  border: 1px solid rgba(212, 168, 79, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.result-leaderboard {
  margin: 12px 0 18px;
  text-align: left;
}

.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(90deg, rgba(90, 20, 14, 0.75), rgba(28, 16, 20, 0.85));
  border-bottom: 1px solid rgba(212, 168, 79, 0.4);
  padding: 6px 12px;
  font-family: 'Cinzel', serif;
  font-size: 12.5px;
  font-weight: 900;
  color: #ffe0a3;
  letter-spacing: 1px;
}

.hs-refresh-btn {
  background: #221619;
  color: #f0c878;
  border: 1px solid var(--border-bronze);
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  cursor: pointer;
}

.hs-refresh-btn:hover {
  border-color: var(--border-gold);
  background: #38201e;
}

.hs-rank-pill {
  font-family: 'Rajdhani', sans-serif;
  font-size: 11.5px;
  background: #59160e;
  border: 1px solid #ff8833;
  color: #ffdd88;
  padding: 1px 8px;
}

.leaderboard-scroll {
  max-height: 158px;
  overflow-y: auto;
}

.hs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.hs-table th {
  position: sticky;
  top: 0;
  background: #140e13;
  color: var(--text-muted);
  font-size: 10.5px;
  letter-spacing: 1px;
  padding: 4px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(140, 109, 59, 0.25);
}

.hs-table th:last-child,
.hs-table td:last-child {
  text-align: right;
}

.hs-table td {
  padding: 4px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #dfd0be;
}

.hs-row.hs-top1 td {
  color: #ffe484;
  font-weight: 700;
}

.hs-row.hs-current {
  background: rgba(185, 35, 20, 0.32);
}

.hs-row.hs-current td {
  color: #ffffff;
  font-weight: 700;
}

.hs-score {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  color: #f7dfc0;
}

.hs-vic-tag {
  font-size: 10px;
  background: rgba(212, 168, 79, 0.22);
  border: 1px solid #d4a84f;
  color: #ffe082;
  padding: 0 4px;
  margin-left: 4px;
}

.hs-empty {
  text-align: center !important;
  color: var(--text-muted);
  padding: 16px !important;
}

.hs-submit-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
