/* ───────────────────────────────────────────────────────────────
   home.css : ホーム画面（ゲームピッカー、マッチング、コード参加）
   ─────────────────────────────────────────────────────────────── */

.home {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    padding: 16px 0 8px;
}

.home .lead {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
    text-align: center;
    max-width: 320px;
}

.home button.primary {
    width: 100%;
    max-width: 240px;
}

/* ─── ゲームピッカー ─────────────────────────────────────────── */

.game-picker {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.game-picker-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.game-picker-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

button.game-option {
    background: var(--surface-soft);
    color: var(--text-muted);
    border: 1.5px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: var(--r-md);
}

button.game-option:hover {
    background: var(--surface);
    color: var(--text);
    border-color: var(--accent);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.15);
    transform: translateY(-1px) rotate(-0.6deg);
}

button.game-option.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: var(--sh-sm);
}

button.game-option.active:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: var(--sh-md);
    transform: translateY(-1px);
}

/* ─── マッチング画面 ─────────────────────────────────────────── */

.matchmaking {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 32px 0 16px;
}

.matchmaking-spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.matchmaking-label {
    margin: 0;
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
}

.matchmaking-hint {
    margin: -6px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

/* ─── ランダムマッチ＋トグル ──────────────────────────────────── */

.random-match {
    width: 100%;
    max-width: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
    user-select: none;
}

.toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

/* ─── ディバイダ ─────────────────────────────────────────────── */

.home-divider {
    margin: 4px 0;
    font-size: 11px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    position: relative;
    width: 100%;
    text-align: center;
}

.home-divider::before,
.home-divider::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 30%;
    height: 1px;
    background: var(--border);
}

.home-divider::before {
    left: 0;
}

.home-divider::after {
    right: 0;
}

/* ─── コード参加 ─────────────────────────────────────────────── */

.join-by-code {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 280px;
}

.code-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.3em;
    text-align: center;
    background: var(--surface-soft);
    color: var(--text);
    transition:
        border-color 0.15s ease,
        background 0.15s ease;
}

.code-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
}

.code-input::placeholder {
    letter-spacing: normal;
    font-weight: 400;
    color: var(--text-faint);
}

.join-by-code button.primary {
    width: 100%;
    padding: 12px 24px;
    font-size: 15px;
}

.join-by-code button.primary:disabled {
    background: var(--text-faint);
    cursor: not-allowed;
    box-shadow: none;
}

@media (max-width: 640px) {
    .home {
        gap: 16px;
        padding: 12px 0 4px;
    }
    button.game-option {
        padding: 9px 13px;
        font-size: 12.5px;
    }
}

/* ─── マッチング成立カウントダウン ─────────────────────────── */

.countdown-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    z-index: 100;
    animation: countdown-fade-in 0.2s ease-out;
}

@keyframes countdown-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.countdown-card {
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 32px 48px;
    box-shadow: var(--sh-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    min-width: 260px;
}

.countdown-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.06em;
}

.countdown-number {
    font-size: 96px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    animation: countdown-pop 0.4s var(--ease-pop);
}

@keyframes countdown-pop {
    0% {
        transform: scale(1.4);
        opacity: 0.4;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.countdown-hint {
    font-size: 13px;
    color: var(--text-muted);
}
