/* Winning screen styling */
.winner-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin: 2rem 0;
    animation: fadeIn 0.8s ease;
}

.winner-word {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--success);
    letter-spacing: -0.05em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.winner-guesses {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

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

.winner-buttons .action-button {
    width: 100%;
    justify-content: center;
}

.winner-chatter-name {
    font-size: 2rem;
    color: white;
    margin: 1rem 0;
    font-weight: bold;
    text-align: center;
}

.winner-total-guesses {
    color: var(--text-secondary);
    margin-top: 1rem;
    text-align: center;
}

.winner-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    margin-top: 1rem;
}

.winner-actions button {
    width: 100%;
}

#new-game-from-win-btn i {
    margin-right: 0.5rem;
}

.action-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background-color: var(--accent-primary);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

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

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

.success-button {
    background-color: var(--success);
}

.success-button:hover {
    background-color: #16a34a;
}

/* Responsive adjustments */
@media (max-width: 700px) {
    .winner-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .winner-buttons .action-button {
        width: 100%;
    }
}

/* Modal styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}


.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    background-color: var(--bg-secondary);
    z-index: 10;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    padding-right: 0.5rem;
}

.close-button {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    margin-left: auto;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2.5rem;
}

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

.modal-body {
    padding: 1rem;
    overflow-y: auto;
    max-height: calc(80vh - 4rem);
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) rgba(255, 255, 255, 0.1);
}

/* Custom scrollbar for webkit browsers (Chrome, Safari, etc.) */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background-color: var(--accent-primary);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background-color: var(--accent-secondary);
}

.closest-words-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.closest-words-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.closest-words-list li::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: var(--progress-color, transparent);
    transition: width 0.5s ease-out;
    z-index: -1;
    width: var(--progress-width, 0%);
}

.closest-words-list li:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.closest-words-list li > * {
    z-index: 2;
}

.closest-words-list .word {
    color: white;
    font-weight: 800;
    font-size: 1.1rem;
}

.closest-words-list .distance {
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    padding: 0.25rem 0.5rem;
    background-color: rgba(72, 51, 255, 0.1);
    border-radius: calc(var(--border-radius) - 4px);
    transition: var(--transition);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Score-based background colors for distance indicators in modal */
.closest-words-list .distance.distance-far {
    background-color: rgba(239, 68, 68, 0.5); /* Based on progress-red but darker */
}

.closest-words-list .distance.distance-medium {
    background-color: rgba(245, 158, 11, 0.5); /* Based on progress-yellow but darker */
}

.closest-words-list .distance.distance-close {
    background-color: rgba(34, 197, 94, 0.5); /* Based on progress-green but darker */
}

.closest-words-list .distance.distance-very-close {
    background-color: rgba(21, 128, 61, 0.6); /* Based on progress-dark-green but darker */
}

.winner-closest-words {
    background-color: var(--background-secondary);
    border: 1px solid var(--border-color);
}

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

/* Twitch Settings Dialog Styles */
.settings-modal {
    max-width: 500px;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 1rem;
}

/* Toggle Switch Styling */
.toggle-container {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

.switch {
    --_switch-bg-clr: #1a1a1a;
    --_switch-padding: 4px;
    --_slider-bg-clr: rgba(145, 70, 255, 0.65);
    --_slider-bg-clr-on: rgba(145, 70, 255, 1);
    --_slider-txt-clr: #ffffff;
    --_label-padding: 0.875rem 2rem;
    --_switch-easing: cubic-bezier(0.47, 1.64, 0.41, 0.8);
    
    color: white;
    width: fit-content;
    display: flex;
    justify-content: center;
    position: relative;
    border-radius: 9999px;
    cursor: pointer;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    position: relative;
    isolation: isolate;
    font-weight: 600;
    font-size: 1rem;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.switch input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.switch > span {
    display: grid;
    place-content: center;
    transition: opacity 300ms ease-in-out 150ms;
    padding: var(--_label-padding);
}

.switch::before,
.switch::after {
    content: "";
    position: absolute;
    border-radius: inherit;
    transition: inset 150ms ease-in-out;
}

/* switch slider */
.switch::before {
    background-color: var(--_slider-bg-clr);
    inset: var(--_switch-padding) 50% var(--_switch-padding) var(--_switch-padding);
    transition:
        inset 500ms var(--_switch-easing),
        background-color 500ms ease-in-out;
    z-index: -1;
    box-shadow:
        inset 0 1px 1px rgba(0, 0, 0, 0.3),
        0 1px rgba(255, 255, 255, 0.3);
}

/* switch bg color */
.switch::after {
    background-color: var(--_switch-bg-clr);
    inset: 0;
    z-index: -2;
}

/* switch hover & focus */
.switch:focus-within::after {
    inset: -0.25rem;
}

.switch:has(input:checked):hover > span:first-of-type,
.switch:has(input:not(:checked)):hover > span:last-of-type {
    opacity
    transition-delay: 0ms;
    transition-duration: 100ms;
}

/* switch hover */
.switch:has(input:checked):hover::before {
    inset: var(--_switch-padding) var(--_switch-padding) var(--_switch-padding) 45%;
}

.switch:has(input:not(:checked)):hover::before {
    inset: var(--_switch-padding) 45% var(--_switch-padding) var(--_switch-padding);
}

/* checked - move slider to right */
.switch:has(input:checked)::before {
    background-color: var(--_slider-bg-clr-on);
    inset: var(--_switch-padding) var(--_switch-padding) var(--_switch-padding) 50%;
}

/* checked - set opacity */
.switch > span:last-of-type,
.switch > input:checked + span:first-of-type {
    opacity: 0.75;
}

.switch > input:checked ~ span:last-of-type {
    opacity: 1;
}

/* Guess Limits Section */
.guess-limits {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    opacity: 1;
    transform: translateY(0);
}

.guess-limits.hidden {
    display: none;
    opacity: 0;
    transform: translateY(-10px);
}

.guess-limit-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    /* Establish a stacking context */
    position: relative; 
    z-index: 1; /* Give it a base z-index */
}

.guess-limit-group label {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
}

.guess-select {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.5rem 0rem 0.5rem 1rem;
    font-size: 1rem;
    border-right: 16px solid transparent;
    min-width: 120px;
    cursor: pointer;
    transition: all 0.2s ease;

}


/* Settings Toggle */
.settings-toggle-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.settings-label {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.simple-toggle {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

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

.simple-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-primary);
    transition: .4s;
    border-radius: 34px;
    border: 2px solid var(--border-color);
}

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

.simple-toggle input:checked + .simple-toggle-slider {
    background-color: rgba(236, 72, 153, 1);
    border-color: rgba(236, 72, 153, 1);
}

.simple-toggle input:checked + .simple-toggle-slider:before {
    transform: translateX(24px);
    background-color: white;
}

/* Info Cards */
.info-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-card {
    position: relative;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    z-index: 1;
}

.info-card:first-child {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, transparent 100%);
    border-color: rgba(79, 70, 229, 0.2);
}

.info-card:last-child {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.1) 0%, transparent 100%);
    border-color: rgba(236, 72, 153, 0.2);
}

.info-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.info-card:first-child:hover {
    border-color: rgba(79, 70, 229, 0.5);
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.15) 0%, rgba(79, 70, 229, 0.05) 100%);
}

.info-card:last-child:hover {
    border-color: rgba(236, 72, 153, 0.5);
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.15) 0%, rgba(236, 72, 153, 0.05) 100%);
}

.info-icon {
    position: absolute;
    bottom: -0.5rem;
    right: -0.5rem;
    font-size: 4rem;
    opacity: 0.15;
    transform: rotate(-5deg);
    transition: all 0.3s ease;
    z-index: -1;
}

.info-card:hover .info-icon {
    transform: rotate(0deg) scale(1.1);
    opacity: 0.25;
}

.info-card:first-child .info-icon {
    color: rgba(79, 70, 229, 0.8);
}

.info-card:last-child .info-icon {
    color: rgba(236, 72, 153, 0.8);
}

.info-card p {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.7;
    text-align: left;
    max-width: 90%;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.info-card .highlight {
    color: #fff;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.info-card .bullet-point {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.info-card .bullet-point i,
.info-card .bullet-point .emoji {
    font-size: 1.1rem;
    margin-top: 0.2rem;
    flex-shrink: 0;
    opacity: 0.9;
}

.info-card .bullet-point:last-child {
    margin-bottom: 0;
}

.info-card:first-child .bullet-point i,
.info-card:first-child .highlight i {
    color: rgba(79, 70, 229, 1);
}

.info-card:last-child .bullet-point i,
.info-card:last-child .highlight i {
    color: rgba(236, 72, 153, 1);
}

/* Modal Footer Modifications */
.settings-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

