.modal-scene1 .modal-title {
    letter-spacing: 0.02em;
}

.modal-panel.modal-scene2 {
    border-radius: 12px;
}

.modal-scene2 .modal-btn-next {
    background-image: linear-gradient(to right, #5a3a72 0%, #3a5a72 51%, #5a3a72 100%);
}

.modal-panel.modal-scene3 {
    border-radius: 16px;
    border-color: #8ab4f8;
}

.modal-scene3 .modal-title {
    font-style: italic;
}

.modal-scene3 .modal-btn-next {
    background-image: linear-gradient(to right, #2a4a72 0%, #3a5a8a 51%, #2a4a72 100%);
}

.modal-panel.modal-scene4 {
    border-radius: 10px;
    border-color: #e8a04a;
}

.modal-scene4 .modal-title {
    font-style: italic;
}

.modal-scene4 .modal-btn-next {
    background-image: linear-gradient(to right, #8a4a1a 0%, #a65c28 51%, #8a4a1a 100%);
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #080b10;
    font-family: "Carlito", sans-serif;
}

#canvas {
    width: 100%;
    height: 100%;
    border: 2px solid #120864;
    box-sizing: border-box;
    outline: none;
}

#fps {
    position: fixed;
    bottom: 12px;
    right: 12px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font: 12px/1.4 monospace;
    border-radius: 4px;
    z-index: 10;
}

#modal-root {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    pointer-events: none;
    --modal-fade-duration: 120ms;
    --modal-fade-easing: ease-out;
}

#modal-root.is-open {
    display: block;
    pointer-events: auto;
}

#modal-root.is-closing {
    --modal-fade-duration: 180ms;
    --modal-fade-easing: ease-in;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: #000;
    opacity: 0;
    transition: opacity var(--modal-fade-duration) var(--modal-fade-easing);
}

#modal-root.is-visible .modal-backdrop {
    opacity: 0.55;
}

.modal-panel {
    position: fixed;
    left: calc(50% + var(--modal-offset-x, 0px));
    top: calc(50% + var(--modal-offset-y, 0px));
    transform: translate(-50%, -50%);
    width: 560px;
    max-width: calc(100vw - 32px);
    min-height: 420px;
    max-height: 90vh;
    height: auto;
    box-sizing: border-box;
    border: 2px solid #fff;
    border-radius: 8px;
    background: var(--modal-color, #333);
    padding: 16px 20px;
    opacity: 0;
    transition: opacity var(--modal-fade-duration) var(--modal-fade-easing);
    backdrop-filter: blur(11px);
    outline: none;
}

.modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-height: calc(90vh - 36px);
    overflow-x: hidden;
    overflow-y: auto;
}

#modal-root.is-visible .modal-panel {
    opacity: 1;
}

.modal-title {
    margin: 0;
    color: #fff;
    font-size: 28px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
}

.modal-image {
    margin-bottom: 8px;
    height: 200px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.modal-embed {
    margin-bottom: 8px;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    border: none;
    border-radius: 4px;
}

.modal-body {
    margin: 0;
    color: #fff;
    font-size: 18px;
    line-height: 1.4;
    text-align: center;
    white-space: pre-wrap;
}

.modal-actions {
    display: flex;
    gap: 16px;
    margin-top: auto;
}

.modal-spacer {
    flex: 0 0 auto;
    width: 100%;
}

.modal-divider {
    width: 100%;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.35);
}

#subtitle-root {
    position: fixed;
    left: 50%;
    bottom: 40px;
    z-index: 120;
    width: min(760px, calc(100vw - 40px));
    transform: translate(-50%, 12px);
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 160ms ease-out,
        transform 160ms ease-out;
}

#subtitle-root.is-visible {
    transform: translate(-50%, 0);
    opacity: 1;
}

.subtitle-line {
    box-sizing: border-box;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    padding: 8px 14px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.78);
    color: #fff;
    font-size: 20px;
    line-height: 1.35;
    text-align: center;
}

.modal-btn {
    margin: 16px;
    padding: 16px 32px;
    text-align: center;
    text-transform: uppercase;
    transition: 0.5s;
    border: 2px solid #fff;
    border-radius: 2px;
    background-size: 200% auto;
    color: white;
    cursor: pointer;
    font-size: 18px;
    letter-spacing: 0.06em;
}

.modal-btn:hover {
    background-position: right center;
}

.modal-btn-close {
    background-image: linear-gradient(to right, #766632 0%, #584436 51%, #766632 100%);
}

.modal-btn-next {
    background-image: linear-gradient(to right, #3a714f 0%, #345a72 51%, #3a714f 100%);
}

