#home { isolation: isolate; overflow: hidden; color: #ffe5ac; }
#home .brand {
  position: absolute;
  isolation: isolate;
  left: max(3.4%, env(safe-area-inset-left));
  top: max(10.9%, 53px);
  width: min(45.7vw, 87vh, 59rem);
  text-align: center;
  color: #ffdfa3;
  text-shadow: 0 2px 1px #241521, 0 0 8px #161219;
}
#home .brand::before {
  content: ""; position: absolute; z-index: -1; inset: -16% -9% -13%; pointer-events: none;
  background: radial-gradient(ellipse closest-side, #241c16ed 25%, #29211bc9 67%, transparent 100%);
}
#home .brand h1 svg { width: 100%; height: auto; }
#home .subtitle {
  margin-top: clamp(5px, 1.55vh, 17px);
  font-size: clamp(1.05rem, min(2.45vw, 4.65vh), 2.6rem);
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: .105em;
}
#home .rules-line {
  margin-top: clamp(4px, 1.1vh, 12px);
  font-size: clamp(.9rem, min(1.69vw, 3.2vh), 1.85rem);
  line-height: 1.25;
}
#home .rules-line span { padding: 0 .23em; }
#home .home-actions {
  position: absolute;
  left: max(2.1%, env(safe-area-inset-left));
  top: 34.6%;
  width: min(42.2vw, 81vh, 55rem);
  height: 50.5%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  background: url('/art/dock-sign.webp') center / 100% 100% no-repeat;
  filter: drop-shadow(0 4px 3px #120e17a8);
}
#home .start-game {
  --ui-size: clamp(44px, 14vh, 150px);
  --start-type: clamp(1.2rem, min(3.38vw, 6.5vh), 3.8rem);
  flex: 0 0 26%;
  width: 91%;
  margin: 4.5% 0 0;
  padding: .03em .3em .17em;
  font-size: var(--start-type);
  gap: .36em;
  white-space: nowrap;
  color: #462815;
}
#home .start-game:is([aria-label="Продолжить спуск"],[aria-label="Повторить спуск"]) {
  font-size: calc(var(--start-type) * .84);
}
#home .home-modes {
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  width: 73%;
  height: 52%;
  margin-top: 2%;
  gap: clamp(3px, .8vh, 10px);
}
#home .home-modes button {
  --ui-size: clamp(38px, 8.6vh, 95px);
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: .72em;
  min-width: 0;
  padding: .04em .55em .17em 9%;
  white-space: nowrap;
  font-size: clamp(1rem, min(1.94vw, 3.5vh), 2.25rem);
  font-weight: 530;
}
#home .home-modes .control-symbol { width: 1.45em; height: 1.45em; }
#game[data-screen=home] #corners { inset: max(6px, env(safe-area-inset-top)) max(7px, env(safe-area-inset-right)) auto max(7px, env(safe-area-inset-left)); }

@media (max-aspect-ratio: 1/1) {
  #game[data-screen=home] #corners .right-corner { display: flex; }
  #home .brand {
    top: max(6.3%, calc(env(safe-area-inset-top) + 56px));
    left: 8%; width: 84%;
  }
  #home .subtitle {
    font-size: clamp(1rem, min(4.9vw, 3.2vh), 2rem);
    margin-top: clamp(2px, .8vh, 10px);
  }
  #home .rules-line { font-size: clamp(.86rem, min(3.8vw, 2.5vh), 1.5rem); margin-top: .5vh; }
  #home .home-actions {
    width: min(92vw, 65vh, 38rem);
    height: clamp(208px, 34%, 354px);
    top: auto;
    bottom: max(1.7%, env(safe-area-inset-bottom));
    left: 50%; transform: translateX(-50%);
  }
  #home .start-game {
    --ui-size: clamp(47px, 8.8vh, 94px);
    --start-type: clamp(1.42rem, min(7vw, 4.5vh), 2.65rem);
    flex-basis: 25%;
    width: 89%; margin-top: 3.6%;
  }
  #home .home-modes {
    width: 79%; height: 57%;
    margin-top: 1.1%;
    gap: clamp(2px, .45vh, 6px);
  }
  #home .home-modes button {
    --ui-size: clamp(35px, 6vh, 72px);
    padding-left: 9%; gap: .65em;
    font-size: clamp(.95rem, min(4.55vw, 2.65vh), 1.68rem);
  }
}
@media (aspect-ratio > 1/1) and (max-height: 530px) {
  #home .brand { top: max(5%, 18px); left: max(8.5%, 55px); width: min(36vw, 74vh); }
  #home .subtitle { margin-top: 2px; }
  #home .rules-line { margin-top: 3px; }
  #home .home-actions { top: 32%; height: 62%; width: min(45vw, 92vh); }
  #home .home-modes { width: 78%; height: 55%; }
  #home .home-modes button {
    gap: .54em; padding-left: 7%;
    font-size: clamp(.875rem, min(2.46vw, 3.95vh), 1.125rem);
  }
}
