/* =============================================================
   SUDOKU APP - CENTRALIZED COLOR VARIABLES
   =============================================================
   RULE: ALL colors must be defined here.
   Usage: var(--variable-name) everywhere in CSS.
   NEVER write #hex or rgba() directly in other files.
   ============================================================= */

:root {
    /* ===== APP BACKGROUND ===== */
    --sudoku-bg-app: #0c0c18;                              /* Main app background */
    --sudoku-bg-surface: #141422;                          /* Cards, modals, panels */
    --sudoku-bg-surface-hover: #1a1a2c;                    /* Surface hover state */
    --sudoku-bg-elevated: #1e1e32;                         /* Elevated elements (buttons, inputs) */

    /* ===== TEXT COLORS ===== */
    --sudoku-text-primary: #eeecff;                        /* Primary text (warm white) */
    --sudoku-text-secondary: #8888aa;                      /* Secondary / muted text */
    --sudoku-text-disabled: #55556a;                       /* Disabled text */
    --sudoku-text-link: #a89ff8;                           /* Links */
    --sudoku-text-link-light: #c4bfff;                     /* Light links (on dark bg) */

    /* ===== GRID COLORS ===== */
    --sudoku-grid-border: rgba(255, 255, 255, 0.28);       /* Grid outer border */
    --sudoku-grid-border-inner: rgba(255, 255, 255, 0.08); /* Grid inner borders */
    --sudoku-cell-bg: transparent;                         /* Default cell background */ 
    --sudoku-cell-bg-selected: rgba(245, 166, 35, 0.45);   /* Selected cell (amber) */
    --sudoku-cell-bg-highlight: rgba(124, 110, 250, 0.12); /* Highlighted row/col/block */
    --sudoku-cell-bg-same-number: rgba(124, 110, 250, 0.32); /* Same number highlight */
    --sudoku-cell-text-given: #eeecff;                     /* Pre-filled numbers */
    --sudoku-cell-text-user: #a89ff8;                      /* User-entered numbers (soft violet) */
    --sudoku-cell-text-error: #f87171;                     /* Error numbers */
    --sudoku-cell-text-notes: #8888bb;                     /* Notes (pencil marks) */

    /* ===== DIFFICULTY COLORS ===== */
    --sudoku-difficulty-very-easy: #4ade80;                /* Very Easy */ 
    --sudoku-difficulty-easy: #a3e635;                     /* Easy */
    --sudoku-difficulty-medium: #fb923c;                   /* Medium */
    --sudoku-difficulty-hard: #f87171;                     /* Hard */
    --sudoku-difficulty-expert: #e879f9;                   /* Expert */

    /* ===== BUTTON COLORS ===== */
    --sudoku-btn-primary-bg: #7c6efa;                      /* Primary button (violet) */
    --sudoku-btn-primary-hover: #6355e8;                   /* Primary button hover */
    --sudoku-btn-secondary-bg: #1e1e32;                    /* Secondary button */
    --sudoku-btn-secondary-hover: #252540;                 /* Secondary button hover */
    --sudoku-btn-danger-bg: #ef4444;                       /* Danger button */
    --sudoku-btn-danger-hover: #dc2626;                    /* Danger button hover */

    /* ===== STATUS COLORS ===== */
    --sudoku-color-success: #4ade80;                       /* Success / completion */
    --sudoku-color-success-dark: #14532d;                  /* Success background */
    --sudoku-offline-bg: #7a4f00;
    --sudoku-offline-text: #ffffff;
    --sudoku-color-warning: #fb923c;                       /* Warning / caution */
    --sudoku-color-warning-light: #f5a623;                 /* Warning light / amber */
    --sudoku-color-error: #f87171;                         /* Error */
    --sudoku-color-error-dark: #ef4444;                    /* Error dark */
    --sudoku-color-error-soft: #f87171;                    /* Error counter text */

    /* ===== ACCENT COLORS ===== */
    --sudoku-accent-blue: #7c6efa;                         /* Main accent (violet) */
    --sudoku-accent-blue-dark: #6355e8;                    /* Dark violet accent */
    --sudoku-accent-purple: #7c6efa;                       /* Purple accent (same violet) */
    --sudoku-accent-purple-light: #a89ff8;                 /* Purple light */
    --sudoku-accent-indigo: #7c6efa;                       /* Indigo accent */
    --sudoku-accent-orange: #f5a623;                       /* Amber / orange accent */

    /* ===== NUMBER PAD ===== */
    --sudoku-numpad-bg: transparent;                       /* Number button background */
    --sudoku-numpad-text: #eeecff;                         /* Number button text */
    --sudoku-numpad-count: #9999bb;                        /* Remaining count text */
    --sudoku-numpad-disabled: rgba(255, 255, 255, 0.12);   /* Disabled number text */

    /* ===== ACTION BUTTONS ===== */
    --sudoku-action-undo-bg: #1e1e32;                      /* Undo button */
    --sudoku-action-erase-bg: #1e1e32;                     /* Erase button */
    --sudoku-action-notes-bg: #1e1e32;                     /* Notes button */
    --sudoku-action-notes-active: rgba(124, 110, 250, 0.20); /* Notes active state */

    /* ===== MODAL ===== */
    --sudoku-modal-overlay: rgba(0, 0, 0, 0.85);           /* Modal backdrop */
    --sudoku-modal-bg: #141422;                            /* Modal background */
    --sudoku-modal-border: rgba(255, 255, 255, 0.10);      /* Modal borders */

    /* ===== CHECKBOX (options) ===== */
    --sudoku-checkbox-bg: transparent;                     /* Unchecked checkbox */
    --sudoku-checkbox-border: rgba(255, 255, 255, 0.2);    /* Checkbox border */
    --sudoku-checkbox-checked-bg: #7c6efa;                 /* Checked checkbox */
    --sudoku-checkbox-checked-border: #7c6efa;             /* Checked checkbox border */

    /* ===== MENU SCREEN ===== */
    --sudoku-menu-title: #eeecff;                          /* SUDOKU main title */
    --sudoku-menu-option-bg: #1e1e32;                      /* Option button bg */
    --sudoku-menu-option-border: rgba(255, 255, 255, 0.10); /* Option button border */
    --sudoku-menu-option-text: #8888aa;                    /* Option button text */

    /* ===== COORDINATES ===== */
    --sudoku-coordinates-text: #55556a;                    /* R1, C1 labels */

    /* ===== TIMER ===== */
    --sudoku-timer-text: #8888aa;                          /* Timer display text */

    /* ===== ERROR DISPLAY ===== */
    --sudoku-error-display-text: #f87171;                  /* Error counter */

    /* ===== ANIMATIONS ===== */
    --sudoku-animation-success-border: #4ade80;            /* Success animation border */
    --sudoku-animation-success-glow: rgba(74, 222, 128, 0.3); /* Success glow effect */

    /* ===== SHADOWS ===== */
    --sudoku-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);     /* Small shadow */
    --sudoku-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);    /* Medium shadow */
    --sudoku-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);    /* Large shadow (modal) */

    /* ===== PWA THEME ===== */
    --sudoku-pwa-theme: #0c0c18;                           /* PWA status bar color */

    /* ===== AUTH SCREEN ===== */
    --sudoku-auth-bg-gradient-start: #08080f;              /* Auth screen gradient start */
    --sudoku-auth-bg-gradient-end: #0c0c18;                /* Auth screen gradient end */
    --sudoku-auth-input-bg: #1e1e32;                       /* Input field background */
    --sudoku-auth-input-border: rgba(255, 255, 255, 0.12); /* Input border */
    --sudoku-auth-input-focus-border: #7c6efa;             /* Input border on focus */
    --sudoku-auth-input-focus-glow: rgba(124, 110, 250, 0.18); /* Input focus glow */
    --sudoku-auth-surface: rgba(255, 255, 255, 0.05);      /* Glass-effect surface */
    --sudoku-auth-surface-hover: rgba(255, 255, 255, 0.08); /* Surface hover */
    --sudoku-auth-surface-border: rgba(255, 255, 255, 0.10); /* Surface border */
    --sudoku-auth-overlay: rgba(0, 0, 0, 0.5);             /* Modal overlay */
    --sudoku-auth-error-bg: rgba(248, 113, 113, 0.12);     /* Error message bg */
    --sudoku-auth-success-bg: rgba(74, 222, 128, 0.12);    /* Success message bg */
    --sudoku-auth-google-bg: #ffffff;                      /* Google button background */
    --sudoku-auth-google-text: #1f1f1f;                    /* Google button text */
    --sudoku-auth-divider: rgba(255, 255, 255, 0.12);      /* Divider line */
    --sudoku-auth-link: rgba(255, 255, 255, 0.5);          /* Auth links */
    --sudoku-auth-link-hover: rgba(255, 255, 255, 0.85);   /* Auth links hover */

    /* ===== HINT HIGHLIGHTS ===== */
    --sudoku-hint-placement-bg: rgba(74, 222, 128, 0.45);      /* Green: cell to fill */
    --sudoku-hint-chain-bg: rgba(124, 110, 250, 0.30);         /* Violet: technique cells */
    --sudoku-hint-elimination-bg: rgba(248, 113, 113, 0.35);   /* Red: cells to remove from */
    --sudoku-hint-panel-bg: #1e1e32;                           /* Hint panel background */
    --sudoku-hint-panel-border: rgba(124, 110, 250, 0.30);     /* Hint panel border */
    --sudoku-hint-technique-color: #a89ff8;                    /* Technique name color */
    --sudoku-hint-blocker-bg: rgba(245, 166, 35, 0.30);        /* Orange: blocking cells */
    --sudoku-hint-connection-bg: rgba(245, 166, 35, 0.10);     /* Faint orange: connection line */
    --sudoku-hint-unit-border: rgba(124, 110, 250, 0.55);      /* Violet: unit outline */
}
/* =============================================================
   SUDOKU APP - MAIN STYLESHEET
   All colors use CSS variables from colors.css.
   RULE: NEVER use hardcoded hex colors here.
   ============================================================= */

/* Fix PWA touch responsiveness */
* {
    -webkit-tap-highlight-color: transparent;
}

button, .sudoku-cell, .number-button, .action-button,
.menu-icon-btn, .difficulty-card, .option-item,
.checkbox, select, a {
    touch-action: manipulation;
    cursor: pointer;
}

.options-language-select {
    appearance: none;
    -webkit-appearance: none;
    color-scheme: dark;
    padding-right: 38px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2712%27 height=%278%27 viewBox=%270 0 12 8%27%3E%3Cpath d=%27m1 1 5 5 5-5%27 fill=%27none%27 stroke=%27%23ffffff%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27 stroke-width=%272%27/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

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

html, body {
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--sudoku-bg-app);
    color: var(--sudoku-text-primary);
    user-select: none;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    height: 100vh;
    position: fixed;
    width: 100%;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    background: var(--sudoku-bg-surface);
    min-height: 100vh;
}

/* =============================================
   APP BAR (game screen top bar)
   ============================================= */
.app-bar {
    background: var(--sudoku-bg-surface);
    padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
    border-bottom: 1px solid var(--sudoku-modal-border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.app-bar-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.app-bar-bottom-row {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.back-button {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: var(--sudoku-bg-elevated);
    border: 1px solid var(--sudoku-modal-border);
    color: var(--sudoku-text-primary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
    transition: background 0.1s;
}

html[dir="rtl"] .back-button {
    transform: scaleX(-1);
    margin-right: 0;
    margin-left: 10px;
}

html[dir="rtl"] .app-bar-top-row {
    direction: rtl;
}

html[dir="rtl"] .game-info {
    direction: rtl;
}

/* Sudoku grid must always be LTR — prevents RTL cascade breaking box borders */
html[dir="rtl"] .sudoku-grid,
html[dir="rtl"] .sudoku-grid-wrapper,
html[dir="rtl"] .sudoku-container {
    direction: ltr;
}

.back-button:hover {
    background: var(--sudoku-bg-surface-hover);
}

.game-info {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.game-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

/* Icon-style action buttons inside game-actions */
.game-actions .btn-secondary {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 11px;
    background: var(--sudoku-bg-elevated);
    border: 1px solid var(--sudoku-modal-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--sudoku-text-primary);
    transition: background 0.1s;
}

.game-actions .btn-secondary:hover {
    background: var(--sudoku-bg-surface-hover);
}

.app-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--sudoku-text-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.timer-display {
    background: var(--sudoku-bg-elevated);
    border: 1px solid var(--sudoku-modal-border);
    border-radius: 8px;
    padding: 4px 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--sudoku-text-secondary);
    font-family: 'Courier New', monospace;
    white-space: nowrap;
    flex-shrink: 0;
}

.error-display {
    font-weight: 600;
    font-size: 12px;
    color: var(--sudoku-error-display-text);
    white-space: nowrap;
    flex-shrink: 0;
    margin-right: 4px;
}

/* =============================================
   MENU SCREEN
   ============================================= */
.menu-screen {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 100vh;
    padding: 0;
    gap: 0;
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom, 16px);
}

/* Header: title on the left, icon buttons on the right */
.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 52px 20px 24px;
    flex-shrink: 0;
}

.menu-title-area { /* wrapper, no extra styles needed */ }

.main-title {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -1.5px;
    color: var(--sudoku-text-primary);
    line-height: 1;
}

.menu-subtitle {
    font-size: 13px;
    color: var(--sudoku-text-secondary);
    margin-top: 6px;
}

.menu-header-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
    flex-shrink: 0;
}

/* Small icon buttons in the menu header */
.menu-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 13px;
    background: var(--sudoku-bg-elevated);
    border: 1px solid var(--sudoku-modal-border);
    color: var(--sudoku-text-primary);
    font-size: 17px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s;
}

.menu-icon-btn:hover {
    background: var(--sudoku-bg-surface-hover);
}

/* Difficulty cards list */
.difficulty-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 16px 12px;
}

.difficulty-card {
    min-height: 90px;
    background: var(--sudoku-bg-elevated);
    border: 1px solid var(--sudoku-modal-border);
    border-radius: 16px;
    padding: 16px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    width: 100%;
    text-align: left;
    color: var(--sudoku-text-primary);
    transition: background 0.1s, border-color 0.1s;
    font-family: inherit;
}

.difficulty-card:hover,
.difficulty-card:active {
    background: var(--sudoku-bg-surface-hover);
    border-color: var(--sudoku-modal-border);
}

/* Colored left accent bar */
.diff-accent-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 16px 0 0 16px;
}

/* Emoji icon inside a tinted rounded square */
.diff-icon-wrap {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.diff-card-name {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--sudoku-text-primary);
}

.diff-card-chevron {
    font-size: 22px;
    color: var(--sudoku-text-disabled);
    line-height: 1;
    flex-shrink: 0;
}

/* Keep old classes for any lingering references */
.option-button,
.difficulty-button {
    display: none;
}

/* =============================================
   GAME SCREEN
   ============================================= */
.game-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* No horizontal padding: grid goes edge-to-edge */
    padding: 12px 0;
    min-height: calc(100vh - 80px);
    gap: 12px;
}

/* When coordinates are visible, add side padding so labels don't clip */
.game-screen.with-coordinates {
    padding: 10px 30px 12px;
}

/* =============================================
   SUDOKU GRID
   ============================================= */
.sudoku-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.sudoku-grid-wrapper {
    position: relative;
    display: block;   /* was inline-block — block lets it stretch full width */
    width: 100%;
}

.coordinates-container {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 10;
}

.row-coordinates {
    position: absolute;
    left: -25px;
    top: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    width: 20px;
}

.col-coordinates {
    position: absolute;
    top: -25px;
    left: 0; right: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 20px;
}

.coordinate-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--sudoku-text-secondary);
    background: var(--sudoku-bg-elevated);
    border: 1px solid var(--sudoku-modal-border);
    border-radius: 4px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Full-width grid — fills the container (capped at 480px by app-container) */
.sudoku-grid {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    border: 2.5px solid var(--sudoku-grid-border);
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
}

/* When coordinates are active, width is already constrained by game-screen padding */
.sudoku-grid.with-coordinates {
    width: 100%;
}

.sudoku-grid.no-events,
.controls.no-events {
    pointer-events: none;
}

/* =============================================
   SUDOKU CELLS
   ============================================= */
.sudoku-cell {
    border: 0.5px solid var(--sudoku-grid-border-inner);
    display: flex;
    align-items: center;
    justify-content: center;
    /* Font scales with viewport so it always fits the cell */
    font-size: clamp(14px, 5.2vw, 32px);
    font-weight: 400;
    cursor: pointer;
    position: relative;
    background: var(--sudoku-cell-bg);
    color: var(--sudoku-text-primary);
    overflow: hidden;
    transition: background-color 0.08s ease;
}

.sudoku-cell.thick-right  { border-right:  2px solid var(--sudoku-grid-border); }
.sudoku-cell.thick-bottom { border-bottom: 2px solid var(--sudoku-grid-border); }

.sudoku-cell.selected {
    background: var(--sudoku-cell-bg-selected) !important;
    color: var(--sudoku-text-primary);
}

.sudoku-cell.error {
    background: rgba(248, 113, 113, 0.18) !important;
    color: var(--sudoku-cell-text-error) !important;
}

.sudoku-cell.error.selected {
    background: rgba(248, 113, 113, 0.55) !important;
    color: var(--sudoku-text-primary) !important;
}

.sudoku-cell.highlight-number { background: var(--sudoku-cell-bg-same-number); }
.sudoku-cell.highlight-area   { background: var(--sudoku-cell-bg-highlight); }
.sudoku-cell.original { color: var(--sudoku-cell-text-given); font-weight: 700; }
.sudoku-cell.user     { color: var(--sudoku-cell-text-user); font-weight: 500; }

.sudoku-cell span {
    position: relative;
    z-index: 2;
}

.sudoku-cell.selected span       { font-weight: 700; }
.sudoku-cell.selected.user span  { color: #d4a520; } /* Amber darkened for selected user cell */

/* Flash animation on conflict */
.sudoku-cell.flash-conflict {
    animation: flashRed 0.6s ease-in-out;
}

@keyframes flashRed {
    0%   { background-color: var(--sudoku-cell-bg); }
    50%  { background-color: var(--sudoku-color-error); }
    100% { background-color: var(--sudoku-cell-bg); }
}

/* Initial fade-in when grid loads */
.sudoku-cell.initial-fade-in {
    animation: fadeIn 0.5s ease-in forwards;
    opacity: 0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Win animation */
.sudoku-cell.win-animate {
    animation: winSpreadText 0.8s ease-in-out forwards;
}

.sudoku-cell.win-animate::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 50%;
    z-index: 20;
    animation: winSpreadEffect 0.8s ease-in-out forwards;
}

@keyframes winSpreadEffect {
    0%   { transform: scale(0); background-color: var(--sudoku-accent-orange); opacity: 1; }
    50%  { transform: scale(1.2); background-color: var(--sudoku-accent-orange); opacity: 1; border-radius: 10%; }
    100% { transform: scale(1); background-color: var(--sudoku-bg-elevated); opacity: 1; border-radius: 0; }
}

@keyframes winSpreadText {
    0%,  49% { }
    50%, 100% { color: var(--sudoku-text-primary); }
}

/* Cell ripple animation on complete */
.sudoku-cell::after {
    content: '';
    position: absolute;
    background-color: var(--sudoku-accent-orange);
    transform: scale(0);
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    z-index: 1;
}

.sudoku-cell.animate-complete::after {
    top: 2px; left: 2px; right: 2px; bottom: 2px;
    animation: growAndShrink 0.8s ease-in-out;
}

.sudoku-cell.animate-complete-selected::after {
    top: 0; left: 0; right: 0; bottom: 0;
    animation: growAndShrinkFull 0.8s ease-in-out;
}

@keyframes growAndShrink {
    0%   { transform: scale(0); opacity: 1; }
    50%  { transform: scale(1.1); opacity: 1; border-radius: 15%; }
    90%  { transform: scale(1.1); opacity: 1; border-radius: 15%; }
    100% { transform: scale(0); opacity: 0; }
}

@keyframes growAndShrinkFull {
    0%   { transform: scale(0); opacity: 1; border-radius: 50%; }
    50%  { transform: scale(1); opacity: 1; border-radius: 0; }
    90%  { transform: scale(1); opacity: 1; border-radius: 0; }
    100% { transform: scale(0); opacity: 0; }
}

/* =============================================
   NOTES (pencil marks)
   ============================================= */
.notes-container {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 0;
    padding: 0;
}

.note {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(6px, 2.2vw, 11px);
    color: var(--sudoku-cell-text-notes);
    font-weight: 600;
    background: none;
    border-radius: 0;
}

.note.highlighted {
    background: var(--sudoku-accent-purple);
    color: var(--sudoku-text-primary);
}

/* White notes on selected cell */
.sudoku-cell.selected .note {
    color: var(--sudoku-text-primary);
}

/* =============================================
   CONTROLS (action + number buttons)
   ============================================= */
.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    /* Add horizontal padding here so only controls are inset, not the grid */
    padding: 0 14px;
}

.action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.action-button {
    width: 44px;
    height: 44px;
    border: 1px solid var(--sudoku-modal-border);
    border-radius: 14px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: background 0.1s, border-color 0.1s;
}

.erase-button {
    background: rgba(239, 68, 68, 0.12);
    color: var(--sudoku-color-error);
    border-color: rgba(239, 68, 68, 0.25);
}

.erase-button:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.22);
    border-color: rgba(239, 68, 68, 0.4);
}

.notes-button {
    background: var(--sudoku-action-notes-bg);
    color: var(--sudoku-text-primary);
    border-color: var(--sudoku-modal-border);
    position: relative;
}

.notes-button.active {
    background: rgba(245, 166, 35, 0.18);
    color: var(--sudoku-accent-orange);
    border-color: rgba(245, 166, 35, 0.45);
}

.notes-button.active .icon-svg {
    filter: brightness(0) saturate(100%) invert(75%) sepia(60%) saturate(800%) hue-rotate(5deg) brightness(105%);
    opacity: 1;
}

.notes-button.active::after {
    content: '';
    position: absolute;
    top: -4px;
    right: -4px;
    width: 8px;
    height: 8px;
    background: var(--sudoku-color-success);
    border-radius: 50%;
    border: 1.5px solid var(--sudoku-bg-surface);
}

.undo-button {
    background: var(--sudoku-action-undo-bg);
    color: var(--sudoku-text-primary);
    border-color: var(--sudoku-modal-border);
}

.undo-button:hover:not(:disabled) {
    background: var(--sudoku-bg-surface-hover);
}

.undo-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.action-button:hover:not(:disabled) {
    opacity: 0.85;
}

/* =============================================
   NUMBER PAD
   ============================================= */
.number-buttons {
    display: flex;
    gap: 5px;
    width: 100%;
    padding: 0;
}

.number-button {
    flex: 1;
    height: 64px;
    border: 1px solid var(--sudoku-modal-border);
    border-radius: 14px;
    font-size: clamp(16px, 4.5vw, 22px);
    font-weight: 700;
    cursor: pointer;
    background: var(--sudoku-bg-elevated);
    color: var(--sudoku-text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background 0.1s, border-color 0.1s;
    gap: 2px;
}

.number-button:hover:not(.highlighted):not(:disabled) {
    background: var(--sudoku-bg-surface-hover);
}

.number-button:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.number-button.highlighted {
    background: rgba(245, 166, 35, 0.32) !important;
    border-color: rgba(245, 166, 35, 0.70) !important;
    color: var(--sudoku-color-warning-light) !important;
    font-weight: 800 !important;
}

.remaining-count {
    font-size: 9px;
    color: var(--sudoku-numpad-count);
    font-weight: 500;
    font-family: system-ui, -apple-system, sans-serif;
}

/* =============================================
   MODALS
   ============================================= */ 
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    background: var(--sudoku-modal-overlay);
    z-index: 1000;
}

.modal.show { display: flex; }

.modal-content {
    background: var(--sudoku-modal-bg);
    color: var(--sudoku-text-primary);
    margin: auto;
    padding: 24px;
    border-radius: 20px;
    max-width: 400px;
    width: 90%;
    border: 1px solid var(--sudoku-modal-border);
    max-height: 88vh;        
    overflow-y: auto;       
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--sudoku-text-primary);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* =============================================
   BUTTONS (general)
   ============================================= */
.btn {
    padding: 8px 14px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    transition: background 0.1s;
}

.btn-primary {
    background: var(--sudoku-btn-primary-bg);
    color: var(--sudoku-text-primary);
}

.btn-primary:hover {
    background: var(--sudoku-btn-primary-hover);
}

.btn-secondary {
    background: var(--sudoku-btn-secondary-bg);
    color: var(--sudoku-text-primary);
    border: 1px solid var(--sudoku-modal-border);
}

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

.btn-danger {
    background: var(--sudoku-btn-danger-bg);
    color: var(--sudoku-text-primary);
}

.btn-danger:hover {
    background: var(--sudoku-btn-danger-hover);
}

/* =============================================
   OPTIONS MODAL ITEMS
   ============================================= */
.option-item {
    display: flex;
    align-items: center;
    padding: 12px 0; 
    border-bottom: 1px solid var(--sudoku-modal-border);
}

.option-item:last-child { border-bottom: none; }

.option-item.clickable {
    cursor: pointer;
    transition: background 0.1s;
    border-radius: 8px; 
    padding: 12px 8px;
    margin: 0 -8px;
}

.option-item.clickable:hover {
    background: var(--sudoku-auth-surface);
}

.checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--sudoku-checkbox-border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: transparent;
    color: var(--sudoku-text-primary);
    font-weight: bold;
    flex-shrink: 0;
    transition: background 0.1s, border-color 0.1s;
}

.checkbox.checked {
    background: var(--sudoku-checkbox-checked-bg);
    border-color: var(--sudoku-checkbox-checked-border);
    color: var(--sudoku-text-primary);
}

.option-details {
    flex: 1;
    margin-left: 12px;
}

.option-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
    color: var(--sudoku-text-primary);
}

.option-subtitle {
    font-size: 11px;
    color: var(--sudoku-text-secondary);
}

/* =============================================
   EXPORT TEXTAREA
   ============================================= */
.export-textarea {
    width: 100%;
    height: 200px;
    background: var(--sudoku-bg-app);
    border: 1px solid var(--sudoku-modal-border);
    border-radius: 10px;
    color: var(--sudoku-text-primary);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    padding: 12px;
    margin: 10px 0;
    resize: vertical;
}

/* =============================================
   UTILITIES
   ============================================= */
.hidden { display: none !important; }

.subtitle {
    font-size: 16px;
    color: var(--sudoku-text-secondary);
    margin-bottom: 10px;
}

.warning-text {
    font-size: 12px;
    color: var(--sudoku-color-success);
    font-style: italic;
    margin-bottom: 30px;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: var(--sudoku-text-primary);
}

.loading-progress {
    margin-top: 10px;
    font-size: 12px;
    color: var(--sudoku-text-secondary);
    text-align: center;
}

.inline-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 60px;
    color: var(--sudoku-text-secondary);
    text-align: center;
}

.inline-loading.inline-loading-row {
    flex-direction: row;
    min-height: auto;
    justify-content: center;
}

.inline-loading-player {
    width: 32px;
    height: 32px;
    opacity: 0.92;
}

.inline-loading.inline-loading-row .inline-loading-player {
    width: 22px;
    height: 22px;
}

.inline-loading-text {
    font-size: 13px;
    color: var(--sudoku-text-secondary);
}

.profile-modal-input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--sudoku-modal-border);
    background: var(--sudoku-bg-surface);
    color: var(--sudoku-text-primary);
    font-size: 15px;
}

.profile-modal-input:focus {
    outline: none;
    border-color: var(--sudoku-accent-purple);
    box-shadow: 0 0 0 3px rgba(124, 110, 250, 0.14);
}

.profile-modal-help {
    margin-top: 10px;
    font-size: 13px;
    color: var(--sudoku-text-secondary);
    line-height: 1.45;
}

.profile-modal-help.success {
    color: var(--sudoku-color-success-light);
}

.profile-modal-help.error {
    color: var(--sudoku-color-error-light);
}

.profile-modal-suggestion {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(124, 110, 250, 0.28);
    background: rgba(124, 110, 250, 0.10);
}

.profile-modal-suggestion-text {
    min-width: 0;
    font-size: 13px;
    color: var(--sudoku-text-primary);
    word-break: break-word;
}

/* =============================================
   ANIMATION OVERLAY (Lottie)
   ============================================= */
.animation-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    pointer-events: none;
}

.animation-overlay lottie-player {
    position: absolute;
    transform: translate(-50%, -50%);
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 400px) {
    .game-screen {
        padding: 8px 0;
        gap: 10px;
    }

    .game-screen.with-coordinates {
        padding: 8px 28px;
    }

    .number-button {
        height: 56px;
    }

    .coordinate-label {
        font-size: 8px;
        width: 14px;
        height: 14px;
    }

    .row-coordinates {
        left: -18px;
        width: 14px;
    }

    .col-coordinates {
        top: -18px;
        height: 14px;
    }

    .controls {
        padding: 0 10px;
    }

    .main-title {
        font-size: 34px;
    }
}

/* SVG icon images — white on dark background */
.icon-svg {
    width: 20px;
    height: 20px;
    display: block;
    filter: brightness(0) invert(1);
    opacity: 0.75;
    flex-shrink: 0;
}

/* Slightly larger for main nav buttons */
.icon-svg-lg {
    width: 22px;
    height: 22px;
    display: block;
    filter: brightness(0) invert(1);
    opacity: 0.85;
    flex-shrink: 0;
}

/* ============================================
   HINT HIGHLIGHTING
   ============================================ */
.sudoku-cell.hint-placement {
    background-color: var(--sudoku-hint-placement-bg) !important;
    box-shadow: inset 0 0 0 2px var(--sudoku-color-success);
}

.sudoku-cell.hint-chain {
    background-color: var(--sudoku-hint-chain-bg) !important;
    box-shadow: inset 0 0 0 2px var(--sudoku-accent-purple);
}

.sudoku-cell.hint-blocker {
    background-color: var(--sudoku-hint-blocker-bg) !important;
    box-shadow: inset 0 0 0 2px var(--sudoku-accent-orange);
}

.sudoku-cell.hint-elimination {
    background-color: var(--sudoku-hint-elimination-bg) !important;
    box-shadow: inset 0 0 0 2px var(--sudoku-color-error);
}

.sudoku-cell.hint-connection {
    background-color: var(--sudoku-hint-connection-bg) !important;
}

/* ============================================
   HINT PANEL
   ============================================ */
.hint-panel {
    margin: 0 12px 12px;
    background: var(--sudoku-hint-panel-bg);
    border: 1px solid var(--sudoku-hint-panel-border);
    border-radius: 14px;
    padding: 14px 16px;
    animation: hintSlideIn 0.25s ease;
}

@keyframes hintSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.hint-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.hint-technique-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--sudoku-hint-technique-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hint-close-btn {
    background: none;
    border: none;
    color: var(--sudoku-text-disabled);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    touch-action: manipulation;
}

.hint-close-btn:hover { color: var(--sudoku-text-primary); }

.hint-panel-text {
    font-size: 13px;
    color: var(--sudoku-text-secondary);
    line-height: 1.5;
}

.hint-panel-text strong {
    color: var(--sudoku-text-primary);
}

.action-button.hint-button {
    background: var(--sudoku-action-notes-bg);
}

.action-button.hint-button.active {
    background: rgba(74, 222, 128, 0.18);
}

/* Hint button active state in app-bar */
#hintButton.active {
    background: rgba(74, 222, 128, 0.18) !important;
    box-shadow: inset 0 0 0 1.5px var(--sudoku-color-success);
}


/* RTL: reverse option items so text appears on the right of checkbox/icon */
html[dir="rtl"] .option-item {
    flex-direction: row-reverse;
}

html[dir="rtl"] .option-details {
    text-align: right;
}

/* ===== MENU GLOBAL LEADERBOARD ===== */
.menu-leaderboard {
    margin: 8px 16px 16px;
    background: var(--sudoku-bg-elevated);
    border: 1px solid var(--sudoku-modal-border);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
}

.menu-leaderboard:empty { display: none; }

.menu-leaderboard-header {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--sudoku-text-secondary);
    margin-bottom: 10px;
}

.menu-lb-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
    border-radius: 8px;
}

.menu-lb-row-me {
    background: rgba(124, 110, 250, 0.15);
}

.menu-lb-rank {
    font-size: 14px;
    min-width: 28px;
    color: var(--sudoku-text-secondary);
}

.menu-lb-name {
    flex: 1;
    font-size: 14px;
    color: var(--sudoku-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.menu-lb-row-me .menu-lb-name {
    font-weight: 600;
    color: var(--sudoku-accent-purple-light);
}

.menu-lb-pts {
    font-size: 13px;
    font-weight: 600;
    color: var(--sudoku-accent-orange);
    white-space: nowrap;
}

/* ============================================
   OFFLINE TOAST + ICON
   ============================================ */

/* Icon in headers — hidden by default, shown when offline */
.offline-icon {
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
}

body.is-offline .offline-icon {
  display: inline-flex;
}

/* Toast notification */
#offline-toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--sudoku-offline-bg);
  color: var(--sudoku-offline-text);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 24px;
  max-width: calc(100% - 48px);
  white-space: normal;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#offline-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== DIFFICULTY CARD PROGRESS ===== */
.diff-card-progress {
    font-size: 12px;
    color: var(--sudoku-text-disabled);
    margin-left: auto;
    margin-right: 10px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* auth.css - Authentication screen styles for Sudoku App */

/* ============================================
   AUTH SCREEN CONTAINER
   ============================================ */
#auth-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(
        135deg,
        var(--sudoku-auth-bg-gradient-start) 0%,
        var(--sudoku-auth-bg-gradient-end) 100%
    );
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;   /* elements start from top */
    z-index: 9999;
    padding: 40px 24px 28px;
    overflow-y: auto;
    min-height: 100vh;
}

/* ============================================
   LOGO / TITLE (top section)
   ============================================ */
.auth-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 0 24px;
    animation: authFadeInDown 0.6s ease forwards;
}

.auth-logo-title {
    font-size: 52px;
    font-weight: 700;
    letter-spacing: 8px;
    color: var(--sudoku-text-primary);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.auth-logo-subtitle {
    font-size: 15px;
    color: var(--sudoku-text-secondary);
    letter-spacing: 2px;
    text-transform: uppercase;
}

@keyframes authFadeInDown {
    from { opacity: 0; transform: translateY(-24px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   FORM CONTAINER (bottom section)
   ============================================ */
.auth-container {
    width: 100%;
    max-width: 400px;
    animation: authFadeInUp 0.6s ease 0.1s both;
}

@keyframes authFadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   ERROR / SUCCESS MESSAGE
   ============================================ */
.auth-message {
    display: none;
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 18px;
    font-size: 14px;
    text-align: center;
    animation: authShake 0.4s ease;
}

.auth-message.error {
    background: var(--sudoku-auth-error-bg);
    border: 1px solid var(--sudoku-color-error);
    color: var(--sudoku-color-error-soft);
}

.auth-message.success {
    background: var(--sudoku-auth-success-bg);
    border: 1px solid var(--sudoku-color-success);
    color: var(--sudoku-color-success);
}

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

/* ============================================
   FORM INPUTS
   ============================================ */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-input-wrapper {
    position: relative;
}

.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"] {
    width: 100%;
    padding: 15px 20px;
    background: var(--sudoku-auth-input-bg);
    border: 1.5px solid var(--sudoku-auth-input-border);
    border-radius: 14px;
    font-size: 16px;
    color: var(--sudoku-text-primary);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

.auth-form input::placeholder {
    color: var(--sudoku-text-disabled);
}

.auth-form input:focus { 
    outline: none;
    border-color: var(--sudoku-auth-input-focus-border);
    box-shadow: 0 0 0 4px var(--sudoku-auth-input-focus-glow);
}

/* Password eye toggle */
#auth-toggle-password {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none; 
    border: none;
    cursor: pointer;
    font-size: 20px;
    padding: 4px;
    opacity: 0.45;
    transition: opacity 0.2s ease;
    touch-action: manipulation;
}

html[dir="rtl"] #auth-toggle-password {
    right: auto;
    left: 14px;
}

#auth-toggle-password:hover { opacity: 0.85; }

/* ============================================
   REMEMBER ME + FORGOT PASSWORD
   ============================================ */
.auth-extras {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2px;
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.auth-remember input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--sudoku-accent-blue);
}

.auth-remember label {
    font-size: 14px;
    color: var(--sudoku-text-secondary);
    cursor: pointer;
}

#auth-forgot-link {
    font-size: 13px;
    color: var(--sudoku-auth-link);
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s ease;
    background: none;
    border: none;
    padding: 0;
    touch-action: manipulation;
}

#auth-forgot-link:hover {
    color: var(--sudoku-auth-link-hover);
    text-decoration: underline;
}

/* ============================================
   MAIN ACTION BUTTON
   ============================================ */
.auth-submit-btn {
    width: 100%;
    padding: 17px;
    margin-top: 10px;
    background: var(--sudoku-btn-primary-bg);
    border: none;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 600;
    color: var(--sudoku-text-primary);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.auth-submit-btn:hover:not(:disabled) {
    background: var(--sudoku-btn-primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--sudoku-shadow-md);
}

.auth-submit-btn:active:not(:disabled) { transform: translateY(0); }

.auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Loading spinner on button */
.auth-submit-btn.loading { pointer-events: none; }
.auth-submit-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2.5px solid transparent;
    border-top-color: var(--sudoku-text-primary);
    border-radius: 50%;
    animation: authSpinner 0.6s linear infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes authSpinner {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ============================================
   DIVIDER "or"
   ============================================ */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--sudoku-auth-divider);
}

.auth-divider span {
    font-size: 13px;
    color: var(--sudoku-text-disabled);
    white-space: nowrap;
}

/* ============================================
   GOOGLE SIGN-IN BUTTON
   ============================================ */
.auth-google-btn {
    width: 100%;
    padding: 15px;
    background: var(--sudoku-auth-google-bg);
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 500;
    color: var(--sudoku-auth-google-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: opacity 0.2s ease, transform 0.15s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.auth-google-btn:hover:not(:disabled) {
    opacity: 0.92;
    transform: translateY(-1px);
}

.auth-google-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-google-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ============================================
   SIGN IN / SIGN UP TOGGLE
   ============================================ */
.auth-switch {
    text-align: center;
    margin-top: 22px;
    font-size: 14px;
    color: var(--sudoku-text-disabled);
}

.auth-switch a {
    color: var(--sudoku-auth-link-hover);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    margin-left: 5px;
    transition: color 0.2s ease;
}

.auth-switch a:hover { text-decoration: underline; }

/* ============================================
   LANGUAGE SELECTOR + LEGAL LINKS (bottom)
   ============================================ */
.auth-bottom {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px; 
}

.auth-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    padding-top: 30px;
    padding-bottom: env(safe-area-inset-bottom, 34px);
    width: 100%;
}

#auth-lang-select {
    background: var(--sudoku-auth-input-bg);
    color: var(--sudoku-text-primary);
    border: 1px solid var(--sudoku-auth-input-border);
    border-radius: 10px;
    padding: 9px 34px 9px 14px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    width: 110px;
    text-align: center;
    appearance: none;
    -webkit-appearance: none;
    color-scheme: dark;
    background-image: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2712%27 height=%278%27 viewBox=%270 0 12 8%27%3E%3Cpath d=%27m1 1 5 5 5-5%27 fill=%27none%27 stroke=%27%23ffffff%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27 stroke-width=%272%27/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.auth-legal {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12px;
    width: 100%;
    text-align: center;
    padding: 0 20px;
    box-sizing: border-box;
}

.auth-legal a {
    color: var(--sudoku-auth-link);
    text-decoration: none;
    transition: color 0.2s;
}

.auth-legal a:hover {
    color: var(--sudoku-auth-link-hover);
}

.auth-legal span {
    color: var(--sudoku-text-disabled);
}

/* ============================================
   RTL SUPPORT
   ============================================ */
html[dir="rtl"] .auth-extras { flex-direction: row-reverse; }
html[dir="rtl"] .auth-switch a { margin-left: 0; margin-right: 5px; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-height: 680px) {
    #auth-screen { padding: 30px 24px 24px; }
    .auth-logo-title { font-size: 40px; }
}

@media (max-width: 360px) {
    .auth-logo-title { font-size: 40px; letter-spacing: 5px; }
    .auth-form input { padding: 14px 18px; }
}



.auth-google-btn.loading { pointer-events: none; position: relative; color: transparent; }
.auth-google-btn.loading svg { opacity: 0; }
.auth-google-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2.5px solid transparent;
    border-top-color: var(--sudoku-auth-google-text);
    border-radius: 50%;
    animation: authSpinner 0.6s linear infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ============================================
   APPLE SIGN-IN BUTTON
   ============================================ */
.auth-apple-btn {
    width: 100%;
    padding: 15px;
    margin-top: 12px;
    background: #ffffff;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 500;
    color: #000000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: opacity 0.2s ease, transform 0.15s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.auth-apple-btn:hover:not(:disabled) {
    opacity: 0.88;
    transform: translateY(-1px);
}

.auth-apple-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-apple-btn svg { flex-shrink: 0; }

.auth-apple-btn.loading { pointer-events: none; color: transparent; }
.auth-apple-btn.loading svg { opacity: 0; }
.auth-apple-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2.5px solid transparent;
    border-top-color: #000000;
    border-radius: 50%;
    animation: authSpinner 0.6s linear infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ============================================
   GUEST / CONTINUE WITHOUT ACCOUNT BUTTON
   ============================================ */
.auth-guest-btn {
    width: 100%;
    margin-top: 18px;
    background: none;
    border: none;
    color: var(--sudoku-text-secondary);
    font-size: 14px;
    cursor: pointer;
    padding: 8px;
    text-align: center;
    transition: color 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.auth-guest-btn:hover {
    color: var(--sudoku-text-primary);
}

