:root {
    --primary: #222222;
    --primary-hover: #333333;
    --secondary: #444444;
    --bg-dark: #0a0a0a;
    --bg-input: #171717;
    --bg-card: #1f1f1f;
    --text-white: #ffffff;
    --text-muted: #94a3b8;
    --border: #262626;
    --accent: #1d6e00;
    --pointer-color: #ffffff;
    --shadow: 0 4px 30px rgba(0, 0, 0, 0.7);
}

@media (prefers-color-scheme: light) {
    :root {
        --primary: #f8fafc;
        --primary-hover: #f1f5f9;
        --bg-dark: #ffffff;
        --bg-input: #f1f5f9;
        --bg-card: #f1f5f9;
        --text-white: #0f172a;
        --text-muted: #475569;
        --border: #e2e8f0;
        --pointer-color: #000000;
        --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    }

    .tabs-container {
        background: #f1f5f9 !important;
        border-bottom: 1px solid #e2e8f0;
    }

    .tab-item {
        background: #f1f5f9;
        color: #475569;
        opacity: 0.8;
    }

    .tab-item.active {
        background: #ffffff;
        color: #0f172a;
        border-bottom: 1px solid #ffffff;
        opacity: 1;
    }

    .tab-name {
        color: inherit;
    }

    .modal-content {
        background: #ffffff;
    }

    .primary-btn,
    .secondary-btn,
    .action-btn.keep {
        background-color: #0f172a !important;
        color: #ffffff !important;
    }

    .primary-btn:hover,
    .secondary-btn:hover,
    .action-btn.keep:hover {
        background-color: #1e293b !important;
    }

    .primary-btn svg,
    .action-btn svg {
        stroke: white !important;
        fill: white !important;
    }

    .delete-tab,
    .delete-word {
        color: #64748b;
    }

    .add-tab-btn {
        background: #e2e8f0;
        color: #0f172a;
        border-color: #cbd5e1;
        opacity: 1 !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }

    .add-tab-btn:hover {
        background: var(--accent);
        border-color: var(--accent);
        color: white;
        box-shadow: 0 0 10px var(--accent);
    }
}

.tabs-container {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 1rem 2rem 0;
    background: #222222;
    border-bottom: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 50;
    overflow: hidden;
    scrollbar-width: none;
}

.tabs-container::-webkit-scrollbar {
    display: none;
}

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

.tab-item {
    padding: 0 1.2rem;
    height: 40px;
    background: #222222;
    color: white;
    border: none;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    opacity: 0.6;
    transition: opacity 0.2s, background 0.2s;
    position: relative;
    top: 1px;
    border-bottom: 1px solid #000;
}

.tab-item.active {
    opacity: 1;
    background: var(--bg-dark);
    /* #111111 */
    z-index: 10;
    border-bottom: 1px solid var(--bg-dark);
}

.tab-name-container {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.tab-name {
    visibility: visible;
}

.tab-name-container.editing .tab-name {
    visibility: hidden;
}

.tab-edit-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-card);
    border: 2px solid var(--accent);
    border-radius: 0;
    color: var(--text-white);
    padding: 0;
    margin: 0;
    font-size: inherit;
    line-height: inherit;
    font-family: inherit;
    outline: none;
    text-align: center;
    z-index: 20;
}

.tab-item:hover {
    opacity: 1;
}

.delete-tab {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0 0.2rem;
}

.delete-tab:hover {
    color: #ef4444;
}

.add-tab-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    margin-bottom: 0.2rem;
    margin-left: 0.5rem;
    opacity: 0.6;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 1.1rem;
}

.add-tab-btn:hover {
    opacity: 1;
    background: var(--accent);
    border-color: var(--accent);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 0 15px var(--accent);
}


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

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

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

::-webkit-scrollbar-thumb {
    background: #ffffff;
    border-radius: 5px;
    border: 3px solid #111111;
}

::-webkit-scrollbar-thumb:hover {
    background: #e0e0e0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-white);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

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

header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--text-white);
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
}

main {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 3rem;
    align-items: start;
}

@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
    }
}

.wheel-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wheel-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1/1;
    margin-bottom: 2rem;
}

#wheelCanvas {
    width: 100%;
    height: 100%;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pointer {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 30px solid var(--pointer-color);
    z-index: 10;
}

.primary-btn {
    padding: 0.8rem 2.2rem 0.8rem 1.8rem;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: white;
    background-color: var(--primary);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-width: 160px;
}

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

.primary-btn svg {
    fill: white;
}

.controls-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.storage-controls {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.5rem;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
}

.action-btn.secondary {
    background: #334155;
    color: #94a3b8;
}

.action-btn.secondary:hover {
    background: #475569;
    color: white;
}

.storage-controls .action-btn {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    padding: 0;
}

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

input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    color: var(--text-white);
    font-size: 1rem;
    outline: none;
}

input:focus {
    border-color: var(--primary);
}

.secondary-btn {
    padding: 0.8rem 1.2rem;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
}

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

.word-list-container {
    background: var(--bg-input);
    border-radius: 12px;
    padding: 1.2rem;
    height: 280px;
    overflow-y: auto;
    border: 1px solid var(--border);
}

.word-list-container h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

#wordList {
    list-style: none;
}

.word-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: grab;
    transition: transform 0.2s, border-color 0.2s, background 0.2s;
}

.word-item:active {
    cursor: grabbing;
}

.word-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.word-item.over {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

.word-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}



.word-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.slice-color {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    max-width: 24px !important;
    min-height: 24px !important;
    max-height: 24px !important;
    -webkit-appearance: none;
    appearance: none;
    flex-shrink: 0;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    background: none;
    padding: 0;
    margin: 0;
    display: block;
    overflow: hidden;
}

.slice-color::-webkit-color-swatch-wrapper {
    padding: 0;
    width: 100%;
    height: 100%;
}

.slice-color::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
    width: 100%;
    height: 100%;
}

.word-info span {
    color: var(--text-white);
    cursor: text;
    user-select: none;
    border-radius: 4px;
}

.word-edit-input {
    background: var(--bg-card);
    border: 1px solid var(--accent);
    color: var(--text-white);
    padding: 0;
    margin: 0;
    border-radius: 0;
    font-size: inherit;
    line-height: inherit;
    font-family: inherit;
    outline: none;
    flex: 1;
    width: 0;
    min-width: 0;
    z-index: 10;
    box-sizing: border-box;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.delete-word {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.4rem;
}

.delete-word:hover {
    color: #ef4444;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: #111111;
    padding: 2.5rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
}

.modal-content p {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1.1rem;
    line-height: 1.5;
}

.modal-content h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--text-white);
}

.modal-input-group {
    margin-bottom: 2rem;
}

.modal-input-group label {
    display: block;
    text-align: left;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-input-group input[type="text"] {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    color: var(--text-white);
    font-size: 1.1rem;
    outline: none;
}

.modal-input-group input[type="color"] {
    width: 100%;
    height: 50px;
    background: none;
    border: 1px solid var(--border);
    padding: 5px;
    border-radius: 8px;
    cursor: pointer;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}



.action-btn.keep {
    background: var(--primary);
    color: white;
}

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

.action-btn.delete {
    background: #ef4444;
    color: white;
}

.action-btn.delete:hover {
    background: #dc2626;
}