/* Les couleurs reprennent celles de l'application native, pour que les deux se ressemblent. */
:root {
    --bg: #1d2a22;
    --card: #223229;
    --field: #2a3a30;
    --line: #3a4a40;
    --text: #f3e7cf;
    --gold: #e9c98a;
    --muted: #8fa898;
    --dim: #7a8a80;
    --green: #2e8b57;
    --blue: #3c7cb8;
    --brown: #8a6e3c;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 1rem 1rem 3rem;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#app { max-width: 34rem; margin: 0 auto; }

.title {
    font-size: 2.5rem; letter-spacing: .18em; color: var(--gold);
    text-align: center; margin: .5rem 0 1.5rem;
}
.title.small { font-size: 1.6rem; letter-spacing: .08em; }

h2 { font-size: 1.15rem; color: var(--gold); margin: 0 0 .75rem; }

.card {
    background: var(--card); border-radius: .6rem;
    padding: 1rem; margin-bottom: 1rem;
}

label { display: block; color: var(--muted); font-size: .85rem; margin: .75rem 0 .25rem; }
.hint { color: var(--dim); font-size: .85rem; margin: 0 0 .5rem; }
.status { color: var(--text); font-size: .9rem; margin: .5rem 0 0; }

input, select {
    width: 100%; padding: .6rem .7rem;
    background: var(--field); color: var(--text);
    border: 1px solid var(--line); border-radius: .35rem; font-size: 1rem;
}

button {
    display: block; width: 100%; margin-top: .9rem; padding: .8rem;
    background: var(--field); color: var(--text);
    border: none; border-radius: .4rem; font-size: 1rem; cursor: pointer;
}
button:hover:not(:disabled) { filter: brightness(1.15); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--green); color: #fff; font-weight: 600; }
button.secondary { background: var(--blue); color: #fff; }
button.tertiary { background: var(--brown); color: #fff; }

.row { display: flex; gap: .6rem; align-items: stretch; }
.row input { flex: 1; }
.row button { width: 9rem; margin-top: 0; }

.code-input { text-transform: uppercase; letter-spacing: .3em; text-align: center; }

.code-box {
    margin-top: 1rem; padding: .9rem;
    background: var(--field); border-radius: .4rem; text-align: center;
}
.code-label { display: block; color: var(--muted); font-size: .8rem; }
.code {
    display: block; color: var(--gold);
    font-size: 2.1rem; font-weight: 700; letter-spacing: .35em;
}

.roster { list-style: none; padding: 0; margin: 0; }
.roster li { background: var(--field); padding: .55rem .8rem; border-radius: .3rem; margin-bottom: .3rem; }

/* --- Partie --- */

.scores { display: flex; gap: .5rem; margin-bottom: .75rem; flex-wrap: wrap; }
.score {
    background: var(--card); border-radius: .4rem; padding: .5rem .9rem; min-width: 6rem;
    /* La couleur qui entoure les mots de ce joueur sur le plateau. */
    border-left: 4px solid transparent;
}
.score.current { background: var(--green); }
.score .who { display: block; font-size: .8rem; }
.score .points { display: block; font-size: 1.3rem; font-weight: 700; color: var(--gold); }
.score.current .points { color: #fff; }

canvas.board {
    display: block; width: 100%; aspect-ratio: 1 / 1;
    border-radius: .3rem; cursor: pointer;
    /* 'manipulation' ne suffit pas : le navigateur tranche des le pointerdown et le defilement
       vertical volerait le glisser des la premiere fraction de mouvement. */
    touch-action: none;
}

/* Les tuiles se partagent la largeur et retrecissent : jamais de debordement horizontal. */
.rack { display: flex; gap: .35rem; margin: .9rem 0; justify-content: center; flex-wrap: nowrap; }
.tile {
    position: relative; flex: 1 1 0; min-width: 0; max-width: 3rem; aspect-ratio: 1 / 1;
    margin: 0; padding: 0;
    background: #e3c98f; color: #2b2116;
    border: 1px solid #b9a06a; border-radius: .3rem;
    font-size: clamp(.85rem, 5vw, 1.4rem); font-weight: 700;
}
.tile { touch-action: none; }
.tile.selected { outline: 3px solid var(--green); }
.tile.drag-source { opacity: .3; }
.tile.drop-slot { outline: 2px dashed var(--gold); }
.tile.placed { opacity: .35; }
.tile .value { position: absolute; right: .2rem; bottom: .05rem; font-size: .65rem; font-weight: 600; }

.actions { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; }
.actions button { margin-top: 0; padding: .7rem .2rem; font-size: .85rem; }

.footer {
    display: flex; justify-content: space-between;
    margin-top: .9rem; font-size: .9rem; color: var(--muted);
}

.history { list-style: none; padding: 0; margin: 1rem 0 0; color: var(--dim); font-size: .85rem; }
.history li { padding: .2rem 0; }
.history .line, .suggestion .line { display: block; }

/* Le mot suggéré par l'indice, avec ce qu'il veut dire. */
.suggestion {
  margin: .75rem 0 0; padding: .5rem .7rem;
  background: #2a3a30; border-left: 3px solid #8a6e3c; border-radius: .3rem;
  color: #cfc4ab; font-size: .85rem;
}

/* Les définitions arrivent après la ligne : décalées, plus discrètes, jamais au premier plan. */
.glossary { list-style: none; padding: 0 0 0 .9rem; margin: .15rem 0 .35rem; }
.glossary li { padding: .05rem 0; line-height: 1.35; }
.glossary .word { color: #8fbfa4; font-weight: 600; margin-right: .35rem; }
.glossary .inflection { color: #7a8a80; font-style: italic; margin-right: .35rem; }
.glossary .sense { color: #a8b8ad; }
.glossary .generated { color: #8a6e3c; margin-left: .3rem; cursor: help; }

.boot { text-align: center; padding-top: 20vh; }

#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
    background: #7a2b2b; color: #fff; padding: .8rem 1.2rem;
}
#blazor-error-ui .dismiss { cursor: pointer; float: right; }
#blazor-error-ui .reload { color: #fff; }

/* La tuile qui suit le pointeur pendant un glisser. Au-dessus de tout, et transparente aux
   evenements : c'est l'element sous elle qui doit recevoir le relachement. */
.drag-overlay { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.drag-ghost {
  position: absolute; left: 0; top: 0;
  display: flex; align-items: center; justify-content: center;
  background: #e3c98f; color: #2b2116;
  border: 1px solid #b9a06a; border-radius: .3rem;
  font-weight: 700; font-size: clamp(.85rem, 5vw, 1.4rem);
  opacity: .92; box-shadow: 0 .4rem .9rem rgba(0, 0, 0, .45);
}
.drag-ghost .value { position: absolute; right: .2rem; bottom: .05rem; font-size: .65rem; font-weight: 600; }
