/* labo de scenarios - esthetique dossier d'enquete / instrument de mesure
   mobile first, breakpoint unique a 1000px */

/* -- tokens --
   fond      #12100e (brun-noir chaud, papier carbonise)
   panneau   #1b1815
   papier    #211d18 (cartes de tour, legerement plus clair, grain de dossier)
   ambre     #e8a33d (narration, action joueur - "encre chaude")
   cyan      #6bc8c4 (etat cache, donnees techniques - "encre froide")
   violet    #b98cf0 (validation, resolution)
   rouge     #d9765a (alerte, correction)
   texte     #ece6da
   attenue   #928a7d
*/

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 18px;
    background: #12100e;
    background-image:
        radial-gradient(circle at 15% 0%, rgba(232, 163, 61, 0.05), transparent 40%),
        radial-gradient(circle at 85% 10%, rgba(107, 200, 196, 0.04), transparent 35%);
    color: #ece6da;
    font-family: "IBM Plex Sans", system-ui, sans-serif;
    line-height: 1.55;
}

h1, h2, h3, h4 {
    font-family: "Bitter", Georgia, serif;
}

/* -- header -- */

.lab-header {
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid #2c2720;
}

.lab-eyebrow {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #6bc8c4;
    margin: 0 0 8px 0;
}

.lab-header h1 {
    font-weight: 700;
    font-size: clamp(1.5rem, 6vw, 2.1rem);
    margin: 0 0 8px 0;
    color: #f5efe3;
    letter-spacing: -0.01em;
}

.lab-subtitle {
    color: #928a7d;
    font-size: 0.9rem;
    margin: 0;
    max-width: 46ch;
}

/* -- panneaux generaux -- */

.lab-panel {
    background: #1b1815;
    border: 1px solid #2c2720;
    border-radius: 4px;
    padding: 18px;
    margin-bottom: 20px;
}

.lab-field {
    margin-bottom: 16px;
}

.lab-field label {
    display: block;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #a89d8a;
    margin-bottom: 7px;
}

.lab-field input[type="text"],
.lab-field textarea,
.lab-field select,
.lab-turns-choice input {
    width: 100%;
    background: #12100e;
    border: 1px solid #2c2720;
    border-radius: 3px;
    padding: 11px 12px;
    color: #ece6da;
    font-size: 0.95rem;
    font-family: inherit;
}

.lab-field select {
    font-family: "IBM Plex Mono", monospace;
}

.lab-field input[type="text"]:focus,
.lab-field textarea:focus,
.lab-turns-choice input:focus {
    outline: 2px solid #e8a33d;
    outline-offset: 1px;
    border-color: #e8a33d;
}

.lab-turns-choice {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.turns-btn {
    background: #12100e;
    border: 1px solid #2c2720;
    color: #ece6da;
    border-radius: 3px;
    padding: 10px 18px;
    cursor: pointer;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.95rem;
}

.turns-btn:focus-visible,
.lab-btn-primary:focus-visible,
.lab-btn-secondary:focus-visible {
    outline: 2px solid #e8a33d;
    outline-offset: 2px;
}

.turns-btn.active {
    background: #e8a33d;
    border-color: #e8a33d;
    color: #12100e;
    font-weight: 600;
}

#turns-custom {
    max-width: 90px;
    font-family: "IBM Plex Mono", monospace;
}

.lab-btn-primary {
    background: #e8a33d;
    color: #12100e;
    border: none;
    border-radius: 3px;
    padding: 13px 20px;
    font-size: 1rem;
    font-weight: 600;
    font-family: "IBM Plex Mono", monospace;
    letter-spacing: 0.03em;
    cursor: pointer;
    width: 100%;
}

.lab-btn-primary:hover {
    background: #f0b158;
}

.lab-btn-secondary {
    background: transparent;
    color: #ece6da;
    border: 1px solid #3a342b;
    border-radius: 3px;
    padding: 8px 14px;
    cursor: pointer;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.8rem;
}

.lab-btn-secondary:hover {
    border-color: #6bc8c4;
    color: #6bc8c4;
}

/* -- barre de suivi de session -- */

.lab-run-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.lab-run-info {
    display: flex;
    justify-content: space-between;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.82rem;
    color: #a89d8a;
    flex-wrap: wrap;
    gap: 6px;
}

#run-theme {
    color: #e8a33d;
}

.lab-run-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.lab-progress-bar {
    height: 4px;
    background: #12100e;
    border-radius: 2px;
    overflow: hidden;
}

.lab-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #e8a33d, #6bc8c4);
    width: 0%;
    transition: width 0.3s ease;
}

/* -- carte de tour, style dossier -- */

.turn-card {
    background: #211d18;
    border: 1px solid #2c2720;
    border-left: 3px solid #3a342b;
    border-radius: 4px;
    padding: 18px;
    margin-bottom: 18px;
}

.turn-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px dashed #3a342b;
}

.turn-stamp {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.turn-stamp-label {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6b6255;
}

.turn-number {
    font-family: "Bitter", serif;
    font-weight: 700;
    font-size: 1.15rem;
    color: #f5efe3;
}

.validator-badge {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    padding: 5px 10px;
    border-radius: 2px;
    border: 1.5px solid #4c4438;
    color: #a89d8a;
    text-transform: uppercase;
    transform: rotate(-2deg);
}

.validator-badge.status-ok {
    border-color: #5a9c6e;
    color: #8fd4a3;
}

.validator-badge.status-correction {
    border-color: #c76650;
    color: #e6907c;
}

.turn-block {
    margin-bottom: 16px;
}

.turn-block:last-child {
    margin-bottom: 0;
}

.turn-block h3 {
    font-size: 0.72rem;
    font-family: "IBM Plex Mono", monospace;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    margin: 0 0 8px 0;
    padding-left: 10px;
    border-left: 2px solid #4c4438;
}

.player-block h3 {
    border-left-color: #e8a33d;
    color: #e8a33d;
}

.world-block h3 {
    border-left-color: #6bc8c4;
    color: #6bc8c4;
}

.dm-block h3 {
    border-left-color: #e8a33d;
    color: #e8a33d;
}

.validator-block h3 {
    border-left-color: #b98cf0;
    color: #b98cf0;
}

.turn-reasoning {
    font-size: 0.85rem;
    color: #928a7d;
    font-style: italic;
    margin: 0 0 8px 0;
}

.turn-action,
.turn-narration,
.validator-comment {
    font-size: 0.96rem;
    margin: 0;
}

.turn-action {
    color: #f0d9ae;
}

.world-state-list {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.8rem;
    margin: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 12px;
}

.world-state-list dt {
    color: #5a9490;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.7rem;
    padding-top: 2px;
}

.world-state-list dd {
    margin: 0;
    color: #d4cec1;
}

.turn-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.world-block,
.dm-block {
    background: #1b1815;
    border: 1px solid #2c2720;
    border-radius: 3px;
    padding: 14px;
}

.validator-block {
    background: rgba(185, 140, 240, 0.05);
    border: 1px solid #3a2f4c;
    border-radius: 3px;
    padding: 14px;
}

/* -- fins possibles : tags style etiquette -- */

.possible-endings {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #3a342b;
}

.possible-endings h4 {
    font-size: 0.68rem;
    font-family: "IBM Plex Mono", monospace;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #6b6255;
    margin: 0 0 8px 0;
}

.possible-endings-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.possible-endings-list li {
    font-size: 0.82rem;
    color: #d9a760;
    background: rgba(232, 163, 61, 0.07);
    border: 1px dashed rgba(232, 163, 61, 0.35);
    border-radius: 2px;
    padding: 6px 9px;
}

/* -- resolution finale -- */

.ending-card {
    background: #1e1a2c;
    border: 1px solid #4c3a8c;
    border-radius: 4px;
    padding: 22px;
    margin-bottom: 20px;
    position: relative;
}

.ending-card::before {
    content: "fin";
    position: absolute;
    top: -10px;
    left: 18px;
    background: #b98cf0;
    color: #1e1a2c;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 3px 10px;
    border-radius: 2px;
    font-weight: 600;
}

.ending-card h2 {
    font-size: 1.2rem;
    margin: 6px 0 10px 0;
    color: #d4bdf5;
}

.ending-text {
    font-size: 1.02rem;
    margin: 0;
    color: #ece6da;
}

/* -- generateur d'intrigue -- */

.plot-preview {
    margin: 12px 0 0 0;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.8rem;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 12px;
}

.plot-preview dt {
    color: #6bc8c4;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.7rem;
    padding-top: 2px;
}

.plot-preview dd {
    margin: 0;
    color: #d4cec1;
}

.scene-type-badge {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.68rem;
    text-transform: none;
    letter-spacing: 0;
    color: #6b6255;
    font-weight: 400;
}

.scene-goal-tag {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.7rem;
    color: #e8a33d;
    margin: -4px 0 8px 0;
    opacity: 0.85;
}

.scene-goal-tag::before {
    content: "objectif de scene : ";
    color: #6b6255;
}

/* -- avertissement mots gris -- */

.banned-words-flag {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.75rem;
    color: #e6907c;
    background: rgba(217, 118, 90, 0.08);
    border: 1px dashed rgba(217, 118, 90, 0.4);
    border-radius: 2px;
    padding: 6px 9px;
    margin-top: 8px;
}

/* -- modale d'erreurs -- */

.lab-hidden {
    display: none !important;
}

.lab-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 10;
}

.lab-modal-content {
    background: #1b1815;
    border: 1px solid #2c2720;
    border-radius: 4px;
    padding: 18px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.lab-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.lab-modal-header h2 {
    font-size: 1rem;
    margin: 0;
}

#errors-content {
    white-space: pre-wrap;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.78rem;
    color: #e6907c;
}

/* -- breakpoint unique -- */

@media (min-width: 1000px) {
    body {
        padding: 36px;
        max-width: 1140px;
        margin: 0 auto;
    }

    .turn-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lab-progress-fill {
        transition: none;
    }
}
