* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #111217;
    color: #fff;
    font-family: Arial, Helvetica, sans-serif;
}

.page {
    width: min(1500px, calc(100% - 30px));
    margin: auto;
    padding: 25px 0 50px;
}

header {
    background: #1d1e24;
    border-radius: 16px;
    padding: 25px;
}

.back {
    color: #aaa;
    text-decoration: none;
}

h1 {
    color: #00d9ff;
    margin: 8px 0;
    font-size: 42px;
}

header p,
.help {
    color: #aeb2bd;
}

.translator-choice {
    margin-top: 15px;
    background: #1d1e24;
    border-radius: 16px;
    padding: 18px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: end;
    gap: 15px;
}

.language {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.language label {
    font-weight: bold;
}

select {
    height: 48px;
    background: #111217;
    color: white;
    border: 1px solid #444752;
    border-radius: 9px;
    padding: 0 12px;
    font-size: 16px;
}

.swap {
    width: 48px;
    height: 48px;
    border: 1px solid #444752;
    border-radius: 50%;
    background: #00cce8;
    color: #071014;
    font-size: 25px;
    font-weight: bold;
    cursor: pointer;
}

nav {
    display: flex;
    gap: 10px;
    margin: 18px 0;
}

.tab,
.map-button {
    border: 1px solid #444752;
    background: #1d1e24;
    color: white;
    padding: 12px 20px;
    border-radius: 9px;
    cursor: pointer;
    font-weight: bold;
}

.tab.active,
.map-button.active {
    background: #00cce8;
    color: #071014;
}

.section {
    display: none;
    background: #1d1e24;
    border-radius: 16px;
    padding: 20px;
}

.active-section {
    display: block;
}

.section h2 {
    margin-top: 0;
    font-size: 30px;
}

.colors-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 13px;
}

.color {
    min-height: 105px;
    border: 0;
    border-radius: 10px;
    padding: 13px 18px;
    text-align: left;
    cursor: pointer;
    color: white;
    text-shadow: 2px 2px 3px #000;
    transition: transform .12s, filter .12s;
}

.color:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
}

.color span {
    display: block;
    font-size: 18px;
    font-weight: bold;
    text-transform: uppercase;
}

.color strong {
    display: block;
    margin-top: 6px;
    font-size: 24px;
}

.color.red { background:#d20b0b; }
.color.blue { background:#1734d5; }
.color.green { background:#0b7d2a; }
.color.pink { background:#df43ae; }
.color.orange { background:#f27c05; }
.color.yellow { background:#f4f44a; color:#111; text-shadow:1px 1px 2px #fff; }
.color.black { background:#414851; }
.color.white { background:#d7e2f4; color:#111; text-shadow:1px 1px 2px #fff; }
.color.purple { background:#6730b9; }
.color.brown { background:#74471b; }
.color.cyan { background:#2ce6d3; color:#111; text-shadow:1px 1px 2px #fff; }
.color.lime { background:#48ed2d; color:#111; text-shadow:1px 1px 2px #fff; }
.color.maroon { background:#750a2b; }
.color.lightpink { background:#e8b9ce; color:#111; text-shadow:1px 1px 2px #fff; }
.color.banana { background:#fffda5; color:#111; text-shadow:1px 1px 2px #fff; }
.color.gray { background:#778795; }
.color.tan { background:#928a7c; }
.color.coral { background:#eb6f73; color:#111; text-shadow:1px 1px 2px #fff; }

.map-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.map-container {
    background: #050505;
    border-radius: 12px;
    padding: 10px;
    overflow: auto;
    text-align: center;
}

.map-stage {
    position: relative;
    display: inline-block;
    max-width: 100%;
    line-height: 0;
}

.map-container img {
    display: block;
    max-width: 100%;
    max-height: 75vh;
    width: auto;
    height: auto;
    margin: auto;
}

.map-labels {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.map-label {
    position: absolute;
    transform: translate(-50%, -50%);
    min-width: 105px;
    max-width: 175px;
    padding: 7px 10px;
    border: 1px solid rgba(255,255,255,.65);
    border-radius: 8px;
    background: rgba(10, 11, 15, .86);
    color: white;
    text-shadow: 1px 1px 2px #000;
    cursor: pointer;
    pointer-events: auto;
    line-height: 1.15;
    box-shadow: 0 3px 10px rgba(0,0,0,.35);
    transition: transform .12s, background .12s;
}

.map-label:hover {
    transform: translate(-50%, -50%) scale(1.05);
    background: rgba(0, 204, 232, .9);
    color: #071014;
    text-shadow: none;
}

.map-label span,
.map-label strong {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.map-label span {
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.map-label strong {
    margin-top: 3px;
    font-size: 14px;
}

/* Polus contient beaucoup de zones : les étiquettes sont légèrement plus compactes. */
#mapLabels[data-map="polus"] .map-label {
    min-width: 82px;
    max-width: 125px;
    padding: 5px 7px;
}

#mapLabels[data-map="polus"] .map-label span {
    font-size: 10px;
}

#mapLabels[data-map="polus"] .map-label strong {
    font-size: 12px;
}

@media (max-width: 1100px) {
    .colors-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 700px) {
    .translator-choice {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .swap {
        justify-self: center;
    }

    h1 {
        font-size: 32px;
    }

    .colors-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .color strong {
        font-size: 19px;
    }

    .map-label {
        min-width: 78px;
        max-width: 120px;
        padding: 5px 6px;
    }

    .map-label span {
        font-size: 9px;
    }

    .map-label strong {
        font-size: 11px;
    }
}

/* Les étiquettes restent centrées sur les salles de la carte. */
.map-label { z-index: 2; }
#mapLabels[data-map="polus"] .map-label { min-width: 96px; max-width: 150px; }
#mapLabels[data-map="polus"] .map-label span { font-size: 10px; }
#mapLabels[data-map="polus"] .map-label strong { font-size: 13px; }

.map-label { cursor: grab; touch-action: none; user-select: none; }
.map-label.dragging { cursor: grabbing; z-index: 1000; }
.map-labels.edit-mode { outline: 2px dashed #ffd84d; outline-offset: 3px; }

.question-category-buttons { display:flex; flex-wrap:wrap; gap:10px; margin:18px 0; }
.question-category { border:0; border-radius:12px; padding:10px 14px; cursor:pointer; background:#e9e9e9; font-weight:700; }
.question-category.active { background:#222; color:#fff; }
.questions-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:14px; }
.question-card { min-height:90px; border:0; border-radius:16px; padding:14px; cursor:pointer; display:flex; flex-direction:column; justify-content:center; gap:7px; font-size:16px; box-shadow:0 3px 10px rgba(0,0,0,.12); }
.question-card span { font-weight:700; }
.question-card strong { font-size:15px; }
