.ws-hidden {
    display: none;
}

/* View Switcher */
.ws-view-switcher {
    display: flex;
    border-bottom: 2px solid #e5e7eb;
    justify-content: center;
    gap: 6px;
}

.ws-view-btn {
    border: none;
    color: #374151;
    background: #f3f4f6;
    padding: 5px 16px;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-weight: 500;
    font-size: 17px;
    transition: transform 0.1s ease;
}

.ws-view-btn.active {
    background: #2563eb;
    color: #fff;
}

.ws-main-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-height: 485px;
}

.ws-container {
    max-width: 800px;
    margin: 0 auto 40px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    background-color: #ffffff;
}

.ws-title {
    text-align: center;
    margin-top: 3px;
    margin-bottom: 20px;
}

.ws-main-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.ws-grid {
    display: grid;
    /* gap: 2px; */
    /* Replaced with border-collapse-like style */
    margin: 0;
    border-top: 1px solid #aaa;
    border-left: 1px solid #aaa;
}

/* --- Fullscreen Simulation for iOS/Mobile --- */
body.ws-simulated-fullscreen {
    overflow: hidden;
    /* Hide body scrollbars */
}

.ws-container.ws-simulated-fullscreen-active {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    max-width: 100%;
    border-radius: 0;
    overflow-y: auto;
    /* Allow scrolling within the container if needed */
    background-color: #fff;
    /* Ensure solid background */
}

/* Enable scrolling for native fullscreen mode */
.ws-container:fullscreen,
.ws-container:-webkit-full-screen {
    overflow-y: auto;
}

.ws-cell {
    background: #fff;
    border-bottom: 1px solid #aaa;
    border-right: 1px solid #aaa;
    text-align: center;
    font-weight: 500;
    user-select: none;
    font-size: 18px;
    /* Use flex to center content in a responsive cell */
    display: flex;
    align-items: center;
    justify-content: center;
}

.ws-cell.found {
    background: #90ee90;
    color: #000;
}

.ws-wordlist {
    display: flex;
    justify-content: center;
    width: 100%;
}

.ws-wordlist ul {
    list-style: none;
    padding: 15px 0 5px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin: 0;
}

.ws-wordlist li {
    padding: 4px 10px;
    background: #e9e9e9;
    border-radius: 5px;
    font-size: 16px;
}

.ws-wordlist li.found {
    text-decoration: line-through;
    color: green;
}

/* Styles for no-border mode */
.ws-grid.no-borders {
    border: none;
}

.ws-grid.no-borders .ws-cell {
    border: none;
}

/* Settings View */
#ws-settings-view:not(.ws-hidden) {
    display: flex;
    justify-content: center;
    /* Center the controls block */
    padding: 20px;
    /* Keep padding */
}

.ws-settings-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    /* Align items to the left */
    gap: 15px;
    /* Match gap from 1.html */
    color: #555;
}

.ws-setting-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
    width: auto;
    border-left: 3px solid #e5e7eb;
    padding-left: 15px;
    margin-left: 10px;
}

.ws-settings-buttons {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    width: 100%;
    justify-content: center;
    /* Center the buttons */
}

.ws-setting-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: normal;
    /* Match 1.html */
}

.ws-setting-row {
    width: 100%;
    max-width: 280px;
    /* Limit width for better alignment */
}

/* --- Settings Input Styles --- */
.ws-setting-item select,
.ws-setting-item input[type="number"] {
    padding: 3px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: #fff;
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.ws-setting-item select:hover,
.ws-setting-item input[type="number"]:hover {
    border-color: #d1d5db;
    box-shadow: none;
}

.ws-setting-item select:focus,
.ws-setting-item select:active,
.ws-setting-item input[type="number"]:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.2);
    background-color: #fff;
}

.ws-setting-item select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 8L10 12L14 8' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 7px center;
    background-size: 20px;
    padding-right: 35px;
}

.ws-setting-item input[type="number"] {
    text-align: center;
    appearance: textfield;
    -moz-appearance: textfield;
}

.ws-setting-item input[type="number"]::-webkit-inner-spin-button,
.ws-setting-item input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ws-setting-item label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.ws-setting-item input[type="checkbox"],
.ws-setting-item input[type="radio"] {
    width: 1.1em;
    height: 1.1em;
    margin: 0;
}

/* Override theme hover styles for checkboxes/radios */
.ws-setting-item input[type="checkbox"]:hover,
.ws-setting-item input[type="radio"]:hover {
    box-shadow: none;
}

/* --- End Settings Input Styles --- */
#ws-timer-duration {
    width: 50px;
    /* Match 1.html */
}

#ws-timer-display {
    font-size: 1.2em;
    color: #d9534f;
}

.ws-action-btn {
    padding: 5px 13px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    transition: background-color 0.3s, transform 0.1s ease;
}

/* Override theme hover/focus/active styles for all buttons */
.ws-container button:hover,
.ws-container button:focus,
.ws-container button:active {
    outline: none;
    box-shadow: none;
}

.ws-container button:active {
    transform: scale(0.97);
    /* Add click effect */
}

.ws-view-btn:not(.active):hover,
.ws-view-btn:not(.active):focus {
    background: #f3f4f6;
    color: #374151;
}

.ws-view-btn.active:hover,
.ws-view-btn.active:focus {
    background: #2563eb;
    color: #fff;
}

.ws-action-btn:not(.ws-btn-secondary):hover,
.ws-action-btn:not(.ws-btn-secondary):focus {
    background-color: #2563eb;
}

.ws-btn-secondary:hover,
.ws-btn-secondary:focus {
    background-color: #6c757d;
}

#ws-fullscreen-btn {
    padding: 4px;
    /* Reduced padding to accommodate a larger icon */
    width: 40px;
    /* Explicit width to match the height */
}

.ws-fullscreen-icon {
    vertical-align: middle;
    /* Better alignment inside the button */
}


.ws-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.ws-popup-overlay.show {
    display: flex;
}

.ws-popup-content {
    background: #fff;
    padding: 25px 35px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    width: 90%;
    max-width: 380px;
    text-align: center;
}

.ws-popup-content h2 {
    margin-top: 0;
    margin-bottom: 15px;
}

#ws-result-time {
    font-weight: 500;
    margin: 20px 0;
    font-size: 1.1em;
    text-align: center;
}

#ws-restart-countdown {
    margin-top: 15px;
    color: #555;
    text-align: center;
}

.ws-result-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.ws-btn-secondary {
    background-color: #6c757d;
}

.faq-list {
    margin-top: 1rem;
}

.faq-list dt {
    font-weight: 500;
    font-size: 1.1em;
}

.faq-list dd {
    margin-left: 0;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    padding-left: 1rem;
    padding-bottom: 10px;
    border-bottom: 1px dashed #ddd;
}

/* --- Mobile Responsive Styles --- */
@media (max-width: 600px) {
    .ws-main-layout {
        min-height: 370px;
    }

    .ws-container {
        margin-bottom: 30px;
        padding: 15px 0;
        border-radius: 0;
        box-shadow: none;
        border-top: 1px solid #e5e7eb;
        border-bottom: 1px solid #e5e7eb;
    }

    #ws-settings-view:not(.ws-hidden) {
        padding: 20px 0;
    }

    .ws-setting-item select,
    .ws-setting-item input[type="number"] {
        padding: 8px;
    }
    
    #ws-grid-size {
        width: 100px;
    }

    .ws-action-btn {
        padding: 8px 13px;
    }
    
    #ws-fullscreen-btn {
        padding: 7px;
    }
}