.startup {
  --startup-background: url('../../assets/ui/startup-background.webp');
  position: fixed; inset: 0; z-index: 21000; overflow: hidden; isolation: isolate;
  display: grid; place-items: center; container-type: size;
  color: #fff2ce; background: #162d21; text-align: center;
  font-family: Fredoka, system-ui, sans-serif;
}
.startup[hidden] { display: none; }
/* Fill the viewport with the whole painting and keep its controls aligned. */
.startup-content {
  position: relative; width: 100%; height: 100%;
}
.startup-art { position: absolute; inset: 0; background: var(--startup-background) center / 100% 100% no-repeat; }
.startup-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap;
}
.startup-scenery { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.startup-scenery i {
  position: absolute; left: 13%; top: 44%; width: 4px; height: 4px; border-radius: 50%;
  background: #ffe6a0; box-shadow: 0 0 13px 4px #f4d48066;
  animation: startup-drift 6s ease-in-out infinite alternate;
}
.startup-scenery i:nth-child(2) { left: 79%; top: 35%; animation-delay: -3s; }
.startup-scenery i:nth-child(3) { left: 62%; top: 63%; animation-delay: -1.5s; }
.startup-loader {
  position: absolute; left: 18.4%; right: 17.4%; bottom: 3.9%; height: 23%; min-height: 176px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(5px, .75cqh, 9px); padding: clamp(10px, 1.4cqh, 18px) clamp(22px, 3.7cqw, 62px);
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  border: 3px solid #ae763a; border-radius: 36px 42px 40px 38px / 28px 30px 33px 30px;
  background: radial-gradient(ellipse at 50% -45%, #456342, transparent 75%), linear-gradient(100deg, #142d22, #203f2c 50%, #142d22);
  box-shadow: 0 0 0 2px #573619, inset 0 0 0 2px #dfad5a55, inset 0 0 28px #06180e88, 0 7px 15px #13241466;
}
.startup-loader::before, .startup-loader::after {
  content: ''; position: absolute; width: clamp(32px, 5cqw, 82px); height: 70%; top: 15%;
  background: url('../../assets/ui/hud-sprig.svg') center / contain no-repeat;
  opacity: .27; pointer-events: none;
}
.startup-loader::before { left: 5px; transform: rotate(-22deg); }
.startup-loader::after { right: 5px; transform: scaleX(-1) rotate(-22deg); }
.startup-status {
  display: flex; justify-content: center; align-items: center; gap: 12px; width: 100%;
  font-size: clamp(17px, 2.7cqh, 30px); line-height: 1.1; text-shadow: 0 2px 2px #081a12;
}
.startup-status b { font-weight: 700; }
#startup-count {
  position: absolute; top: 13px; right: 18px; color: #b7d0a5;
  font-size: clamp(9px, 1.25cqh, 12px); font-variant-numeric: tabular-nums; font-weight: 500;
}
#startup-progress {
  flex-shrink: 0; display: block; appearance: none; width: 88%; height: clamp(11px, 2cqh, 22px); margin: 0;
  border: 2px solid #d5f6c4; border-radius: 30px; overflow: hidden; background: #0c2419; color: #96f4a1;
  box-shadow: 0 0 0 3px #0b2119, 0 0 12px #86e9a344, inset 0 2px 4px #0008;
}
#startup-progress::-webkit-progress-bar { background: #0c2419; }
#startup-progress::-webkit-progress-value {
  background: repeating-linear-gradient(120deg, transparent 0 16px, #e8ffd32a 16px 30px), linear-gradient(#c9ffb0, #64d68a);
  border-radius: 30px; transition: width .35s ease;
}
#startup-progress::-moz-progress-bar { background: linear-gradient(#c9ffb0, #64d68a); border-radius: 30px; }
.startup-tip {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; text-align: left; z-index: 1;
}
.startup-tip > img { flex-shrink: 0; width: clamp(19px, 2.7cqh, 28px); height: auto; opacity: .85; }
.startup-tip p { flex: 1; margin: 0; color: #f0edcc; font-size: clamp(11px, 1.55cqh, 16px); line-height: 1.3; }
#startup-tip-label {
  display: block; color: #b8d99c; font-size: clamp(8px, 1.05cqh, 11px); font-weight: 500; letter-spacing: .16em; margin-bottom: 2px;
}
#startup-tip-next {
  flex-shrink: 0; width: 36px; height: 36px; border: 1px solid #a8c78e4d; border-radius: 50%;
  color: #e1ebba; background: #a0ce8e12; font: 500 28px/1 Fredoka, system-ui, sans-serif; cursor: pointer;
}
#startup-tip-next:hover { background: #a0ce8e30; border-color: #cfe5ac; }
.startup-detail {
  margin: 0; color: #f8dda0; font-size: clamp(10px, 1.35cqh, 13px); line-height: 1.35; z-index: 1;
}
.startup-detail[hidden] { display: none; }
#startup-enter {
  position: relative; flex-shrink: 0; width: 73%; min-height: 44px; padding: clamp(7px, 1cqh, 12px) 18px;
  border: 2px solid #d4ffc3; border-radius: 40px;
  background: radial-gradient(ellipse at 50% 0, #e2ffbc88, transparent 70%), linear-gradient(#b4fda4, #69d68d);
  box-shadow: 0 0 0 4px #102c20, 0 0 0 6px #719c6d, inset 0 2px 2px #f1ffe9, 0 6px 0 4px #0a2318, 0 0 18px #98f1a52b;
  color: #102914; font: 700 clamp(16px, 2.65cqh, 29px)/1.1 Fredoka, system-ui, sans-serif;
  text-shadow: 0 1px #d5ffc2; cursor: pointer; z-index: 1;
}
#startup-enter:not(:disabled):hover { filter: brightness(1.1); }
#startup-enter:not(:disabled):active { transform: translateY(3px); box-shadow: 0 0 0 4px #102c20, 0 0 0 6px #719c6d; }
#startup-enter:disabled {
  background: linear-gradient(#3c6548, #294c35); color: #c2d2ae; text-shadow: 0 1px #122b20;
  border-color: #91b27f; box-shadow: 0 0 0 4px #102c20, inset 0 2px 1px #b7dc9a22; cursor: wait;
}
.startup button:focus-visible, .startup-footer a:focus-visible { outline: 3px solid #fff0b1; outline-offset: 5px; }
#startup-offline {
  position: absolute; bottom: max(5px, env(safe-area-inset-bottom)); left: 23%; right: 23%;
  font-size: 9px; line-height: 1.3; color: #e1e5c9; text-shadow: 0 1px 3px #071c12, 0 0 6px #071c12;
}
.startup-footer {
  position: absolute; left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right));
  bottom: max(5px, env(safe-area-inset-bottom)); display: flex; justify-content: space-between; gap: 12px;
  color: #e5e6c8; font-size: 9px; letter-spacing: .1em; text-shadow: 0 1px 4px #071c12;
}
.startup-footer b { font-weight: 500; letter-spacing: 0; margin-left: 4px; }
.startup-footer a { color: #f0e8c7; letter-spacing: 0; text-decoration-color: #e4e4be88; }
.startup-orientation { display: none; color: #f0d79b; margin: 5px 0 0; font-size: 14px; line-height: 1.4; }
.startup-orientation b, .startup-orientation span { display: block; }
.startup-orientation span { font-size: 12px; color: #c8d5bd; margin-top: 5px; }
.startup-nojs { position: absolute; bottom: 8%; padding: 10px 18px; background: #162b25; }
#rotate-ios-help { display: block; max-width: 360px; font-size: 12px; line-height: 1.5; margin: 14px auto 0; }
#rotate-ios-help[hidden] { display: none; }
.startup[data-state="notice"] .startup-loader { height: 28%; min-height: 210px; }
@keyframes startup-drift { to { transform: translate(16px, -26px); opacity: .25; } }
@media (max-height: 580px) and (orientation: landscape) {
  .startup-loader { top: auto; bottom: 3.9%; left: 15%; right: 14%; height: auto; min-height: 136px; padding: 9px 28px 12px; gap: 5px; border-radius: 25px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .startup-status { font-size: 18px; }
  #startup-count { font-size: 9px; top: 11px; right: 12px; }
  #startup-progress { height: 12px; width: 88%; }
  .startup-tip { min-height: 30px; gap: 7px; }
  .startup-tip p { font-size: 11px; }
  #startup-tip-label { display: inline; font-size: 9px; letter-spacing: .07em; margin-right: 7px; }
  #startup-tip-next { width: 30px; height: 30px; }
  #startup-enter { min-height: 36px; font-size: 19px; padding: 6px 12px; }
  .startup[data-state="notice"] .startup-loader { top: auto; height: auto; min-height: 166px; }
  #startup-offline { font-size: 8px; }
  .startup-footer { font-size: 8px; }
}
@media (orientation: portrait) {
  .startup { overflow-y: auto; display: block; background: #142b20; }
  .startup-content { width: 100%; height: auto; min-height: 100%; padding: 42cqh max(20px, env(safe-area-inset-right)) 80px max(20px, env(safe-area-inset-left)); }
  .startup-art { height: 44cqh; background-size: auto 62cqh; background-position: center top; }
  .startup-art::after { content: ''; position: absolute; inset: auto 0 0; height: 10cqh; background: linear-gradient(transparent, #142b20); }
  .startup-scenery { height: 42cqh; }
  .startup-loader, .startup[data-state="notice"] .startup-loader {
    position: relative; inset: auto; width: min(100%, 500px); height: auto; margin: 0 auto; padding: 24px 20px;
    gap: 16px; border-radius: 30px; min-height: 0;
  }
  .startup-status { font-size: clamp(20px, 5vw, 28px); }
  #startup-count { position: static; font-size: 11px; }
  #startup-progress { width: 100%; height: 16px; }
  .startup-tip { min-height: 68px; gap: 8px; }
  .startup-tip p { font-size: 14px; line-height: 1.45; }
  #startup-tip-label { font-size: 9px; margin-bottom: 4px; }
  #startup-tip-next { width: 36px; height: 36px; }
  .startup-tip > img { width: 25px; }
  #startup-enter { width: 94%; min-height: 48px; font-size: 21px; margin: 0 0 4px; }
  .startup-detail { font-size: 12px; }
  #startup-offline { position: relative; display: block; inset: auto; margin: -55px 24px 35px; font-size: 10px; }
  .startup-footer { position: relative; inset: auto; margin: 0 max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
}
@media (orientation: portrait) and (pointer: coarse) {
  .rotate { display: grid; }
  .startup-orientation { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  .startup-scenery i { animation: none; }
  #startup-progress::-webkit-progress-value { transition: none; }
}
