/* Fateweld Visual Direction UI v1 — Home proof.
   World art, Character layers and controls stay independent; gameplay owners
   remain unchanged. */
:root {
  --fw-charcoal: #090b0a;
  --fw-iron: #747c74;
  --fw-stone: #191d19;
  --fw-bronze: #b98a3d;
  --fw-gold: #e4bd67;
  --fw-fire: #bb6332;
  --fw-healer: #6f9f78;
  --fw-world-line: rgb(196 154 74 / 28%);
  --fw-interface-scrim: rgb(7 10 8 / 86%);
}

.home-identity-shell {
  isolation: isolate;
  grid-template-columns: minmax(520px, .98fr) minmax(430px, 1.02fr);
  border-color: rgb(185 138 61 / 46%);
  background: var(--fw-charcoal);
  box-shadow: 0 26px 72px rgb(0 0 0 / 48%), inset 0 1px 0 rgb(255 255 255 / 4%);
}

.home-identity-shell::before {
  z-index: -2;
  opacity: .78;
  background-image: url("/assets/world/common_district_home_backdrop_v1.webp");
  background-position: center;
  background-size: cover;
  filter: saturate(.82) contrast(1.06) brightness(.72);
}

.home-identity-shell::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgb(5 8 6 / 98%) 0%, rgb(7 10 8 / 93%) 42%, rgb(7 9 8 / 28%) 68%, rgb(5 7 6 / 58%) 100%),
    linear-gradient(0deg, rgb(3 5 4 / 84%), transparent 35% 78%, rgb(4 6 5 / 52%));
}

.home-identity-content {
  border-right: 1px solid rgb(196 154 74 / 17%);
  background: linear-gradient(90deg, rgb(8 11 9 / 42%), transparent);
}

.home-identity-heading {
  padding-bottom: 10px;
  border-bottom: 1px solid rgb(196 154 74 / 18%);
}

.home-identity-heading h2 {
  color: #f7f0df;
  letter-spacing: -.035em;
  text-shadow: 0 3px 18px rgb(0 0 0 / 72%);
}

.home-kicker {
  color: var(--fw-gold);
}

.home-vital-card,
.home-resource {
  border-color: rgb(183 175 151 / 17%);
  background: linear-gradient(120deg, rgb(5 8 6 / 78%), rgb(18 22 18 / 56%));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 2.5%);
}

.home-vital-card {
  border-radius: 7px;
}

.home-resource {
  position: relative;
  border: 0;
  border-left: 2px solid rgb(185 138 61 / 44%);
  border-radius: 2px 7px 7px 2px;
}

.home-resource strong {
  font-size: 15px;
}

.home-history-disclosure {
  min-width: 0;
  border: 1px solid rgb(196 154 74 / 18%);
  border-radius: 8px;
  background: rgb(6 9 7 / 63%);
}

.home-history-disclosure > summary {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  cursor: pointer;
  list-style: none;
}

.home-history-disclosure > summary::-webkit-details-marker {
  display: none;
}

.home-history-disclosure > summary > span:first-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.home-history-disclosure > summary strong {
  color: var(--fw-gold);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.home-history-disclosure > summary small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-history-disclosure > summary::after {
  content: "+";
  flex: 0 0 auto;
  color: var(--fw-gold);
  font-size: 18px;
}

.home-history-disclosure[open] > summary::after {
  content: "−";
}

.home-history-disclosure > summary .home-record-badge {
  margin-left: auto;
}

.home-history-disclosure .home-combat-record {
  margin: 0 10px 10px;
  border-radius: 5px;
  background: rgb(4 7 5 / 68%);
}

.home-history-disclosure .home-record-heading {
  display: none;
}

.team-combat-entry {
  position: relative;
  isolation: isolate;
  min-height: 126px;
  overflow: hidden;
  border-color: rgb(228 189 103 / 52%);
  border-radius: 9px;
  background: transparent;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 28%), 0 12px 28px rgb(0 0 0 / 22%);
}

.team-combat-entry::before,
.team-combat-entry::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.team-combat-entry::before {
  z-index: -2;
  background-image: url("/assets/world/common_district_home_backdrop_v1.webp");
  background-position: 27% 31%;
  background-size: 150%;
  filter: saturate(.82) brightness(.58) contrast(1.12);
}

.team-combat-entry::after {
  z-index: -1;
  background: linear-gradient(90deg, rgb(7 9 7 / 96%), rgb(10 12 9 / 78%) 55%, rgb(46 28 13 / 48%));
}

.team-combat-entry > div:first-child {
  align-self: stretch;
  align-content: center;
  padding-right: 12px;
  border-right: 1px solid rgb(228 189 103 / 22%);
}

.team-combat-entry > div:first-child > strong {
  color: #f2e2bd;
  font-size: 19px;
}

.team-combat-entry-actions {
  flex: 1 1 58%;
}

.team-combat-entry #arenaActor3x3EntryMode {
  border-color: rgb(228 189 103 / 34%);
  background: linear-gradient(145deg, rgb(98 62 24 / 28%), rgb(8 10 8 / 58%));
}

.team-combat-entry #arenaActor3x3EntryButton.primary {
  border-color: #d9ad58;
  background: linear-gradient(180deg, #b88332, #70471d);
  color: #fff4d4;
  box-shadow: 0 5px 18px rgb(99 53 18 / 38%), inset 0 1px 0 rgb(255 240 191 / 26%);
}

.home-battle-prep,
.home-chat-discovery {
  padding: 10px 11px;
  border: 1px solid rgb(169 166 145 / 13%);
  border-radius: 7px;
  background: rgb(5 8 6 / 57%);
}

.home-battle-prep {
  align-items: center;
}

.home-chat-discovery {
  background: linear-gradient(110deg, rgb(70 49 22 / 20%), transparent 46%), rgb(5 8 6 / 62%);
}

.home-route-grid button {
  position: relative;
  isolation: isolate;
  min-height: 54px;
  overflow: hidden;
  border-color: rgb(185 138 61 / 25%);
  border-radius: 7px;
  background: rgb(7 10 8 / 82%);
}

.home-route-grid button::before,
.home-route-grid button::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.home-route-grid button::before {
  z-index: -2;
  opacity: .23;
  background-image: url("/assets/world/common_district_home_backdrop_v1.webp");
  background-size: 390%;
  filter: saturate(.72) contrast(1.15);
  transition: opacity 150ms ease, transform 180ms ease;
}

.home-route-grid button::after {
  z-index: -1;
  background: linear-gradient(90deg, rgb(5 8 6 / 96%), rgb(7 9 7 / 64%));
}

.home-route-grid button[data-home-destination="growth"]::before { background-position: 52% 70%; }
.home-route-grid button[data-home-destination="gear"]::before { background-position: 96% 72%; }
.home-route-grid button[data-home-destination="world"]::before { background-position: 46% 28%; }

.home-route-grid button:hover::before,
.home-route-grid button:focus-visible::before {
  opacity: .42;
  transform: scale(1.035);
}

.home-character-stage {
  min-height: 540px;
  border-left: 0;
  background:
    radial-gradient(ellipse at 58% 54%, rgb(221 173 82 / 13%), transparent 37%),
    linear-gradient(90deg, rgb(6 8 7 / 48%), transparent 28%);
}

.home-character-stage::after {
  bottom: 30px;
  width: 72%;
  height: 48px;
  background: radial-gradient(ellipse, rgb(0 0 0 / 84%), transparent 68%);
}

.home-character-aura {
  display: none;
}

.home-character-appearance[data-mode="fallback"] .home-character-art {
  width: min(100%, 600px);
  height: 100%;
  bottom: 0;
  object-fit: contain;
  object-position: 50% 100%;
  -webkit-mask-image: radial-gradient(ellipse 58% 72% at 50% 50%, #000 53%, transparent 89%);
  mask-image: radial-gradient(ellipse 58% 72% at 50% 50%, #000 53%, transparent 89%);
  filter: saturate(.82) contrast(1.08) brightness(.94) drop-shadow(0 20px 16px rgb(0 0 0 / 76%));
}

.home-character-appearance[data-mode="modular"] .home-character-base,
.home-character-appearance[data-mode="modular"] .home-character-attachment {
  width: min(108%, 520px);
  height: 560px;
}

.home-world-anchor {
  position: absolute;
  z-index: 5;
  top: 16px;
  right: 16px;
  display: grid;
  justify-items: end;
  gap: 2px;
  padding: 9px 10px 9px 14px;
  border-right: 2px solid var(--fw-gold);
  background: linear-gradient(90deg, transparent, rgb(5 7 6 / 78%));
  text-align: right;
}

.home-world-anchor span {
  color: #cbbda6;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.home-world-anchor strong {
  color: #f2e3c4;
  font-size: 16px;
}

.home-world-anchor button {
  min-height: 34px;
  margin-top: 4px;
  padding: 5px 12px;
  border-color: rgb(228 189 103 / 42%);
  background: rgb(8 10 8 / 74%);
  color: var(--fw-gold);
}

.home-character-caption {
  z-index: 6;
  border-color: rgb(228 189 103 / 31%);
  background: rgb(6 8 7 / 76%);
  backdrop-filter: blur(3px);
}

@media (max-width: 1100px) and (min-width: 701px) {
  .home-identity-shell {
    grid-template-columns: minmax(490px, 1.08fr) minmax(330px, .82fr);
  }

  .home-world-anchor {
    right: 10px;
  }
}

@media (max-width: 700px) {
  .home-identity-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-identity-shell::before {
    background-image: url("/assets/world/common_district_home_backdrop_mobile_v1.webp");
    background-position: center bottom;
  }

  .home-identity-shell::after {
    background:
      linear-gradient(180deg, rgb(5 8 6 / 98%) 0%, rgb(6 9 7 / 92%) 58%, rgb(5 7 6 / 38%) 78%, rgb(3 5 4 / 74%) 100%);
  }

  .home-identity-content {
    grid-row: 2;
    border-right: 0;
    background: linear-gradient(180deg, rgb(6 9 7 / 36%), transparent);
  }

  .home-character-stage {
    grid-row: 1;
    min-height: clamp(440px, 120vw, 520px);
    max-height: clamp(440px, 120vw, 520px);
    border-bottom: 1px solid rgb(196 154 74 / 25%);
    border-top-color: rgb(196 154 74 / 25%);
    background:
      linear-gradient(180deg, rgb(5 8 6 / 38%), rgb(5 8 6 / 10%) 54%, rgb(3 5 4 / 56%)),
      url("/assets/world/common_district_home_backdrop_mobile_v1.webp") center bottom / cover no-repeat;
  }

  .home-character-appearance[data-mode="fallback"] .home-character-art {
    bottom: 8px;
    width: calc(100% - 24px);
    height: calc(100% - 20px);
    object-fit: contain;
    object-position: 50% 100%;
    -webkit-mask-image: radial-gradient(ellipse 82% 96% at 50% 50%, #000 72%, transparent 100%);
    mask-image: radial-gradient(ellipse 82% 96% at 50% 50%, #000 72%, transparent 100%);
  }

  .home-character-appearance[data-mode="modular"] .home-character-base,
  .home-character-appearance[data-mode="modular"] .home-character-attachment {
    bottom: 8px;
    width: calc(100% - 24px);
    height: calc(100% - 20px);
  }

  .home-world-anchor {
    top: 10px;
    right: 10px;
    max-width: 38%;
    padding-left: 8px;
  }

  .home-world-anchor button {
    min-width: 72px;
    min-height: 44px;
  }

  .home-character-caption {
    top: 10px;
    right: auto;
    bottom: auto;
    left: 10px;
    max-width: 38%;
  }

  .home-history-disclosure > summary {
    min-height: 50px;
  }

  .home-history-disclosure > summary .home-record-badge {
    display: none;
  }

  .team-combat-entry {
    min-height: 0;
  }

  .team-combat-entry::before {
    background-image: url("/assets/world/common_district_home_backdrop_mobile_v1.webp");
    background-size: cover;
  }

  .team-combat-entry > div:first-child {
    padding: 0 0 10px;
    border-right: 0;
    border-bottom: 1px solid rgb(228 189 103 / 22%);
  }

  .home-route-grid button::before {
    background-image: url("/assets/world/common_district_home_backdrop_mobile_v1.webp");
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-route-grid button::before {
    transition: none;
  }
}
