.wordle-mode-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 480px;
    margin: 0 auto 20px;
}

.wordle-mode-tab {
    flex: 1;
    min-width: 140px;
    padding: 10px 14px;
    border: 0.5px solid var(--color-border);
    background: white;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.wordle-mode-tab.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.wordle-mode-tab:not(.active):hover {
    background: var(--color-bg);
    border-color: var(--color-border-strong);
}

.game-container {
    max-width: 480px;
    margin: 0 auto;
}

.wordle-title {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 4px;
}

.wordle-subtitle {
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.wordle-board {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.wordle-row {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.wordle-row.shake {
    animation: shake 0.4s;
}

@keyframes shake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(4px); }
    30%, 50%, 70% { transform: translateX(-8px); }
    40%, 60% { transform: translateX(8px); }
}

.wordle-cell {
    width: 52px;
    height: 52px;
    border: 2px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-text);
    background: white;
    transition: all 0.15s;
}

.wordle-cell[data-state="correct"] {
    background: var(--color-sudoku-start);
    border-color: var(--color-sudoku-start);
    color: white;
}

.wordle-cell[data-state="present"] {
    background: #D8A030;
    border-color: #D8A030;
    color: white;
}

.wordle-cell[data-state="absent"] {
    background: var(--color-text-muted);
    border-color: var(--color-text-muted);
    color: white;
}

.wordle-message {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary);
    min-height: 20px;
    margin-bottom: 16px;
}

.wordle-keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wordle-kb-row {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.wordle-key {
    min-width: 32px;
    height: 46px;
    padding: 0 8px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--color-border);
    color: var(--color-text);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}

.wordle-key.wide {
    flex: 0 0 auto;
    min-width: 52px;
    font-size: 11px;
}

.wordle-key:hover {
    background: var(--color-border-strong);
}

.wordle-key[data-state="correct"] {
    background: var(--color-sudoku-start);
    color: white;
}

.wordle-key[data-state="present"] {
    background: #D8A030;
    color: white;
}

.wordle-key[data-state="absent"] {
    background: var(--color-text-muted);
    color: white;
}

.wordle-tournament-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wordle-tournament-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    border: 0.5px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
}

.wordle-tournament-name {
    font-weight: 700;
    font-size: 16px;
    color: var(--color-text);
}

.wordle-tournament-divider {
    border-top: 0.5px solid var(--color-border);
}

.wordle-tournament-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.wordle-tournament-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.wordle-tournament-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.wordle-tournament-sep {
    color: var(--color-border-strong);
}

.wordle-tournament-card .btn {
    flex: 0 0 auto;
    padding: 8px 16px;
    font-size: 13px;
    white-space: nowrap;
}

.wordle-tournament-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
}

/* ---------- Challenge a Friend ---------- */
.wc-subtabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.wc-subtab {
    flex: 1;
    padding: 8px 12px;
    border: 0.5px solid var(--color-border);
    background: white;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.wc-subtab.active {
    background: var(--color-primary-tint);
    color: var(--color-primary);
    border-color: var(--color-primary-light);
}

.wc-subtab:not(.active):hover {
    background: var(--color-bg);
    border-color: var(--color-border-strong);
}

.wc-visibility-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 16px;
}

/* Same pattern as pages/challenges.css's .share-box -- duplicated here rather than shared since
   only one page's CSS loads at a time and this page must not depend on challenges.css. */
.share-box {
    display: flex;
    gap: 8px;
    align-items: center;
    background: var(--color-primary-tint);
    border: 0.5px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-top: 16px;
}

.share-box input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--color-primary);
    font-size: 14px;
    font-weight: 600;
}

.share-box input:focus {
    outline: none;
}

.wc-copy-btn {
    flex: 0 0 auto;
    padding: 8px 12px;
    font-size: 18px;
    line-height: 1;
}

.wc-mine-item {
    margin-bottom: 12px;
}

.wc-mine-summary-card {
    flex-wrap: wrap;
    gap: 12px;
}

.wc-mine-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--color-text);
    letter-spacing: 0.5px;
}

.wc-mine-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 6px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.wc-mine-meta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.wc-expired {
    color: var(--color-danger);
    font-weight: 600;
}

.wc-more-info-btn {
    flex: 0 0 auto;
}

.wc-mine-detail {
    background: var(--color-surface);
    border: 0.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-top: -4px;
}

.wc-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

.wc-detail-close {
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.wc-detail-close:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.wc-attempts-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--color-text);
    margin-top: 16px;
    margin-bottom: 8px;
}

.wc-attempts-table {
    display: flex;
    flex-direction: column;
}

.wc-attempt-row {
    display: grid;
    grid-template-columns: 32px 1fr 90px 90px;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    border-bottom: 0.5px solid var(--color-border);
    font-size: 13px;
}

.wc-attempt-row:last-child {
    border-bottom: none;
}

.wc-attempt-header {
    font-weight: 700;
    color: var(--color-text-muted);
    font-size: 11px;
    text-transform: uppercase;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    border-bottom: none;
}

.wc-attempt-index,
.wc-attempt-count {
    color: var(--color-text-muted);
}

.wc-attempt-user {
    font-weight: 600;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wc-attempt-result {
    display: inline-block;
    justify-self: start;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.wc-attempt-result.solved {
    background: #E4F5EE;
    color: var(--color-success);
}

.wc-attempt-result.failed {
    background: #FCEBE9;
    color: var(--color-danger);
}

.wc-no-completions {
    font-size: 13px;
    color: var(--color-text-muted);
}

@media (max-width: 480px) {
    .wc-attempt-row {
        grid-template-columns: 24px 1fr 60px 70px;
        font-size: 12px;
    }
}

.wc-load-more {
    display: block;
    width: 100%;
    margin-top: 4px;
}

.wordle-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    background: var(--color-surface);
    border: 0.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
}

.wordle-stat {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wordle-stat-icon {
    font-size: 18px;
    line-height: 1;
}

.wordle-stat-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary);
}

.wordle-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
}

.wordle-stat-value.urgent {
    color: var(--color-danger);
}

/* ---------- Post-round summary modal ----------
   Same overlay/dialog/close pattern as index.html's sign-in modal (defined in pages/home.css),
   duplicated here rather than shared since only one page's CSS loads at a time and this page
   must not depend on home.css. */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(44, 44, 42, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 300;
}

.modal-dialog {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 52px 24px 24px;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    border-radius: var(--radius-sm);
    z-index: 1;
}

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

.wordle-summary-celebrate {
    position: relative;
    display: flex;
    justify-content: center;
    height: 64px;
    margin-bottom: 8px;
}

.wordle-summary-trophy-wrap {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--color-primary-tint);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wordle-summary-trophy-wrap svg {
    width: 30px;
    height: 30px;
}

.wordle-summary-confetti {
    position: absolute;
    top: 8px;
    width: 7px;
    height: 7px;
    border-radius: 2px;
}

.wordle-summary-confetti-1 {
    left: calc(50% - 92px);
    background: #F2B705;
    transform: rotate(20deg);
}

.wordle-summary-confetti-2 {
    left: calc(50% - 68px);
    top: 34px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--color-danger);
}

.wordle-summary-confetti-3 {
    right: calc(50% - 92px);
    background: var(--color-primary);
    transform: rotate(-20deg);
}

.wordle-summary-confetti-4 {
    right: calc(50% - 68px);
    top: 34px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--color-success);
}

.wordle-summary-title {
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    color: var(--color-text);
    margin-bottom: 4px;
}

.wordle-summary-subtitle {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 20px;
}

.wordle-summary-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 20px;
}

.wordle-summary-row {
    display: flex;
    gap: 4px;
}

.wordle-summary-cell {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: var(--color-text-muted);
}

.wordle-summary-cell[data-state="correct"] {
    background: var(--color-sudoku-start);
}

.wordle-summary-cell[data-state="present"] {
    background: #D8A030;
}

.wordle-summary-cell.empty {
    background: var(--color-border);
}

.wordle-summary-breakdown {
    border-top: 0.5px solid var(--color-border);
    padding-top: 12px;
    margin-bottom: 16px;
}

.wordle-summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--color-text-secondary);
    padding: 4px 0;
}

.wordle-summary-line-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wordle-summary-line-icon {
    display: flex;
    flex: 0 0 auto;
    color: var(--color-primary);
}

.wordle-summary-line-icon svg {
    width: 16px;
    height: 16px;
}

.wordle-summary-total {
    border-top: 0.5px solid var(--color-border);
    margin-top: 6px;
    padding-top: 10px;
    font-weight: 700;
    color: var(--color-text);
    font-size: 16px;
}

/* ---------- Daily Challenge share options ---------- */
.wordle-share-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wordle-share-option {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--color-primary);
    border-radius: var(--radius-lg);
    background: var(--color-primary-tint);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: filter 0.15s;
}

.wordle-share-option:hover {
    filter: brightness(0.97);
}

.wordle-share-friends {
    border-color: var(--color-success);
    background: #E3F5EE;
}

.wordle-share-option-icon {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: white;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wordle-share-friends .wordle-share-option-icon {
    color: var(--color-success);
}

.wordle-share-option-icon svg {
    width: 22px;
    height: 22px;
}

.wordle-share-option-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wordle-share-option-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--color-primary);
}

.wordle-share-friends .wordle-share-option-title {
    color: var(--color-success);
}

.wordle-share-option-desc {
    font-size: 13px;
    color: var(--color-text-secondary);
    line-height: 1.4;
}

/* Badge + chevron live in their own column on the right, out of the title's text flow, so a long
   title never pushes the badge onto its own visual row underneath. */
.wordle-share-option-side {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    color: var(--color-primary);
}

.wordle-share-friends .wordle-share-option-side {
    color: var(--color-success);
}

.wordle-share-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--color-primary);
    color: white;
    font-size: 12px;
    font-weight: 700;
}

.wordle-share-badge-green {
    background: var(--color-success);
}

.wordle-share-option-side svg {
    width: 18px;
    height: 18px;
}

/* Set by markClaimed() once this specific option's bonus has been awarded -- the other option
   stays fully interactive regardless. */
.wordle-share-option-claimed {
    cursor: default;
    opacity: 0.7;
}

.wordle-share-option-claimed:hover {
    filter: none;
}

.wordle-share-or {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--color-primary);
    font-weight: 700;
    font-size: 12px;
}

.wordle-share-or::before,
.wordle-share-or::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

@media (max-width: 420px) {
    .wordle-cell {
        width: 42px;
        height: 42px;
        font-size: 20px;
    }

    .wordle-key {
        min-width: 26px;
        height: 42px;
        font-size: 12px;
    }
}
