/* ===== LITERE RO v3 — Design system Footix ===== */
/* Light + Dark mode, green theme, aligned with Footix common.css */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=Russo+One&family=Space+Mono:wght@400;700&family=Inter:wght@400;600;700;900&display=swap');

/* ===== RESET ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ===== VARIABLES — LIGHT MODE ===== */
:root {
    --bg:              #F5F9F0;
    --bg-secondary:    #EBF2E4;
    --surface:         #FFFFFF;
    --surface-warm:    #F0F5E8;
    --text:            #1A2E1A;
    --text-secondary:  #3A5A3A;
    --text-muted:      #7A9A7A;
    --border:          #D2E0C8;

    --accent:          #2E7D32;
    --accent-hover:    #1B5E20;
    --accent-light:    #4CAF50;
    --accent-dim:      rgba(46, 125, 50, 0.12);
    --gold:            #D4A017;
    --gold-light:      #FFD54F;

    /* Couleurs jeu spécifiques */
    --albastru:        #2563EB;
    --albastru-light:  #3B82F6;
    --verde:           #2E7D32;
    --verde-bg:        rgba(46, 125, 50, 0.10);
    --red:             #DC2626;

    --radius:          12px;
    --radius-sm:       8px;
    --shadow:          0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg:       0 8px 32px rgba(0, 0, 0, 0.12);
    --transition:      0.25s ease;

    --font-mono: 'Space Mono', 'JetBrains Mono', monospace;
}

/* ===== DARK MODE ===== */
[data-theme="dark"] {
    --bg:              #0F1A0F;
    --bg-secondary:    #152215;
    --surface:         #1E3320;
    --surface-warm:    #253D25;
    --text:            #E8F0E4;
    --text-secondary:  #B8D4B0;
    --text-muted:      #6A8A62;
    --border:          #2A4A2A;

    --accent:          #4CAF50;
    --accent-hover:    #66BB6A;
    --accent-light:    #81C784;
    --accent-dim:      rgba(76, 175, 80, 0.15);
    --gold:            #FFD54F;
    --gold-light:      #FFECB3;

    --albastru:        #3B82F6;
    --albastru-light:  #60A5FA;
    --verde:           #4CAF50;
    --verde-bg:        rgba(76, 175, 80, 0.15);
    --red:             #F87171;

    --shadow:          0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg:       0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ===== BODY ===== */
body {
    font-family: 'DM Sans', 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 0.75rem;
    transition: background var(--transition), color var(--transition);
    -webkit-font-smoothing: antialiased;
}

#app {
    width: 100%;
    max-width: 540px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ===== HEADER ===== */
header {
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}


.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.brand {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
}

header h1 {
    font-family: 'Russo One', sans-serif;
    font-size: 1.8rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* Bouton retour portail */
.btn-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 1rem;
    text-decoration: none;
    transition: all var(--transition);
    flex-shrink: 0;
}
.btn-back:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* Boutons icone — alignes Footix */
.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.btn-icon:hover {
    border-color: var(--text-muted);
    background: var(--surface-warm);
    color: var(--text);
}

/* ===== MODE SELECTOR ===== */
.mode-selector {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
}

.mode-card {
    flex: 1;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}

.mode-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.mode-card.official:hover { border-color: var(--gold); }
.mode-card.practice:hover { border-color: var(--albastru); }

.mode-icon { font-size: 2rem; margin-bottom: 0.5rem; }

.mode-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.mode-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.mode-note {
    margin: 0.5rem 0;
    font-size: 0.75rem !important;
    color: var(--text-muted);
}

.mode-card .btn {
    margin-top: 0.75rem;
    width: 100%;
}

/* ===== TIMER BAR ===== */
.timer-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 1rem;
}

.timer-left {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gold);
}

.timer-icon { font-size: 1rem; }

.jour-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* ===== 3 SLOTS ===== */
.slots-container {
    display: flex;
    gap: 0.5rem;
}

.slot-mot {
    flex: 1;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 0.5rem;
    text-align: center;
    transition: all var(--transition);
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--surface);
}

.slot-mot.actif {
    border-color: var(--albastru);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.slot-mot.valid {
    border-color: var(--verde);
    background: var(--verde-bg);
}

.slot-mot.empty {
    opacity: 0.4;
    background: var(--bg-secondary);
}

.slot-header {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.slot-cuvant {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    min-height: 1.4em;
    color: var(--text);
}

.slot-info {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.slot-info .multiplicator {
    color: var(--verde);
    font-weight: 600;
}

/* ===== LETTRES ===== */
.litere-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.5rem 0;
}

.litera {
    width: 50px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--albastru);
    color: #fff;
    border: 2px solid var(--albastru-light);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.12s ease;
    user-select: none;
    box-shadow: 0 3px 0 rgba(0,0,0,0.2);
}

.litera:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 0 rgba(0,0,0,0.2);
    filter: brightness(1.1);
}

.litera:active {
    transform: translateY(1px);
    box-shadow: 0 1px 0 rgba(0,0,0,0.2);
}

.litera.animate-in {
    animation: flipIn 0.3s ease forwards;
}

@keyframes flipIn {
    0% { transform: rotateX(90deg) scale(0.5); opacity: 0; }
    100% { transform: rotateX(0deg) scale(1); opacity: 1; }
}

/* ===== INPUT ZONE ===== */
.input-zone {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
}

.mot-compose {
    display: flex;
    justify-content: center;
    gap: 0.3rem;
    min-height: 48px;
    padding: 0.4rem;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    transition: border-color var(--transition);
}

.mot-compose.has-letters { border-color: var(--albastru); border-style: solid; }

.mot-compose .litera-selectata {
    width: 40px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--gold);
    color: var(--bg);
    border-radius: var(--radius-sm);
    animation: popIn 0.12s ease;
}

@keyframes popIn {
    0% { transform: scale(0); }
    80% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

.mot-compose.empty::after {
    content: 'Alege literele...';
    color: var(--text-muted);
    font-size: 0.85rem;
}

.score-estime {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    min-height: 1.2em;
    font-family: var(--font-mono);
}

.input-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 0.55rem 1.1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: var(--verde);
    color: #fff;
    border-color: var(--verde);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); transform: translateY(-1px); }

.btn-secondary {
    background: var(--surface-warm);
    color: var(--text);
    border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-secondary); border-color: var(--text-muted); }

.btn-accent {
    background: var(--gold);
    color: var(--bg);
    border-color: var(--gold);
    padding: 0.65rem 1.5rem;
    font-size: 1rem;
}
.btn-accent:hover { background: var(--gold-light); border-color: var(--gold-light); transform: translateY(-1px); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}
.btn-ghost:hover {
    border-color: var(--text-muted);
    color: var(--text);
    background: var(--surface-warm);
}

/* ===== FEEDBACK ===== */
.feedback {
    text-align: center;
    padding: 0.6rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    0% { transform: translateY(8px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.feedback.success {
    background: var(--verde-bg);
    color: var(--verde);
    border: 1px solid rgba(46, 125, 50, 0.25);
}
.feedback.error {
    background: rgba(220, 38, 38, 0.08);
    color: var(--red);
    border: 1px solid rgba(220, 38, 38, 0.2);
}
.feedback.info {
    background: rgba(212, 160, 23, 0.1);
    color: var(--gold);
    border: 1px solid rgba(212, 160, 23, 0.2);
}

/* ===== BOTTOM BAR ===== */
.bottom-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.score-total {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.score-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.score-value {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gold);
}

.score-pts {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ===== OVERLAY RESULT ===== */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1rem;
}

.overlay-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    max-width: 440px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.4s ease;
}

.overlay-content h2 {
    font-family: 'Russo One', sans-serif;
    color: var(--gold);
    margin-bottom: 1.25rem;
    font-size: 1.5rem;
    font-weight: 400;
}

.result-mots {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.result-mot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: var(--surface-warm);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.result-mot.empty-result {
    opacity: 0.4;
}

.result-mot-cuvant {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text);
}

.result-mot-info {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.result-summary {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.25rem;
}

.result-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.result-row span:first-child {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.08em;
}

.result-big {
    font-family: var(--font-mono);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--gold);
}

.share-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.result-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    padding: 1rem;
}

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }

.modal-content h2 {
    margin-bottom: 1rem;
    font-family: 'Russo One', sans-serif;
    font-weight: 400;
    color: var(--gold);
}

.modal-section { margin-bottom: 1rem; }

.modal-section h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.modal-words {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.modal-word {
    padding: 0.25rem 0.5rem;
    background: var(--surface-warm);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text);
}

.modal-word.long {
    background: rgba(212, 160, 23, 0.12);
    border-color: rgba(212, 160, 23, 0.3);
    color: var(--gold);
}

.modal-word.found {
    border-color: var(--verde);
    background: var(--verde-bg);
    color: var(--verde);
}

/* Help */
.help-body p { margin-bottom: 0.5rem; font-size: 0.9rem; color: var(--text-secondary); }
.help-body h3 { margin: 1rem 0 0.5rem; color: var(--gold); font-size: 1rem; font-family: 'Russo One', sans-serif; font-weight: 400; }
.help-table { width: 100%; border-collapse: collapse; margin: 0.5rem 0; }
.help-table td {
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}
.help-table td:last-child { color: var(--verde); font-weight: 600; text-align: right; }

/* ===== CLASSEMENT ===== */
.clasament-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
}

.clasament-section h2 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--text);
    font-weight: 600;
}

.clasament-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.clasament-row {
    display: grid;
    grid-template-columns: 28px 1fr auto auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    transition: background var(--transition);
}
.clasament-row:hover { background: var(--surface-warm); }

.clasament-row.my-row {
    background: rgba(212, 160, 23, 0.08);
    border: 1px solid rgba(212, 160, 23, 0.25);
}

.clasament-row .poz {
    font-weight: 700;
    color: var(--gold);
    text-align: center;
    font-family: var(--font-mono);
}

.clasament-row .name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.clasament-row .mots {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.clasament-row .pts {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--verde);
    white-space: nowrap;
}

.no-data {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.5rem;
}

.hidden { display: none !important; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== RESPONSIVE ===== */
@media (max-width: 420px) {
    .litera { width: 44px; height: 50px; font-size: 1.2rem; }
    .mot-compose .litera-selectata { width: 36px; height: 42px; font-size: 1rem; }
    header h1 { font-size: 1.4rem; }
    .slot-cuvant { font-size: 0.85rem; }
    .mode-selector { flex-direction: column; }
    .clasament-row .mots { max-width: 90px; }
    .overlay-content { padding: 1.5rem 1rem; }
}
