*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #ffffff; /* Wordle-style page background */
    color: #000000;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}


.header {
    padding: 1.25rem 1.5rem 0.25rem;
    position: relative;
    width: 100%;
    max-width: 600px;
}

.logo {
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #000000;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-decoration: none;
}

.logo-img {
    display: block;
    width: 230px; /* Source image is 400px wide; we scale down for header */
    height: auto;
    max-width: 75vw;
}

.tagline {
    margin-top: 1rem;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    color: #9ca3af;
    padding: 0 1.5rem;
    text-align: center;
    max-width: 18rem;
    line-height: 1.4;
    margin-left: auto;
    margin-right: auto;
}

.panel {
    background: #ffffff;
    border-radius: 0;
    padding: .75rem 1.5rem 2rem;
    margin: 1rem;
    margin-top: 0;
    box-shadow: none;
    max-width: 480px;
    width: 100%;
}

.panel h2 {
    margin: 0 0 0.25rem;
    font-size: 1.4rem;
}

.subheading {
    margin: 0 0 1rem;
    color: #000000;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
}

body.dark-mode .subheading {
    color: #f9fafb;
}

.create-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.create-form label {
    font-size: 0.95rem;
    font-weight: 500;
}

.text-input {
    padding: 0.65rem 0.75rem;
    border-radius: 0.25rem;
    border: 1px solid #3a3a3c;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.text-input:focus {
    border-color: #20a815;
    box-shadow: 0 0 0 1px #20a815;
}

.text-input.readonly {
    background: #f9fafb;
    width: 100%;
}

.hint {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.15rem;
    margin-bottom: 0.25rem;
}

.primary-btn,
.secondary-btn {
    border: none;
    border-radius: 999px;
    padding: 0.6rem 1.3rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease, color 0.15s ease;
    text-decoration: none;
}

.primary-btn {
    background: #20a815;
    color: #ffffff;
}

.primary-btn:hover {
    background: #1fa815c7;
}

.secondary-btn {
    background: #000;
    color: #f9fafb;
    box-shadow: none;
}

.secondary-btn:hover {
    background: #666;
}

.inline-btn {
    margin-top: 1.5rem;
    width: 100%;
}

.share-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px dashed #e5e7eb;
}

.share-buttons {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    width: 100%;
}

.error {
    margin-top: 0.35rem;
    color: #b91c1c;
    font-size: 0.85rem;
}

.hidden {
    display: none !important;
}

.board {
    display: grid;
    /* Row count is set dynamically in JS to support 3-10 letter puzzles. */
    grid-auto-rows: 1fr;
    row-gap: 0.3rem;
    margin: 1.25rem auto 1.25rem;
    width: 100%;
    max-width: 330px; /* Keep Wordle-like tile sizes on 3–10 letter puzzles */
}

.row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    column-gap: 0.3rem;
}

.tile {
    width: 3.1rem;
    height: 3.1rem;
    border: 2px solid #d3d6da;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 0.15rem;
    background: #ffffff;
    color: #000000;
}

.tile.win-pop {
    animation: tile-pop 180ms ease-out forwards;
}

@keyframes tile-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

.tile.filled {
    border-color: #878a8c;
}

.tile.correct {
    background: #20a815;
    border-color: #20a815;
    color: #ffffff;
}

.tile.present {
    background: #f9ff00;
    border-color: #f9ff00;
    color: #121213;
}

.tile.absent {
    background: #787c7e;
    border-color: #787c7e;
    color: #f9fafb;
}

.keyboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    margin: 0 auto;
    max-width: 600px;
}

.keyboard-row {
    width: auto;
    display: flex;
    justify-content: center;
    gap: 0.25rem;
}

.key {
    height: 3rem;
    border-radius: 0.25rem;
    border: none;
    background: #d3d6da;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
     color: #111827;
    transition: background 0.1s ease, transform 0.05s ease;
    width: 43px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.key.enter-key {
    background: #20a815;
    color: #ffffff;
}

.key svg {
    width: 20px;
    height: 20px;
}

.key svg path {
    fill: #000;
}

.key.delete-key {
    background: #d3d6da;
    box-shadow: none;
    color: #000; /* SVG uses currentColor */
}

.key.delete-key svg {
    width: 80%;
    height: 80%;
    background-color: #fff;
    border-radius: 7px;
}

.key.wide {
    width: 65px;
}

.key.correct {
    background: #20a815;
    color: #ffffff;
}

.key.present {
    background: #f9ff00;
}

/* Color blind mode (blue / orange) */
body.colorblind .tile.correct,
body.colorblind .key.correct {
    background: #85c0f9;
    border-color: #85c0f9;
    color: #111827;
}

body.colorblind .tile.present,
body.colorblind .key.present {
    background: #f5793a;
    border-color: #f5793a;
    color: #111827;
}

.key.absent {
    background: #787c7e;
    color: #f9fafb;
}

.key:active {
    transform: translateY(1px);
}

@media (max-width: 480px) {
    .keyboard {
        max-width: 100%;
    }

    .keyboard-row {
        gap: 0.18rem;
    }

    .key {
        width: 34px;
        height: 2.6rem;
        font-size: 0.8rem;
    }

    .key.wide {
        width: 50px;
    }
}

.status {
    min-height: 1.2rem;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: #374151;
}
.footer-help {
    display: block;
    margin-top: 0.35rem;
    width: 100%;
    text-align: center;
}

.footer {
    margin-top: auto;
    padding: 0.75rem 1rem 1rem;
    font-size: 0.75rem;
    color: #9ca3af;
}

.share-buttons .primary-btn,
.share-buttons .secondary-btn {
    flex: 1 1 0;
    justify-content: center;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.35rem;
}

.header-right {
    position: absolute;
    right: 1.5rem;
    top: 1.35rem;
    transform: none;
}

@media (max-width: 480px) {
    .logo-img {
        width: 170px;
    }
}

.icon-button {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.15rem;
    color: #6b7280;
    padding: 0.25rem;
}

.icon-button:hover {
    color: #111827;
}

.icon-button svg,
.icon-button svg path,
.icon-button svg circle,
.icon-button svg rect {
    fill: currentColor;
}

body.dark-mode .icon-button {
    color: #e5e7eb;
}

body.dark-mode .icon-button:hover {
    color: #ffffff;
}

.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.settings-modal {
    background: #f9fafb;
    color: #111827;
    padding: 1.5rem 1.75rem;
    border-radius: 0.75rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.5);
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.settings-header h3 {
    margin: 0;
    font-size: 1.1rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.settings-subtitle {
    margin: 0 0 1rem;
    font-size: 0.85rem;
    color: #4b5563;
}

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

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.settings-label {
    display: flex;
    flex-direction: column;
}

.settings-title {
    font-size: 0.9rem;
    font-weight: 600;
}

.settings-help {
    font-size: 0.75rem;
    color: #9ca3af;
}

.switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
}

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

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

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.2s;
    border-radius: 999px;
}

.switch input:checked + .slider {
    background-color: #22c55e;
}

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

body.dark-mode {
    background: #121213;
    color: #f9fafb;
}

body.dark-mode .panel {
    background: #121213;
}

body.dark-mode .logo {
    color: #f9fafb;
}

body.dark-mode .tagline {
    color: #d1d5db;
}

body.dark-mode .primary-btn {
    background: #20a815;
    color: #ffffff;
}

body.dark-mode .secondary-btn {
    background: #e5e7eb;
    color: #111827;
}

body.dark-mode .settings-modal {
    background: #1f2933;
    color: #f9fafb;
}

body.dark-mode .settings-subtitle {
    color: #d1d5db;
}

.info-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.info-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-swatch {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid #d3d6da;
    flex-shrink: 0;
}

.info-swatch.correct {
    background: #20a815;
    border-color: #20a815;
}

.info-swatch.present {
    background: #f9ff00;
    border-color: #f9ff00;
}

.info-swatch.absent {
    background: #787c7e;
    border-color: #787c7e;
}

body.colorblind .info-swatch.correct {
    background: #85c0f9;
    border-color: #85c0f9;
}

body.colorblind .info-swatch.present {
    background: #f5793a;
    border-color: #f5793a;
}

.win-modal {
    text-align: center;
}

.win-row-indicator {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin: 0.5rem 0 0.75rem;
}

.win-row-indicator .tile-mini {
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 0.2rem;
    background: #d3d6da;
}

.win-buttons {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    justify-content: center;
    align-items: center;
    width: 100%;
}


@media (min-width: 500px) {
    .panel {
        padding: 0rem 2rem 2.25rem;
    }

    .tile {
        width: 3.1rem;
        height: 3.1rem;
    }
}

@media (min-width: 768px) {
    .panel, .tagline, .header, .footer {
        max-width: 600px;
    }
  
    
}

