/* A painted festival at dusk, with the original rigged cast composited in front. */
.title-world {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
  background: #291c3c;
  pointer-events: none;
}

.game:is([data-view="home"], [data-view="loading"]) .title-world {
  display: block;
}

.title-painting,
.title-painting img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.title-painting img {
  object-fit: cover;
  object-position: 57% center;
}

.title-world::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(90deg, #1d132eea 0%, #211631cb 27%, #21163168 47%, transparent 67%),
    linear-gradient(0deg, #21163157, transparent 26%);
  content: "";
}

.title-stage {
  position: absolute;
  z-index: 1;
  right: 4.5%;
  bottom: 15.5%;
  width: 47%;
  height: min(46dvh, 40vw);
}

.game[data-view="loading"] .title-stage {
  visibility: hidden;
}

.title-character {
  position: absolute;
  left: var(--x);
  bottom: var(--lift);
  height: var(--scale);
  transform: translateX(-50%);
}

.title-character img {
  position: relative;
  display: block;
  width: auto;
  height: 100%;
  max-width: none;
  filter: drop-shadow(1px 3px 3px #1b142a39);
}

.title-character::before {
  position: absolute;
  left: 50%;
  bottom: 2%;
  width: var(--contact);
  height: max(7px, 4%);
  transform: translateX(-50%);
  border-radius: 50%;
  background: #25173491;
  filter: blur(4px);
  content: "";
}

.character-mamma { --x: 22%; --lift: 12%; --scale: 89%; --contact: 56%; }
.character-pappa { --x: 76%; --lift: 16%; --scale: 92%; --contact: 56%; }
.character-sara { --x: 38%; --lift: 4%; --scale: 74%; --contact: 65%; }
.character-ellie { --x: 79%; --lift: 2%; --scale: 41%; --contact: 70%; }
.character-amor { --x: 57%; --lift: 0%; --scale: 58%; --contact: 67%; }

.title-bar {
  top: max(22px, env(safe-area-inset-top));
  left: max(5.5vw, env(safe-area-inset-left));
  right: max(4.2vw, env(safe-area-inset-right));
  align-items: center;
}

.title-edition {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid #ffe0aa78;
  border-radius: 30px;
  background: #2b1b3de0;
  color: #ffe6ac;
  font-weight: 950;
  font-size: .82rem;
  line-height: 1;
}

.title-edition .icon { width: 17px; height: 17px; }

.title-screen {
  z-index: 2;
  color: #fff5e4;
}

.title-panel {
  position: absolute;
  top: 50%;
  left: max(5.5vw, env(safe-area-inset-left));
  width: min(42vw, 522px);
  transform: translateY(-46%);
}

.title-intro h1 {
  margin: 0;
  font-family: Fredoka, sans-serif;
  font-weight: 650;
  letter-spacing: -.038em;
  line-height: .94;
  text-shadow: 0 .06em .12em #1b112a96;
}

.title-name {
  display: block;
  font-size: clamp(4rem, 8vw, 6rem);
  color: #fff7e5;
}

.title-subtitle {
  display: block;
  margin-top: .22em;
  color: #ffda88;
  font-size: clamp(1.9rem, 3.55vw, 3.2rem);
  line-height: 1.05;
}

.title-intro p {
  margin: 15px 0 0;
  color: #fff0e4;
  font-size: clamp(.94rem, 1.4vw, 1.12rem);
  font-weight: 800;
  line-height: 1.4;
}

.title-actions {
  display: grid;
  width: min(100%, 432px);
  gap: 9px;
  margin-top: clamp(15px, 3.2dvh, 31px);
  pointer-events: auto;
}

.title-episode {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 4px 10px;
  min-height: 54px;
  padding: 7px 10px;
  border-block-start: 1px solid #ffe4ba56;
  color: #fff5e4;
}

.title-episode-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 12px;
  background: #63464c;
  color: #ffdd99;
}

.title-episode-icon .icon { width: 19px; height: 19px; }
.title-episode #next-world {
  display: block;
  color: #ffd992;
  font-size: .7rem;
  font-weight: 950;
  line-height: 1.1;
}

.title-episode #next-title {
  display: block;
  font-size: .97rem;
  font-weight: 900;
  line-height: 1.2;
}

.title-episode #mode-summary {
  color: #f5e1ed;
  font-size: .7rem;
  font-weight: 850;
}

.title-reserve {
  grid-column: 2 / -1;
  color: #a6f1dd;
  font-size: .75rem;
  font-weight: 900;
}

.title-screen .title-play {
  width: 100%;
  min-height: 66px;
  border: 2px solid #ffebaf;
  border-radius: 22px;
  background: linear-gradient(#ffdf8c, #efb14c);
  color: #39220f;
  box-shadow: 0 6px 15px #1a102d61, inset 0 2px 0 #fff1c4;
  font-family: Fredoka, sans-serif;
  font-size: 1.83rem;
  font-weight: 650;
}

.title-screen .title-play .icon { width: 25px; height: 25px; }
.title-screen .title-play:hover { background: linear-gradient(#ffe9a8, #f9bc58); }

.title-online { display: grid; grid-template-columns: minmax(0, 1fr) max-content; gap: 7px; }
.title-online .button-online,
.title-online select {
  min-height: 48px;
  border: 1px solid #ffe1b975;
  border-radius: 14px;
  background: #312141f2;
  color: #fff3e0;
  box-shadow: none;
}

.title-online .button-online {
  gap: 8px;
  padding: 7px 11px;
  font-size: .94rem;
}

.title-online .button-online .icon { width: 21px; height: 21px; color: #fbd2a0; }
.title-online select { width: auto; min-width: 119px; padding-inline: 8px; font-size: .81rem; }
.title-online .button-online:hover,
.title-online select:hover { background: #513754; }

.title-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 6px;
}

.title-tools button {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #ffe2bb6b;
  border-radius: 14px;
  padding: 6px 7px;
  background: #31243ee8;
  color: #fff5e5;
  font-size: .86rem;
  font-weight: 950;
  line-height: 1.12;
  text-align: left;
}

.title-tools button:hover { background: #503750; }
.title-tools button .icon { width: 19px; height: 19px; color: #ffdb9d; }
.title-tools small { display: block; color: #f6dfec; font-size: .71rem; font-weight: 750; margin-top: 2px; }

.title-screen :is(button, select):focus-visible {
  outline: 3px solid #a6f1dd;
  outline-offset: 2px;
}

#game .title-screen .save-note {
  top: 79px;
  right: max(4.2vw, env(safe-area-inset-right));
  bottom: auto;
  left: auto;
  width: min(372px, calc(100% - 32px));
  transform: none;
  translate: none;
}

#game .title-screen .storage-warning {
  top: 141px;
  bottom: auto;
  translate: none;
}

.result-carry {
  margin: 10px 0 14px;
  border: 1px solid #b2dccc;
  border-radius: 14px;
  padding: 8px 12px;
  background: #effcf7;
  color: #244a3a;
  font-size: .89rem;
  font-weight: 900;
}

@media (max-aspect-ratio: 4/5) {
  .title-world::after {
    background: linear-gradient(180deg, #1f142eee 0%, #211631a1 24%, transparent 43%, transparent 65%, #23162cd9 82%, #20142bee);
  }
  .title-bar { left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right)); top: max(13px, env(safe-area-inset-top)); }
  .title-panel {
    inset: max(65px, calc(env(safe-area-inset-top) + 56px)) 0 max(13px, env(safe-area-inset-bottom));
    width: auto;
    transform: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
  }
  .title-intro { text-align: center; }
  .title-name { font-size: clamp(3.3rem, 14vw, 5.4rem); }
  .title-subtitle { font-size: clamp(1.72rem, 7.3vw, 3rem); }
  .title-intro p { margin: 8px 12px 0; font-size: clamp(.8rem, 3.6vw, 1.02rem); }
  .title-stage { width: min(96%, 610px); height: min(40dvh, 70vw); bottom: 29%; right: 50%; transform: translateX(50%); }
  .title-actions { width: min(92%, 432px); gap: 6px; margin: 0; }
  .title-episode { padding: 4px 5px; min-height: 43px; }
  .title-episode-icon { width: 30px; height: 30px; }
  .title-episode #next-title { font-size: .87rem; }
  .title-screen .title-play { min-height: 54px; font-size: 1.55rem; border-radius: 17px; }
  .title-tools button { min-height: 48px; gap: 5px; }
  .title-tools small { font-size: .71rem; }
  #game .title-screen .save-note { top: 59px; right: 16px; }
}

@media (max-aspect-ratio: 4/5) and (max-height: 700px) {
  .title-intro p { display: none; }
  .title-stage { height: min(36dvh, 59vw); bottom: max(34%, calc(219px + env(safe-area-inset-bottom))); }
  .title-name { font-size: clamp(2.6rem, 10vw, 4rem); }
  .title-subtitle { margin-top: 4px; font-size: clamp(1.48rem, 6vw, 2.4rem); }
  .title-tools button { min-height: 44px; }
}

@media (min-aspect-ratio: 4/5) and (max-height: 570px) {
  .title-bar { top: 10px; }
  .title-panel { top: 55%; width: min(48vw, 433px); }
  .title-name { font-size: clamp(2.8rem, 13dvh, 4.8rem); }
  .title-subtitle { font-size: clamp(1.4rem, 5.5dvh, 2.3rem); }
  .title-intro p { display: none; }
  .title-actions { margin-top: 10px; gap: 5px; }
  .title-episode { min-height: 35px; padding-block: 3px; }
  .title-episode-icon { width: 28px; height: 28px; }
  .title-screen .title-play { min-height: 46px; font-size: 1.35rem; }
  .title-online .button-online, .title-online select, .title-tools button { min-height: 43px; }
}

@media (min-aspect-ratio: 4/5) and (max-height: 385px) {
  .title-panel { top: auto; bottom: 8px; transform: none; }
  .title-name { font-size: 2.4rem; }
  .title-subtitle { font-size: 1.4rem; }
  .title-actions { margin-top: 5px; }
  .title-episode-icon { display: none; }
  .title-episode { grid-template-columns: 1fr auto; }
  .title-reserve { grid-column: 1 / -1; }
}

/* 2.0: familjen står levande på scenen. Bilderna av de äldre figurerna ligger kvar under tills 3D-ytan har ritat. */
.game .title-stage .title-cast { position: absolute; inset: auto; left: -12%; top: -34%; width: 124%; height: 141%; pointer-events: none; opacity: 0; transition: opacity .35s ease-out; }
.game .title-stage .title-cast[data-ready="true"] { opacity: 1; }
.title-stage:has(.title-cast[data-ready="true"]) .title-character { visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .title-cast { transition: none; } }
