/* @import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap'); */

:root {
    --bg-deep: #06131f;
    --bg-ocean: #0b2030;
    --panel: rgba(9, 27, 42, 0.82);
    --panel-strong: rgba(15, 39, 60, 0.96);
    --text-main: #eef6fb;
    --text-soft: #aac2d3;
    --blue: #45b4ff;
    --blue-strong: #1d84d4;
    --red: #ff5368;
    --red-strong: #b41f39;
    --line: rgba(129, 192, 232, 0.18);
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
    --radius: 28px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: 'arial','Vazirmatn', sans-serif;
    color: var(--text-main);
    background:
        radial-gradient(circle at top, rgba(69, 180, 255, 0.18), transparent 30%),
        radial-gradient(circle at bottom right, rgba(255, 83, 104, 0.16), transparent 30%),
        linear-gradient(180deg, var(--bg-ocean) 0%, var(--bg-deep) 100%);
    overflow-x: hidden;
}

.sea-glow {
    position: fixed;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    filter: blur(24px);
    opacity: 0.4;
    pointer-events: none;
    z-index: 0;
}

.sea-glow-left {
    top: -120px;
    left: -120px;
    background: radial-gradient(circle, rgba(69, 180, 255, 0.3), transparent 65%);
}

.sea-glow-right {
    bottom: -120px;
    right: -120px;
    background: radial-gradient(circle, rgba(255, 83, 104, 0.24), transparent 65%);
}

.screen {
    display: none !important;
    position: relative;
    z-index: 1;
}

.screen.screen-active {
    display: grid !important;
}

[hidden] {
    display: none !important;
}

.shell {
    width: min(1120px, calc(100% - 32px));
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    padding: 32px 0 40px;
    display: grid;
    place-content: center;
    gap: 24px;
}

.shell-narrow {
    width: min(560px, calc(100% - 28px));
}

.panel {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(145deg, rgba(69, 180, 255, 0.08), transparent 40%),
        linear-gradient(180deg, var(--panel-strong) 0%, var(--panel) 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel::before {
    content: "";
    position: absolute;
    inset: auto auto -80px -50px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(69, 180, 255, 0.18), transparent 68%);
    pointer-events: none;
}

.hero-panel,
.setup-panel,
.waiting-panel,
.role-panel,
.end-panel {
    padding: 28px;
}

.hero-panel > * + *,
.setup-panel > * + *,
.waiting-panel > * + *,
.role-panel > * + *,
.end-panel > * + *,
.modal-card > * + * {
    margin-top: 18px;
}

.eyebrow,
.step-label,
.role-kicker,
.modal-result-kicker {
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.8rem;
}

.eyebrow,
.step-label {
    color: var(--blue);
}

.title {
    margin: 0 0 14px;
    font-size: clamp(2.2rem, 7vw, 4.8rem);
    line-height: 1.15;
}

.title-small {
    margin: 0 0 14px;
    font-size: clamp(1.6rem, 5vw, 2.4rem);
    line-height: 1.35;
}

.subtitle,
.subtitle-small,
.waiting-panel p,
.role-description {
    margin: 0;
    color: var(--text-soft);
    line-height: 2;
}

.setup-form,
.game-actions {
    display: grid;
    gap: 20px;
}

.field {
    display: grid;
    gap: 12px;
}

.field label {
    color: var(--text-soft);
    font-size: 0.95rem;
}

.field input {
    width: 100%;
    border: 1px solid rgba(129, 192, 232, 0.22);
    border-radius: 18px;
    background: rgba(4, 18, 30, 0.72);
    color: var(--text-main);
    font: inherit;
    padding: 15px 16px;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.field input:focus {
    border-color: rgba(69, 180, 255, 0.68);
    box-shadow: 0 0 0 4px rgba(69, 180, 255, 0.14);
    transform: translateY(-1px);
}

.field-hint {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.92rem;
    line-height: 1.9;
}

.btn {
    border: 0;
    border-radius: 18px;
    padding: 15px 18px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.btn + .btn,
.field + .btn,
.modal-result + .btn,
.game-actions .btn {
    margin-top: 8px;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    color: #03131f;
    background: linear-gradient(135deg, #7ad0ff 0%, #41a7ff 100%);
    box-shadow: 0 16px 30px rgba(69, 180, 255, 0.26);
}

.btn-secondary {
    color: var(--text-main);
    background: linear-gradient(135deg, rgba(255, 83, 104, 0.92) 0%, rgba(180, 31, 57, 0.92) 100%);
    box-shadow: 0 16px 30px rgba(180, 31, 57, 0.26);
}

.role-panel {
    display: grid;
    gap: 24px;
}

.role-scene {
    position: relative;
    padding: 24px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.role-content {
    flex: 1 1 auto;
}

.role-image {
    width: 120px;
    height: 200px;
    border-radius: 18px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.2);
    flex: 0 0 auto;
}

.role-scene::after {
    content: "";
    position: absolute;
    inset: auto -40px -48px auto;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    opacity: 0.75;
}

.role-pirate {
    background:
        linear-gradient(160deg, rgba(69, 180, 255, 0.22), rgba(7, 20, 31, 0.86)),
        linear-gradient(180deg, rgba(19, 66, 96, 0.96), rgba(6, 22, 34, 0.94));
}

.role-pirate::after {
    background: radial-gradient(circle, rgba(84, 194, 255, 0.42), transparent 68%);
}

.role-pirate .role-kicker {
    color: #9addff;
}

.role-rebel {
    background:
        linear-gradient(160deg, rgba(255, 83, 104, 0.18), rgba(25, 8, 12, 0.9)),
        linear-gradient(180deg, rgba(92, 12, 26, 0.96), rgba(28, 7, 10, 0.94));
}

.role-rebel::after {
    background: radial-gradient(circle, rgba(255, 95, 116, 0.42), transparent 68%);
}

.role-rebel .role-kicker {
    color: #ff9ba8;
}

.role-name {
    margin: 0 0 12px;
    font-size: clamp(1.8rem, 6vw, 2.8rem);
    line-height: 1.3;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 180ms ease, visibility 180ms ease;
}

.modal-open {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(1, 7, 12, 0.76);
}

.modal-card {
    position: relative;
    width: min(100%, 460px);
    padding: 24px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(14, 38, 57, 0.98), rgba(8, 20, 31, 0.98));
    border: 1px solid rgba(129, 192, 232, 0.2);
    box-shadow: var(--shadow);
    display: grid;
    gap: 14px;
}

.modal-result {
    border-radius: 20px;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-result h3 {
    margin: 0 0 10px;
    font-size: 1.5rem;
    line-height: 1.4;
}

.modal-result p {
    margin: 0;
    line-height: 1.95;
}

.modal-result.role-pirate {
    background: linear-gradient(180deg, rgba(18, 72, 109, 0.8), rgba(8, 26, 40, 0.9));
}

.modal-result.role-pirate .modal-result-kicker {
    color: #9addff;
}

.modal-result.role-rebel {
    background: linear-gradient(180deg, rgba(107, 17, 33, 0.82), rgba(32, 8, 12, 0.92));
}

.modal-result.role-rebel .modal-result-kicker {
    color: #ff9ba8;
}

.modal-result.role-unknown {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-soft);
}

.hidden {
    display: none !important;
}

@media (min-width: 860px) {
    #screen-setup.shell {
        grid-template-columns: 1.2fr 0.9fr;
        align-items: center;
    }

    .hero-panel,
    .setup-panel {
        min-height: 420px;
        display: grid;
        align-content: center;
    }
}

@media (max-width: 640px) {
    .shell,
    .shell-narrow {
        width: min(100% - 20px, 1120px);
        padding: 18px 0 24px;
    }

    .hero-panel,
    .setup-panel,
    .waiting-panel,
    .role-panel,
    .end-panel,
    .modal-card {
        padding: 20px;
        border-radius: 22px;
    }

    .role-scene {
        padding: 20px;
        gap: 14px;
    }

    .role-image {
        width: 110px;
        height: 200px;
    }

    .hero-panel > * + *,
    .setup-panel > * + *,
    .waiting-panel > * + *,
    .role-panel > * + *,
    .end-panel > * + *,
    .modal-card > * + * {
        margin-top: 14px;
    }
}
