/* Cité des rêves — les deux mini-jeux : le Puits aveugle (js/well.js) et les défis ascendants
   (js/ascent.js). Le cadre commun (.game, .game-hud…) est dans css/components/game.css. */

#bw-time.is-urgent, #asc-time.is-urgent { color: #ffb08a; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* ---------- Le Puits aveugle ---------- */
.well { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 18px; padding: clamp(14px, 2.6vw, 24px); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: radial-gradient(ellipse 70% 80% at 40% 50%, rgba(122, 212, 255, .06), transparent 70%), #050812; }
.bw-arena { position: relative; aspect-ratio: 16 / 10; overflow: hidden; border: 1px solid rgba(122, 212, 255, .25); background: radial-gradient(ellipse 60% 60% at 50% 50%, #12233a 0%, #0a1426 45%, #060b16 100%); }
.bw-arena::before { content: ''; position: absolute; inset: 0; background: repeating-radial-gradient(ellipse at 50% 50%, transparent 0 22px, rgba(122, 212, 255, .05) 22px 23px); pointer-events: none; }
.bw-sphere { position: absolute; left: 50%; top: 50%; width: 50.6%; height: 48.4%; transform: translate(-50%, -50%); border-radius: 50%; border: 1px dashed rgba(223, 244, 255, .25); pointer-events: none; transition: box-shadow .6s, border-color .6s; }
.well[data-phase="play"] .bw-sphere, .well[data-phase="heroic"] .bw-sphere { border-style: solid; border-color: rgba(223, 244, 255, .5); box-shadow: inset 0 0 40px rgba(122, 212, 255, .18), 0 0 30px rgba(122, 212, 255, .15); }
.bw-mist { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0; transition: opacity .8s;
  background: radial-gradient(ellipse 25.3% 24.2% at 50% 50%, transparent 92%, rgba(170, 190, 214, .55) 100%), radial-gradient(ellipse 70% 70% at 50% 50%, rgba(150, 170, 196, .8), rgba(120, 138, 164, .95)); -webkit-mask-image: radial-gradient(ellipse 25.3% 24.2% at 50% 50%, transparent 95%, #000 100%); mask-image: radial-gradient(ellipse 25.3% 24.2% at 50% 50%, transparent 95%, #000 100%); }
.well.is-misty .bw-mist { opacity: .94; }
.well.is-harmony .bw-mist { opacity: .12; }
.bw-core { position: absolute; left: 50%; top: 50%; z-index: 2; width: 11%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, #fff 0%, #bfe8ff 30%, rgba(122, 212, 255, .2) 70%, transparent 72%); box-shadow: 0 0 30px rgba(122, 212, 255, .7); }
.bw-core i { width: 46%; aspect-ratio: 1; border: 1px solid rgba(255, 255, 255, .8); transform: rotate(45deg); }
.well[data-phase="idle"] .bw-core, .well[data-phase="over"] .bw-core { filter: grayscale(.8) brightness(.6); box-shadow: none; }
.bw-core.hurt { animation: core-hurt .5s; }
@keyframes core-hurt { 40% { box-shadow: 0 0 40px #ff6a4a; filter: hue-rotate(160deg); } }

.bw-foe { position: absolute; z-index: 4; width: 28px; height: 28px; padding: 0; transform: translate(-50%, -50%); border: 1.5px solid rgba(0, 0, 0, .6); border-radius: 50% 50% 40% 40%; cursor: crosshair; transition: opacity .3s; display: grid; place-items: center; }
.bw-foe i { width: 40%; height: 40%; border-radius: 50%; background: rgba(0, 0, 0, .55); }
.bw-foe.bw-scorn { background: radial-gradient(circle at 40% 35%, #f6ef9c, #b8a63c); }
.bw-foe.bw-hive { background: radial-gradient(circle at 40% 35%, #c9ef8f, #5e8a2e); }
.bw-foe.bw-taken { background: radial-gradient(circle at 40% 35%, #ffffff, #b9bccb); border-color: #000; box-shadow: 0 0 0 2px rgba(0, 0, 0, .6); }
.bw-foe--elite { width: 34px; height: 34px; box-shadow: 0 0 0 2px #f2c94c; }
.bw-foe--screeb { width: 20px; height: 20px; background: radial-gradient(circle, #ffd28a, #e2672b) !important; }
.bw-foe--anathema { z-index: 5; width: 34px; height: 34px; border: 0; border-radius: 50%; background: radial-gradient(circle, #fff 0%, #ffd6ff 30%, rgba(214, 120, 255, .4) 60%, transparent 70%) !important; box-shadow: 0 0 24px rgba(230, 160, 255, .9); animation: ana-pulse 1.4s ease-in-out infinite; }
@keyframes ana-pulse { 50% { transform: translate(-50%, -50%) scale(1.15); } }
.bw-foe--orb, .bw-foe--relic { z-index: 6; width: 22px; height: 22px; border: 0; border-radius: 50%; animation: orb-pop 1s ease-in-out infinite; }
.bw-foe--orb { background: radial-gradient(circle, #fff, #9ff0ff 60%, transparent 72%) !important; box-shadow: 0 0 20px #9ff0ff; }
.bw-foe--relic { border-radius: 2px; transform: translate(-50%, -50%) rotate(45deg); background: linear-gradient(135deg, #fff2b0, #e2b13c) !important; box-shadow: 0 0 18px #f2c94c; animation: none; }
@keyframes orb-pop { 50% { box-shadow: 0 0 34px #fff; } }
.bw-foe--servant { width: 40px; height: 40px; }
.bw-foe--herald { width: 48px; height: 48px; border-radius: 30% 30% 45% 45%; }
.bw-foe--plague { width: 70px; height: 70px; border-radius: 40% 40% 48% 48%; }
.bw-foe.is-shielded::before { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid rgba(223, 244, 255, .85); box-shadow: 0 0 14px rgba(160, 220, 255, .8), inset 0 0 10px rgba(160, 220, 255, .5); }
.bw-foe.is-hurt::after { content: ''; position: absolute; left: 8%; right: 8%; bottom: -8px; height: 3px; background: linear-gradient(90deg, #ff8a6a calc(var(--hp) * 100%), rgba(255, 255, 255, .15) 0); }
.bw-foe.in-mist { opacity: .05; pointer-events: none; }
.bw-foe.bw-bounce { animation: bounce .3s; }
@keyframes bounce { 50% { transform: translate(-50%, -50%) scale(1.25); } }
.bw-foe:focus-visible { outline-offset: 4px; }

.bw-side { display: flex; flex-direction: column; gap: 8px; }
.bw-label { margin: 6px 0 0; font-size: .62rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--well-hi); }
.bw-tiers { display: grid; gap: 6px; }
.bw-tier { display: flex; justify-content: space-between; align-items: baseline; padding: 7px 10px; border: 1px solid var(--line-strong); background: rgba(8, 14, 28, .7); color: var(--muted); font-size: .82rem; font-weight: 700; cursor: pointer; text-align: left; }
.bw-tier small { font-size: .6rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.bw-tier[aria-checked="true"] { border-color: var(--well); background: rgba(122, 212, 255, .14); color: var(--well-hi); }
.bw-tier:disabled { cursor: default; opacity: .6; }
.bw-phases { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin: 0; padding: 0; list-style: none; }
.bw-phases li { padding: 4px 0; border: 1px solid rgba(122, 212, 255, .25); font-size: .72rem; font-weight: 800; text-align: center; color: var(--faint); }
.bw-phases li.is-now { border-color: var(--well); color: var(--well-hi); box-shadow: 0 0 10px rgba(122, 212, 255, .4); }
.bw-phases li.is-done { background: rgba(122, 212, 255, .18); border-color: var(--well); color: #fff; }
.bw-charge { height: 6px; background: rgba(255, 255, 255, .08); }
.bw-charge span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--well), #fff); box-shadow: 0 0 10px var(--well); transition: width .15s linear; }
.bw-buffs { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; margin: 4px 0 0; }
.bw-buff { padding: 3px 8px; font-size: .62rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.bw-buff[hidden] { display: none; }
.bw-buff--harmony { background: rgba(230, 160, 255, .2); border: 1px solid #e6a0ff; color: #fbe8ff; }
.bw-buff--relic { background: rgba(242, 201, 76, .2); border: 1px solid #f2c94c; color: #fff2c4; }
.bw-week { margin: auto 0 0; padding-top: 8px; border-top: 1px solid var(--line); font-size: .74rem; line-height: 1.45; color: var(--muted); }

/* ---------- Les défis ascendants ---------- */
.asc-picker { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; padding: 14px clamp(14px, 2.6vw, 24px) 0; }
.asc-pick { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 9px 10px; border: 1px solid rgba(143, 245, 210, .2); background: rgba(6, 16, 14, .7); color: var(--muted); text-align: left; cursor: pointer; transition: border-color .2s, background .2s; }
.asc-pick b { font-size: .78rem; color: var(--pearl); }
.asc-pick small { font-size: .6rem; letter-spacing: .06em; color: var(--faint); }
.asc-pick:hover { border-color: rgba(143, 245, 210, .6); }
.asc-pick.is-current { border-color: var(--asc); background: rgba(143, 245, 210, .12); }
.asc-pick.is-done b::after { content: ' ✓'; color: var(--asc); }
.asc-pick.is-live::before { content: 'Cette semaine'; position: absolute; top: -8px; right: 6px; padding: 0 6px; background: var(--asc); color: var(--night); font-size: .52rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.asc-pick:disabled { cursor: default; opacity: .55; }
.ascent { margin-top: 14px; padding: clamp(14px, 2.6vw, 24px); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); outline: none;
  background: radial-gradient(ellipse 60% 70% at 85% 50%, rgba(255, 255, 255, .06), transparent 60%), radial-gradient(ellipse 80% 80% at 30% 50%, rgba(143, 245, 210, .05), transparent 70%), #030706; }
.asc-riddle { margin: 0 0 14px; font-family: var(--font-lore); font-style: italic; font-size: 1.1rem; color: var(--asc-hi); }
.asc-field { display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px; gap: 10px; align-items: stretch; }
.asc-portal, .asc-light { border-radius: 40%; }
.asc-portal { border: 2px solid rgba(143, 245, 210, .7); box-shadow: inset 0 0 18px rgba(143, 245, 210, .5), 0 0 16px rgba(143, 245, 210, .4); }
.asc-light { background: radial-gradient(ellipse at 0% 50%, rgba(255, 255, 255, .9), rgba(255, 255, 255, .1) 60%, transparent 70%); }
.asc-board { display: grid; grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr)); gap: 6px; }
.asc-cell { aspect-ratio: 1.35; padding: 0; border: 1px dashed rgba(143, 245, 210, .07); background: transparent; cursor: pointer; transition: background .25s, border-color .25s, box-shadow .25s; }
.asc-cell:hover:not(:disabled) { border-color: rgba(143, 245, 210, .35); }
.asc-cell:disabled { cursor: default; }
.asc-cell.is-start, .asc-cell.is-seen, .asc-cell.is-exit, .ascent.is-vision .asc-cell.is-solid { border: 1px solid rgba(220, 255, 240, .55); background: linear-gradient(180deg, #6b7f7a, #2e3a38 70%, #1b2322); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
.ascent.is-vision .asc-cell.is-solid { box-shadow: 0 0 14px rgba(143, 245, 210, .6), inset 0 1px 0 rgba(255, 255, 255, .5); }
.asc-cell.is-exit { box-shadow: 8px 0 18px rgba(255, 255, 255, .55), inset 0 1px 0 rgba(255, 255, 255, .5); border-color: #fff; }
.asc-cell.is-here { position: relative; }
.asc-cell.is-here::after { content: ''; position: absolute; left: 50%; top: 50%; width: 34%; aspect-ratio: 1; transform: translate(-50%, -50%) rotate(45deg); background: var(--gold-hi); box-shadow: 0 0 12px var(--gold); }
.asc-cell.is-void { animation: void-flash .6s; }
@keyframes void-flash { 30% { background: rgba(255, 90, 70, .35); border-color: #ff6a4a; } }
.ascent[data-phase="idle"] .asc-cell, .ascent[data-phase="over"] .asc-cell { opacity: .55; }
.ascent[data-phase="done"] .asc-board { filter: drop-shadow(0 0 14px rgba(143, 245, 210, .4)); }
.asc-finale { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 16px; }
.asc-finale[hidden] { display: none; }
.asc-target { position: relative; display: grid; gap: 6px; min-width: 120px; padding: 12px 16px; border: 1px solid rgba(255, 255, 255, .5); background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, .2), rgba(20, 20, 30, .9)); color: #fff; font-weight: 800; font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; cursor: crosshair; animation: target-in .4s calc(var(--i) * .08s) both; }
.asc-target i { display: block; height: 4px; background: linear-gradient(90deg, #ff8a6a calc(var(--hp, 1) * 100%), rgba(255, 255, 255, .15) 0); }
.asc-target:active:not(:disabled) { transform: scale(.96); }
.asc-target.is-down { opacity: .3; cursor: default; }
@keyframes target-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 860px) {
  .well { grid-template-columns: minmax(0, 1fr); }
  .bw-tiers { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bw-tier { flex-direction: column; align-items: flex-start; }
  .asc-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .asc-field { grid-template-columns: 18px minmax(0, 1fr) 18px; gap: 6px; }
  .asc-board { gap: 4px; }
  .bw-foe { width: 24px; height: 24px; }
  .bw-foe--plague { width: 54px; height: 54px; }
  .bw-foe--herald { width: 40px; height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .shake, .bw-foe--anathema, .bw-foe--orb, .asc-target { animation: none; }
}
