/* =========================
   CHARACTER WINDOW
========================= */

.character-container {
  width: 860px;
  min-height: 860px;
  max-height: 1080px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 16px;
  position: absolute;
  background: var(--ui-bg-panel);
  border: 2px solid var(--ui-border-strong);
  box-shadow: var(--ui-shadow);
}

.character-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.character-hero {
  gap: 16px;
  padding: 16px 18px;
  background:
    radial-gradient(circle at left center, rgba(147, 188, 208, 0.14), transparent 46%),
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(0,0,0,0.12));
}

.character-hero-icon-wrap {
  width: 62px;
  height: 62px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(170, 202, 216, 0.16), rgba(55, 78, 96, 0.22));
  border: 1px solid rgba(170, 202, 216, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.12),
    0 10px 26px rgba(0,0,0,0.24);
}

.character-hero-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.char-close {
  margin-left: auto;
  align-self: flex-start;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.character-body {
  flex: 1;
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow: hidden;
}

.character-overview-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.02));
}

.character-main-row {
  display: flex;
  gap: 24px;
  align-items: stretch;
  min-height: 380px;
}

.left-column {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.character-panel-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.character-portrait-card {
  flex: 0 0 auto;
}

.character-portrait {
  width: 100%;
  height: 220px;
  align-self: center;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(145deg, rgba(46,45,33,0.88), rgba(23,23,15,0.94));
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 12px;
}

.equipment-area {
  flex: 1;
}

.equipment-grid {
  display: flex;
  justify-content: center;
  padding: 6px 10px 2px;
}

.equip-layout {
  display: grid;
  grid-template-columns: 84px 84px 84px;
  grid-template-rows: repeat(5, 84px);
  gap: 10px;
}

.slot.head       { grid-column: 2; grid-row: 1; }
.slot.amulet     { grid-column: 2; grid-row: 2; }
.slot.chest      { grid-column: 2; grid-row: 3; }
.slot.back       { grid-column: 1; grid-row: 2; }
.slot.hands      { grid-column: 1; grid-row: 4; }
.slot.legs       { grid-column: 2; grid-row: 4; }
.slot.feet       { grid-column: 2; grid-row: 5; }
.slot.ring1      { grid-column: 3; grid-row: 5; }
.slot.ring2      { grid-column: 1; grid-row: 5; }
.slot.weaponMain { grid-column: 1; grid-row: 3; }
.slot.weaponOff  { grid-column: 3; grid-row: 3; }

.equip-slot {
  width: 80px;
  height: 80px;
  position: relative;
  transition: transform 0.12s ease;
}

.equip-slot:hover {
  transform: translateY(-2px);
}

.equip-slot img.slot-bg,
.tool-slot img.slot-bg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.equip-slot img.item-icon,
.tool-slot img.item-icon {
  position: absolute;
  top: 18%;
  left: 18%;
  width: 64%;
  height: 64%;
  object-fit: contain;
}

.tools-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 60px);
  grid-template-rows: repeat(2, 60px);
  gap: 10px;
  justify-content: center;
}

.tool-slot {
  width: 60px;
  height: 60px;
  position: relative;
}

.stats-full-width {
  flex: 1;
}

.stats-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 16px;
  justify-content: space-between;
  align-items: stretch;
}

.stats-grid > div {
  flex: 1;
  min-width: 0;
  background: rgba(35,35,30,0.48);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.28);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 140px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
}

.stat-value {
  font-weight: 500;
  color: var(--ui-accent-soft);
}

.equip-slot.filled img.slot-bg,
.tool-slot.filled img.slot-bg {
  filter: brightness(0.45) saturate(0.2);
  opacity: 0.85;
}

.equip-slot.filled img.item-icon,
.tool-slot.filled img.item-icon {
  filter: var(--item-extra-filter, none) drop-shadow(0 0 6px rgba(0,0,0,0.7));
}

@media (max-width: 768px) {
  .character-container {
    width: 100%;
    min-height: 0;
    max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    border-radius: 22px;
    position: relative;
  }

  .character-hero {
    padding: 14px;
    gap: 12px;
  }

  .character-hero-icon-wrap {
    width: 54px;
    height: 54px;
    border-radius: 16px;
  }

  .character-hero-icon {
    width: 30px;
    height: 30px;
  }

  .character-body {
    padding: 12px 12px 18px;
    gap: 14px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .character-main-row {
    flex-direction: column;
    gap: 16px;
    min-height: 0;
  }

  .left-column {
    width: 100%;
  }

  .character-portrait {
    height: 176px;
  }

  .equipment-grid {
    overflow-x: auto;
    padding: 0 0 6px;
    justify-content: flex-start;
  }

  .equip-layout {
    grid-template-columns: repeat(3, 74px);
    grid-template-rows: repeat(5, 74px);
    gap: 8px;
    margin: 0 auto;
  }

  .equip-slot {
    width: 74px;
    height: 74px;
  }

  .tools-grid {
    grid-template-columns: repeat(3, 56px);
    grid-template-rows: repeat(2, 56px);
    justify-content: flex-start;
  }

  .tool-slot {
    width: 56px;
    height: 56px;
  }

  .stats-grid {
    flex-direction: column;
    gap: 12px;
  }
}


@media (max-height: 1100px), (max-width: 1920px) and (max-height: 1080px) {
  .character-container {
    width: 800px;
    min-height: 760px;
    max-height: 940px;
  }

  .character-hero {
    padding: 12px 16px;
    gap: 12px;
  }

  .character-hero-icon-wrap {
    width: 54px;
    height: 54px;
    border-radius: 16px;
  }

  .character-hero-icon {
    width: 30px;
    height: 30px;
  }

  .character-body {
    padding: 12px 16px 16px;
    gap: 14px;
  }

  .character-main-row {
    gap: 16px;
    min-height: 340px;
  }

  .left-column {
    width: 195px;
    gap: 14px;
  }

  .character-panel-card,
  .character-overview-card,
  .stats-full-width {
    gap: 10px;
  }

  .character-panel-card h3,
  .character-overview-card h3,
  .stats-full-width h3 {
    margin: 0;
    font-size: 13px;
  }

  .character-portrait {
    height: 170px;
  }

  /* OVERVIEW oben deutlich kompakter */
  .character-overview-card {
    padding: 12px 14px;
  }

  .character-overview-card h3 {
    margin-bottom: 8px;
  }

  .view-overview-grid {
    gap: 10px;
  }

  .view-stat-pill {
    min-height: 58px;
    padding: 8px 12px;
    border-radius: 14px;
  }

  .view-stat-label {
    font-size: 11px;
    letter-spacing: 0.08em;
  }

  .view-stat-pill strong {
    font-size: 18px;
    line-height: 1.1;
  }

  /* Equipment etwas kleiner, aber nicht kaputt-komprimiert */
  .equipment-grid {
    padding: 2px 6px 0;
  }

  .equip-layout {
    grid-template-columns: 64px 64px 64px;
    grid-template-rows: repeat(5, 64px);
    gap: 8px;
  }

  .equip-slot {
    width: 64px;
    height: 64px;
  }

  .tools-grid {
    grid-template-columns: repeat(3, 54px);
    grid-template-rows: repeat(2, 54px);
    gap: 8px;
  }

  .tool-slot {
    width: 54px;
    height: 54px;
  }

  .stats-grid {
    gap: 12px;
  }

  .stats-grid > div {
    min-height: 122px;
    padding: 12px 14px;
    gap: 8px;
  }

  .stat-row {
    font-size: 14px;
  }
}
