:root {
            --dark-bg: #121212;
            --dark-surface: #1e1e1e;
            --dark-surface-lighter: #2d2d2d;
            --text-primary: #e0e0e0;
            --text-secondary: #a0a0a0;
            --accent: #4fc3f7;
            --accent-light: #8bf6ff;
            --accent-dark: #0093c4;
            --error: #cf6679;
            --success: #4caf50;
            --grid-cell-size: 48px;
            --grid-border: 1px solid #444;
        }

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

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: var(--dark-bg);
            color: var(--text-primary);
            line-height: 1.6;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
        }

        header {
            background-color: var(--dark-surface);
            padding: 1.5rem;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
            text-align: center;
            position: relative;
        }

        header h1 {
            color: var(--accent);
            font-size: 2rem;
            margin-bottom: 0.5rem;
        }

        header p {
            color: var(--text-secondary);
            max-width: 700px;
            margin: 0 auto;
        }

        nav {
            background-color: var(--dark-surface-lighter);
            display: flex;
            justify-content: center;
            padding: 0.5rem;
        }

        .tab {
            background: none;
            border: none;
            color: var(--text-secondary);
            padding: 0.8rem 1.5rem;
            margin: 0 0.2rem;
            cursor: pointer;
            border-radius: 4px;
            transition: all 0.3s;
            font-weight: 500;
        }

        .tab:hover {
            background-color: rgba(79, 195, 247, 0.1);
            color: var(--accent);
        }

        .tab.active {
            background-color: rgba(79, 195, 247, 0.2);
            color: var(--accent);
        }

        main {
            flex: 1;
            padding: 2rem;
            max-width: 1200px;
            margin: 0 auto;
            width: 100%;
        }

        .tab-content {
            display: none;
            opacity: 0;
            transition: opacity 0.3s;
        }

        .tab-content.active {
            display: block;
            opacity: 1;
        }

        .input-group {
            margin-bottom: 1.5rem;
        }

        label {
            display: block;
            margin-bottom: 0.5rem;
            color: var(--text-secondary);
        }

        input[type="text"],
        textarea,
        select {
            width: 100%;
            padding: 0.8rem;
            background-color: var(--dark-surface);
            border: 1px solid #444;
            border-radius: 4px;
            color: var(--text-primary);
            font-family: inherit;
            transition: border-color 0.3s;
        }

        input[type="text"]:focus,
        textarea:focus,
        select:focus {
            border-color: var(--accent);
            outline: none;
        }

        button {
            background-color: var(--accent);
            color: #000;
            border: none;
            padding: 0.8rem 1.5rem;
            border-radius: 4px;
            cursor: pointer;
            font-weight: 500;
            transition: background-color 0.3s;
        }

        button:hover {
            background-color: var(--accent-light);
        }

        button:disabled {
            background-color: #555;
            cursor: not-allowed;
        }

        .btn-secondary {
            background-color: var(--dark-surface-lighter);
            color: var(--text-primary);
        }

        .btn-secondary:hover {
            background-color: #3d3d3d;
        }

        .btn-danger {
            background-color: var(--error);
        }

        .btn-danger:hover {
            background-color: #e57373;
        }

        .table-container {
            margin-top: 2rem;
            background-color: var(--dark-surface);
            border-radius: 4px;
            overflow: hidden;
        }

        table {
            width: 100%;
            border-collapse: collapse;
        }

        th {
            background-color: var(--dark-surface-lighter);
            padding: 0.8rem;
            text-align: left;
            color: var(--accent);
            font-weight: 500;
        }

        td {
            padding: 0.8rem;
            border-top: 1px solid #444;
            vertical-align: top;
        }

        .word-input-container {
            display: flex;
            gap: 1rem;
            margin-bottom: 1rem;
        }

        .word-input-container input {
            flex: 1;
        }

        .word-input-container button {
            flex-shrink: 0;
        }

        .words-list {
            max-height: 300px;
            overflow-y: auto;
            margin-top: 1rem;
        }

        .word-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0.5rem;
            border-bottom: 1px solid #444;
        }

        .word-item:hover {
            background-color: var(--dark-surface-lighter);
        }

        .word-item .word-text {
            font-weight: 500;
        }

        .word-item .word-clue {
            color: var(--text-secondary);
            margin-left: 1rem;
            flex: 1;
        }

        .crossword-container {
            display: flex;
            flex-direction: column;
            margin-top: 2rem;
            gap: 2rem;
        }

        @media (min-width: 768px) {
            .crossword-container {
                flex-direction: row;
            }
        }

        .crossword-grid-container {
            flex: 1;
            overflow: auto;
            background-color: var(--dark-surface);
            border-radius: 8px;
            padding: 1rem;
        }

        .crossword-grid {
            display: inline-grid;
            grid-gap: 0;
            margin: 0 auto;
        }

        .cell {
            width: var(--grid-cell-size);
            height: var(--grid-cell-size);
            border: var(--grid-border);
            display: flex;
            justify-content: center;
            align-items: center;
            position: relative;
            background-color: var(--dark-surface-lighter);
            transition: all 0.2s;
            padding: 4px;
            box-sizing: border-box;
        }

        .cell.empty {
            background-color: var(--dark-bg);
            border: none;
        }

        .cell.selected {
            background-color: rgba(79, 195, 247, 0.3);
        }

        .cell.highlighted {
            background-color: rgba(79, 195, 247, 0.1);
        }

        .cell-number {
            position: absolute;
            top: 1px;
            left: 1px;
            font-size: 0.65rem;
            color: var(--text-secondary);
            line-height: 1;
            z-index: 1;
        }

        .cell-input {
            width: 100%;
            height: 100%;
            border: none;
            background: transparent;
            text-align: center;
            font-size: 0.85rem;
            font-weight: bold;
            color: var(--text-primary);
            text-transform: uppercase;
            padding: 0;
            margin: 0;
            line-height: 1;
            position: relative;
            top: 0;
            letter-spacing: -0.8px;
        }

        .cell-input:focus {
            outline: none;
        }

        .clues-container {
            width: 100%;
            max-width: 400px;
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }

        .clues-section {
            background-color: var(--dark-surface);
            border-radius: 8px;
            padding: 1rem;
        }

        .clues-section h3 {
            color: var(--accent);
            margin-bottom: 0.5rem;
            border-bottom: 1px solid #444;
            padding-bottom: 0.5rem;
        }

        .clue-item {
            padding: 0.5rem;
            cursor: pointer;
            border-radius: 4px;
            margin-bottom: 0.2rem;
            transition: all 0.2s;
        }

        .clue-item:hover {
            background-color: var(--dark-surface-lighter);
        }

        .clue-item.active {
            background-color: rgba(79, 195, 247, 0.2);
        }

        .clue-number {
            font-weight: bold;
            color: var(--accent);
            margin-right: 0.5rem;
        }

        .controls {
            display: flex;
            justify-content: space-between;
            margin-bottom: 1.5rem;
            flex-wrap: wrap;
            gap: 1rem;
        }

        .controls-group {
            display: flex;
            gap: 0.5rem;
        }

        .timer {
            background-color: var(--dark-surface);
            padding: 0.5rem 1rem;
            border-radius: 4px;
            display: inline-flex;
            align-items: center;
            margin-left: auto;
        }

        .timer-icon {
            margin-right: 0.5rem;
            color: var(--accent);
        }

        .message {
            margin-top: 1rem;
            padding: 1rem;
            border-radius: 4px;
            text-align: center;
        }

        .message.success {
            background-color: rgba(76, 175, 80, 0.2);
            color: var(--success);
        }

        .message.error {
            background-color: rgba(207, 102, 121, 0.2);
            color: var(--error);
        }

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

        @media (min-width: 768px) {
            .settings-grid {
                grid-template-columns: 1fr 1fr;
            }
        }

        .settings-card {
            background-color: var(--dark-surface);
            border-radius: 8px;
            padding: 1.5rem;
        }

        .settings-card h3 {
            color: var(--accent);
            margin-bottom: 1rem;
            border-bottom: 1px solid #444;
            padding-bottom: 0.5rem;
        }

        .switch-container {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem;
        }

        .switch {
            position: relative;
            display: inline-block;
            width: 54px;
            height: 28px;
        }

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

        .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #555;
            transition: .4s;
            border-radius: 34px;
        }

        .slider:before {
            position: absolute;
            content: "";
            height: 20px;
            width: 20px;
            left: 4px;
            bottom: 4px;
            background-color: var(--text-primary);
            transition: .4s;
            border-radius: 50%;
        }

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

        input:focus + .slider {
            box-shadow: 0 0 1px var(--accent);
        }

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

        .range-slider {
            display: flex;
            flex-direction: column;
            margin-bottom: 1rem;
        }

        .range-slider input {
            margin-top: 0.5rem;
            -webkit-appearance: none;
            width: 100%;
            height: 6px;
            background: #555;
            border-radius: 5px;
        }

        .range-slider input::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 18px;
            height: 18px;
            border-radius: 50%;
            background: var(--accent);
            cursor: pointer;
        }

        .range-slider .range-value {
            margin-top: 0.3rem;
            color: var(--text-secondary);
            text-align: right;
        }

        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.7);
            z-index: 1000;
            justify-content: center;
            align-items: center;
            padding: 1rem;
        }

        .modal-content {
            background-color: var(--dark-surface);
            border-radius: 8px;
            max-width: 500px;
            width: 100%;
            max-height: 90vh;
            overflow-y: auto;
            animation: modal-appear 0.3s;
        }

        @keyframes modal-appear {
            from {
                opacity: 0;
                transform: translateY(-50px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .modal-header {
            padding: 1rem 1.5rem;
            border-bottom: 1px solid #444;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .modal-header h3 {
            color: var(--accent);
        }

        .close-modal {
            background: none;
            border: none;
            color: var(--text-secondary);
            font-size: 1.5rem;
            cursor: pointer;
            padding: 0;
        }

        .close-modal:hover {
            color: var(--text-primary);
        }

        .modal-body {
            padding: 1.5rem;
        }

        .modal-footer {
            padding: 1rem 1.5rem;
            border-top: 1px solid #444;
            display: flex;
            justify-content: flex-end;
            gap: 0.8rem;
        }

        footer {
            text-align: center;
            padding: 1.5rem;
            margin-top: 2rem;
            background-color: var(--dark-surface);
            color: var(--text-secondary);
        }

        /* Loading Spinner */
        .loading-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.7);
            z-index: 2000;
            justify-content: center;
            align-items: center;
        }

        .spinner {
            width: 50px;
            height: 50px;
            border: 5px solid transparent;
            border-top-color: var(--accent);
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

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

        /* Toast Notification */
        .toast {
            position: fixed;
            bottom: 20px;
            right: 20px;
            background-color: var(--dark-surface);
            color: var(--text-primary);
            padding: 1rem 1.5rem;
            border-radius: 4px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
            z-index: 1000;
            display: flex;
            align-items: center;
            min-width: 250px;
            transform: translateY(100px);
            opacity: 0;
            transition: all 0.3s;
        }

        .toast.show {
            transform: translateY(0);
            opacity: 1;
        }

        .toast.success {
            border-left: 4px solid var(--success);
        }

        .toast.error {
            border-left: 4px solid var(--error);
        }

        .toast-icon {
            margin-right: 0.8rem;
            font-size: 1.2rem;
        }

        .toast-message {
            flex: 1;
        }

        .toast-close {
            background: none;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            padding: 0.2rem;
            margin-left: 0.5rem;
        }

        .toast-close:hover {
            color: var(--text-primary);
        }

        /* Print Styles */
        @media print {
            header, nav, footer, .controls, button {
                display: none !important;
            }

            body, main {
                background: white !important;
                color: black !important;
                padding: 0 !important;
                margin: 0 !important;
            }

            .crossword-grid-container, .clues-container, .clues-section, .cell {
                background: white !important;
                color: black !important;
            }

            .cell-input {
                color: black !important;
            }

            .clue-number {
                color: black !important;
            }

            .print-header {
                display: block !important;
                text-align: center;
                margin-bottom: 1rem;
            }

            .print-header h2 {
                margin-bottom: 0.5rem;
            }
        }