/* ========================================
   Find the Imposter - Clean Mobile-First Styles
   ======================================== */

/* CSS Variables - Dark Theme (Default) */
:root,
[data-theme="dark"] {
    --bg-primary: #0a0a0f;
    --bg-secondary: #14141f;
    --bg-tertiary: #1f1f2e;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.08);

    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --accent: #8b5cf6;
    --accent-hover: #7c3aed;
    --accent-bg: rgba(139, 92, 246, 0.15);

    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);

    --border: rgba(255, 255, 255, 0.1);
    --border-focus: rgba(139, 92, 246, 0.5);

    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);

    --radius: 12px;
    --radius-sm: 8px;
    --radius-full: 50%;

    --transition: 0.2s ease;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: rgba(0, 0, 0, 0.03);
    --bg-card-hover: rgba(0, 0, 0, 0.06);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --border: rgba(0, 0, 0, 0.1);

    --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* ========================================
   Base Styles
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

#app {
    min-height: 100vh;
    min-height: 100dvh;
}

.hidden {
    display: none !important;
}

/* ========================================
   Theme Toggle
   ======================================== */

.theme-toggle {
    position: fixed;
    top: 0.75rem;
    right: 0.75rem;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border);
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 100;
    transition: transform var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* ========================================
   Typography
   ======================================== */

.title {
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #a78bfa 0%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.title-small {
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.phase-title {
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 0.25rem;
}

.phase-subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

h2 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* ========================================
   Layout
   ======================================== */

.phase {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 1rem;
    padding-top: 3.5rem;
    padding-bottom: 2rem;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease-out;
}

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

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

.section {
    margin-bottom: 1.5rem;
}

.header {
    text-align: center;
    margin-bottom: 1rem;
}

/* ========================================
   Buttons
   ======================================== */

.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.875rem 1.75rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-compact {
    width: auto;
    padding: 0.875rem 1.25rem;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.icon-btn:active {
    transform: scale(0.95);
}

.start-btn {
    margin-top: auto;
    padding: 1rem;
}

.top-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

/* Leave Button (exit game mid-round) */
.leave-btn {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    z-index: 10;
}

.leave-btn:hover {
    background: var(--danger-bg);
    border-color: var(--danger);
    color: var(--danger);
}

/* ========================================
   Inputs & Selects
   ======================================== */

.input,
.select,
.textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color var(--transition);
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.input::placeholder {
    color: var(--text-muted);
}

/* Custom Select for Dark Mode */
.select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

/* Fix select dropdown styling for dark mode */
.select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0.5rem;
}

.textarea {
    resize: vertical;
    min-height: 80px;
}

.emoji-input {
    width: 60px;
    text-align: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

/* ========================================
   Player Management
   ======================================== */

.add-player-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.add-player-form .input {
    flex: 1;
}

.player-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.player-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid;
    border-radius: var(--radius-sm);
    position: relative;
    animation: scaleIn 0.2s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

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

.player-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: white;
    flex-shrink: 0;
}

.player-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.remove-btn {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    background: var(--danger);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.25rem;
    opacity: 0.7;
    transition: opacity var(--transition);
}

.remove-btn:hover {
    opacity: 1;
}

.empty-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 1rem;
    text-align: center;
    width: 100%;
}

/* ========================================
   Category Selection
   ======================================== */

.category-select-btn {
    width: 100%;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all var(--transition);
    font-family: inherit;
}

.category-select-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
}

.category-select-btn.has-category {
    border-style: solid;
    border-color: var(--accent);
    color: var(--text-primary);
}

.selected-cats-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    justify-content: center;
}

.cat-preview-item {
    font-size: 1.25rem;
}

/* ========================================
   Settings
   ======================================== */

.settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-item label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.mode-description {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
}

.settings-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: auto;
}

.settings-actions button {
    flex: 1;
}

/* ========================================
   Role Reveal
   ======================================== */

.round-badge {
    background: var(--accent-bg);
    color: var(--accent);
    padding: 0.5rem 1.25rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.85rem;
    align-self: center;
    margin-bottom: 1.5rem;
}

.pass-device {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-align: center;
}

.pass-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.player-indicator {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 2rem;
    color: white;
    box-shadow: var(--shadow);
}

.current-player-name {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.role-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: cardFlip 0.4s ease-out;
}

@keyframes cardFlip {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

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

.imposter-card,
.crew-card {
    width: 100%;
    padding: 2rem 1.5rem;
    border-radius: var(--radius);
    text-align: center;
    margin-bottom: 1.5rem;
}

.imposter-card {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.imposter-card h1 {
    color: #f87171;
    font-size: 1.5rem;
    margin: 0.5rem 0;
}

.crew-card {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.crew-card h1 {
    color: #4ade80;
    font-size: 1.5rem;
    margin: 0.5rem 0;
}

.role-emoji {
    font-size: 3rem;
}

.imposter-info {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
}

.imposter-info p {
    color: #fbbf24;
    font-weight: 500;
}

.imposter-info small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.secret-word {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    margin: 0.75rem 0;
}

.category-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

/* ========================================
   Hints Phase
   ======================================== */

.hint-turn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.hint-turn h2 {
    font-size: 1rem;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-primary);
}

.hints-info {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.hints-info p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.hints-info p:last-child {
    margin-bottom: 0;
}

.start-player {
    text-align: center;
    margin-bottom: 1.5rem;
}

.start-player>p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.start-player-card {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--accent-bg);
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 600;
}

.start-player-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: white;
}

.collected-hints,
.all-hints {
    width: 100%;
    margin-bottom: 1.5rem;
}

.hints-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.hint-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
}

.hint-avatar {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.7rem;
    color: white;
}

.hint-item span {
    font-size: 0.85rem;
}

/* ========================================
   Voting Phase
   ======================================== */

.voting-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex: 1;
    align-content: start;
}

.vote-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 1rem;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    color: var(--text-primary);
}

.vote-card:active {
    transform: scale(0.98);
}

.vote-card.selected {
    background: var(--danger-bg);
    border-color: var(--danger);
}

.vote-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    color: white;
}

.vote-card span {
    font-weight: 500;
    font-size: 0.9rem;
}

/* ========================================
   Results Phase
   ======================================== */

.crew-win,
.imposter-win {
    padding: 1.5rem;
    border-radius: var(--radius);
    text-align: center;
    margin-bottom: 1.5rem;
    animation: resultPop 0.4s ease-out;
}

@keyframes resultPop {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.crew-win {
    background: var(--success-bg);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.crew-win h1 {
    color: var(--success);
    font-size: 1.5rem;
}

.imposter-win {
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.imposter-win h1 {
    color: var(--danger);
    font-size: 1.5rem;
}

.result-emoji {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.reveal-section {
    width: 100%;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    text-align: center;
}

.reveal-section>p:first-child {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.imposter-reveal {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0.75rem 0;
}

.reveal-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
}

.word-reveal {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.word-reveal strong {
    color: var(--text-primary);
}

.score-board {
    width: 100%;
    margin-bottom: 1rem;
}

.score-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
}

.score-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: white;
}

.score-item .score-name {
    flex: 1;
    font-size: 0.9rem;
}

.score-value {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.9rem;
}

.result-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: auto;
}

.result-actions button {
    flex: 1;
}

/* ========================================
   Modals
   ======================================== */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

@media (min-width: 480px) {
    .modal {
        align-items: center;
        padding: 1rem;
    }
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 1.5rem;
    width: 100%;
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

@media (min-width: 480px) {
    .modal-content {
        border-radius: var(--radius);
        max-width: 500px;
        max-height: 85vh;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

@media (min-width: 480px) {
    @keyframes slideUp {
        from {
            opacity: 0;
            transform: scale(0.95);
        }

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

.modal-content h2 {
    font-size: 1.25rem;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    text-align: center;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.modal-actions button {
    flex: 1;
}

/* Tutorial Modal */
.tutorial-modal {
    text-align: center;
}

.tutorial-progress {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
}

.progress-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    transition: all var(--transition);
}

.progress-dot.active {
    background: var(--accent);
}

.tutorial-modal p {
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Category Modal */
.category-modal {
    max-height: 95vh;
    max-height: 95dvh;
}

.category-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    background: var(--bg-card);
    padding: 0.25rem;
    border-radius: var(--radius-sm);
}

.category-tabs button {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    font-family: inherit;
}

.category-tabs button.tab-active {
    background: var(--accent);
    color: white;
}

.tab-content {
    animation: fadeIn 0.2s ease-out;
}

.category-quick-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.filter-btn {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 50px;
    transition: all var(--transition);
    font-family: inherit;
}

.filter-btn.filter-active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    max-height: 280px;
    overflow-y: auto;
    margin-bottom: 1rem;
    padding: 0.25rem;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 0.5rem;
    background: var(--bg-card);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    color: var(--text-primary);
    text-align: center;
}

.category-card:active {
    transform: scale(0.97);
}

.category-card.selected {
    background: var(--accent-bg);
    border-color: var(--accent);
}

.cat-icon {
    font-size: 1.5rem;
}

.cat-name {
    font-weight: 500;
    font-size: 0.7rem;
    line-height: 1.2;
}

.cat-words {
    font-size: 0.6rem;
    color: var(--text-muted);
}

/* Custom Categories */
.custom-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.custom-cat-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-row label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.form-row-inline {
    flex-direction: row;
    gap: 0.75rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group-grow {
    flex: 1;
}

.custom-card-actions {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.custom-card-actions button {
    flex: 1;
    padding: 0.4rem;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.7rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-family: inherit;
}

/* Stats */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-box {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius-sm);
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.player-stats-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.player-stat-item {
    background: var(--bg-card);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
}

.player-stat-name {
    font-weight: 500;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 0.25rem;
}

.player-stat-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.win-rate {
    background: var(--success-bg);
    color: var(--success);
    padding: 0.15rem 0.4rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

/* ========================================
   Scrollbar
   ======================================== */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 10px;
}

/* ========================================
   Safe Area (for notched devices)
   ======================================== */

@supports (padding: max(0px)) {
    .phase {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
    }
}