/* ===========================
   SORTIA - Style System
   =========================== */

/* --- Design Tokens --- */
:root {
    /* Color Palette */
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-surface: rgba(255, 255, 255, 0.04);
    --bg-glass: rgba(255, 255, 255, 0.06);
    --text-primary: #e0e0ff;
    --text-secondary: #8888aa;
    --text-muted: #555570;
    --accent-primary: #6c63ff;
    --accent-secondary: #ff6584;
    --accent-glow: rgba(108, 99, 255, 0.3);
    --success: #00c897;
    --warning: #ffb347;
    --danger: #ff4757;

    /* Card Colors */
    --card-red: #ff4757;
    --card-blue: #4dabf7;
    --card-green: #51cf66;
    --card-yellow: #fcc419;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;

    /* Font */
    --font-main: 'Outfit', 'Noto Sans JP', sans-serif;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    user-select: none;
    -webkit-user-select: none;
}

/* --- Screen Management --- */
.screen {
    display: none;
    width: 100%;
    height: 100%;
}

.screen.active {
    display: flex;
}

/* --- Lobby Screen --- */
#lobby-screen {
    justify-content: center;
    align-items: center;
    background: linear-gradient(145deg, #0a0a19 0%, #141428 50%, #0d1b2a 100%);
    position: relative;
    overflow: hidden;
}

#lobby-screen::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-glow), transparent 70%);
    top: -100px;
    right: -100px;
    pointer-events: none;
    animation: floatGlow 8s ease-in-out infinite;
}

#lobby-screen::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 101, 132, 0.15), transparent 70%);
    bottom: -80px;
    left: -80px;
    pointer-events: none;
    animation: floatGlow 10s ease-in-out infinite reverse;
}

@keyframes floatGlow {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(30px, -20px) scale(1.1);
    }
}

.lobby-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-lg);
    z-index: 1;
    width: 90%;
    max-width: 400px;
}

.logo-area {
    text-align: center;
    margin-bottom: var(--spacing-md);
}

.logo {
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    background: linear-gradient(135deg, #6c63ff, #ff6584);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    filter: drop-shadow(0 0 30px rgba(108, 99, 255, 0.3));
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: var(--spacing-xs);
    letter-spacing: 0.2em;
}

/* --- Connection Status --- */
.connection-status {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.85rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background var(--transition-normal);
}

.status-dot.waiting {
    background: var(--warning);
    animation: pulse 1.5s ease-in-out infinite;
}

.status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 8px rgba(0, 200, 151, 0.5);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* --- Buttons --- */
.lobby-actions {
    display: flex;
    gap: var(--spacing-md);
    width: 100%;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
    color: #fff;
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(108, 99, 255, 0.5);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-small {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.85rem;
}

.btn-large {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: 1.1rem;
}

.btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-icon {
    font-size: 1.1em;
}

.lobby-actions .btn {
    flex: 1;
}

/* --- Difficulty Selection --- */
.difficulty-select {
    display: flex;
    gap: 8px;
    width: 100%;
}

.btn-difficulty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: var(--bg-glass);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-difficulty:hover {
    border-color: rgba(108, 99, 255, 0.3);
    background: rgba(108, 99, 255, 0.08);
}

.btn-difficulty.active {
    border-color: var(--accent-primary);
    background: rgba(108, 99, 255, 0.15);
    color: var(--text-primary);
    box-shadow: 0 0 15px rgba(108, 99, 255, 0.2);
}

.diff-icon {
    font-size: 1.5rem;
}

.diff-label {
    font-size: 0.75rem;
    font-weight: 600;
}

/* --- Match Selection --- */
.match-select {
    display: flex;
    gap: 8px;
    width: 100%;
}

.btn-match {
    flex: 1;
    padding: 8px;
    background: var(--bg-glass);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.btn-match:hover {
    border-color: rgba(108, 99, 255, 0.3);
}

.btn-match.active {
    border-color: var(--accent-primary);
    background: rgba(108, 99, 255, 0.15);
    color: var(--text-primary);
}

/* --- Icon Only Button (Header) --- */
.btn-icon-only {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    color: var(--text-secondary);
    line-height: 1;
}

.btn-icon-only:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* --- Panels --- */
.panel {
    width: 100%;
    padding: var(--spacing-lg);
    background: var(--bg-glass);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel.hidden {
    display: none;
}

.panel-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.id-display-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.id-display {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 0.95rem;
    color: var(--accent-primary);
    word-break: break-all;
    border: 1px solid rgba(108, 99, 255, 0.2);
}

.waiting-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.dots-anim {
    display: inline-block;
    animation: dots 1.4s steps(4, end) infinite;
    width: 1.5em;
    text-align: left;
}

@keyframes dots {
    0% {
        content: '';
    }

    25% {
        content: '.';
    }

    50% {
        content: '..';
    }

    75% {
        content: '...';
    }
}

.join-row {
    display: flex;
    gap: var(--spacing-sm);
}

.input-field {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.95rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

.input-field:focus {
    border-color: var(--accent-primary);
}

.input-field::placeholder {
    color: var(--text-muted);
}

/* ===========================
   Game Screen
   =========================== */
#game-screen {
    flex-direction: column;
    background: linear-gradient(180deg, #0a0a19 0%, #141428 40%, #0d1b2a 100%);
}

/* --- Game Header --- */
.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
    min-height: 44px;
    gap: var(--spacing-xs);
}

.game-logo {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    background: linear-gradient(135deg, #6c63ff, #ff6584);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- Win Counter --- */
.win-counter {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.8rem;
}

.win-you,
.win-opponent {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.win-you {
    color: var(--accent-primary);
}

.win-opponent {
    color: var(--text-muted);
}

.win-score {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--accent-primary);
    min-width: 14px;
    text-align: center;
}

.win-separator {
    color: var(--text-muted);
    font-weight: 600;
}

.win-target {
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-left: 2px;
}

.game-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.turn-indicator {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-xl);
    background: var(--bg-glass);
    color: var(--text-secondary);
    transition: all var(--transition-normal);
}

.turn-indicator.my-turn {
    background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
    color: #fff;
    box-shadow: 0 0 15px rgba(108, 99, 255, 0.3);
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(108, 99, 255, 0.3);
    }

    50% {
        box-shadow: 0 0 25px rgba(108, 99, 255, 0.5);
    }
}

/* --- Opponent Area --- */
.opponent-area {
    padding: var(--spacing-sm) var(--spacing-md);
    flex-shrink: 0;
}

.player-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.opponent-hand {
    display: flex;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
    min-height: 40px;
}

.card-back {
    width: 30px;
    height: 44px;
    background: linear-gradient(135deg, #2a2a4a, #1a1a3e);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

.card-back::after {
    content: '';
    position: absolute;
    inset: 3px;
    border: 1px solid rgba(108, 99, 255, 0.2);
    border-radius: 4px;
    background: repeating-linear-gradient(45deg,
            transparent,
            transparent 3px,
            rgba(108, 99, 255, 0.05) 3px,
            rgba(108, 99, 255, 0.05) 6px);
}

/* --- Field Area --- */
.field-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    min-height: 0;
}

.field-section {
    text-align: center;
    width: 100%;
}

.section-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: var(--spacing-xs);
}

.field-cards {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    min-height: 72px;
    padding: var(--spacing-sm);
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px dashed rgba(255, 255, 255, 0.08);
    align-items: center;
}

.empty-field {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.discard-section {
    text-align: center;
}

.discard-pile {
    display: flex;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
    min-height: 28px;
    align-items: center;
}

/* --- Card --- */
.card {
    width: 48px;
    height: 68px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.card .card-number {
    font-size: 1.4rem;
    line-height: 1;
}

.card .card-color-label {
    font-size: 0.55rem;
    margin-top: 2px;
    opacity: 0.7;
    letter-spacing: 0.05em;
}

/* Card Colors */
.card.red {
    background: linear-gradient(145deg, rgba(255, 71, 87, 0.2), rgba(255, 71, 87, 0.08));
    border-color: rgba(255, 71, 87, 0.4);
    color: var(--card-red);
}

.card.blue {
    background: linear-gradient(145deg, rgba(77, 171, 247, 0.2), rgba(77, 171, 247, 0.08));
    border-color: rgba(77, 171, 247, 0.4);
    color: var(--card-blue);
}

.card.green {
    background: linear-gradient(145deg, rgba(81, 207, 102, 0.2), rgba(81, 207, 102, 0.08));
    border-color: rgba(81, 207, 102, 0.4);
    color: var(--card-green);
}

.card.yellow {
    background: linear-gradient(145deg, rgba(252, 196, 25, 0.2), rgba(252, 196, 25, 0.08));
    border-color: rgba(252, 196, 25, 0.4);
    color: var(--card-yellow);
}

/* Card States */
.card.selected {
    transform: translateY(-8px);
    box-shadow: 0 8px 20px rgba(108, 99, 255, 0.3);
    border-color: var(--accent-primary) !important;
}

.card.selectable {
    cursor: pointer;
}

.card.selectable:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.card.collect-target {
    cursor: pointer;
    animation: collectGlow 1s ease-in-out infinite;
}

.card.collect-target:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(255, 101, 132, 0.4);
}

@keyframes collectGlow {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(255, 101, 132, 0.3);
    }

    50% {
        box-shadow: 0 0 16px rgba(255, 101, 132, 0.5);
    }
}

/* Small cards for discard pile */
.card.small {
    width: 28px;
    height: 40px;
    font-size: 0.7rem;
    border-radius: 5px;
    cursor: default;
    opacity: 0.5;
}

.card.small .card-number {
    font-size: 0.85rem;
}

.card.small .card-color-label {
    display: none;
}

/* --- Card Animations --- */
.card-enter {
    animation: cardSlideUp 0.35s ease-out both;
}

@keyframes cardSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.card-field-enter {
    animation: cardFieldPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes cardFieldPop {
    from {
        opacity: 0;
        transform: scale(0.5) rotate(-5deg);
    }

    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* --- Info Bar --- */
.info-bar {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: center;
    flex-shrink: 0;
}

#info-message {
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--bg-surface);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-xl);
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all var(--transition-normal);
}

#info-message.highlight {
    color: var(--accent-primary);
    border-color: rgba(108, 99, 255, 0.2);
    background: rgba(108, 99, 255, 0.08);
}

#info-message.warning {
    color: var(--warning);
    border-color: rgba(255, 179, 71, 0.2);
    background: rgba(255, 179, 71, 0.08);
}

/* --- Action Bar --- */
.action-bar {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    justify-content: center;
    flex-shrink: 0;
}

.btn-action {
    padding: var(--spacing-sm) var(--spacing-xl);
    font-size: 0.95rem;
    border-radius: var(--radius-xl);
    min-width: 120px;
}

.btn-play {
    background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
    color: #fff;
}

.btn-play:not(:disabled):hover {
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.4);
}

.btn-pass {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-pass:not(:disabled):hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Pass Highlight - 出せるカードがないとき */
.btn-pass.pass-highlight {
    background: linear-gradient(135deg, var(--accent-secondary), #ff8a65) !important;
    color: #fff !important;
    border-color: var(--accent-secondary) !important;
    box-shadow: 0 0 20px rgba(255, 101, 132, 0.4);
    animation: passGlow 1.2s ease-in-out infinite;
    opacity: 1 !important;
}

@keyframes passGlow {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(255, 101, 132, 0.3);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 30px rgba(255, 101, 132, 0.6);
        transform: scale(1.05);
    }
}

/* --- My Area --- */
.my-area {
    padding: var(--spacing-sm) var(--spacing-md) var(--spacing-md);
    margin-bottom: 60px;
    flex-shrink: 0;
}

.my-label {
    color: var(--accent-primary);
}

.my-hand {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    padding-top: var(--spacing-xs);
}

/* ===========================
   Result Overlay
   =========================== */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.3s ease;
}

.overlay.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.result-card {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-xl);
    background: linear-gradient(145deg, var(--bg-secondary), var(--bg-card));
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 320px;
    width: 90%;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.result-icon {
    font-size: 3.5rem;
    margin-bottom: var(--spacing-md);
}

.result-text {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: var(--spacing-sm);
    background: linear-gradient(135deg, #6c63ff, #ff6584);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-sub {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-md);
}

/* --- Result Last Cards --- */
.result-last-cards {
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.result-last-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
    text-align: center;
}

.result-last-hand {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* --- Match Result --- */
.match-result-card {
    z-index: 2;
    position: relative;
}

.match-score-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.match-score-num {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent-primary);
}

.match-score-sep {
    font-size: 1.5rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* --- Confetti --- */
#confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -20px;
    width: 10px;
    height: 6px;
    opacity: 0;
    animation: confettiFall linear forwards;
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg) scale(1);
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg) scale(0.5);
    }
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 480px) {
    .logo {
        font-size: 3rem;
    }

    .tagline {
        font-size: 0.8rem;
    }

    .card {
        width: 40px;
        height: 58px;
    }

    .card .card-number {
        font-size: 1.15rem;
    }

    .card .card-color-label {
        font-size: 0.5rem;
    }

    .card-back {
        width: 24px;
        height: 36px;
    }

    .btn-action {
        min-width: 100px;
        padding: var(--spacing-sm) var(--spacing-lg);
        font-size: 0.85rem;
    }

    .field-cards {
        min-height: 60px;
    }

    .game-header {
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .card.small {
        width: 22px;
        height: 32px;
    }

    .game-logo {
        font-size: 0.85rem;
    }
}

@media (min-width: 768px) {
    .card {
        width: 56px;
        height: 80px;
    }

    .card .card-number {
        font-size: 1.6rem;
    }

    .card .card-color-label {
        font-size: 0.6rem;
    }

    .card-back {
        width: 36px;
        height: 52px;
    }

    .field-cards {
        min-height: 90px;
        max-width: 600px;
        margin: 0 auto;
    }

    .my-hand,
    .opponent-hand {
        gap: 8px;
    }
}

/* ===========================
   Utility
   =========================== */
.hidden {
    display: none !important;
}

/* --- Back Button --- */
.btn-back {
    margin-top: var(--spacing-md);
    width: 100%;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-back:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}