/* 
   Gizzi Kombat — Stylesheet
   Design: Premium Dark / Neon Arena
*/

/*  Reset & base  */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100dvh;
    overflow: hidden;
    background: #080810;
    color: #fff;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    user-select: none;
    -webkit-user-select: none;
}

/*  Game container & canvas  */

#gameContainer {
    position: relative;
    width: 100%;
    height: 100dvh;
    display: grid;
    place-items: center;
}

#gameCanvas {
    display: block;
    background: #0a0a1a;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    /* Size is set by JS — these just prevent layout shifts */
    max-width: 100%;
    max-height: 100%;
}

/*  Global vignette + subtle scanlines — sits above canvas/video, below UI  */

.screen-vignette {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 6;
    background:
        radial-gradient(circle at 50% 45%, transparent 35%, rgba(0, 0, 0, 0.55) 85%, rgba(0, 0, 0, 0.82) 100%),
        repeating-linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0.03) 0,
            rgba(0, 0, 0, 0.03) 1px,
            transparent 1px,
            transparent 3px
        );
    mix-blend-mode: multiply;
}

@media (prefers-reduced-motion: reduce) {
    .screen-vignette {
        display: none;
    }
}

/*  Screen base (menus & overlays)  */

.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 3rem;
    z-index: 10;

    background-image: url('./assets/splash.png?v=2');
    background-size: cover;
    background-position: center;

    animation: bgBreathe 6s ease-in-out infinite;
}

@keyframes bgBreathe {

    0%,
    100% {
        background-position: center 50%;
    }

    50% {
        background-position: center 52%;
    }
}

/*  Game-over overlay — no background image, just a dark wash  */
.game-over-screen {
    background-image: none;
    background: transparent;
    justify-content: flex-end;
    pointer-events: none;
    /* canvas shows result; only buttons are interactive */
}

.game-over-screen .btn-group {
    pointer-events: all;
}

/*  Hidden utility  */

.hidden {
    display: none !important;
}

/*  Typography  */

.screen h1 {
    position: absolute;
    top: 40px;
    left: 60px;
    margin: 0;
    font-size: 4.5rem;
    line-height: 1;
    letter-spacing: 4px;
    text-shadow:
        0 0 20px rgba(168, 85, 247, 0.8),
        0 0 60px rgba(168, 85, 247, 0.3);
    color: #f0e6ff;
}

#pauseOverlay h2 {
    position: absolute;
    top: 40px;
    left: 60px;
    margin: 0;
    font-size: 3rem;
    letter-spacing: 6px;
    color: #e9d5ff;
    text-shadow: 0 0 20px rgba(168, 85, 247, 0.5);
}

#settingsScreen h2,
#instructionsScreen h2 {
    font-size: 2.4rem;
    letter-spacing: 8px;
    margin: 0 0 1.5rem 0;
    color: #e9d5ff;
    text-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
}

/*  Buttons  */

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 0;
}

button {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 1.8rem;
    font-weight: 400;
    text-align: left;
    background: none;
    border: none;
    outline: none;
    padding: 10px 20px;
    color: rgba(220, 200, 255, 0.75);
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.15s ease, transform 0.15s ease, text-shadow 0.15s ease;
    position: relative;
}

button:hover,
button:focus-visible {
    color: #fff;
    transform: translateX(6px);
    text-shadow: 0 0 12px rgba(168, 85, 247, 0.9);
    outline: none;
}

button:active {
    transform: translateX(3px) scale(0.97);
}

/*  Main menu screen — let the splash art be the hero  */

#menuScreen {
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 3rem;
}

#menuScreen h1 {
    display: none;
}

#menuScreen .btn-group {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    padding: 1.25rem 2rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.4));
    border-radius: 12px;
    backdrop-filter: blur(4px);
}

#menuScreen button {
    font-size: 1.6rem;
    padding: 10px 24px;
    text-align: center;
}

#menuScreen button:hover,
#menuScreen button:focus-visible {
    transform: translateY(-3px);
}

#menuScreen button:active {
    transform: translateY(-1px) scale(0.97);
}

/*  Title intro video — layered behind menu UI, static splash is fallback  */

.title-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.6s ease;
    /* Color-grade the Seedance clip to match the game's dark neon palette */
    filter: saturate(0.88) contrast(1.06) brightness(0.82);
}

.title-video.ready {
    opacity: 1;
}

/* Tint overlay that blends the title video into the menu color story */
#menuScreen::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% 60%, transparent 20%, rgba(8, 8, 16, 0.55) 65%, rgba(8, 8, 16, 0.88) 100%),
        linear-gradient(to bottom, rgba(8, 8, 16, 0.25) 0%, rgba(8, 8, 16, 0.45) 60%, rgba(8, 8, 16, 0.75) 100%);
}

#menuScreen h1,
#menuScreen .btn-group {
    position: relative;
    z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
    .title-video {
        display: none;
    }
}

/*  Super transformation cut-in overlay  */

.transform-cutscene {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    z-index: 5;
    filter: saturate(0.9) contrast(1.05) brightness(0.85);
}

/*  Select screens (player / opponent / arena)  */

#playerSelectScreen,
#selectScreen,
#arenaSelectScreen {
    background:
        radial-gradient(circle at 70% 30%, rgba(168, 85, 247, 0.12), transparent 35%),
        linear-gradient(to bottom, rgba(8, 8, 16, 0.98), rgba(8, 8, 16, 0.96));
    justify-content: flex-start;
    padding-top: 3rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

#playerSelectScreen h2,
#selectScreen h2,
#arenaSelectScreen h2 {
    font-size: 2.4rem;
    letter-spacing: 8px;
    margin: 0 0 1.5rem 0;
    color: #e9d5ff;
    text-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
}

.arena-grid {
    grid-template-columns: repeat(4, 1fr);
    max-width: 720px;
}

.arena-card img {
    width: 120px;
    height: 68px;
    object-fit: cover;
    border-radius: 6px;
    image-rendering: auto;
    transition: transform 0.15s ease;
}

.arena-card span {
    font-size: 1rem;
    letter-spacing: 1px;
}

.arena-card.selected,
.arena-card:focus-visible.selected {
    background: rgba(168, 85, 247, 0.22);
    border-color: rgba(250, 204, 21, 0.85);
    box-shadow: 0 0 18px rgba(250, 204, 21, 0.35);
}

/* 16:9 live preview panel (arena select) */
.arena-preview {
    position: absolute;
    top: 50%;
    right: 3rem;
    transform: translateY(-50%);
    width: 320px;
    max-width: 42vw;
    aspect-ratio: 16 / 9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(168, 85, 247, 0.4);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 24px rgba(168, 85, 247, 0.2);
}

.arena-preview.hidden {
    display: none;
}

.arena-preview img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    pointer-events: none;
}

.arena-preview span {
    position: relative;
    z-index: 1;
    padding: 8px 14px;
    background: rgba(0, 0, 0, 0.65);
    border-radius: 6px 6px 0 0;
    font-size: 1rem;
    letter-spacing: 2px;
    color: #e9d5ff;
    text-shadow: 0 0 8px rgba(168, 85, 247, 0.7);
    backdrop-filter: blur(4px);
}

.opponent-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 540px;
    margin-bottom: 1.5rem;
}

.opponent-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s, border-color 0.15s;
    min-width: 140px;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: rgba(168, 85, 247, 0.3);
    /* Reset <button> defaults */
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    color: inherit;
    text-align: center;
}

.opponent-card:hover,
.opponent-card:focus-visible {
    background: rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.7);
    transform: translateY(-3px) scale(1.02);
    outline: none;
}

.opponent-card:active {
    transform: translateY(-1px) scale(0.98);
}

.opponent-card img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    image-rendering: pixelated;
    pointer-events: none;
}

.opponent-card span {
    font-size: 1.25rem;
    letter-spacing: 2px;
    color: #e9d5ff;
    text-align: center;
    pointer-events: none;
}

.opponent-card-random img {
    width: 72px;
    height: 72px;
}

#selectBackButton {
    flex: 0;
}

/*  Pause button (top-center in-game)  */

.back-button {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 20;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    font-size: 18px;
    text-decoration: none;
    color: #fff;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(192, 132, 252, 0.35);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
}

.back-button:hover {
    background: rgba(168, 85, 247, 0.25);
    transform: scale(1.05);
}

.pause-button {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    padding: 0;
    display: grid;
    place-items: center;
    font-size: 16px;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    z-index: 5;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
}

.pause-button:hover {
    background: rgba(168, 85, 247, 0.25);
    transform: translateX(-50%) scale(1.05);
    text-shadow: none;
    color: #fff;
}

.pause-button:active {
    transform: translateX(-50%) scale(0.97);
}

/*  Settings screen  */

#settingsScreen {
    background-image:
        linear-gradient(to right, rgba(0, 0, 0, 0.88) 40%, rgba(0, 0, 0, 0.4)),
        url('./assets/splash.png?v=2');
    justify-content: flex-start;
    padding-top: 3rem;
}

.settings-form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-left: 0.5rem;
    margin-bottom: 1rem;
}

.settings-form label {
    margin-top: 10px;
    font-size: 1.2rem;
    letter-spacing: 4px;
    color: #c4b5fd;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin-top: 12px !important;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #a855f7;
    cursor: pointer;
}

.settings-form input[type="range"] {
    width: 220px;
    accent-color: #a855f7;
    cursor: pointer;
}

.settings-form select {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.06);
    color: #e9d5ff;
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 1.1rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s;
    backdrop-filter: blur(4px);
}

.settings-form select:hover,
.settings-form select:focus {
    border-color: rgba(168, 85, 247, 0.7);
}

#settingsBackButton {
    margin-top: 0.5rem;
    flex: 0;
}

/*  Instructions screen  */

#instructionsScreen {
    background-image:
        linear-gradient(to right, rgba(0, 0, 0, 0.88) 40%, rgba(0, 0, 0, 0.4)),
        url('./assets/splash.png?v=2');
    justify-content: flex-start;
    padding-top: 3rem;
    overflow-y: auto;
    gap: 0;
}

#instructionsScreen p {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.9rem;
    line-height: 1.6;
    color: rgba(220, 200, 255, 0.85);
    margin: 0 0 6px 0;
    max-width: 480px;
}

#instructionsScreen strong {
    color: #f0abfc;
}

.controls-table {
    border-collapse: collapse;
    margin: 0.5rem 0 1.2rem 0;
    font-size: 0.9rem;
    font-family: system-ui, sans-serif;
}

.controls-table th,
.controls-table td {
    padding: 4px 16px 4px 0;
    text-align: left;
    color: rgba(220, 200, 255, 0.85);
    border: none;
}

.controls-table th {
    color: #c084fc;
    letter-spacing: 2px;
    font-size: 0.8rem;
    text-transform: uppercase;
    padding-bottom: 8px;
}

#instructionsBackButton {
    margin-top: 1rem;
    flex: 0;
}

/*  About page  */

.about-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 0 0 1.2rem 0;
    max-width: 720px;
}

.about-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: 8px;
    padding: 12px 14px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.8rem;
    line-height: 1.5;
    color: rgba(220, 200, 255, 0.85);
    backdrop-filter: blur(4px);
}

.about-card-title {
    display: block;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 1.1rem;
    letter-spacing: 2px;
    color: #f0abfc;
    margin-bottom: 4px;
}

.controls-table kbd {
    display: inline-block;
    min-width: 22px;
    padding: 2px 7px;
    margin-right: 4px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(168, 85, 247, 0.4);
    border-bottom-width: 2px;
    border-radius: 4px;
    color: #f0e6ff;
    font-family: system-ui, sans-serif;
    font-size: 0.75rem;
    line-height: 1.2;
    text-align: center;
}

.tips-list {
    margin: 0 0 1.2rem 0;
    padding-left: 1.2rem;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.9rem;
    line-height: 1.6;
    color: rgba(220, 200, 255, 0.85);
    max-width: 480px;
}

.tips-list li {
    margin-bottom: 4px;
}

.author-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    margin: 1rem 0;
    padding: 12px 16px;
    max-width: 360px;
    background: rgba(168, 85, 247, 0.08);
    border: 1px solid rgba(168, 85, 247, 0.35);
    border-radius: 8px;
}

.author-name {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 1.6rem;
    letter-spacing: 3px;
    color: #f0e6ff;
}

.author-link {
    font-family: system-ui, sans-serif;
    font-size: 0.85rem;
    color: #c084fc;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.author-link:hover {
    color: #f0abfc;
    border-color: rgba(168, 85, 247, 0.6);
}

#instructionsScreen .author-line {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.8rem;
    line-height: 1.5;
    color: rgba(220, 200, 255, 0.7);
    margin: 2px 0 0 0;
}

/*  Mobile controls  */

#mobileControls {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 20;
}

.touch-button {
    position: absolute;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 2px solid rgba(168, 85, 247, 0.5);
    background: rgba(168, 85, 247, 0.15);
    backdrop-filter: blur(4px);
    color: rgba(255, 255, 255, 0.9);
    font-size: 22px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    display: grid;
    place-items: center;
    touch-action: none;
    pointer-events: all;
    cursor: pointer;
    transition: background 0.1s, transform 0.1s;
    outline: none;
}

.touch-button:active {
    background: rgba(168, 85, 247, 0.5);
    transform: scale(0.92);
    text-shadow: none;
}

/* Positions — left cluster */
.touch-left {
    left: 20px;
    bottom: 30px;
}

.touch-right {
    left: 110px;
    bottom: 30px;
}

.touch-jump {
    left: 65px;
    bottom: 120px;
}

/* Positions — right cluster (diamond layout) */
/*
    [U]
  [I] [J]
    [K]
*/
.touch-attack {
    right: 30px;
    bottom: 30px;
}

/* J — bottom */
.touch-block {
    right: 30px;
    bottom: 120px;
}

/* K — top */
.touch-sweep {
    right: 120px;
    bottom: 75px;
}

/* I — left */
.touch-heavy {
    right: 30px;
    bottom: 210px;
}

/* O — left of heavy */
.touch-special {
    right: 120px;
    bottom: 210px;
}

/* U — far top */

/*  Rotate overlay  */

#rotateOverlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 8, 16, 0.96);
    color: #e9d5ff;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    z-index: 9999;
    font-size: 1.3rem;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(168, 85, 247, 0.5);
}

/*  Responsive  */

@media screen and (orientation: landscape) and (max-height: 500px) {
    .screen {
        padding: 1.5rem 2rem;
    }

    .screen h1 {
        font-size: 2.2rem;
        top: 16px;
        left: 32px;
        letter-spacing: 3px;
    }

    #pauseOverlay h2 {
        font-size: 1.8rem;
        top: 16px;
        left: 32px;
    }

    #settingsScreen h2,
    #instructionsScreen h2 {
        font-size: 1.6rem;
        letter-spacing: 4px;
    }

    button {
        font-size: 1.2rem;
        padding: 6px 14px;
    }

    .settings-form {
        max-height: 65dvh;
        overflow-y: auto;
    }

    .settings-form label {
        font-size: 0.9rem;
        letter-spacing: 3px;
    }

    .about-cards {
        grid-template-columns: 1fr;
        max-width: 420px;
        gap: 8px;
    }

    .about-card {
        padding: 8px 12px;
        font-size: 0.75rem;
    }

    .about-card-title {
        font-size: 0.95rem;
    }

    .controls-table {
        font-size: 0.8rem;
    }

    .controls-table kbd {
        min-width: 18px;
        padding: 1px 6px;
        font-size: 0.7rem;
    }

    .author-card {
        padding: 10px 14px;
    }

    .touch-button {
        width: 56px;
        height: 56px;
        font-size: 16px;
    }

    .touch-left {
        left: 12px;
        bottom: 14px;
    }

    .touch-right {
        left: 80px;
        bottom: 14px;
    }

    .touch-jump {
        left: 46px;
        bottom: 82px;
    }

    .touch-attack {
        right: 22px;
        bottom: 14px;
    }

    .touch-block {
        right: 22px;
        bottom: 82px;
    }

    .touch-sweep {
        right: 90px;
        bottom: 48px;
    }

    .touch-heavy {
        right: 22px;
        bottom: 150px;
    }

    .touch-special {
        right: 90px;
        bottom: 150px;
    }

    #playerSelectScreen h2,
    #selectScreen h2,
    #arenaSelectScreen h2 {
        font-size: 1.6rem;
        letter-spacing: 4px;
        margin-bottom: 1rem;
    }

    .opponent-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        max-width: 100%;
    }

    .arena-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .arena-preview {
        display: none;
    }

    .opponent-card {
        min-width: auto;
        padding: 10px 6px;
        gap: 6px;
    }

    .opponent-card img {
        width: 48px;
        height: 48px;
    }

    .arena-card img {
        width: 100%;
        height: auto;
        max-height: 52px;
    }

    .opponent-card span {
        font-size: 0.85rem;
        letter-spacing: 1px;
    }

    .opponent-card-random img {
        width: 48px;
        height: 48px;
    }

    #menuScreen {
        padding-bottom: 1.5rem;
    }

    #menuScreen .btn-group {
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }

    #menuScreen button {
        font-size: 1.1rem;
        padding: 6px 14px;
    }
}