.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: clamp(20px, 4vw, 50px);
  align-items: start;
}

.profile-list,
.profile-form,
.map-card,
.area-card {
  border: 2px solid rgb(255 255 255 / 72%);
  background: rgb(255 253 244 / 88%);
  box-shadow: var(--shadow-soft);
}

.profile-list,
.profile-form {
  padding: clamp(18px, 3vw, 30px);
  border-radius: var(--radius-large);
}

.profile-cards {
  display: grid;
  gap: 12px;
}

.profile-card-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.profile-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 78px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 18px;
  text-align: left;
  background: white;
}

.profile-card:hover {
  border-color: var(--moss);
  transform: translateY(-1px);
}

.avatar-orb,
.avatar-choice span:first-child {
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: var(--sun);
}

.avatar-orb {
  width: 54px;
  height: 54px;
  font-size: 1.5rem;
}

.profile-meta {
  display: grid;
  gap: 3px;
}

.profile-meta small {
  color: var(--ink-soft);
}

.delete-profile {
  min-width: 48px;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  color: #7b2720;
  background: #f7e1dc;
  font-weight: 900;
}

.field-label {
  display: grid;
  gap: 8px;
  margin-bottom: 22px;
  font-weight: 900;
}

.field-label input {
  min-height: 54px;
  padding: 10px 14px;
  border: 3px solid var(--line);
  border-radius: 15px;
  background: white;
}

.avatar-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
  margin: 10px 0 24px;
  padding: 0;
  border: 0;
}

.avatar-options legend {
  margin-bottom: 10px;
  font-weight: 900;
}

.avatar-choice {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 5px;
}

.avatar-choice input {
  position: absolute;
  opacity: 0;
}

.avatar-choice span:first-of-type {
  width: 54px;
  height: 54px;
  border: 3px solid transparent;
  font-size: 1.45rem;
}

.avatar-choice input:checked + span {
  border-color: var(--moss-dark);
  box-shadow: 0 0 0 4px rgb(247 191 74 / 55%);
}

.avatar-choice input:focus-visible + span {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
}

.avatar-choice small {
  font-weight: 800;
}

.form-error {
  min-height: 24px;
  color: #8b2821;
  font-weight: 800;
}

.map-grid,
.area-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 2.3vw, 26px);
}

.map-card,
.area-card {
  position: relative;
  display: grid;
  min-height: 250px;
  padding: 22px;
  overflow: hidden;
  border-radius: var(--radius-large);
  text-align: left;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.map-card:not(:disabled):hover,
.area-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.map-card::before,
.area-card::before {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -52px;
  width: 180px;
  height: 180px;
  border: 24px solid rgb(255 255 255 / 28%);
  border-radius: 50%;
}

.map-card > *,
.area-card > * {
  position: relative;
  z-index: 1;
}

.map-card strong,
.area-card strong {
  align-self: end;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
}

.map-card p,
.area-card p {
  margin: 8px 0 0;
  font-size: 0.95rem;
}

.map-symbol,
.scene-symbol {
  font-size: clamp(2.6rem, 6vw, 4.8rem);
  line-height: 1;
}

.map-card[data-area="area_forest"] {
  color: #14372b;
  background: linear-gradient(145deg, #d5e8a8, #89bd74);
}

.map-card[data-area="area_farm"] {
  background: linear-gradient(145deg, #f8df9a, #e9aa5f);
}

.map-card[data-area="area_village"] {
  background: linear-gradient(145deg, #f4c8a8, #d99075);
}

.map-card[data-area="area_city"] {
  background: linear-gradient(145deg, #cbd8e2, #8daab8);
}

.map-card[data-area="area_school"] {
  background: linear-gradient(145deg, #d9ccec, #a792c8);
}

.map-card[data-area="area_home"] {
  background: linear-gradient(145deg, #bae1e4, #71b3b9);
}

.map-card.is-locked {
  filter: saturate(0.62);
}

.lock-label {
  justify-self: start;
}

.area-card[data-scene="scene_forest_river_home"] {
  background: linear-gradient(145deg, #bfe5df, #72b9a9);
}

.area-card[data-scene="scene_forest_rustling_path"] {
  background: linear-gradient(145deg, #dce6b0, #8db267);
}

.area-card[data-scene="scene_forest_sunny_clearing"] {
  background: linear-gradient(145deg, #f4e7a0, #aec76c);
}

.area-card[data-scene="scene_forest_secret_pond"] {
  background: linear-gradient(145deg, #b9dddb, #649fab);
}

.scene-screen {
  display: grid;
  gap: 14px;
}

.scene-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.scene-heading h1 {
  margin-bottom: 4px;
  font-size: clamp(1.6rem, 4vw, 2.8rem);
}

.scene-heading p {
  margin: 0;
  color: var(--ink-soft);
}

.scene-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 260px;
  overflow: hidden;
  border: 7px solid rgb(255 255 255 / 80%);
  border-radius: clamp(18px, 3vw, 34px);
  box-shadow: var(--shadow);
  isolation: isolate;
}

.scene-stage.has-artwork {
  background-position: center;
  background-size: cover;
}

.scene-stage.has-artwork::before,
.scene-stage.has-artwork::after {
  display: none;
}

.scene-stage::before,
.scene-stage::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  opacity: 0.5;
}

.scene-stage::before {
  top: 8%;
  right: 8%;
  width: 12%;
  aspect-ratio: 1;
  background: #ffe69c;
}

.scene-stage::after {
  right: -8%;
  bottom: -26%;
  width: 55%;
  aspect-ratio: 1.8;
  background: rgb(255 255 255 / 22%);
}

.scene-river {
  background: linear-gradient(#aadbd7 0 50%, #61aeb4 50% 72%, #7fa366 72%);
}

.scene-path {
  background: linear-gradient(#b8d5a1 0 52%, #6d955c 52% 68%, #b89565 68%);
}

.scene-clearing {
  background: linear-gradient(#c6e3b2 0 52%, #9cc56d 52% 100%);
}

.scene-pond {
  background: linear-gradient(#a8d5cc 0 48%, #63989e 48% 80%, #6e995e 80%);
}

.scene-placeholder-label {
  position: absolute;
  top: 14px;
  left: 14px;
  max-width: 62%;
  padding: 7px 10px;
  border-radius: 10px;
  color: white;
  background: rgb(22 63 54 / 78%);
  font-size: clamp(0.68rem, 1.6vw, 0.9rem);
  font-weight: 800;
}

.scene-artwork-label {
  position: absolute;
  z-index: 6;
  top: 12px;
  right: 12px;
  padding: 7px 11px;
  border: 1px solid rgb(255 255 255 / 64%);
  border-radius: 999px;
  color: white;
  background: rgb(22 49 38 / 72%);
  box-shadow: 0 3px 12px rgb(17 32 25 / 18%);
  font-size: clamp(0.68rem, 1.25vw, 0.84rem);
  font-weight: 800;
  backdrop-filter: blur(4px);
}

.benny-placeholder {
  position: absolute;
  z-index: 3;
  left: 8%;
  bottom: 12%;
  display: grid;
  width: clamp(70px, 13vw, 160px);
  aspect-ratio: 0.82;
  place-items: center;
  border: clamp(4px, 0.7vw, 8px) solid #73452e;
  border-radius: 48% 48% 42% 42%;
  color: white;
  background: #956044;
  box-shadow: 8px 10px 0 rgb(68 41 28 / 22%);
  font-size: clamp(0.65rem, 1.4vw, 1rem);
  font-weight: 900;
  text-align: center;
}

.benny-placeholder::after {
  content: "";
  position: absolute;
  right: -36%;
  bottom: 4%;
  width: 48%;
  height: 62%;
  border-radius: 48%;
  background: #624232;
  transform: rotate(22deg);
  z-index: -1;
}

.hotspot {
  position: absolute;
  z-index: 5;
  display: grid;
  min-width: 48px;
  min-height: 48px;
  place-items: center;
  padding: 7px;
  border: 3px dashed rgb(255 255 255 / 92%);
  border-radius: 18px;
  color: var(--ink);
  background: rgb(255 247 191 / 82%);
  box-shadow: 0 3px 12px rgb(34 59 51 / 22%);
  font-weight: 900;
}

.hotspot-circle {
  border-radius: 50%;
}

.hotspot-polygon {
  border-radius: 0;
}

.hotspot.is-found {
  border-style: solid;
  background: rgb(213 239 192 / 90%);
}

.hotspot.is-found::after {
  content: "✓";
  position: absolute;
  top: -12px;
  right: -10px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--moss);
}

.hotspot.is-hinting {
  animation: hint-pulse 900ms ease-in-out 2;
}

.scene-stage.has-artwork .hotspot {
  overflow: visible;
  border-color: transparent;
  color: transparent;
  background: transparent;
  box-shadow: none;
  font-size: 0;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.scene-stage.has-artwork .hotspot:hover,
.scene-stage.has-artwork .hotspot:focus-visible,
.scene-stage.has-artwork .hotspot.is-hinting {
  border-color: rgb(255 245 163 / 88%);
  background: rgb(255 224 90 / 18%);
  box-shadow: 0 0 0 7px rgb(255 214 62 / 20%), inset 0 0 28px rgb(255 238 154 / 26%);
}

.scene-stage.has-artwork .hotspot.is-found:not(:hover):not(:focus-visible):not(.is-hinting) {
  border-color: transparent;
  background: transparent;
}

.scene-stage.has-artwork .hotspot.is-found::after {
  top: 6px;
  right: 6px;
  font-size: 1rem;
}

@keyframes hint-pulse {
  50% { transform: scale(1.08); box-shadow: 0 0 0 12px rgb(247 191 74 / 30%); }
}

.scene-exits {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.scene-exit {
  min-height: 52px;
  padding: 10px 18px;
  border: 2px solid rgb(255 255 255 / 80%);
  border-radius: 16px;
  background: rgb(255 253 244 / 88%);
  box-shadow: var(--shadow-soft);
  font-weight: 900;
}

@media (max-width: 850px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .map-grid,
  .area-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 540px) {
  .map-grid,
  .area-grid {
    grid-template-columns: 1fr;
  }

  .map-card,
  .area-card {
    min-height: 190px;
  }

  .scene-stage {
    border-width: 4px;
  }

  .hotspot {
    padding: 4px;
    font-size: 0.75rem;
  }
}

@media (orientation: landscape) and (min-width: 700px) and (max-height: 900px) {
  .map-card,
  .area-card {
    min-height: clamp(150px, 24vh, 190px);
    padding: 17px;
  }

  .map-card p,
  .area-card p {
    font-size: 0.86rem;
  }

  .scene-heading h1 {
    font-size: clamp(1.5rem, 3.2vw, 2.35rem);
  }

  .scene-heading p {
    font-size: 0.9rem;
  }

  .scene-stage {
    width: min(100%, calc((100dvh - 220px) * 16 / 9));
    max-height: calc(100dvh - 220px);
    margin-inline: auto;
  }

  .scene-exit {
    min-height: 48px;
  }
}

@media (orientation: landscape) and (min-width: 900px) {
  .area-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
