:root {
    --bg-main: #1a1c20;
    --bg-secondary: #232529;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-blue: #8ab4f8;
    --accent-note: #7aa1d6;
    --grid-border: #44474f;
    --grid-thick-border: #777a85;
    --cell-bg: #282a2f;
    --cell-selected: #004a77;
    --cell-highlight: #3c4043;
    --success-green: #34a853;
    --error-red: rgba(235, 52, 52, 0.6);
    --bg-button: #303134;
    --hint-highlight: rgba(52, 168, 83, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.main-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    color: var(--text-secondary);
    position: relative;
}

.header-title h1 {
    font-size: 20px;
    color: var(--text-primary);
    text-align: center;
}

.animated-title {
    background: linear-gradient(90deg, var(--accent-blue), #ffffff, var(--accent-blue));
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 3s linear infinite;
    text-shadow: 0 0 20px rgba(138, 180, 248, 0.3);
    transition: transform 0.3s ease;
}

.animated-title:hover {
    transform: scale(1.05);
}

@keyframes shimmer {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 200% center;
    }
}

.header-title p {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

.settings-icon {
    position: absolute;
    right: 0;
    cursor: pointer;
    font-size: 18px;
}

.sub-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.timer-container {
    display: flex;
    align-items: center;
    font-weight: 500;
}

.timer-icon {
    margin-right: 8px;
    color: var(--text-secondary);
}

.difficulty-badge {
    background: #3c4043;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    color: var(--accent-blue);
    text-transform: uppercase;
    font-weight: 700;
}

.reset-btn {
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    transition: color 0.2s;
}

.reset-btn:hover {
    color: var(--text-primary);
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    background-color: var(--grid-border);
    gap: 1px;
    border: 2px solid var(--grid-thick-border);
    margin-bottom: 10px;
    /* Reduced to make room for hint */
    border-radius: 4px;
    overflow: hidden;
}

.cell {
    background-color: var(--cell-bg);
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 26px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    user-select: none;
    transition: all 0.2s ease, box-shadow 0.3s ease;
}

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

.cell.user-input {
    color: var(--accent-blue);
}

.cell.error {
    background-color: var(--error-red) !important;
    color: #fff;
}

.cell.selected {
    background-color: var(--cell-selected) !important;
}

.cell.highlighted {
    background-color: var(--cell-highlight);
}

.cell.same-number {
    background-color: #003355;
}

.cell.hint-depiction {
    background-color: var(--hint-highlight) !important;
}

.note-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.note-num {
    font-size: 8px;
    color: var(--accent-note);
    display: flex;
    justify-content: center;
    align-items: center;
}

.cell:nth-child(3n) {
    border-right: 2px solid var(--grid-thick-border);
}

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

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

/* Floating Hint Label - positioned below grid */
.hint-badge {
    background-color: var(--success-green);
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
    line-height: 1.4;
}

.hint-badge.hidden {
    display: none;
}

.hint-badge i.close-hint {
    margin-left: 15px;
    cursor: pointer;
    opacity: 0.9;
    font-size: 20px;
    flex-shrink: 0;
}

.hint-badge i.close-hint:hover {
    opacity: 1;
}

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

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

@keyframes blinkSuccessAnim {
    0% {
        background-color: var(--cell-bg);
        box-shadow: 0 0 0 rgba(52, 235, 119, 0);
    }

    40% {
        background-color: #74ff8e;
        box-shadow: 0 0 5px rgba(52, 235, 119, 0.8);
        /* transform: scale(1.1); */
    }

    100% {
        background-color: var(--cell-bg);
        box-shadow: 0 0 0 rgba(52, 235, 119, 0);
        transform: scale(1);
    }
}

.blink-success {
    animation: blinkSuccessAnim 0.8s ease-in-out;
}

.controls-mid {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
}

.control-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 20px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.control-item:hover {
    color: var(--text-primary);
    transform: translateY(-2px);
}

.control-item.active-mode {
    color: var(--text-primary);
    background-color: var(--cell-selected);
}

.numpad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 25px;
}

.num-btn {
    background-color: var(--bg-button);
    border-radius: 12px;
    height: 55px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    color: var(--accent-blue);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.num-btn:hover {
    background-color: #3c4043;
    transform: translateY(-2px);
    /* box-shadow: 0 4px 12px rgba(138, 180, 248, 0.3); */
    border-color: var(--accent-blue);
}

.num-btn:active {
    background-color: #444;
    transform: translateY(0);
}

.num-btn.action-btn {
    font-size: 14px;
    flex-direction: column;
    color: var(--text-secondary);
}

.num-btn.action-btn i {
    font-size: 18px;
    margin-bottom: 4px;
}

.result-btn {
    background-color: var(--accent-blue);
    color: #000;
    padding: 15px;
    border-radius: 25px;
    font-weight: 700;
    width: 100%;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    /* box-shadow: 0 4px 15px rgba(138, 180, 248, 0.4); */
    position: relative;
    overflow: hidden;
}

.result-btn:hover {
    transform: translateY(-2px);
    /* box-shadow: 0 6px 20px rgba(138, 180, 248, 0.6); */
    background: linear-gradient(135deg, var(--accent-blue), #9bc5ff);
}

.result-btn:active {
    transform: scale(0.98);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background-color: var(--bg-secondary);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    width: 85%;
    max-width: 320px;
}

.difficulty-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 15px 20px;
    margin: 10px 0;
    background-color: var(--bg-button);
    color: var(--text-primary);
    border-radius: 12px;
    border: none;
    cursor: pointer;
}

.end-game-btn {
    width: 100%;
    padding: 15px;
    margin-top: 10px;
    background-color: var(--accent-blue);
    color: #000;
    border-radius: 12px;
    font-weight: bold;
    border: none;
    cursor: pointer;
}

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

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    color: var(--text-primary);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.app-footer {
    position: fixed;
    bottom: 10px;
    right: 10px;
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.7;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.app-footer:hover {
    opacity: 1;
}

.app-footer a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.2s ease;
}

.app-footer a:hover {
    color: #ffffff;
    text-decoration: underline;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-button);
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--accent-blue);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.app-footer {
    position: fixed;
    bottom: 10px;
    right: 10px;
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.7;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.app-footer:hover {
    opacity: 1;
}

.app-footer a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.2s ease;
}

.app-footer a:hover {
    color: #ffffff;
    text-decoration: underline;
}