/* WordMaze Styles
 * A distinctive, warm aesthetic with paper/maze vibes
 */

:root {
    /* Warm earthy palette with a pop of teal */
    --bg-primary: #f7f3eb;
    --bg-secondary: #ebe5d9;
    --bg-card: #ffffff;
    --text-primary: #2d2a26;
    --text-secondary: #6b6560;
    --text-muted: #9d9690;
    --accent: #0d9488;
    --accent-light: #14b8a6;
    --accent-dark: #0f766e;
    --highlight: #fbbf24;
    --highlight-light: #fcd34d;
    --success: #22c55e;
    --error: #ef4444;
    --cell-bg: #fefcf9;
    --cell-border: #d4cfc5;
    --cell-hover: #e8f5f3;
    --cell-selected: #ccfbf1;
    --cell-found: #d1fae5;
    --path-line: #14b8a6;
    
    /* Typography */
    --font-display: 'Archivo Black', sans-serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Borders */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

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

/* Utility class for hiding elements */
.hidden {
    display: none !important;
}

html {
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    
    /* Subtle maze pattern background */
    background-image: 
        linear-gradient(90deg, var(--bg-secondary) 1px, transparent 1px),
        linear-gradient(var(--bg-secondary) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: -1px -1px;
}

/* App container */
.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--space-md);
    min-height: 100vh;
}

/* Header */
.header {
    text-align: center;
    padding: var(--space-xl) 0;
}

.logo {
    font-family: var(--font-display);
    font-size: 2.5rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.logo span {
    color: var(--accent);
}

.tagline {
    color: var(--accent);
    margin-top: var(--space-sm);
    font-size: 1.5rem;
    font-weight: 700;
}

.header-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    margin-top: var(--space-xs);
}

.header-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* Screens */
.screen {
    display: none;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

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

/* Menu */
.menu-content {
    display: grid;
    gap: var(--space-lg);
}

.menu-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--cell-border);
}

.menu-card h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    margin-bottom: var(--space-sm);
}

.menu-card p {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.menu-card.how-to-play ol {
    padding-left: var(--space-lg);
    color: var(--text-secondary);
}

.menu-card.how-to-play li {
    margin-bottom: var(--space-sm);
}

.menu-card.how-to-play strong {
    color: var(--accent);
}

/* Difficulty buttons */
.difficulty-select {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.btn-difficulty {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-difficulty:hover {
    background: var(--cell-hover);
    color: var(--accent);
}

.btn-difficulty.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent-dark);
}

/* Theme select */
.theme-select {
    margin-bottom: var(--space-lg);
}

.theme-select label {
    display: block;
    margin-bottom: var(--space-xs);
    font-weight: 500;
    color: var(--text-secondary);
}

.theme-select input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-size: 1rem;
    font-family: var(--font-body);
    border: 2px solid var(--cell-border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
}

.theme-select input:focus {
    outline: none;
    border-color: var(--accent);
}

.theme-select input::placeholder {
    color: var(--text-muted);
}

.theme-hint {
    margin-top: var(--space-xs);
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    padding: var(--space-md) var(--space-xl);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    width: 100%;
}

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

.btn-small {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.85rem;
    width: auto;
}

.btn-icon {
    background: transparent;
    color: var(--text-secondary);
    padding: var(--space-sm) var(--space-md);
}

.btn-icon:hover {
    color: var(--accent);
    background: var(--cell-hover);
}

/* Game screen */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.game-info {
    display: flex;
    gap: var(--space-lg);
    align-items: center;
}

.theme-label,
.found-count {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: var(--space-sm);
}

.settings-toggle {
    text-align: center;
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
}

.toggle-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.archive-link {
    text-align: center;
    margin-top: var(--space-md);
}

/* Footer */
.site-footer {
    text-align: center;
    padding: var(--space-lg) var(--space-md);
    margin-top: var(--space-xl);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.site-footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--accent);
}

/* Policy page */
.policy-content {
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}

.policy-content h3 {
    margin-top: var(--space-lg);
    color: var(--accent);
}

.policy-content ul {
    margin-left: var(--space-lg);
}

.archive-link a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1rem;
}

.archive-link a:hover {
    color: var(--accent);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-card);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* Hint Modal */
.hint-modal-content {
    text-align: center;
    max-width: 300px;
}

.hint-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: var(--space-lg);
}

.hint-text::before {
    content: '💡 ';
}

.theme-label strong,
.found-count span:first-child {
    color: var(--accent);
}

/* Puzzle area */
.puzzle-area {
    display: grid;
    gap: var(--space-xl);
    margin-bottom: var(--space-lg);
}

@media (min-width: 800px) {
    .puzzle-area {
        grid-template-columns: auto 1fr;
        align-items: start;
    }
    
    .puzzle-area .grid {
        margin: 0; /* Remove auto-centering so it sits left */
    }
}

/* Grid section (grid + controls) */
.grid-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-controls {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    margin-top: var(--space-md);
    flex-wrap: wrap;
    background: var(--bg-card);
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    border: 1px solid var(--cell-border);
}

/* Grid */
.grid {
    display: grid;
    gap: 2px;
    background: var(--cell-border);
    border: 3px solid var(--text-primary);
    border-radius: var(--radius-md);
    justify-content: center;
    margin: 0 auto;
    padding: 2px;
    width: fit-content;
    margin: 0 auto;
}

.grid-cell {
    width: clamp(60px, 15vw, 80px);
    height: clamp(60px, 15vw, 80px);
    background: var(--cell-bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    user-select: none;
}

.grid-cell:hover {
    background: var(--cell-hover);
}

.grid-cell.selected {
    background: var(--cell-selected);
    box-shadow: inset 0 0 0 3px var(--accent);
}

.grid-cell.start-cell {
    background: var(--highlight-light);
}

.grid-cell.current-position {
    background: var(--highlight-light);
    box-shadow: inset 0 0 0 3px var(--highlight);
}

.grid-cell.found-one {
    background: #a7f3d0; /* Light green - one letter used */
}

.grid-cell.found-both {
    background: #34d399; /* Darker green - both letters used */
}

.grid-cell.path-cell::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--path-line);
    border-radius: 50%;
    opacity: 0.5;
}

.cell-letters {
    display: flex;
    gap: var(--space-xs);
}

.cell-letter {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--text-primary);
    width: 24px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.grid-cell.selected .cell-letter.letter-selected {
    background: var(--accent);
    color: white;
}

.cell-letter.used {
    background: var(--cell-found);
    color: var(--success);
}

/* Empty cells / orphans */
.grid-cell.empty {
    background: var(--bg-secondary);
    cursor: default;
}

.grid-cell.orphan .cell-letter {
    background: var(--highlight);
}

/* Word list */
.word-list-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid var(--cell-border);
}

.puzzle-date {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: var(--space-xs);
}

.word-list-container h3 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: var(--space-md);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.word-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

@media (min-width: 820px) {
    .word-list {
        flex-direction: column;
    }
}

.word-list li {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.word-list li.found {
    background: var(--cell-found);
    color: var(--success);
    text-decoration: line-through;
}

.word-list li.hidden-word {
    background: var(--bg-secondary);
    color: var(--bg-secondary);
    letter-spacing: -0.5em;
}

.theme-hint {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

.theme-hint strong {
    color: var(--accent);
}

.found-words {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    min-height: 2rem; /* Reserve space even when empty */
}

.found-word-tag {
    background: var(--success);
    color: white;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Prominent hint button */
.btn-hint {
    background: var(--highlight);
    color: var(--text-primary);
    padding: var(--space-sm) var(--space-lg);
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-hint:hover {
    background: var(--highlight-light);
    transform: translateY(-1px);
}

/* Shake animation for wrong answers */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-8px); }
    80% { transform: translateX(8px); }
}

.shake {
    animation: shake 0.4s ease-in-out;
}

/* Make the selection area more prominent */
.current-selection {
    transition: background 0.2s ease, border-color 0.2s ease;
}

/* Current selection display */
.current-selection {
    text-align: center;
    padding: var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--cell-border);
}

.selection-label {
    color: var(--text-secondary);
    margin-right: var(--space-sm);
}

.selection-text {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--accent);
    letter-spacing: 0.1em;
}

/* Message box */
.message-box {
    text-align: center;
    padding: var(--space-md);
    background: #fee2e2;
    border-radius: var(--radius-lg);
    border: 1px solid var(--error);
    color: var(--error);
    font-weight: 600;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.message-box.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Victory overlay */
.victory {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.3s ease;
}

.victory.hidden {
    display: none;
}

.victory-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.victory-content h2 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    margin-bottom: var(--space-sm);
}

.victory-content p {
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
}

.victory-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--accent);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Victory email prompt */
.victory-email-prompt {
    margin-bottom: var(--space-lg);
}

.victory-email-prompt p {
    margin-bottom: var(--space-md);
}

.victory-email-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.victory-email-form input {
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--cell-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    text-align: center;
}

.victory-email-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    margin-top: var(--space-sm);
    text-decoration: underline;
}

.btn-link:hover {
    color: var(--text-secondary);
}

.save-status {
    font-size: 0.9rem;
    margin-bottom: var(--space-md);
}

.save-status.success {
    color: var(--success);
}

/* Create screen */
.create-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.create-header h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
}

.create-form {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    border: 1px solid var(--cell-border);
}

.form-group {
    margin-bottom: var(--space-lg);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-xs);
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: var(--space-md);
    font-size: 1rem;
    font-family: var(--font-body);
    border: 2px solid var(--cell-border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group textarea {
    resize: vertical;
    min-height: 150px;
}

.form-hint {
    margin-top: var(--space-xs);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

/* Generation status */
.generation-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    margin-top: var(--space-lg);
    color: var(--text-secondary);
}

.generation-status.hidden {
    display: none;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--cell-border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.generation-error {
    margin-top: var(--space-lg);
    padding: var(--space-md);
    background: #fef2f2;
    border: 1px solid var(--error);
    border-radius: var(--radius-md);
    color: var(--error);
}

.generation-error.hidden {
    display: none;
}

/* Puzzle navigation */
.puzzle-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

.puzzle-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    min-width: 110px;
    background: var(--bg-card);
    border: 1px solid var(--cell-border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.puzzle-nav-btn:hover:not(.disabled) {
    background: var(--cell-hover);
    border-color: var(--accent);
    color: var(--accent);
}

.puzzle-nav-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.puzzle-nav-arrow {
    font-size: 1.1rem;
}

/* How to play collapsible */
.how-to-play-collapsible {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--cell-border);
    margin-top: var(--space-md);
}

.how-to-play-collapsible summary {
    padding: var(--space-md) var(--space-lg);
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    list-style: none;
}

.how-to-play-collapsible summary::-webkit-details-marker {
    display: none;
}

.how-to-play-collapsible summary::before {
    content: '▶ ';
    font-size: 0.8em;
}

.how-to-play-collapsible[open] summary::before {
    content: '▼ ';
}

.how-to-play-content {
    padding: 0 var(--space-lg) var(--space-lg);
}

.how-to-play-content .how-intro {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    font-size: 0.95rem;
    line-height: 1.5;
}

.how-to-play-content h4 {
    color: var(--text-primary);
    font-size: 0.95rem;
    margin: var(--space-md) 0 var(--space-sm);
    font-weight: 600;
}

.how-to-play-content ol,
.how-to-play-content ul {
    padding-left: var(--space-lg);
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.how-to-play-content li {
    margin-bottom: var(--space-xs);
    font-size: 0.9rem;
    line-height: 1.5;
}

.how-to-play-content strong {
    color: var(--accent);
}

/* Subscribe form */
.subscribe-form {
    margin: var(--space-lg) 0;
}

.subscribe-form input[type="email"] {
    width: 100%;
    padding: var(--space-md);
    font-size: 1rem;
    border: 2px solid var(--cell-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    text-align: center;
}

.subscribe-form input[type="email"]:focus {
    outline: none;
    border-color: var(--accent);
}

/* Daily email subscription section */
.subscribe-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--cell-border);
    padding: var(--space-lg);
    margin-top: var(--space-xl);
    text-align: center;
}

.subscribe-section h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.subscribe-section > p {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    font-size: 0.95rem;
}

.subscribe-daily-form {
    display: flex;
    gap: var(--space-sm);
    max-width: 400px;
    margin: 0 auto;
}

.subscribe-daily-form input[type="email"] {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    font-size: 1rem;
    border: 2px solid var(--cell-border);
    border-radius: var(--radius-md);
}

.subscribe-daily-form input[type="email"]:focus {
    outline: none;
    border-color: var(--accent);
}

.subscribe-daily-form .btn {
    width: auto;
    white-space: nowrap;
}

.subscribe-message {
    margin-top: var(--space-md);
    font-size: 0.9rem;
    display: none;
}

.subscribe-message.success {
    color: var(--success);
}

.subscribe-message.error {
    color: var(--error);
}

/* Responsive */
@media (max-width: 480px) {
    .grid-cell {
        width: calc((100vw - 40px) / 5); /* Fills screen for 5-column grid */
        height: calc((100vw - 40px) / 5);
        max-width: 72px;
        max-height: 72px;
    }
    
    .cell-letter {
        font-size: 1.1rem;
        width: 45%;
        height: 32px;
        padding: 4px;
    }
    
    .cell-letters {
        gap: 2px;
        width: 100%;
        justify-content: center;
    }
    
    .game-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .game-info {
        justify-content: center;
    }
    
    
    .subscribe-daily-form {
        flex-direction: column;
    }
    
    .subscribe-daily-form .btn {
        width: 100%;
    }
}

/* Share buttons */
.share-buttons {
    margin: var(--space-lg) 0;
}

.share-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.share-row {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
}

.share-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.share-btn:hover {
    transform: scale(1.1);
}

.share-btn:active {
    transform: scale(0.95);
}

.share-twitter {
    background: #000;
    color: #fff;
}

.share-bluesky {
    background: #0085ff;
    color: #fff;
}

.share-facebook {
    background: #1877f2;
    color: #fff;
}

.share-whatsapp {
    background: #25d366;
    color: #fff;
}

.share-copy {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--cell-border);
}

.share-copy.copied {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}

/* Smaller inline share buttons for game page */
.share-puzzle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--cell-border);
}

.share-puzzle-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-right: var(--space-xs);
}

.share-btn-small {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, opacity 0.15s ease;
    opacity: 0.8;
}

.share-btn-small:hover {
    transform: scale(1.1);
    opacity: 1;
}

.share-btn-small:active {
    transform: scale(0.95);
}

/* Victory buttons */
.victory-buttons {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
}

.victory-buttons .btn {
    white-space: nowrap;
    width: auto;
}

.victory-buttons .btn.hidden {
    display: none;
}

/* Previous completion message in words section */
.previous-completion {
    background: var(--cell-found);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    text-align: center;
    width: 100%;
    margin-top: var(--space-sm);
}

.previous-completion .completion-message {
    color: var(--success);
    margin-bottom: var(--space-sm);
    font-size: 0.95rem;
}

.previous-completion .completion-message strong {
    font-size: 1.1rem;
}

/* Completion message shown inline with word tags (on first completion) */
.completion-inline {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
    text-align: center;
}

.completion-inline .completion-message {
    color: var(--success);
    margin-bottom: var(--space-sm);
    font-size: 0.95rem;
}

.completion-inline .completion-message strong {
    font-size: 1.1rem;
}

/* ===== Leaderboard ===== */
.leaderboard-section {
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
}

.player-rank {
    text-align: center;
    font-size: 1rem;
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
}

.player-rank strong {
    color: var(--accent);
}

.leaderboard {
    max-height: 280px;
    overflow-y: auto;
}

.leaderboard-loading,
.leaderboard-error,
.leaderboard-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: var(--space-md);
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.leaderboard-table thead {
    position: sticky;
    top: 0;
    background: var(--surface);
}

.leaderboard-table th {
    text-align: left;
    padding: var(--space-xs) var(--space-sm);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.leaderboard-table th:first-child {
    width: 2.5rem;
    text-align: center;
}

.leaderboard-table th:last-child {
    text-align: right;
}

.leaderboard-row td {
    padding: var(--space-sm);
    border-bottom: 1px solid var(--border-light, rgba(0,0,0,0.05));
}

.leaderboard-row:last-child td {
    border-bottom: none;
}

.leaderboard-row.current-player {
    background: var(--cell-found);
}

.leaderboard-row.current-player td {
    font-weight: 600;
}

.leaderboard-rank {
    text-align: center;
    font-weight: 600;
}

.leaderboard-name {
    color: var(--text-secondary);
}

.leaderboard-time {
    text-align: right;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-weight: 600;
}

.leaderboard-total {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border);
}

/* Feedback page */
.feedback-content {
    max-width: 500px;
    margin: 0 auto;
}

.feedback-form {
    margin-top: var(--space-lg);
}

.feedback-form .optional {
    font-weight: normal;
    color: var(--text-muted);
    font-size: 0.85em;
}

.feedback-message {
    margin-top: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    text-align: center;
    display: none;
}

.feedback-message.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.feedback-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

