/* Mercure — l'énigme des Couloirs du temps : onglets des deux cartes, carte de l'emblème
   (SVG, js/corridors.js), grande carte en losange (canevas, js/corridors-board.js), codes des
   obélisques, portes, chambre finale et remerciements.
   Le cadre vient de css/components/game.css. Les Couloirs sont blancs : la carte aussi. */

.cot-sec { background: linear-gradient(180deg, transparent, rgba(233, 241, 255, .05) 30%, rgba(233, 241, 255, .03) 70%, transparent); }
.cot { --paper: #e9f1ff; --ink-dark: #10141f; }
.key { display: inline-block; width: .8em; height: .8em; vertical-align: -.05em; border-radius: 50%; }
.key--start { background: var(--vex); }
.key--end { border: 2px solid var(--exotic); }

/* ---------- Mode d'emploi d'une dalle (schéma : js/corridors-tile.js) ---------- */
.tile-guide { margin: 28px 0; padding: 30px 32px; border: 1px solid var(--line); background: rgba(8, 11, 18, .6); }
.tile-head { max-width: 760px; }
.tile-head h3 { margin: 6px 0 12px; font-size: 1.5rem; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; color: var(--pearl); }
.tile-head > p:not(.tag) { margin: 0; font-size: 1rem; line-height: 1.7; color: var(--muted); }
.tile-shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 24px; }
.tile-shots figure { margin: 0; }
.tile-shots a { display: block; }
.tile-shots img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border: 1px solid var(--line); }
.tile-shots img.photo--paper { object-fit: contain; background: #fff; }
.tile-shots figcaption, .tile-figure figcaption { margin-top: 9px; font-size: .84rem; line-height: 1.55; color: var(--muted); }
.tile-shots figcaption b { color: var(--pearl); }
.credit { display: block; margin-top: 3px; font-size: .64rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.tile-anatomy { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 28px; align-items: center; margin-top: 28px; padding-top: 28px; border-top: 1px solid var(--line); }
.tile-figure { margin: 0; }
#tile-fig { display: block; width: 100%; border: 1px solid var(--line); background: radial-gradient(ellipse 70% 70% at 50% 45%, #1a2233, #080b12 80%); }
#tile-fig g, #tile-fig text { transition: opacity .25s; }
.tile-core { fill: #dfe6f2; }
.tile-sign { color: #10141f; }
.tile-wall { stroke: #10141f; stroke-width: 3.2; stroke-linecap: round; }
.tile-cell { fill: #b9c8e0; stroke: #080b12; stroke-width: .8; }
.tile-cell.is-blank { fill: rgba(233, 241, 255, .16); }
.tile-flower.part-match .tile-cell:not(.is-blank) { fill: #f3dc9a; }
.tile-flower.part-match .tile-cell.is-blank { fill: rgba(243, 220, 154, .3); }
.tile-name { font-family: var(--font-ui); font-size: 9px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase; fill: #98a1bd; }
.tile-equal { font-family: var(--font-ui); font-size: 20px; font-weight: 800; fill: var(--exotic); }
/* une ligne de la légende survolée : le reste du schéma s'efface */
#tile-fig[data-show="centre"] :is(.part-walls, .part-edges, .tile-equal),
#tile-fig[data-show="walls"] :is(.part-edges, .tile-equal, .part-centre .tile-sign),
#tile-fig[data-show="edges"] :is(.part-centre, .part-walls, .tile-equal),
#tile-fig[data-show="match"] :is(.part-centre, .part-walls, .part-edges:not(.part-match)) { opacity: .16; }
.tile-legend { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tile-legend li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; padding: 12px 14px; cursor: default; border: 1px solid transparent; transition: border-color .2s, background .2s; }
.tile-legend li:hover, .tile-legend li:focus-visible { outline: 0; border-color: var(--line-strong); background: rgba(233, 241, 255, .06); }
.tile-legend b { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--page-accent); font-size: .8rem; color: var(--page-accent-hi); }
.tile-legend li[data-part="match"] b { border-color: var(--exotic); color: var(--exotic); }
.tile-legend h4 { margin: 0 0 4px; font-size: .95rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--pearl); }
.tile-legend p { margin: 0; font-size: .9rem; line-height: 1.6; color: var(--muted); }
.tile-note { margin: 22px 0 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: .84rem; line-height: 1.55; color: var(--faint); }

/* ---------- Onglets ---------- */
.cot-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 18px 24px 0; }
.cot-tabs button { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; align-items: center; padding: 10px 14px; cursor: pointer; text-align: left; background: transparent; border: 1px solid var(--line-strong); font: inherit; font-size: .9rem; font-weight: 700; color: var(--pearl); transition: border-color .2s, background .2s, opacity .2s; }
.cot-tabs b { grid-row: span 2; display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid currentColor; font-size: .8rem; }
.cot-tabs span { font-size: .68rem; font-weight: 600; letter-spacing: .08em; color: var(--muted); }
.cot-tabs button:hover, .cot-tabs button:focus-visible { outline: 0; border-color: #fff; }
.cot-tabs button[aria-selected="true"] { border-color: var(--paper); background: rgba(233, 241, 255, .1); }
.cot-tabs button.locked { opacity: .45; }
.cot-tabs button.locked b::after { content: ''; }

/* ---------- Carte ---------- */
.cot-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(260px, 1fr); gap: 20px; margin: 16px 24px 0; align-items: start; }
.cot-map-wrap { position: relative; border: 1px solid var(--line); background: radial-gradient(ellipse 70% 70% at 50% 45%, #1a2233, #080b12 80%); }
.cot-map { display: block; width: 100%; aspect-ratio: 1 / .92; }
.cot-map[data-map="emblem"] { padding: 4% 16%; box-sizing: border-box; }
.cot-count { position: absolute; left: 12px; bottom: 10px; margin: 0; font-size: .7rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-variant-numeric: tabular-nums; pointer-events: none; }

/* ---------- Grande carte : 5 040 pièces en losange ---------- */
.cot-board, .cot-tools { display: none; }
.cot[data-map="tomb"] .cot-map { display: none; }
.cot[data-map="tomb"] .cot-layout { grid-template-columns: minmax(0, 1fr); }
.cot[data-map="tomb"] .cot-side { grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 24px; }
.cot[data-map="tomb"] .cot-board { display: block; width: 100%; aspect-ratio: 16 / 9.4; touch-action: pan-y; outline-offset: -2px; }
.cot[data-map="tomb"] .cot-tools { position: absolute; top: 10px; right: 10px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.cot[data-map="tomb"] .cot-count { font-size: .95rem; color: var(--pearl); text-shadow: 0 1px 8px #000; }
.cot-map-wrap.zoomed .cot-board { touch-action: none; cursor: grab; }
.cot-map-wrap.dragging .cot-board { cursor: grabbing; }
.cot-tools button { min-width: 34px; min-height: 34px; padding: 0 11px; cursor: pointer; background: rgba(8, 11, 18, .82); border: 1px solid var(--line-strong); font: inherit; font-size: .66rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--pearl); transition: border-color .2s, background .2s, opacity .2s; }
.cot-tools button[data-board="in"], .cot-tools button[data-board="out"] { padding: 0; font-size: 1.1rem; letter-spacing: 0; }
.cot-tools button:not(:disabled):hover, .cot-tools button:focus-visible { outline: 0; border-color: #fff; background: rgba(233, 241, 255, .16); }
.cot-tools button:disabled { cursor: default; opacity: .4; }
.cot-tools [hidden] { display: none; }
.cot-map-wrap.complete [data-board="path"] { border-color: var(--exotic); color: var(--exotic); }
/* jauge : part de la carte déjà assemblée */
.cot[data-map="tomb"] .cot-map-wrap::after { content: ''; position: absolute; left: 0; bottom: 0; width: 100%; height: 3px; background: var(--paper); transform-origin: 0 50%; transform: scaleX(var(--fill, 0)); transition: transform .2s linear; }
.cot[data-map="tomb"] .cot-map-wrap.complete::after { background: var(--exotic); }
.cot-map-wrap:fullscreen { display: grid; border: 0; background: #080b12; }
.cot-map-wrap:fullscreen .cot-board { height: 100%; aspect-ratio: auto; }
.cot-map * { vector-effect: non-scaling-stroke; }
.hx-cell { fill: rgba(255, 255, 255, .02); stroke: rgba(255, 255, 255, .09); stroke-width: 1; stroke-dasharray: 2 3; transition: fill .4s, stroke .4s; }
.hx-wall, .hx-glyph { opacity: 0; transition: opacity .4s; }
.hx-wall { stroke: #0b0e16; stroke-width: 4; stroke-linecap: round; }
.hx-glyph { color: var(--ink-dark); }
.hx.placed .hx-cell { fill: #dfe6f2; stroke: rgba(16, 20, 31, .12); stroke-dasharray: none; }
.hx-wall.placed { opacity: 1; }
.hx.placed .hx-glyph { opacity: 1; }
.hx--blank.placed .hx-cell { fill: #6f7a8d; }
.hx.fresh .hx-cell { animation: hx-in .7s ease; }
@keyframes hx-in { from { fill: #fff; } }
/* le chemin ne se montre qu'une fois la carte complète */
.cot-route, .cot-start, .cot-end, .cot-here { opacity: 0; pointer-events: none; transition: opacity .6s; }
.cot-route { fill: none; stroke: var(--exotic); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 5 6; }
.cot-start { fill: var(--vex); stroke: #10141f; stroke-width: 1.5; }
.cot-end { fill: none; stroke: var(--exotic); stroke-width: 3; }
.cot-here { fill: none; stroke: var(--vex); stroke-width: 3.5; }
.cot-map.complete .cot-route { opacity: .95; animation: route-march 1.4s linear infinite; }
.cot-map.complete .cot-start, .cot-map.complete .cot-end { opacity: 1; }
.cot-map.walking .cot-here { opacity: 1; }
@keyframes route-march { to { stroke-dashoffset: -22; } }
.cot-map.complete .hx:not(.walked) .hx-cell { fill: #c9d3e4; }
.hx.walked .hx-cell { fill: #ffe9b8 !important; }

/* ---------- Colonne de droite ---------- */
.cot-side { display: grid; gap: 14px; }
.cot-side .panel-title { display: flex; justify-content: space-between; gap: 12px; }
.cot-side .panel-title span { color: var(--page-accent-hi); letter-spacing: .08em; text-transform: none; font-weight: 600; }
.cot[data-map="emblem"] .cot-crowd, .cot[data-map="tomb"] .cot-obelisk { display: none; }
.cot-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.code-row { display: flex; align-items: center; gap: 8px; padding: 5px 7px; cursor: pointer; background: transparent; border: 1px solid var(--line); font: inherit; color: var(--ink); transition: border-color .2s, background .2s, opacity .2s; }
.code-row b { font-size: .62rem; font-weight: 800; letter-spacing: .08em; color: var(--faint); font-variant-numeric: tabular-nums; }
.code-glyphs { display: flex; gap: 2px; }
.code-glyphs i { display: grid; }
.code-glyphs svg { width: 15px; height: 15px; }
.code-row:hover, .code-row:focus-visible { outline: 0; border-color: #fff; background: rgba(255, 255, 255, .06); }
.code-row.now { border-color: var(--page-accent); box-shadow: inset 0 0 0 1px var(--page-accent); }
.code-row.used { opacity: .38; }
.cot-hint { margin: 10px 0 0; font-size: .78rem; line-height: 1.5; color: var(--muted); }
.cot-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cot-actions [hidden] { display: none; }

/* ---------- Code et portes ---------- */
.cot-code { display: flex; flex-wrap: wrap; gap: 4px; margin: 18px 24px 0; padding: 12px; list-style: none; border: 1px solid var(--line); background: #0b0d14; }
.cot-code li { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid rgba(255, 255, 255, .16); color: var(--pearl); transition: background .3s, color .3s, border-color .3s; }
.cot-code svg { width: 18px; height: 18px; }
.cot-code li.unknown { color: var(--faint); font-size: .8rem; font-weight: 700; }
.cot-code li.done { background: #ffe9b8; border-color: #ffe9b8; color: #10141f; }
.cot-code li.next { border-color: var(--vex); box-shadow: 0 0 12px rgba(127, 224, 210, .6); }
.doors { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 14px 24px 0; }
.door { display: grid; justify-items: center; gap: 6px; padding: 16px 6px 12px; cursor: pointer; clip-path: polygon(50% 0, 100% 34%, 100% 100%, 0 100%, 0 34%); background: linear-gradient(180deg, #f4f8ff, #b9c4d6); border: 0; font: inherit; color: #10141f; transition: transform .2s var(--ease), filter .2s; }
.door svg { width: clamp(26px, 5vw, 40px); height: clamp(26px, 5vw, 40px); margin-top: 14px; }
.door span { font-size: .62rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.door:not(:disabled):hover, .door:focus-visible { outline: 0; transform: translateY(-4px); filter: brightness(1.08) drop-shadow(0 0 14px rgba(233, 241, 255, .6)); }
.door:disabled { cursor: default; filter: grayscale(1) brightness(.55); }

/* ---------- Chambre ---------- */
.vault { margin: 0 24px 24px; border: 1px solid rgba(233, 241, 255, .4); background: linear-gradient(160deg, rgba(233, 241, 255, .12), rgba(233, 241, 255, .03)); animation: vault-in .8s ease; }
.vault[hidden] { display: none; }
@keyframes vault-in { from { opacity: 0; transform: translateY(10px); } }
.vault[data-map="emblem"] .vault-tomb, .vault[data-map="tomb"] .vault-emblem { display: none; }
.vault-emblem { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 20px; padding: 22px 24px; align-items: start; }
.vault-emblem > img { border: 1px solid rgba(255, 255, 255, .3); }
.vault-tomb { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
.vault-tomb figure { position: relative; margin: 0; min-height: 260px; }
.vault-tomb figure img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vault-tomb > div { padding: 22px 24px 24px; }
.vault h4 { margin: 6px 0 10px; font-size: 1.5rem; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; color: var(--pearl); }
.vault p:not(.tag) { margin: 0 0 14px; font-size: .95rem; line-height: 1.65; color: var(--muted); }
.eulogy { display: none; margin-top: 4px; padding-top: 16px; border-top: 1px solid var(--line); }
.vault.mourned .eulogy { display: block; animation: vault-in .8s ease; }
.vault.mourned #cot-mourn { display: none; }
.eulogy blockquote { margin: 0 0 14px; font-family: var(--font-lore); font-style: italic; font-size: 1.35rem; line-height: 1.35; color: #e9e3d6; }
.eulogy cite { display: block; margin-top: 8px; font-family: var(--font-ui); font-style: normal; font-size: .66rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--page-accent); }

/* ---------- Remerciements ---------- */
.cot-thanks { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px 40px; margin-top: 28px; padding: 34px 36px; border: 1px solid rgba(233, 241, 255, .34); background: linear-gradient(150deg, rgba(233, 241, 255, .1), rgba(233, 241, 255, .02) 60%); }
.cot-thanks h3 { margin: 6px 0 14px; font-family: var(--font-lore); font-style: italic; font-weight: 400; font-size: clamp(2.6rem, 6vw, 4.4rem); line-height: 1; color: #e9f1ff; }
.thanks-head > p:not(.tag) { margin: 0; font-size: 1rem; line-height: 1.7; color: var(--muted); }
.thanks-figures { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 0; padding: 0; list-style: none; background: var(--line); border: 1px solid var(--line); }
.thanks-figures li { display: grid; gap: 4px; padding: 16px 18px; background: #0b0e16; }
.thanks-figures b { font-size: clamp(1.6rem, 3.4vw, 2.4rem); font-weight: 800; line-height: 1; color: var(--pearl); font-variant-numeric: tabular-nums; }
.thanks-figures span { font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.thanks-list { display: grid; align-content: center; gap: 10px; margin: 0; padding: 0; list-style: none; }
.thanks-list li { padding-left: 16px; border-left: 2px solid rgba(233, 241, 255, .3); font-size: .95rem; line-height: 1.55; color: var(--ink); }
.thanks-list li:last-child { border-left-color: var(--exotic); color: var(--pearl); font-weight: 700; }

@media (max-width: 1020px) {
  .tile-anatomy { grid-template-columns: minmax(0, 1fr); }
  .cot-thanks { grid-template-columns: minmax(0, 1fr); padding: 26px 24px; }
  .thanks-figures { grid-row: auto; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cot-layout { grid-template-columns: minmax(0, 1fr); }
  .vault-tomb { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .hx-wall { stroke-width: 2.5; }
  .cot-tabs, .cot-layout, .cot-code, .doors { margin-inline: 16px; }
  .vault { margin: 0 16px 16px; }
  .cot-tabs { grid-template-columns: minmax(0, 1fr); }
  .cot[data-map="tomb"] .cot-board { aspect-ratio: 4 / 3; }
  .cot[data-map="tomb"] .cot-side { grid-template-columns: minmax(0, 1fr); }
  .cot-thanks { padding: 22px 16px; }
  .tile-guide { padding: 22px 16px; }
  .tile-shots { grid-template-columns: minmax(0, 1fr); }
  .doors { gap: 5px; }
  .door span { font-size: .5rem; letter-spacing: .06em; }
  .cot-code li { width: 24px; height: 24px; }
  .cot-code svg { width: 14px; height: 14px; }
  .vault-emblem { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .cot-map.complete .cot-route { animation: none; }
}
/* sur un petit écran, les commandes de la grande carte passent au-dessus d'elle plutôt que dessus */
@media (max-width: 680px) {
  .cot[data-map="tomb"] .cot-tools { position: static; justify-content: flex-start; padding: 8px; border-bottom: 1px solid var(--line); }
}
