* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #7c3aed;
    --primary-light: #a78bfa;
    --primary-dark: #6d28d9;
    --secondary-color: #9333ea;
    --accent-color: #c084fc;
    --success-color: #10b981;
    --error-color: #ef4444;
    --bg-color: #f3e8ff;
    --surface-color: #faf5ff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e9d5ff;
    --border-light: #f3e8ff;
    --cell-bg: #ffffff;
    --cell-selected: #ede9fe;
    --cell-given: #f3f4f6;
    --cell-hover: #f5f3ff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Prevent text selection during gameplay */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.container {
    width: 100%;
    max-width: 600px;
    position: relative;
    /* Better mobile scrolling */
    -webkit-overflow-scrolling: touch;
}

/* Streak Display */
.streak-container {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    text-align: center;
    animation: slideDown 0.5s ease-out;
    z-index: 100;
    background: var(--surface-color);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.1);
    white-space: nowrap;
    max-width: calc(100% - 40px);
    box-sizing: border-box;
}

.streak-icon {
    font-size: 18px;
    animation: pulse 2s ease-in-out infinite;
    flex-shrink: 0;
    display: inline-block;
}

.streak-text {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.streak-count {
    font-weight: 700;
    color: var(--primary-color);
}

.share-button {
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
    padding: 0;
    margin-left: 4px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    box-shadow: 0 1px 3px rgba(124, 58, 237, 0.2);
    flex-shrink: 0;
}

.share-button:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.3);
}

.share-button:active {
    transform: scale(0.95);
}

.share-button svg {
    width: 14px;
    height: 14px;
}

/* Loader Screen */
.loader-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.loader-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.loader-logo-wrapper {
    animation: logoFadeIn 0.6s ease-out;
}

.loader-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    animation: logoRotate 0.5s linear 0.6s infinite;
}

@keyframes logoFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes logoRotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Roulette Screen */
.roulette-screen {
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

.home-logo {
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.6s ease-out;
}

.logo-image {
    width: 100px;
    height: 100px;
    object-fit: contain;
    max-width: 100%;
}

.title {
    font-size: 2.2rem;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 40px;
    font-size: 1rem;
    font-weight: 400;
}

.spinner-container {
    position: relative;
    width: 240px;
    height: 140px;
    margin: 50px auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.spinner-window {
    width: 180px;
    height: 100px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.1);
}

.spinner-track {
    position: relative;
    transition: transform 5.5s cubic-bezier(0.17, 0.67, 0.12, 0.99);
    transform: translateY(0);
}

.spinner-item {
    width: 180px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.spinner-item[data-difficulty="easy"] {
    background: white;
}

.spinner-item[data-difficulty="medium"] {
    background: white;
}

.spinner-item[data-difficulty="hard"] {
    background: white;
}

.spinner-label {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 3px;
    text-transform: uppercase;
}

.spinner-desc {
    display: none;
}

.spinner-indicator {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    height: 100px;
    pointer-events: none;
    z-index: 10;
    opacity: 0.6;
}

.spin-button {
    margin-top: 50px;
    padding: 16px 48px;
    font-size: 1rem;
    font-weight: 600;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
    /* Better touch interaction */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    min-height: 48px; /* Minimum touch target */
}

.spin-button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.4);
}

.spin-button:active {
    transform: translateY(0);
}

.spin-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Game Screen */
.game-screen {
    animation: fadeIn 0.5s ease-out;
    max-width: 600px;
    margin: 0 auto;
}

.game-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 24px;
    padding: 0 4px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.best-times-button {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-width: 36px;
    min-height: 36px;
}

.best-times-button:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

.best-times-button:active {
    transform: scale(0.95);
}

.best-times-button svg {
    width: 20px;
    height: 20px;
}

.difficulty-badge {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.difficulty-badge.easy {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.difficulty-badge.medium {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.difficulty-badge.hard {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.difficulty-badge.extrahard {
    background: #ede9fe;
    color: #5b21b6;
    border: 1px solid #c4b5fd;
}

.timer {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    padding: 8px 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-width: 70px;
    text-align: center;
}

.mistakes-counter {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.mistakes-icon {
    font-size: 16px;
}

.mistakes-text {
    font-size: 0.9rem;
}

.mistakes-counter.mistakes-warning {
    border-color: #f59e0b;
    background: #fef3c7;
    color: #92400e;
}

.mistakes-counter.mistakes-max {
    border-color: var(--error-color);
    background: #fee2e2;
    color: #991b1b;
    animation: shake 0.5s;
}

/* Best Times Modal */
.best-times-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.best-times-modal.active {
    display: flex;
}

.best-times-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.best-times-modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: scaleIn 0.3s ease-out;
    z-index: 2001;
}

.best-times-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.best-times-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.best-times-modal-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    border-radius: 4px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.best-times-modal-close:hover {
    background: var(--surface-color);
    color: var(--text-primary);
}

.best-times-modal-close:active {
    transform: scale(0.95);
}

.best-times-modal-close svg {
    width: 24px;
    height: 24px;
}

.best-times-modal-content .best-times-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.best-times-modal-content .best-time-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
}

.best-times-modal-content .best-time-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.best-times-modal-content .best-time-value {
    color: var(--primary-color);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Best Times Display - Hidden on mobile, shown on desktop */
.best-times-container {
    margin-top: 20px;
    padding: 16px;
    background: var(--surface-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.08);
}

/* Best Times Display - Always hidden, use modal instead */
.best-times-container {
    display: none !important;
}

/* Best Times Button - Always visible */
.best-times-button {
    display: flex;
}

@media (max-width: 768px) {
    .best-times-container {
        display: none !important;
    }
    
    .best-times-button {
        display: flex;
    }
}

@media (min-width: 769px) {
    .best-times-button {
        display: flex;
    }
    
    .best-times-container {
        display: none !important;
    }
    
    .best-times-modal-content {
        max-width: 450px;
    }
}

.best-times-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-align: center;
}

.best-times-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.best-time-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.85rem;
}

.best-time-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.best-time-value {
    color: var(--primary-color);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.new-game-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    /* Better touch interaction */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    min-height: 36px; /* Minimum touch target */
}

.new-game-button:hover {
    background: var(--surface-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.sudoku-wrapper {
    display: flex;
    justify-content: center;
    margin: 24px 0;
    padding: 16px;
    background: var(--surface-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.08);
    /* Prevent scrolling when interacting with grid */
    touch-action: pan-y;
    overscroll-behavior: contain;
}

.sudoku-container {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 500px;
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 1px;
    background: var(--border-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 4px;
    width: 100%;
    aspect-ratio: 1;
    /* Prevent scrolling when interacting with cells */
    touch-action: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.sudoku-cell {
    background: white;
    border: none;
    color: var(--text-primary);
    font-size: clamp(1.1rem, 4vw, 1.6rem);
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-radius: 2px;
    /* Better touch interaction on mobile */
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    /* Prevent unwanted scrolling when clicking */
    -webkit-touch-callout: none;
    /* Prevent focus outline and scrolling */
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.sudoku-cell:hover:not(.given) {
    background: var(--cell-hover);
    z-index: 1;
}

.sudoku-cell.selected {
    background: var(--cell-selected);
    color: var(--primary-color);
    font-weight: 600;
    z-index: 2;
}

.sudoku-cell.given {
    background: var(--cell-given);
    color: var(--text-primary);
    font-weight: 600;
    cursor: default;
}

.sudoku-cell.error {
    background: #fee2e2 !important;
    color: #dc2626 !important;
    animation: shake 0.3s;
}

.sudoku-cell.correct {
    animation: pop 0.3s;
}

/* Priority order: error > selected > same-number > row/col > completed > default */

/* Error state (highest priority - always show red) */
.sudoku-cell.error {
    background: #fee2e2 !important;
    color: #dc2626 !important;
    animation: shake 0.3s;
}

/* Default completed number style */
.sudoku-cell.number-completed {
    background: #ede9fe;
    color: var(--primary-color);
    font-weight: 700;
}

/* Row and column highlighting (lowest priority) */
.sudoku-cell.highlight-row,
.sudoku-cell.highlight-col {
    background: var(--cell-hover) !important;
}

/* Same number highlighting (higher priority than row/col) */
.sudoku-cell.highlight-same-number {
    background: #ddd6fe !important;
    color: var(--secondary-color) !important;
}

/* Selected cell (higher priority) */
.sudoku-cell.selected {
    background: var(--cell-selected) !important;
    color: var(--primary-color) !important;
}

/* Selected cell with same number */
.sudoku-cell.selected.highlight-same-number {
    background: var(--primary-color) !important;
    color: white !important;
}

/* Error overrides everything except itself */
.sudoku-cell.error.highlight-row,
.sudoku-cell.error.highlight-col,
.sudoku-cell.error.highlight-same-number,
.sudoku-cell.error.selected {
    background: #fee2e2 !important;
    color: #dc2626 !important;
}

/* Given cells - don't highlight row/col */
.sudoku-cell.given.highlight-row,
.sudoku-cell.given.highlight-col {
    background: var(--cell-given) !important;
}

/* Given cells can still show same-number highlighting */
.sudoku-cell.given.highlight-same-number {
    background: #ddd6fe !important;
    color: var(--secondary-color) !important;
}

/* Completed numbers - override row/col but not same-number or selected */
.sudoku-cell.number-completed:not(.highlight-same-number):not(.selected):not(.error) {
    background: #ede9fe !important;
    color: var(--primary-color) !important;
}

/* Completed + same-number (show completed style, not highlight style) */
.sudoku-cell.number-completed.highlight-same-number:not(.error) {
    background: #ede9fe !important;
    color: var(--primary-color) !important;
    font-weight: 700;
}

/* Border styling for 3x3 boxes */
.sudoku-cell:nth-child(3n):not(:nth-child(9n)) {
    border-right: 2px solid var(--border-color);
}

.sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 2px solid var(--border-color);
}

.sudoku-cell:nth-child(9n) {
    border-right: none;
}

.game-controls {
    margin-top: 32px;
    padding: 0 4px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.number-pad {
    display: flex;
    gap: 8px;
    max-width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}

.num-btn {
    padding: 10px 16px;
    font-size: 1.5rem;
    font-weight: 600;
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
    /* Better touch interaction */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.num-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.num-btn:active {
    transform: translateY(0);
}

.num-btn.number-completed-btn {
    background: #ede9fe;
    border-color: var(--primary-color);
    color: var(--primary-color);
    position: relative;
}

.num-btn.number-completed-btn::after {
    content: '✓';
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 0.7rem;
    color: var(--primary-color);
}

.clear-btn {
    width: 100%;
    background: white;
    border-color: var(--error-color);
    color: var(--error-color);
    padding: 12px;
    font-size: 1.2rem;
}

.clear-btn:hover {
    background: var(--error-color);
    color: white;
    border-color: var(--error-color);
}

/* Victory Screen */
.victory-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(243, 232, 255, 0.95);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease-out;
}

.victory-content {
    text-align: center;
    background: white;
    padding: 40px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    width: 90%;
    animation: scaleIn 0.5s ease-out;
}

.victory-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 1s ease-in-out infinite;
}

.victory-content h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--primary-color);
    font-weight: 700;
}

.victory-message {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.victory-time,
.victory-streak {
    margin: 10px 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.play-again-button {
    margin-top: 30px;
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.play-again-button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.4);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive Design - Mobile First Approach */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }
    
    .container {
        max-width: 100%;
    }
    
    /* Logo - Mobile */
    .home-logo {
        margin-bottom: 20px;
    }
    
    .logo-image {
        width: 80px;
        height: 80px;
    }
    
    /* Streak Display - Mobile Optimized */
    .streak-container {
        top: -45px;
        gap: 4px;
        padding: 5px 10px;
        max-width: calc(100% - 24px);
    }
    
    .streak-icon {
        font-size: 16px;
        flex-shrink: 0;
    }
    
    .streak-text {
        font-size: 0.8rem;
        white-space: nowrap;
    }
    
    .streak-count {
        font-size: 0.8rem;
    }
    
    .share-button {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }
    
    .share-button svg {
        width: 12px;
        height: 12px;
    }
    
    /* Title & Subtitle */
    .title {
        font-size: 1.75rem;
        margin-bottom: 6px;
        letter-spacing: -0.3px;
    }
    
    .subtitle {
        font-size: 0.9rem;
        margin-bottom: 32px;
        color: var(--text-secondary);
    }
    
    /* Spinner - Mobile Optimized */
    .spinner-container {
        width: 200px;
        height: 120px;
        margin: 32px auto;
    }
    
    .spinner-window {
        width: 160px;
        height: 90px;
        border-radius: 12px;
    }
    
    .spinner-item {
        width: 160px;
        height: 90px;
    }
    
    .spinner-label {
        font-size: 1.4rem;
        letter-spacing: 2px;
    }
    
    .spinner-indicator {
        height: 90px;
    }
    
    /* Spin Button */
    .spin-button {
        margin-top: 32px;
        padding: 14px 40px;
        font-size: 0.95rem;
        border-radius: 10px;
    }
    
    /* Game Header - Mobile Layout */
    .game-header {
        margin-bottom: 16px;
        padding: 0;
        gap: 8px;
    }
    
    .header-left {
        gap: 8px;
        flex: 1;
    }
    
    .best-times-button {
        min-width: 32px;
        min-height: 32px;
        padding: 6px;
    }
    
    .best-times-button svg {
        width: 18px;
        height: 18px;
    }
    
    .best-times-modal-content {
        padding: 20px;
        max-width: 90%;
    }
    
    .best-times-modal-content .best-times-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .difficulty-badge {
        padding: 8px 14px;
        font-size: 0.75rem;
        border-radius: 8px;
    }
    
    .timer {
        padding: 8px 14px;
        font-size: 0.9rem;
        min-width: 65px;
        border-radius: 8px;
    }
    
    .mistakes-counter {
        padding: 6px 12px;
        font-size: 0.85rem;
        gap: 4px;
    }
    
    .mistakes-icon {
        font-size: 14px;
    }
    
    .mistakes-text {
        font-size: 0.85rem;
    }
    
    .best-times-container {
        margin-top: 16px;
        padding: 12px;
    }
    
    .best-times-title {
        font-size: 0.85rem;
        margin-bottom: 10px;
    }
    
    .best-times-grid {
        gap: 8px;
    }
    
    .best-time-item {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    /* Logo - Small Mobile */
    .home-logo {
        margin-bottom: 16px;
    }
    
    .logo-image {
        width: 70px;
        height: 70px;
    }
    
    /* Sudoku Wrapper */
    .sudoku-wrapper {
        margin: 16px 0;
        padding: 12px;
        border-radius: 10px;
    }
    
    .sudoku-grid {
        border-radius: 6px;
        padding: 3px;
    }
    
    .sudoku-cell {
        font-size: clamp(1rem, 5vw, 1.4rem);
        border-radius: 1px;
    }
    
    /* Number Pad - Mobile Optimized */
    .game-controls {
        margin-top: 20px;
        gap: 10px;
    }
    
    .number-pad {
        gap: 6px;
        padding: 0 4px;
    }
    
    .num-btn {
        padding: 8px 12px;
        font-size: 1.4rem;
        border-radius: 8px;
        min-height: 48px; /* Minimum touch target */
        flex: 1;
        min-width: calc((100% - 48px) / 9); /* 9 buttons with gaps */
    }
    
    .clear-btn {
        min-height: 48px;
        font-size: 1.1rem;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    /* Streak Display */
    .streak-container {
        top: -75px;
        gap: 3px;
        padding: 4px 8px;
        max-width: calc(100% - 20px);
    }
    
    .streak-icon {
        font-size: 14px;
        flex-shrink: 0;
    }
    
    .streak-text {
        font-size: 0.75rem;
        white-space: nowrap;
    }
    
    .streak-count {
        font-size: 0.75rem;
    }
    
    .share-button {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
    }
    
    .share-button svg {
        width: 11px;
        height: 11px;
    }
    
    /* Title & Subtitle */
    .title {
        font-size: 1.5rem;
        margin-bottom: 4px;
    }
    
    .subtitle {
        font-size: 0.85rem;
        margin-bottom: 28px;
    }
    
    /* Spinner - Small Mobile */
    .spinner-container {
        width: 180px;
        height: 110px;
        margin: 28px auto;
    }
    
    .spinner-window {
        width: 150px;
        height: 80px;
        border-radius: 10px;
    }
    
    .spinner-item {
        width: 150px;
        height: 80px;
        padding: 10px;
    }
    
    .spinner-label {
        font-size: 1.2rem;
        letter-spacing: 1.5px;
    }
    
    .spinner-indicator {
        height: 80px;
    }
    
    /* Spin Button */
    .spin-button {
        margin-top: 28px;
        padding: 14px 36px;
        font-size: 0.9rem;
        width: 100%;
        max-width: 200px;
    }
    
    /* Game Header - Stacked on Small Mobile */
    .game-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 14px;
    }
    
    .header-left {
        justify-content: space-between;
        width: 100%;
        gap: 8px;
    }
    
    .difficulty-badge {
        flex: 1;
        text-align: center;
    }
    
    .timer {
        flex: 1;
        text-align: center;
    }
    
    .mistakes-counter {
        flex: 1;
        text-align: center;
        justify-content: center;
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .mistakes-icon {
        font-size: 12px;
    }
    
    .mistakes-text {
        font-size: 0.8rem;
    }
    
    .best-times-container {
        margin-top: 12px;
        padding: 10px;
    }
    
    .best-times-title {
        font-size: 0.8rem;
        margin-bottom: 8px;
    }
    
    .best-times-grid {
        gap: 6px;
    }
    
    .best-time-item {
        padding: 6px 8px;
        font-size: 0.75rem;
    }
    
    /* Sudoku Wrapper */
    .sudoku-wrapper {
        margin: 12px 0;
        padding: 10px;
    }
    
    .sudoku-grid {
        padding: 2px;
    }
    
    .sudoku-cell {
        font-size: clamp(0.95rem, 5.5vw, 1.3rem);
    }
    
    /* Number Pad - Compact for Small Mobile */
    .game-controls {
        margin-top: 16px;
        gap: 8px;
    }
    
    .number-pad {
        gap: 4px;
        padding: 0 2px;
    }
    
    .num-btn {
        padding: 6px 10px;
        font-size: 1.3rem;
        min-height: 44px; /* Minimum touch target for small screens */
        border-radius: 6px;
        flex: 1;
        min-width: calc((100% - 32px) / 9); /* 9 buttons with gaps */
    }
    
    .clear-btn {
        min-height: 44px;
        font-size: 1rem;
        padding: 10px;
    }
    
    /* Victory Screen */
    .victory-content {
        padding: 28px 20px;
        margin: 20px;
    }
    
    .victory-icon {
        font-size: 3rem;
        margin-bottom: 16px;
    }
    
    .victory-content h2 {
        font-size: 1.75rem;
    }
    
    .victory-message,
    .victory-time,
    .victory-streak {
        font-size: 0.95rem;
        margin: 8px 0;
    }
    
    .play-again-button {
        margin-top: 24px;
        padding: 12px 28px;
        font-size: 0.95rem;
        width: 100%;
    }
}

/* Very Small Devices (iPhone SE, etc.) */
@media (max-width: 375px) {
    body {
        padding: 8px;
    }
    
    .spinner-container {
        width: 160px;
        height: 100px;
        margin: 24px auto;
    }
    
    .spinner-window {
        width: 140px;
        height: 75px;
    }
    
    .spinner-item {
        width: 140px;
        height: 75px;
    }
    
    .spinner-label {
        font-size: 1.1rem;
        letter-spacing: 1px;
    }
    
    .spinner-indicator {
        height: 75px;
    }
    
    .spin-button {
        margin-top: 24px;
        padding: 12px 32px;
        font-size: 0.875rem;
    }
    
    .num-btn {
        padding: 6px 8px;
        font-size: 1.2rem;
        min-height: 42px;
        flex: 1;
        min-width: calc((100% - 32px) / 9);
    }
    
    .clear-btn {
        font-size: 0.95rem;
        padding: 8px;
    }
    
    .sudoku-cell {
        font-size: clamp(0.9rem, 6vw, 1.2rem);
    }
    
    .title {
        font-size: 1.35rem;
    }
    
    .subtitle {
        font-size: 0.8rem;
    }
}

/* Landscape Mobile Optimization */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        padding: 8px;
    }
    
    .streak-container {
        top: -40px;
        padding: 4px 8px;
        gap: 3px;
        max-width: calc(100% - 16px);
    }
    
    .streak-icon {
        font-size: 12px;
        flex-shrink: 0;
    }
    
    .streak-text {
        font-size: 0.7rem;
        white-space: nowrap;
    }
    
    .streak-count {
        font-size: 0.7rem;
    }
    
    .share-button {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }
    
    .share-button svg {
        width: 10px;
        height: 10px;
    }
        font-size: 1.5rem;
        margin-bottom: 4px;
    }
    
    .subtitle {
        font-size: 0.85rem;
        margin-bottom: 20px;
    }
    
    .spinner-container {
        margin: 20px auto;
    }
    
    .spin-button {
        margin-top: 20px;
    }
    
    .game-header {
        margin-bottom: 12px;
    }
    
    .sudoku-wrapper {
        margin: 12px 0;
        padding: 8px;
    }
    
    .game-controls {
        margin-top: 12px;
    }
}
