:root {
    --bg: #f3f5f9;
    --surface: rgba(255, 255, 255, 0.88);
    --surface-solid: #ffffff;

    --ink: #10131a;
    --ink-soft: #5c6472;
    --ink-muted: #9198a6;

    --line: rgba(16, 19, 26, 0.08);

    --primary: #6d5dfc;
    --primary-dark: #5546e8;
    --primary-soft: #eeeafd;

    --danger: #ef476f;
    --danger-soft: #fff0f3;

    --success: #15a875;
    --warning: #e89b26;

    --radius-xl: 32px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 14px;

    --shadow:
        0 18px 60px rgba(26, 31, 44, 0.08);

    --shadow-soft:
        0 8px 24px rgba(26, 31, 44, 0.06);
}


* {
    box-sizing: border-box;
}


html {
    min-height: 100%;
    background: var(--bg);
}


body {
    min-height: 100vh;
    margin: 0;

    color: var(--ink);
    background:
        radial-gradient(
            circle at 10% 5%,
            rgba(109, 93, 252, 0.13),
            transparent 28%
        ),
        radial-gradient(
            circle at 95% 20%,
            rgba(255, 108, 141, 0.1),
            transparent 25%
        ),
        var(--bg);

    font-family:
        Pretendard,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        "Noto Sans KR",
        sans-serif;

    overflow-x: hidden;
}


button,
input {
    font: inherit;
}


button {
    -webkit-tap-highlight-color: transparent;
}


button,
input {
    outline: none;
}


button:focus-visible,
input:focus-visible {
    box-shadow:
        0 0 0 4px rgba(109, 93, 252, 0.18);
}


.ambient {
    position: fixed;
    pointer-events: none;
    border-radius: 999px;
    filter: blur(80px);
    opacity: 0.25;
}


.ambient-one {
    width: 220px;
    height: 220px;
    top: -60px;
    left: -80px;
    background: #8c7dff;
}


.ambient-two {
    width: 260px;
    height: 260px;
    right: -130px;
    top: 280px;
    background: #ff92aa;
}


.app-shell {
    position: relative;
    width: min(100%, 720px);
    min-height: 100vh;
    margin: 0 auto;
    padding:
        max(18px, env(safe-area-inset-top))
        18px
        calc(40px + env(safe-area-inset-bottom));
}


.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 42px;
}


.brand-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;

    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;

    cursor: pointer;
}


.brand-mark {
    display: grid;
    place-items: center;

    width: 42px;
    height: 42px;

    border-radius: 14px;

    color: white;
    background: var(--ink);

    font-size: 21px;
    font-weight: 900;
    font-style: italic;

    transform: rotate(-5deg);
}


.brand-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    line-height: 1;
}


.brand-text strong {
    font-size: 15px;
    letter-spacing: 0.08em;
}


.brand-text small {
    margin-top: 4px;

    color: var(--ink-muted);

    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.22em;
}


.connection-badge {
    display: flex;
    align-items: center;
    gap: 7px;

    min-height: 38px;
    padding: 0 13px;

    border: 1px solid var(--line);
    border-radius: 999px;

    background: rgba(255, 255, 255, 0.68);

    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 700;

    backdrop-filter: blur(16px);
}


.connection-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;
    background: var(--warning);

    box-shadow:
        0 0 0 4px rgba(232, 155, 38, 0.13);
}


.connection-badge.online .connection-dot {
    background: var(--success);

    box-shadow:
        0 0 0 4px rgba(21, 168, 117, 0.13);
}


.screen {
    display: none;
}


.screen.active {
    display: block;
    animation: screenIn 0.45s ease both;
}


@keyframes screenIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.hero {
    padding: 20px 4px 44px;
}


.eyebrow,
.sub-label {
    color: var(--primary);

    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.18em;
}


.hero h1,
.final-hero h1 {
    margin: 16px 0 0;

    font-size:
        clamp(42px, 12vw, 72px);

    line-height: 1.04;
    letter-spacing: -0.055em;
}


.hero-description {
    margin: 22px 0 0;

    color: var(--ink-soft);

    font-size: 17px;
    line-height: 1.65;
}


.home-actions {
    display: flex;
    flex-direction: column;
    gap: 20px;
}


.primary-button,
.secondary-button,
.danger-button,
.ghost-danger-button {
    min-height: 56px;

    border: 0;
    border-radius: var(--radius-md);

    padding: 0 20px;

    font-weight: 800;
    font-size: 15px;

    cursor: pointer;

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        opacity 0.15s ease;
}


.primary-button:active,
.secondary-button:active,
.danger-button:active,
.ghost-danger-button:active {
    transform: scale(0.98);
}


.primary-button {
    color: white;
    background:
        linear-gradient(
            135deg,
            var(--primary),
            #806efc
        );

    box-shadow:
        0 12px 28px rgba(109, 93, 252, 0.24);
}


.primary-button:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    box-shadow: none;
}


.secondary-button {
    color: var(--ink);
    background: #edf0f5;
}


.danger-button {
    color: white;
    background: var(--danger);

    box-shadow:
        0 12px 28px rgba(239, 71, 111, 0.22);
}


.ghost-danger-button {
    color: var(--danger);
    background: var(--danger-soft);
}


.large-button {
    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 70px;
    padding: 0 24px;

    border-radius: 22px;

    font-size: 17px;
}


.button-arrow {
    font-size: 24px;
    font-weight: 400;
}


.full-button {
    width: 100%;
}


.divider {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;

    color: var(--ink-muted);

    font-size: 11px;
}


.divider span {
    height: 1px;
    background: var(--line);
}


.join-card,
.panel,
.action-card,
.host-panel,
.room-header-card {
    border: 1px solid rgba(255, 255, 255, 0.7);
    background: var(--surface);

    box-shadow: var(--shadow);

    backdrop-filter: blur(22px);
}


.join-card {
    display: flex;
    flex-direction: column;
    gap: 18px;

    padding: 22px;

    border-radius: var(--radius-xl);
}


.field-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}


.field-label {
    padding-left: 4px;

    color: var(--ink-soft);

    font-size: 12px;
    font-weight: 800;
}


.text-input {
    width: 100%;
    min-height: 58px;

    padding: 0 17px;

    border: 1px solid var(--line);
    border-radius: var(--radius-sm);

    color: var(--ink);
    background: #f7f8fb;

    font-size: 16px;

    transition:
        border-color 0.2s ease,
        background 0.2s ease;
}


.text-input:focus {
    border-color:
        rgba(109, 93, 252, 0.55);

    background: white;
}


.code-input {
    font-size: 22px;
    font-weight: 850;
    letter-spacing: 0.08em;
}


.room-header-card {
    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 20px;

    border-radius: 24px;

    margin-bottom: 14px;
}


.room-code-line {
    display: flex;
    align-items: center;
    gap: 10px;

    margin-top: 6px;
}


.room-code-line strong {
    font-size: 34px;
    letter-spacing: -0.04em;
}


.mini-button {
    min-height: 36px;

    padding: 0 12px;

    border: 0;
    border-radius: 11px;

    color: var(--primary);
    background: var(--primary-soft);

    font-size: 12px;
    font-weight: 800;

    cursor: pointer;
}


.round-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    min-width: 70px;
    min-height: 70px;

    border-radius: 22px;

    color: var(--ink-soft);
    background: #f0f2f6;

    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.12em;
}


.round-badge strong {
    margin-top: 3px;

    color: var(--ink);

    font-size: 27px;
    letter-spacing: normal;
}


.status-banner {
    margin-bottom: 14px;
    padding: 14px 17px;

    border-radius: 16px;

    color: var(--primary-dark);
    background: var(--primary-soft);

    font-size: 13px;
    font-weight: 750;
    line-height: 1.45;
}


.word-card {
    position: relative;
    overflow: hidden;

    padding: 32px 24px;

    border-radius: 30px;

    color: white;
    background:
        linear-gradient(
            145deg,
            #171923,
            #272c3c
        );

    box-shadow:
        0 20px 50px rgba(15, 18, 26, 0.22);

    text-align: center;

    margin-bottom: 16px;
}


.word-card::after {
    content: "";

    position: absolute;
    width: 170px;
    height: 170px;
    right: -70px;
    top: -80px;

    border-radius: 50%;

    background:
        rgba(125, 108, 255, 0.32);

    filter: blur(8px);
}


.word-card-label {
    position: relative;
    z-index: 1;

    color: rgba(255, 255, 255, 0.55);

    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.2em;
}


.word-card p {
    position: relative;
    z-index: 1;

    margin: 15px 0 8px;

    color: rgba(255, 255, 255, 0.68);

    font-size: 13px;
}


.word-card strong {
    position: relative;
    z-index: 1;

    display: block;

    margin: 12px 0 18px;

    font-size:
        clamp(38px, 11vw, 64px);

    line-height: 1.15;
    letter-spacing: -0.05em;
}


.word-card small {
    position: relative;
    z-index: 1;

    color: rgba(255, 255, 255, 0.48);

    font-size: 11px;
}


.panel,
.action-card,
.host-panel {
    margin-bottom: 14px;

    padding: 21px;

    border-radius: var(--radius-lg);
}


.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}


.panel-heading.compact {
    align-items: center;
}


.panel h2,
.action-card h2 {
    margin: 7px 0 0;

    font-size: 22px;
    letter-spacing: -0.03em;
}


.panel-description,
.action-card p {
    margin: 12px 0 18px;

    color: var(--ink-soft);

    font-size: 13px;
    line-height: 1.6;
}


.section-icon {
    display: grid;
    place-items: center;

    width: 46px;
    height: 46px;

    margin-bottom: 18px;

    border-radius: 16px;

    color: white;
    background: var(--primary);

    font-size: 22px;
    font-weight: 900;
}


.action-card form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}


.count-chip,
.revote-badge {
    display: inline-flex;
    align-items: center;

    min-height: 34px;
    padding: 0 11px;

    border-radius: 999px;

    font-size: 11px;
    font-weight: 850;
}


.count-chip {
    color: var(--ink-soft);
    background: #f0f2f6;
}


.revote-badge {
    color: #b56e09;
    background: #fff4d9;
}


.scoreboard-list,
.result-list,
.final-ranking-list {
    display: flex;
    flex-direction: column;
    gap: 8px;

    margin-top: 18px;
}


.score-row,
.result-row,
.final-ranking-row {
    display: flex;
    align-items: center;

    min-height: 58px;
    padding: 10px 13px;

    border: 1px solid var(--line);
    border-radius: 15px;

    background: rgba(248, 249, 251, 0.78);
}


.score-rank {
    display: grid;
    place-items: center;

    width: 34px;
    height: 34px;

    flex: none;

    margin-right: 11px;

    border-radius: 11px;

    color: var(--ink-soft);
    background: #eceff4;

    font-size: 12px;
    font-weight: 900;
}


.score-rank.top {
    color: #6f5700;
    background:
        linear-gradient(
            135deg,
            #ffe896,
            #ffc95f
        );
}


.player-info {
    min-width: 0;
    flex: 1;
}


.player-name {
    display: flex;
    align-items: center;
    gap: 7px;

    font-weight: 800;
    font-size: 14px;
}


.me-chip {
    display: inline-flex;
    align-items: center;

    min-height: 20px;
    padding: 0 7px;

    border-radius: 999px;

    color: var(--primary);
    background: var(--primary-soft);

    font-size: 9px;
    font-weight: 900;
}


.offline-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;
    background: #c6cbd4;
}


.score-value {
    flex: none;

    font-size: 17px;
    font-weight: 900;
}


.vote-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 9px;

    margin: 18px 0;
}


.vote-option {
    position: relative;

    min-height: 62px;

    border: 1px solid var(--line);
    border-radius: 16px;

    color: var(--ink);
    background: #f7f8fa;

    font-size: 14px;
    font-weight: 800;

    cursor: pointer;

    transition:
        border-color 0.18s ease,
        color 0.18s ease,
        background 0.18s ease,
        transform 0.18s ease;
}


.vote-option.selected {
    border-color: var(--primary);

    color: var(--primary-dark);
    background: var(--primary-soft);

    transform: translateY(-2px);
}


.vote-option:disabled {
    cursor: default;
}


.result-row {
    gap: 12px;
}


.result-name {
    min-width: 72px;

    font-size: 13px;
    font-weight: 800;
}


.result-bar-track {
    height: 8px;
    flex: 1;

    overflow: hidden;

    border-radius: 999px;
    background: #e9ebf0;
}


.result-bar-value {
    height: 100%;

    border-radius: inherit;

    background:
        linear-gradient(
            90deg,
            var(--primary),
            #9388ff
        );

    transition: width 0.7s ease;
}


.result-count {
    width: 34px;

    text-align: right;

    font-size: 13px;
    font-weight: 900;
}


.notice-card {
    margin-top: 14px;
    padding: 15px;

    border-radius: 15px;

    font-size: 13px;
    font-weight: 750;
    line-height: 1.5;
}


.notice-card.warning {
    color: #8a5b06;
    background: #fff5dc;
}


.host-panel {
    position: sticky;
    bottom: calc(12px + env(safe-area-inset-bottom));

    z-index: 10;

    border:
        1px solid rgba(109, 93, 252, 0.2);

    box-shadow:
        0 20px 50px rgba(27, 31, 44, 0.16);
}


.host-label {
    margin-bottom: 12px;

    color: var(--primary);

    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.18em;
}


.round-end-actions {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 9px;
}


.vote-progress {
    margin-top: 14px;
}


.vote-progress-head {
    display: flex;
    justify-content: space-between;

    margin-bottom: 8px;

    color: var(--ink-soft);

    font-size: 12px;
}


.vote-progress-head strong {
    color: var(--ink);
}


.progress-track {
    height: 8px;

    overflow: hidden;

    border-radius: 999px;
    background: #e7e9ef;
}


.progress-value {
    width: 0%;
    height: 100%;

    border-radius: inherit;

    background:
        linear-gradient(
            90deg,
            var(--primary),
            #9388ff
        );

    transition: width 0.35s ease;
}


.final-hero {
    padding: 12px 4px 30px;

    text-align: center;
}


.trophy-orb {
    display: grid;
    place-items: center;

    width: 82px;
    height: 82px;

    margin: 0 auto 22px;

    border-radius: 28px;

    color: #6f5400;

    background:
        linear-gradient(
            145deg,
            #fff1a5,
            #ffc656
        );

    box-shadow:
        0 16px 36px rgba(255, 190, 64, 0.26);

    font-size: 35px;

    transform: rotate(-4deg);
}


.final-hero h1 {
    font-size: 48px;
}


.final-hero p {
    color: var(--ink-soft);
}


.winner-card {
    padding: 30px 22px;

    margin-bottom: 14px;

    border-radius: 30px;

    text-align: center;

    color: white;

    background:
        radial-gradient(
            circle at 80% 10%,
            rgba(144, 124, 255, 0.42),
            transparent 35%
        ),
        linear-gradient(
            145deg,
            #161922,
            #272c3b
        );

    box-shadow:
        0 20px 50px rgba(18, 21, 30, 0.2);
}


.winner-card > span {
    color: rgba(255, 255, 255, 0.48);

    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.22em;
}


.winner-names {
    margin: 18px 0 8px;

    font-size: 34px;
    font-weight: 900;
    letter-spacing: -0.04em;
}


.winner-card > strong {
    color: #c8c1ff;

    font-size: 16px;
}


.final-ranking-row {
    min-height: 64px;
}


.modal-backdrop {
    position: fixed;
    inset: 0;

    z-index: 100;

    display: grid;
    place-items: center;

    padding: 20px;

    background: rgba(12, 14, 20, 0.58);

    backdrop-filter: blur(12px);
}


.modal-card {
    width: min(100%, 420px);

    padding: 26px;

    border-radius: 28px;

    background: white;

    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.25);

    animation: modalIn 0.25s ease both;
}


@keyframes modalIn {
    from {
        opacity: 0;
        transform:
            translateY(15px)
            scale(0.97);
    }

    to {
        opacity: 1;
        transform:
            translateY(0)
            scale(1);
    }
}


.modal-icon {
    display: grid;
    place-items: center;

    width: 46px;
    height: 46px;

    margin-bottom: 18px;

    border-radius: 15px;

    color: var(--danger);
    background: var(--danger-soft);

    font-size: 22px;
    font-weight: 900;
}


.modal-card h2 {
    margin: 0;

    font-size: 23px;
}


.modal-card p {
    margin: 11px 0 22px;

    color: var(--ink-soft);
    line-height: 1.6;
}


.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}


.toast {
    position: fixed;

    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom));

    z-index: 200;

    max-width: calc(100vw - 36px);

    padding: 13px 17px;

    border-radius: 14px;

    color: white;
    background: rgba(20, 23, 31, 0.94);

    box-shadow:
        0 15px 40px rgba(0, 0, 0, 0.2);

    font-size: 13px;
    font-weight: 750;

    opacity: 0;
    pointer-events: none;

    transform:
        translate(-50%, 12px);

    transition:
        opacity 0.25s ease,
        transform 0.25s ease;
}


.toast.show {
    opacity: 1;

    transform:
        translate(-50%, 0);
}


.hidden {
    display: none !important;
}


@media (min-width: 620px) {
    .app-shell {
        padding-left: 28px;
        padding-right: 28px;
    }

    .join-card,
    .panel,
    .host-panel {
        padding: 26px;
    }

    .vote-grid {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }
}


@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}
