:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #edf0f5;
  background: #0c1015;
  color-scheme: dark;
  font-size: 16px;
  --surface: #161c24;
  --line: #303946;
  --muted: #a5afbf;
  --gold: #f3cc76;
}
* { box-sizing: border-box; }
body { margin: 0; }
#app { max-width: 480px; margin: auto; padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left)); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 21px; line-height: 1.25; letter-spacing: -.6px; }
h2 { font-size: 20px; line-height: 1.3; }
h3 { font-size: 17px; }
svg { width: 21px; height: 21px; flex-shrink: 0; }
button, input, a { font: inherit; -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
.btn, .player-tab, .hero-pick {
  min-height: 48px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 12px; background: #222b37; color: #edf0f5;
  font-weight: 650; cursor: pointer; text-align: center; text-decoration: none;
}
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
button:active:not(:disabled) { filter: brightness(1.18); transform: translateY(1px); }
button:disabled { background: #1b222c; color: #788494; border-color: #2b3440; cursor: default; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.panel { padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.eyebrow { display: block; font-size: 10px; font-weight: 750; letter-spacing: 1.7px; color: var(--gold); margin-bottom: 5px; }
.remote-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.connection { display: inline-flex; align-items: center; gap: 6px; color: #ff9a9f; font-size: 11px; font-weight: 650; white-space: nowrap; }
.connection::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.connection.on { color: #8cdbb8; }
.status { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 8px 0; margin-bottom: 8px; border-block: 1px solid var(--line); }
.stat { display: flex; align-items: center; justify-content: center; gap: 9px; color: var(--muted); font-size: 11px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat > svg { color: #b8a17c; width: 19px; }
.stat strong { display: block; color: #edf0f5; font-size: 20px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); font-size: 12px; font-weight: 500; }
.player-picker { display: grid; grid-template-columns: repeat(var(--players), minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.player-tab { min-width: 0; padding: 9px 4px; display: grid; justify-items: center; gap: 5px; font-size: 12px; background: color-mix(in srgb, var(--pc) 38%, #10151d); border-color: var(--pc); box-shadow: inset 0 3px var(--pc); }
.player-tab span:not(.player-dot) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--pc); }
.player-tab small { font-size: 10px; color: #edf0f5; font-weight: 500; }
.player-tab[aria-pressed="true"] { background: color-mix(in srgb, var(--pc) 45%, #10151d); border-color: #fff; box-shadow: inset 0 3px var(--pc), inset 0 -3px var(--pc); outline: 1px solid #fff; outline-offset: 0; }
.player-tab[aria-pressed="true"] small { color: #e4e9f0; }
.selected-player { padding: 10px; display: grid; gap: 8px; position: relative; overflow: hidden; }
.selected-player::before { content: ''; position: absolute; top: 0; left: 18px; right: 18px; height: 2px; background: var(--pc); }
.player-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.player-heading > div { min-width: 0; }
.player-heading h2 { overflow-wrap: anywhere; }
.player-heading .eyebrow { color: var(--muted); font-size: 9px; letter-spacing: 1.2px; margin-bottom: 2px; }
.health { display: flex; align-items: center; gap: 5px; white-space: nowrap; color: #a4e4c6; }
.health strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.health > span { color: var(--muted); font-size: 12px; }
.health.empty { color: #ff9a9f; }
.health-track { height: 4px; border-radius: 4px; background: #323d47; overflow: hidden; }
.health-track span { height: 100%; display: block; background: #89ceae; border-radius: inherit; }
.player-inventory { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px; color: var(--muted); font-size: 12px; }
.player-inventory strong { color: #edf0f5; }
.artifact-badge { color: #d2baff; }
.player-state { font-size: 12px; color: var(--gold); line-height: 1.5; }
.player-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.player-actions .btn { min-height: 48px; font-size: 14px; }
.player-actions .hit, .player-actions .noise { min-height: 56px; font-size: 17px; }
.hit:not(:disabled) { background: #502832; border-color: #79404d; color: #ffd5da; }
.noise:not(:disabled) { background: var(--gold); border-color: var(--gold); color: #30230c; }
.btn-artifact:not(:disabled) { background: #30263f; border-color: #5d4678; color: #dac3fc; }
.btn-exit:not(:disabled) { background: #203a33; border-color: #3b6555; color: #a5e3c3; }
.player-corrections { display: flex; gap: 8px; }
.player-corrections .btn { flex: 1; padding: 8px 4px; min-width: 0; font-size: 12px; background: transparent; }
.player-corrections .btn:not(:disabled) { color: #cad3e0; }
.dungeon-ctl { margin-top: 8px; padding: 3px 12px; }
.control-row { display: grid; grid-template-columns: minmax(0, 1fr) 48px 48px; align-items: center; gap: 8px; padding: 3px 0; }
.control-row + .control-row { border-top: 1px solid var(--line); }
.control-label { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; }
.control-label > svg { color: #b5c6d8; }
.control-label small { display: block; margin-top: 2px; font-size: 10px; color: var(--muted); font-weight: 400; }
.control-label strong { color: var(--gold); margin-left: 4px; }
.rage-row .control-label > svg { color: #edaa80; }
.btn-pad { width: 48px; padding: 6px; font-size: 22px; }
.command-dock { position: sticky; bottom: 0; z-index: 2; margin: 8px -2px 0; padding: 8px 2px max(6px, env(safe-area-inset-bottom)); background: #0c1015; border-top: 1px solid #303946; }
.btn-attack { width: 100%; min-height: 58px; justify-content: flex-start; gap: 12px; padding: 10px 16px; border-radius: 15px; }
.btn-attack:not(:disabled) { background: #b93547; border-color: #df6572; color: #fff; box-shadow: 0 4px 20px #b935471a; }
.btn-attack > svg { width: 25px; height: 25px; }
.btn-attack > span { text-align: left; font-size: 16px; }
.btn-attack small { display: block; font-size: 10px; font-weight: 400; margin-top: 2px; }
.btn-attack > strong { margin-left: auto; padding-left: 12px; border-left: 1px solid #ffffff45; font-size: 23px; line-height: 1; }
.remote-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; }
.remote-footer .btn { background: transparent; border-color: transparent; min-height: 48px; font-size: 12px; color: #bfc9d7; }
.remote-footer .btn:disabled { color: #788494; }
.remote-footer svg { width: 16px; height: 16px; }
.game-finished { padding: 12px; margin-bottom: 8px; background: #203a33; color: #a5e3c3; border-radius: 12px; font-weight: 600; }
.setup { padding-bottom: 24px; }
.setup, .setup-player { display: grid; gap: 14px; }
.setup-intro { margin-top: 10px; font-size: 14px; line-height: 1.6; }
.setup-player { border-left: 3px solid var(--pc); }
.field-label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 650; }
.count-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.count-picker .btn { padding-inline: 4px; font-size: 14px; }
.count-picker [aria-pressed="true"], .btn-primary { background: var(--gold); border-color: var(--gold); color: #30230c; }
input { width: 100%; min-height: 48px; padding: 12px; border: 1px solid #627083; border-radius: 10px; color: #edf0f5; background: #0c1015; }
.heroes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hero-pick { border-left: 4px solid var(--c); padding: 8px 4px; font-size: 13px; }
.hero-pick[aria-pressed="true"] { outline: 2px solid var(--gold); outline-offset: 1px; background: #333128; }
dialog { width: min(480px, 100%); max-width: 100%; max-height: 85dvh; overflow: auto; margin: auto auto 0; padding: 18px 18px max(18px, env(safe-area-inset-bottom)); border: 1px solid #435063; border-bottom: 0; border-radius: 24px 24px 0 0; background: var(--surface); color: #edf0f5; overscroll-behavior: contain; }
dialog::backdrop { background: #030609b8; backdrop-filter: blur(4px); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 18px; }
.menu-actions { display: grid; gap: 8px; }
.sheet h3 { margin: 22px 0 12px; }
.bag-lines { display: grid; gap: 10px; font-size: 14px; }
.bag-line { display: flex; gap: 10px; }
.bag-line .n { min-width: 2ch; font-weight: 700; color: var(--gold); }
.log { list-style: none; padding: 0; font-size: 13px; line-height: 1.6; }
.log li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.log time { margin-right: 8px; color: var(--muted); }
.muted { color: var(--muted); }
.loading { text-align: center; padding: 32px; }
#toast { position: fixed; left: 50%; bottom: calc(146px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 12px 16px; background: #7c2634; border: 1px solid #f7a0ad; color: #fff; border-radius: 12px; opacity: 0; pointer-events: none; z-index: 10; font-size: 14px; }
#toast.show { opacity: 1; }
@media (max-width: 359px) {
  #app { padding-inline: 10px; }
  .stat { gap: 6px; }
  .player-tab { font-size: 11px; }
  .btn-attack { gap: 8px; padding-inline: 12px; }
  .btn-attack > span { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { button:active:not(:disabled) { transform: none; } }

/* Choix visuel de l’objet réellement ramassé sur le plateau. */
#artifact-description { font-size: 13px; line-height: 1.5; }
.artifact-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.artifact-choice { min-width: 0; flex-direction: column; padding: 12px 8px; background: #30263f; border-color: #5d4678; }
.artifact-choice img { object-fit: contain; }
.artifact-choice span { overflow-wrap: anywhere; }
.artifact-choice small { display: block; margin-top: 4px; font-size: 11px; font-weight: 400; color: #c6b3df; }
.artifact-choice:disabled img { opacity: .4; }
.artifact-choice:disabled small { color: #a5afbf; }
#artifact-error { margin-top: 12px; color: #ff9a9f; font-size: 13px; }
#artifact-error:empty { display: none; }
