/* Nardora board-mounted start console. The board stays primary on every viewport. */
:root {
    --lobby-bg: #0d0703;
    --lobby-panel: rgba(29, 17, 9, 0.985);
    --lobby-panel-deep: rgba(19, 10, 5, 0.99);
    --lobby-row: rgba(43, 25, 13, 0.96);
    --lobby-ink: #f4dfb2;
    --lobby-muted: rgba(235, 216, 179, 0.7);
    --lobby-gold: #dda83f;
    --lobby-gold-bright: #f4d077;
    --lobby-gold-deep: #9a681f;
    --lobby-dark-text: #281606;
    --lobby-line: rgba(224, 171, 68, 0.42);
    --lobby-focus: #fff0a8;
    --lobby-board-ratio: 1.405;
}

body.is-start-screen-open {
    overflow: hidden;
}

#start-screen,
#start-screen * {
    box-sizing: border-box;
}

#start-screen .start-icon {
    --start-icon-url: none;
    display: block;
    flex: 0 0 auto;
    background-color: currentColor;
    -webkit-mask: var(--start-icon-url) center / contain no-repeat;
    mask: var(--start-icon-url) center / contain no-repeat;
}

#start-screen .start-icon-history { --start-icon-url: url('./assets/ui/icons/history.svg'); }
#start-screen .start-icon-chevron-left { --start-icon-url: url('./assets/ui/icons/chevron-left.svg'); }
#start-screen .start-icon-zap { --start-icon-url: url('./assets/ui/icons/zap.svg'); }
#start-screen .start-icon-bot { --start-icon-url: url('./assets/ui/icons/bot.svg'); }
#start-screen .start-icon-users { --start-icon-url: url('./assets/ui/icons/users.svg'); }
#start-screen .start-icon-globe { --start-icon-url: url('./assets/ui/icons/globe-2.svg'); }
#start-screen .start-icon-book-open { --start-icon-url: url('./assets/ui/icons/book-open.svg'); }
#start-screen .start-icon-user { --start-icon-url: url('./assets/ui/icons/user-round.svg'); }
#start-screen .start-icon-palette { --start-icon-url: url('./assets/ui/icons/palette.svg'); }
#start-screen .start-icon-settings { --start-icon-url: url('./assets/ui/icons/settings.svg'); }

#start-screen {
    align-items: stretch;
    justify-content: center;
    padding:
        max(8px, env(safe-area-inset-top))
        max(8px, env(safe-area-inset-right))
        max(8px, env(safe-area-inset-bottom))
        max(8px, env(safe-area-inset-left));
    overflow: hidden;
    color: var(--lobby-ink);
    background:
        radial-gradient(circle at 50% 42%, rgba(101, 58, 22, 0.18), transparent 45%),
        repeating-linear-gradient(2deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 5px),
        linear-gradient(145deg, #160c06 0%, #080402 55%, #130a04 100%);
}

#start-screen-box {
    position: relative;
    isolation: isolate;
    width: min(100%, 1480px);
    height: calc(100dvh - 16px);
    min-height: 0;
    max-height: calc(100dvh - 16px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: clamp(6px, 1.1vh, 12px);
    margin: auto;
    padding: clamp(10px, 1.3vw, 20px);
    overflow: hidden;
    border: 1px solid rgba(214, 159, 61, 0.18);
    border-radius: 22px;
    background:
        linear-gradient(90deg, transparent, rgba(224, 171, 68, 0.035) 50%, transparent),
        rgba(12, 7, 3, 0.9);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.58);
    text-align: left;
}

#start-lobby-header {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(36px, 1fr) auto minmax(36px, 1fr);
    align-items: center;
    gap: clamp(12px, 2vw, 28px);
    width: min(100%, 980px);
    margin-inline: auto;
}

#start-screen-box #start-lobby-header h2 {
    margin: 0;
    color: #e9be61;
    font-family: Cinzel, Georgia, 'Times New Roman', serif;
    font-size: clamp(2.35rem, 5.3vw, 4.8rem);
    font-weight: 500;
    line-height: 0.94;
    letter-spacing: 0.08em;
    text-align: center;
    text-shadow: 0 2px 16px rgba(214, 151, 41, 0.24);
}

.start-brand-line {
    position: relative;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(217, 158, 49, 0.82));
}

.start-brand-line-right {
    transform: scaleX(-1);
}

.start-brand-line::after {
    position: absolute;
    right: -4px;
    top: 50%;
    width: 8px;
    height: 8px;
    content: '';
    border: 1px solid rgba(224, 171, 68, 0.88);
    transform: translateY(-50%) rotate(45deg);
    background: #120904;
}

#start-lobby-layout {
    position: relative;
    min-width: 0;
    min-height: 0;
    width: auto;
    height: 100%;
    max-width: calc(100% - 136px);
    aspect-ratio: 1280 / 911;
    justify-self: center;
    overflow: visible;
}

#start-lobby-layout[data-step='modes'],
#start-lobby-layout[data-step='bot-settings'] {
    width: min(100%, 1180px);
    max-width: 100%;
    aspect-ratio: auto;
}

#start-board-showcase {
    position: absolute;
    inset: 0;
    min-width: 0;
    min-height: 0;
    display: grid;
    place-items: center;
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

#start-board-showcase img {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: block;
    object-fit: contain;
    object-position: center;
    filter: drop-shadow(0 16px 22px rgba(0, 0, 0, 0.52));
}

#start-lobby-layout[data-step='modes'] #start-board-showcase,
#start-lobby-layout[data-step='bot-settings'] #start-board-showcase {
    right: clamp(350px, 34%, 430px);
}

#start-launch-panel {
    position: absolute;
    inset: 0;
    min-width: 0;
    min-height: 0;
    pointer-events: none;
}

#start-launch-panel[data-step='modes'],
#start-launch-panel[data-step='bot-settings'] {
    inset: clamp(8px, 1.6vh, 18px) 0 clamp(8px, 1.6vh, 18px) auto;
    width: clamp(350px, 34%, 430px);
    display: block;
    padding: clamp(14px, 1.7vw, 22px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    pointer-events: auto;
    border: 1px solid rgba(229, 179, 80, 0.58);
    border-radius: 28px 4px 4px 28px;
    background:
        radial-gradient(circle at 50% 0, rgba(219, 161, 55, 0.08), transparent 35%),
        linear-gradient(155deg, var(--lobby-panel), var(--lobby-panel-deep));
    box-shadow: -16px 18px 36px rgba(0, 0, 0, 0.5);
}

#ongoing-match-entry {
    position: absolute;
    top: clamp(2px, 1vh, 10px);
    left: clamp(-96px, -5vw, -54px);
    width: max-content;
    max-width: min(260px, 38vw);
    pointer-events: auto;
}

#ongoing-match-entry:has(#continue-match-button[hidden]) {
    display: none;
}

#start-launch-panel:not([data-step='landing']) #ongoing-match-entry {
    display: none;
}

#continue-match-button {
    width: auto;
    min-width: 0;
    min-height: 48px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 6px 16px 6px 8px;
    border: 1px solid rgba(229, 177, 72, 0.72);
    border-radius: 999px;
    background: rgba(35, 20, 10, 0.96);
    color: #f4d991;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.34);
    text-align: left;
}

#continue-match-button .start-resume-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(237, 195, 106, 0.5);
    border-radius: 50%;
    background: rgba(201, 151, 57, 0.14);
}

#continue-match-button .start-resume-icon .start-icon {
    width: 19px;
    height: 19px;
}

#continue-match-button .start-mode-copy > span {
    display: none;
}

#continue-match-button .start-mode-copy strong {
    font-size: 0.92rem;
    white-space: nowrap;
}

.start-lobby-stage[hidden] {
    display: none !important;
}

.start-lobby-stage {
    min-width: 0;
    min-height: 0;
}

#start-stage-landing {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

#play-gateway-button {
    position: absolute;
    z-index: 3;
    top: 50%;
    right: clamp(-146px, -9.6vw, -110px);
    width: clamp(224px, 18vw, 272px);
    aspect-ratio: 3 / 2;
    display: grid;
    place-content: center;
    margin: 0;
    padding: 0;
    pointer-events: auto;
    border: 0;
    border-radius: 0;
    background: transparent url('./assets/ui/nardora-play-medallion-v1.webp') center / contain no-repeat;
    color: transparent;
    filter: drop-shadow(0 18px 20px rgba(0, 0, 0, 0.46));
    box-shadow: none;
    transform: translateY(-50%);
    text-align: center;
}

#play-gateway-button strong {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

#start-stage-modes,
#start-stage-bot-settings {
    align-content: start;
}

#start-stage-modes {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: clamp(10px, 1.6vh, 17px);
}

#start-stage-bot-settings {
    display: grid;
    grid-template-rows: auto auto auto auto;
    align-content: center;
    gap: clamp(14px, 2.2vh, 24px);
}

.start-stage-header {
    min-width: 0;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    align-items: center;
    gap: 8px;
}

.start-stage-header h3 {
    margin: 0;
    color: #f2d997;
    font-family: Cinzel, Georgia, 'Times New Roman', serif;
    font-size: clamp(1.45rem, 2vw, 2rem);
    font-weight: 600;
    line-height: 1.1;
    text-align: center;
}

.start-back-button {
    width: 48px;
    min-width: 48px;
    min-height: 48px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--lobby-gold-bright);
    box-shadow: none;
}

.start-back-button .start-icon {
    width: 30px;
    height: 30px;
}

#start-mode-menu,
#start-mode-grid {
    min-width: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    margin: 0;
}

#start-mode-menu {
    align-content: center;
    overflow: hidden;
    border: 1px solid rgba(224, 171, 68, 0.33);
    border-radius: 18px;
    background: rgba(30, 17, 9, 0.72);
}

#start-mode-menu-heading {
    min-height: 0;
}

#start-screen .start-mode-card {
    width: 100%;
    min-width: 0;
    min-height: 76px;
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    padding: 11px 16px;
    border: 0;
    border-bottom: 1px solid rgba(224, 171, 68, 0.27);
    border-radius: 0;
    background: transparent;
    color: var(--lobby-ink);
    box-shadow: none;
    text-align: left;
}

#start-screen .start-mode-card-primary {
    background: linear-gradient(100deg, #dca43b, #efc563);
    color: var(--lobby-dark-text);
    box-shadow: inset 0 1px 0 rgba(255, 248, 214, 0.5);
}

#start-screen .start-mode-card-bot {
    background: rgba(47, 27, 14, 0.52);
}

#start-screen .start-mode-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(232, 194, 111, 0.46);
    border-radius: 50%;
    background: rgba(210, 164, 78, 0.1);
}

#start-screen .start-mode-card-primary .start-mode-icon {
    border-color: rgba(60, 34, 9, 0.35);
    background: rgba(48, 28, 8, 0.12);
}

#start-screen .start-mode-icon .start-icon {
    width: 25px;
    height: 25px;
}

#start-screen .start-mode-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

#start-screen .start-mode-copy strong {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.18rem;
    font-weight: 700;
    line-height: 1.12;
}

#start-screen .start-mode-copy > span:not(.start-mode-badge) {
    color: var(--lobby-muted);
    font-size: 0.72rem;
    line-height: 1.25;
}

#start-screen .start-mode-card-primary .start-mode-copy > span:not(.start-mode-badge) {
    color: rgba(42, 23, 6, 0.76);
}

#start-future-modes {
    display: grid;
    grid-template-columns: 1fr;
}

#start-screen .start-mode-card-unavailable {
    min-height: 64px;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 11px;
    padding-block: 8px;
    color: rgba(225, 205, 168, 0.48);
    opacity: 1;
    filter: none;
}

#start-screen .start-mode-card-unavailable:last-child {
    border-bottom: 0;
}

#start-screen .start-mode-card-unavailable .start-mode-icon {
    width: 42px;
    height: 42px;
    border-color: rgba(214, 174, 98, 0.22);
}

#start-screen .start-mode-card-unavailable .start-mode-copy > span:not(.start-mode-badge) {
    display: none;
}

#start-screen .start-mode-badge {
    margin: 0;
    padding: 5px 10px;
    border: 1px solid rgba(221, 185, 114, 0.25);
    border-radius: 999px;
    color: rgba(232, 211, 172, 0.5);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.start-bot-heading {
    min-height: 0;
}

.start-segmented-field {
    min-width: 0;
    display: grid;
    gap: 9px;
    margin: 0;
    padding: 0;
    border: 0;
}

.start-segmented-field legend {
    padding: 0;
    color: #eed795;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.start-segmented-options {
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid rgba(221, 172, 82, 0.55);
    border-radius: 14px;
    background: rgba(25, 13, 7, 0.88);
}

.start-segmented-options button {
    min-width: 0;
    min-height: 48px;
    padding: 7px 4px;
    border: 0;
    border-right: 1px solid rgba(221, 172, 82, 0.27);
    border-radius: 0;
    background: transparent;
    color: rgba(244, 223, 178, 0.9);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(0.66rem, 0.9vw, 0.78rem);
    font-weight: 700;
}

.start-segmented-options button:last-child {
    border-right: 0;
}

.start-segmented-options button[aria-pressed='true'] {
    background: linear-gradient(100deg, #dca43b, #efc563);
    color: var(--lobby-dark-text);
}

.start-bot-submit {
    width: 100%;
    min-height: 58px;
    padding: 10px 14px;
    border: 1px solid var(--lobby-gold-bright);
    border-radius: 999px;
    background: linear-gradient(100deg, #dca43b, #efc563);
    color: var(--lobby-dark-text);
    box-shadow:
        inset 0 1px 0 rgba(255, 248, 214, 0.58),
        0 12px 22px rgba(0, 0, 0, 0.28);
    font-family: Cinzel, Georgia, 'Times New Roman', serif;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

#start-screen-actions {
    position: relative;
    width: min(100%, 650px);
    min-height: 50px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    justify-self: center;
    overflow: hidden;
    border-top: 1px solid rgba(226, 177, 83, 0.34);
    border-bottom: 1px solid rgba(226, 177, 83, 0.24);
    border-radius: 0;
    background: transparent;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

#start-screen-actions .secondary-start-button {
    width: 100%;
    max-width: none;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    padding: 7px 12px;
    border: 0;
    border-right: 1px solid rgba(226, 177, 83, 0.24);
    border-radius: 0;
    background: transparent;
    color: #f1d58e;
    box-shadow: none;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(0.76rem, 1.1vw, 0.94rem);
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}

#start-screen-actions .secondary-start-button:last-child {
    border-right: 0;
}

#start-screen-actions .start-utility-icon {
    width: 23px;
    height: 23px;
    flex: 0 0 23px;
}

#start-lobby-layout[data-step='modes'] + #start-screen-actions,
#start-lobby-layout[data-step='bot-settings'] + #start-screen-actions {
    display: none;
}

#start-preferences {
    display: none;
}

#start-lobby-layout[data-step='modes'] ~ #start-preferences,
#start-lobby-layout[data-step='bot-settings'] ~ #start-preferences {
    position: absolute;
    z-index: 18;
    top: clamp(86px, 11vh, 118px);
    right: max(22px, calc((100% - 1180px) / 2 + 22px));
    display: block;
}

#start-preferences > summary {
    position: relative;
    z-index: 2;
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    display: grid;
    place-items: center;
    padding: 0;
    cursor: pointer;
    list-style: none;
    border: 1px solid rgba(225, 178, 86, 0.38);
    border-radius: 50%;
    background: rgba(37, 21, 11, 0.82);
    color: rgba(242, 215, 153, 0.88);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.26);
}

#start-preferences > summary::-webkit-details-marker {
    display: none;
}

#start-preferences > summary .start-icon {
    width: 23px;
    height: 23px;
}

#start-preferences[open] > summary {
    border-color: var(--lobby-gold-bright);
    background: rgba(100, 62, 26, 0.92);
    color: #fff0c6;
}

#start-preferences-panel {
    position: absolute;
    top: 52px;
    right: 0;
    width: min(390px, calc(100vw - 24px));
    max-height: min(68vh, 470px);
    display: grid;
    gap: 10px;
    padding: 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid rgba(226, 177, 83, 0.58);
    border-radius: 16px;
    background: #180d07;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.6);
}

#start-match-settings {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    margin: 0;
    overflow: hidden;
    border: 1px solid rgba(207, 153, 62, 0.28);
    border-radius: 13px;
    background: rgba(34, 19, 11, 0.72);
}

#start-language-container,
#start-screen #checker-color-picker {
    width: 100%;
    max-width: none;
    min-width: 0;
    min-height: 54px;
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 6px 9px;
    border: 0;
    border-radius: 0;
    background: transparent;
}

#start-screen #checker-color-picker {
    border-top: 1px solid rgba(210, 158, 66, 0.22);
}

#start-language-label,
#start-screen #checker-color-picker legend {
    position: static;
    float: none;
    align-self: center;
    padding: 0;
    color: rgba(229, 195, 128, 0.9);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

#start-language-select {
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 44px;
    padding: 6px 8px;
    border: 1px solid rgba(219, 170, 82, 0.36);
    border-radius: 9px;
    background: #211209;
    color: var(--lobby-ink);
    font-size: 0.8rem;
}

#start-screen .checker-color-options {
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
}

#start-screen .checker-color-option {
    min-width: 0;
    min-height: 44px;
    justify-content: flex-start;
    gap: 5px;
    padding: 5px 6px;
    overflow: hidden;
    border-color: transparent;
    border-radius: 9px;
    background: #211209;
    font-size: 0.64rem;
}

#start-screen .checker-color-option:has(input:checked) {
    border-color: rgba(242, 203, 117, 0.72);
    background: #3b2313;
    box-shadow: none;
}

#start-screen .checker-color-swatch {
    width: 22px;
    height: 22px;
    flex-basis: 22px;
}

#start-screen #friend-preview-entry,
#start-screen #feedback-button-row {
    position: static;
    width: 100%;
    margin: 0;
}

#start-screen #friend-preview-entry .secondary-start-button {
    width: 100%;
    max-width: none;
    min-height: 44px;
    padding: 7px 10px;
    border: 1px solid rgba(213, 163, 70, 0.3);
    border-radius: 11px;
    background: rgba(48, 27, 15, 0.9);
    color: rgba(239, 219, 180, 0.86);
    box-shadow: none;
    font-size: 0.74rem;
}

#start-screen #helper-mascot,
#start-screen #helper-mascot-toggle {
    width: 100%;
}

#start-screen button:not(:disabled):focus-visible,
#start-preferences > summary:focus-visible,
#start-screen .checker-color-option:has(input:focus-visible) {
    outline: 3px solid var(--lobby-focus);
    outline-offset: 3px;
}

#start-screen button:not(:disabled):hover {
    border-color: var(--lobby-gold-bright);
    filter: brightness(1.045);
}

#start-screen button:disabled {
    cursor: not-allowed;
}

@media (min-width: 761px) and (max-height: 760px) {
    #start-screen-box {
        gap: 5px;
        padding: 8px 14px;
    }

    #start-screen-box #start-lobby-header h2 {
        font-size: clamp(2rem, 4.6vw, 3.3rem);
    }

    #start-screen-actions {
        min-height: 44px;
    }

    #start-screen-actions .secondary-start-button {
        min-height: 44px;
        padding-block: 4px;
    }

    #start-launch-panel[data-step='modes'],
    #start-launch-panel[data-step='bot-settings'] {
        padding: 10px 13px;
    }

    #start-stage-modes,
    #start-stage-bot-settings {
        gap: 8px;
    }

    #start-screen .start-mode-card {
        min-height: 62px;
        padding-block: 7px;
    }

    #start-screen .start-mode-card-unavailable {
        min-height: 50px;
    }

    .start-segmented-options button,
    .start-bot-submit,
    .start-back-button {
        min-height: 44px;
    }

    #start-lobby-layout[data-step='modes'] ~ #start-preferences,
    #start-lobby-layout[data-step='bot-settings'] ~ #start-preferences {
        top: 64px;
    }
}

@media (max-width: 760px) {
    #start-screen {
        padding: 0;
        overflow: hidden;
    }

    #start-screen-box {
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        grid-template-rows: auto minmax(0, 1fr) auto;
        gap: 0;
        padding:
            max(8px, env(safe-area-inset-top))
            max(7px, env(safe-area-inset-right))
            max(8px, env(safe-area-inset-bottom))
            max(7px, env(safe-area-inset-left));
        border: 0;
        border-radius: 0;
        background:
            radial-gradient(circle at 50% 30%, rgba(105, 60, 22, 0.2), transparent 44%),
            repeating-linear-gradient(2deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 5px),
            #0e0804;
    }

    #start-lobby-header {
        min-height: clamp(84px, 24vw, 112px);
        grid-template-columns: minmax(24px, 1fr) auto minmax(24px, 1fr);
        gap: 10px;
        width: 100%;
        padding-inline: 8px;
    }

    #start-screen-box #start-lobby-header h2 {
        font-size: clamp(2.25rem, 12.5vw, 3.65rem);
        letter-spacing: 0.055em;
    }

    #start-lobby-layout,
    #start-lobby-layout[data-step='modes'],
    #start-lobby-layout[data-step='bot-settings'] {
        width: 100%;
        height: 100%;
        max-width: none;
        min-height: 0;
        aspect-ratio: auto;
        justify-self: stretch;
    }

    #start-board-showcase,
    #start-lobby-layout[data-step='modes'] #start-board-showcase,
    #start-lobby-layout[data-step='bot-settings'] #start-board-showcase {
        inset: 0 0 auto;
        width: 100%;
        height: auto;
        aspect-ratio: 1280 / 911;
    }

    #start-board-showcase img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    #ongoing-match-entry {
        top: calc(71.1vw + 72px);
        left: 50%;
        width: max-content;
        max-width: calc(100vw - 28px);
        transform: translateX(-50%);
    }

    #continue-match-button {
        min-height: 48px;
        padding-right: 18px;
    }

    #play-gateway-button {
        top: calc(71.1vw - 12px);
        right: auto;
        left: 50%;
        width: clamp(202px, 56vw, 232px);
        transform: translate(-50%, -50%);
    }

    #start-launch-panel[data-step='modes'],
    #start-launch-panel[data-step='bot-settings'] {
        inset: calc(71.1vw - 8px) 0 0;
        width: auto;
        padding: 13px 14px max(14px, env(safe-area-inset-bottom));
        border-radius: 26px 26px 0 0;
        box-shadow: 0 -16px 34px rgba(0, 0, 0, 0.48);
    }

    .start-stage-header {
        grid-template-columns: 46px minmax(0, 1fr) 46px;
        min-height: 48px;
    }

    .start-stage-header h3 {
        font-size: clamp(1.55rem, 7vw, 2rem);
    }

    .start-back-button {
        width: 46px;
        min-width: 46px;
        min-height: 46px;
    }

    #start-stage-modes,
    #start-stage-bot-settings {
        gap: 10px;
    }

    #start-stage-bot-settings {
        align-content: start;
        grid-template-rows: auto auto auto auto;
        gap: clamp(13px, 2.6vh, 20px);
    }

    #start-screen .start-mode-card {
        min-height: 68px;
        grid-template-columns: 48px minmax(0, 1fr);
        gap: 13px;
        padding: 9px 14px;
    }

    #start-screen .start-mode-copy > span:not(.start-mode-badge) {
        display: none;
    }

    #start-screen .start-mode-card-unavailable {
        min-height: 60px;
        grid-template-columns: 44px minmax(0, 1fr) auto;
        gap: 10px;
    }

    #start-screen .start-mode-copy strong {
        font-size: clamp(1.05rem, 4.8vw, 1.28rem);
    }

    #start-screen .start-mode-icon {
        width: 44px;
        height: 44px;
    }

    .start-segmented-field {
        gap: 8px;
    }

    .start-segmented-field legend {
        font-size: clamp(1rem, 4.7vw, 1.2rem);
    }

    .start-segmented-options button {
        min-height: 56px;
        font-size: clamp(0.72rem, 3.3vw, 0.88rem);
    }

    .start-bot-submit {
        min-height: 58px;
        margin-top: auto;
        font-size: clamp(1rem, 4.8vw, 1.22rem);
    }

    #start-screen-actions {
        width: calc(100% - 12px);
        min-height: 72px;
        margin-inline: auto;
        margin-bottom: max(1px, env(safe-area-inset-bottom));
        overflow: hidden;
        border: 1px solid rgba(226, 177, 83, 0.46);
        border-radius: 13px;
        background: rgba(39, 22, 12, 0.92);
        box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.24);
    }

    #start-screen-actions .secondary-start-button {
        min-height: 70px;
        flex-direction: column;
        gap: 5px;
        padding: 7px 4px;
        font-size: clamp(0.67rem, 3.2vw, 0.84rem);
    }

    #start-screen-actions .start-utility-icon {
        width: 29px;
        height: 29px;
        flex-basis: 29px;
    }

    #start-lobby-layout[data-step='modes'] ~ #start-preferences,
    #start-lobby-layout[data-step='bot-settings'] ~ #start-preferences {
        top: calc(max(8px, env(safe-area-inset-top)) + clamp(84px, 24vw, 112px) + 71.1vw + 6px);
        right: max(17px, env(safe-area-inset-right));
    }

    #start-preferences-panel {
        position: fixed;
        inset: auto max(9px, env(safe-area-inset-right)) max(9px, env(safe-area-inset-bottom)) max(9px, env(safe-area-inset-left));
        width: auto;
        max-height: min(70dvh, 520px);
    }

    #start-preferences[open] > summary {
        position: fixed;
        z-index: 20;
        right: max(17px, env(safe-area-inset-right));
        bottom: calc(min(70dvh, 520px) - 52px + max(9px, env(safe-area-inset-bottom)));
    }
}

@media (max-width: 760px) and (max-height: 760px) and (orientation: portrait) {
    #start-lobby-header {
        min-height: 70px;
    }

    #start-screen-box #start-lobby-header h2 {
        font-size: clamp(2rem, 10.5vw, 2.8rem);
    }

    #continue-match-button {
        min-height: 44px;
    }

    #start-launch-panel[data-step='modes'],
    #start-launch-panel[data-step='bot-settings'] {
        padding-top: 0;
    }

    #start-stage-modes,
    #start-stage-bot-settings {
        gap: 4px;
    }

    .start-stage-header {
        min-height: 44px;
    }

    .start-stage-header h3 {
        font-size: 1.35rem;
    }

    #start-screen .start-mode-card {
        min-height: 54px;
        padding-block: 5px;
    }

    #start-screen .start-mode-card-unavailable {
        min-height: 48px;
    }

    .start-segmented-options button,
    .start-bot-submit,
    .start-back-button,
    #start-preferences > summary {
        min-height: 44px;
    }

    .start-segmented-options button {
        font-size: 0.68rem;
    }

    #start-screen-actions,
    #start-screen-actions .secondary-start-button {
        min-height: 60px;
    }

    #start-screen-actions .secondary-start-button {
        font-size: 0.66rem;
    }
}

@media (max-height: 600px) and (orientation: landscape) {
    #start-screen {
        padding: 4px;
    }

    #start-screen-box {
        width: 100%;
        height: calc(100dvh - 8px);
        max-height: calc(100dvh - 8px);
        grid-template-rows: 42px minmax(0, 1fr) 44px;
        gap: 3px;
        padding: 4px 8px;
        border-radius: 12px;
    }

    #start-lobby-header {
        min-height: 42px;
        width: min(100%, 680px);
    }

    #start-screen-box #start-lobby-header h2 {
        font-size: clamp(1.6rem, 5.4vh, 2rem);
    }

    #start-lobby-layout,
    #start-lobby-layout[data-step='modes'],
    #start-lobby-layout[data-step='bot-settings'] {
        width: min(100%, 1040px);
        height: 100%;
        max-width: 100%;
        aspect-ratio: auto;
    }

    #start-board-showcase,
    #start-lobby-layout[data-step='modes'] #start-board-showcase,
    #start-lobby-layout[data-step='bot-settings'] #start-board-showcase {
        inset: 0 40% 0 0;
        width: auto;
        height: auto;
        aspect-ratio: auto;
    }

    #start-lobby-layout[data-step='landing'] #start-board-showcase {
        right: 18%;
    }

    #start-launch-panel[data-step='modes'],
    #start-launch-panel[data-step='bot-settings'] {
        inset: 0 0 0 auto;
        width: 41%;
        padding: 5px 8px;
        border-radius: 18px 4px 4px 18px;
    }

    #play-gateway-button {
        top: 50%;
        right: auto;
        left: 80%;
        width: 196px;
        transform: translate(-50%, -50%);
    }

    #ongoing-match-entry {
        top: 4px;
        left: 6px;
        transform: none;
    }

    #continue-match-button {
        min-height: 44px;
    }

    #start-stage-modes,
    #start-stage-bot-settings,
    #start-mode-grid {
        gap: 3px;
    }

    .start-stage-header {
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        min-height: 44px;
    }

    .start-stage-header h3 {
        font-size: 1.1rem;
    }

    .start-back-button,
    .start-segmented-options button,
    .start-bot-submit,
    #start-preferences > summary {
        min-height: 44px;
    }

    #start-screen .start-mode-card {
        min-height: 48px;
        grid-template-columns: 36px minmax(0, 1fr);
        gap: 7px;
        padding: 3px 7px;
    }

    #start-screen .start-mode-icon,
    #start-screen .start-mode-card-unavailable .start-mode-icon {
        width: 34px;
        height: 34px;
    }

    #start-screen .start-mode-icon .start-icon {
        width: 20px;
        height: 20px;
    }

    #start-screen .start-mode-copy strong {
        font-size: 0.85rem;
    }

    #start-screen .start-mode-copy > span:not(.start-mode-badge) {
        display: none;
    }

    #start-screen .start-mode-card-unavailable {
        min-height: 44px;
        grid-template-columns: 34px minmax(0, 1fr) auto;
    }

    #start-screen .start-mode-badge {
        padding: 3px 6px;
        font-size: 0.52rem;
    }

    .start-segmented-field {
        gap: 2px;
    }

    .start-segmented-field legend {
        font-size: 0.78rem;
    }

    .start-segmented-options button {
        padding-block: 3px;
        font-size: 0.58rem;
    }

    .start-bot-submit {
        font-size: 0.78rem;
    }

    #start-screen-actions {
        width: min(100%, 560px);
        min-height: 44px;
    }

    #start-screen-actions .secondary-start-button {
        min-height: 44px;
        padding: 3px 7px;
        font-size: 0.68rem;
    }

    #start-screen-actions .start-utility-icon {
        display: none;
    }

    #start-lobby-layout[data-step='modes'] ~ #start-preferences,
    #start-lobby-layout[data-step='bot-settings'] ~ #start-preferences {
        top: 51px;
        right: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #start-screen *,
    #start-screen *::before,
    #start-screen *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
