@import url('./games/carnage-board.css');
@import url('./games/inspectres-wall.css');
@import url('./games/withgreatpower.css');

:root {
  color-scheme: dark;
  --ink: #eeece7;
  --muted: #a8a9ad;
  --canvas: #101216;
  --raised: #181b21;
  --field: #111419;
  --line: #343841;
  --accent: #e7c78c;
  --accent-ink: #181510;
  --heading: Georgia, 'Times New Roman', serif;
  --body: 'Segoe UI', system-ui, sans-serif;
  font: 16px/1.55 var(--body);
}

.theme-polaris { --accent: #bbdff8; --accent-ink: #091921; --raised: #151f2b; --field: #101822; --line: #384a60; --canvas: #101720; --art-fallback: #263a51; }
.theme-inspectres { --accent: #abf2cc; --accent-ink: #071c13; --raised: #172522; --field: #121c1a; --line: #354d44; --canvas: #101915; --art-fallback: #233c33; --heading: 'Trebuchet MS', 'Segoe UI', sans-serif; }
.theme-carnage { --accent: #ffb68b; --accent-ink: #241108; --raised: #251c18; --field: #1d1512; --line: #594238; --canvas: #19120f; --art-fallback: #503428; --heading: Impact, 'Arial Narrow', 'Segoe UI', sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; display: flex; min-height: 100vh; flex-direction: column; background: var(--canvas); color: var(--ink); }
main { flex: 1; }
main:focus { outline: none; }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, h4, p, ul, ol { margin: 0; }
h1, h2, h3, h4 { line-height: 1.16; }
h1 { font-family: var(--heading); font-weight: 700; letter-spacing: -.045em; }
h2 { font-size: clamp(1.1rem, 1.7vw, 1.45rem); }
h3 { font-size: 1.06rem; }
h4 { font-size: .95rem; }
hr { border: 0; border-top: 1px solid var(--line); }
details > summary { cursor: pointer; color: var(--accent); }
details[open] > summary { margin-bottom: .75rem; }
article, section { min-width: 0; }
.layout { width: min(100% - 3rem, 1230px); margin-inline: auto; }
.icon { width: 1.15em; height: 1.15em; flex: none; }
.site-header, .site-footer { border-block-end: 1px solid var(--line); }
.header-inner, .footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 70px; }
.brand { display: inline-flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--ink); font-size: .69rem; font-weight: 760; letter-spacing: .115em; line-height: 1.15; }
.brand-logo { display: block; flex: none; border: 1px solid var(--line); border-radius: 8px; }
.all-games, .source { display: inline-flex; gap: .5rem; align-items: center; text-decoration: none; color: var(--muted); font-size: .88rem; }
.all-games:hover, .source:hover { color: var(--ink); text-decoration: underline; text-underline-offset: .2em; }
.header-caption, .site-footer { color: var(--muted); font-size: .88rem; }
.site-footer { border-block-start: 1px solid var(--line); border-block-end: 0; }
.footer-inner { min-height: 85px; }
.skip { position: fixed; top: 1rem; left: 1rem; z-index: 10; padding: .75rem; background: var(--accent); color: var(--accent-ink); clip-path: inset(50%); }
.skip:focus { clip-path: none; }
.loading { margin: 4rem auto; text-align: center; color: var(--muted); }

.lobby { padding-block: clamp(3rem, 7vw, 6.5rem); }
.lobby h1, .cover h1 { font-size: clamp(3.25rem, 8vw, 7rem); }
.lede { max-width: 56ch; color: #d0cec8; font-size: clamp(1rem, 1.65vw, 1.24rem); }
.lobby .lede { margin-block: 1rem 2.5rem; }
.game-cards, .grid { display: grid; gap: 1rem; }
.game-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.game-card { display: flex; min-width: 0; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: var(--raised); text-decoration: none; transition: border-color .18s, transform .18s; }
.game-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.card-art { display: block; width: 100%; aspect-ratio: 16/9; background-color: var(--art-fallback); background-position: var(--card-position, 74% 45%); background-size: cover; border-bottom: 1px solid var(--line); }
.art-polaris {
  --art: url('./art/polaris.webp');
  --card-position: 74% 29%;
  --cover-position: 68% 22%;
  --cover-mobile-position: 70% 38%;
  --cover-filter: linear-gradient(90deg, #0a0a0afa 0%, #0a0a0ad0 33%, #0a0a0a55 61%, #0a0a0a08 100%);
  --cover-shadow: linear-gradient(0deg, #080808cc, #08080800 52%);
  --cover-mobile-filter: linear-gradient(0deg, #080808fc 0%, #080808b3 45%, #08080830 78%);
  --banner-filter: linear-gradient(90deg, #0b0b0bf0 0%, #0b0b0ba8 53%, #0b0b0b20 100%);
  --banner-position: 67% 19%;
}
.art-inspectres { --art: url('./art/inspectres.webp'); }
.art-carnage {
  --art: url('./art/carnage.webp');
  --banner-art: url('./art/carnage-bandeau.webp');
  --card-position: 78% 42%;
  --cover-position: 74% 42%;
  --cover-mobile-position: 82% 0%;
  --cover-filter: linear-gradient(90deg, #100a07fa 0%, #100a07da 34%, #100a0755 57%, #100a0700 80%);
  --cover-mobile-filter: linear-gradient(0deg, #100a07 0%, #100a07 35%, #100a07e0 44%, #100a0728 59%, #100a0700 75%);
  --banner-filter: linear-gradient(90deg, #140d09f5 0%, #140d09b2 47%, #140d0924 76%, #140d091f 100%);
  --banner-position: 86% 51%;
}
.card-art { background-image: var(--art); }
.card-text { display: flex; flex: 1; flex-direction: column; padding: clamp(1.05rem, 2vw, 1.6rem); }
.card-genre, .eyebrow { color: var(--accent); font-size: .72rem; font-weight: 780; letter-spacing: .105em; text-transform: uppercase; }
.card-text strong { margin-block: .55rem .75rem; font: 700 clamp(1.62rem, 2.8vw, 2.5rem)/1.12 var(--heading); letter-spacing: -.025em; }
.card-description { flex: 1; color: var(--muted); font-size: .92rem; }
.card-link { display: flex; gap: .55rem; align-items: center; margin-top: 1.3rem; font-size: .9rem; font-weight: 720; color: var(--accent); }

.cover { background-color: var(--art-fallback); background-image: var(--cover-filter, linear-gradient(90deg, #0d1119f5 0%, #0d1119dc 29%, #0d11196b 58%, #0d111910 100%)), var(--cover-shadow, linear-gradient(0deg, #0b0d13c9, #0b0d1300 50%)), var(--art); background-position: center, center, var(--cover-position, 68% 50%); background-size: cover; border-bottom: 1px solid var(--line); }
.cover-inner { position: relative; display: flex; min-height: clamp(390px, 56vh, 570px); flex-direction: column; justify-content: end; align-items: start; gap: 1.2rem; padding-block: 3rem; }
.cover-logo { position: absolute; inset: 1rem 0 auto auto; width: clamp(50px, 6vw, 82px); height: auto; border: 1px solid #ffffff70; border-radius: 8px; }
.cover h1 { max-width: 13ch; text-wrap: balance; }
.cover-author { margin-top: .35rem; color: var(--ink); font-size: 1rem; font-weight: 650; text-shadow: 0 2px 8px #090909, 0 0 12px #090909; }
.cover .lede { text-shadow: 0 2px 10px #0b0d13; }
.seat-count { display: inline-flex; align-items: center; gap: .55rem; padding: .42rem .7rem; border: 1px solid #ffffff42; border-radius: 999px; background: #0d11197a; font-size: .8rem; }
.landing-body { display: grid; gap: 1rem; padding-block: 1.8rem 4rem; }
.entry-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.entry-grid h2, .saved h2 { margin-bottom: 1.05rem; }
.saved ul { padding: 0; list-style: none; }
.saved li + li { border-top: 1px solid var(--line); }
.saved li a { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .85rem .1rem; text-decoration: none; }
.saved li a:hover { color: var(--accent); }
.saved li span { display: inline-flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .85rem; }
.join-page { display: grid; justify-items: center; padding-block: clamp(2rem, 8vw, 6rem); }
.join-card { display: grid; width: min(100%, 475px); gap: 1.15rem; }
.join-card h1 { font-size: clamp(2rem, 5vw, 3.25rem); overflow-wrap: anywhere; }

.table-banner { border-bottom: 1px solid var(--line); background-color: var(--art-fallback); background-image: var(--banner-filter, linear-gradient(90deg, #11151bed 0%, #11151bb5 52%, #11151b63 100%)), var(--banner-art, var(--art)); background-size: cover; background-position: center, var(--banner-position, 66% 45%); }
.banner-inner { display: flex; justify-content: space-between; align-items: end; gap: 1rem; padding-block: clamp(1.1rem, 4vw, 3rem); }
.banner-inner h1 { margin-top: .2rem; font-size: clamp(1.95rem, 5vw, 4.4rem); overflow-wrap: anywhere; }
.banner-actions { flex: none; }
.table-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(215px, 280px); align-items: start; gap: 1.3rem; padding-block: 1.4rem 4rem; }
.table-main { min-width: 0; }
.connection { display: flex; align-items: center; gap: .5rem; margin-bottom: .7rem; color: var(--muted); font-size: .82rem; }
.connection[data-connection='lost'] { color: #ffc391; }
.panel { padding: clamp(1rem, 2.3vw, 1.5rem); border: 1px solid var(--line); border-radius: 12px; background: var(--raised); overflow-wrap: anywhere; }
.game-view .panel > :not(:first-child) { margin-top: .85rem; }
.game-view .panel > .stack, .game-view .panel > .grid { margin-top: 1rem; }
.game-view .panel > .button { justify-self: start; }
.game-view .grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 235px), 1fr)); }
.game-view ul:not([class]), .game-view ol:not([class]) { padding-inline-start: 1.35rem; }
.stack { display: grid; gap: .85rem; align-content: start; }
.field-grid, .metrics { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.actions, .chips { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.chip, .metric, .notice { background: var(--field); border: 1px solid var(--line); border-radius: 8px; padding: .48rem .75rem; }
.chip { border-radius: 999px; font-size: .84rem; }
.metric { display: grid; gap: .1rem; }
.metric strong { font-size: 1.22rem; color: var(--accent); }
.muted, .metric small, .metric span { color: var(--muted); }
.notice { padding: .75rem .9rem; border-inline-start: 3px solid var(--accent); }
.game-view blockquote { margin: 0; padding: .65rem 1rem; border-left: 2px solid var(--accent); background: var(--field); }
.timeline { display: grid; gap: .55rem; }
.side-title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .55rem; }
.room-code, .invite-code { color: var(--accent); font-family: ui-monospace, Consolas, monospace; letter-spacing: .115em; }
.seats, .journal { padding: 0; list-style: none; }
.seats li { display: grid; grid-template-columns: .5rem 1fr auto; align-items: center; gap: .6rem; padding-block: .5rem; }
.seats li + li, .journal li + li { border-top: 1px solid var(--line); }
.seats li small { color: var(--muted); }
.dot { display: inline-block; width: .49rem; height: .49rem; flex: none; border-radius: 50%; background: #83858a; }
.dot.online { background: #9eebba; }
.journal { margin-top: .7rem; max-height: 560px; overflow: auto; }
.journal li { padding: .6rem .25rem .6rem 0; font-size: .82rem; }
.journal li div { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.journal p, .journal time { color: var(--muted); }
.journal time { white-space: nowrap; }

label { display: grid; min-width: 0; gap: .32rem; font-size: .84rem; font-weight: 650; }
input, select, textarea { display: block; width: 100%; min-width: 0; min-height: 44px; color: var(--ink); background: var(--field); padding: .6rem .72rem; border: 1px solid var(--line); border-radius: 8px; font-weight: 450; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
textarea { min-height: 85px; resize: vertical; }
.button, .icon-button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: .48rem; padding: .58rem 1rem; border: 1px solid transparent; border-radius: 8px; background: var(--accent); color: var(--accent-ink); cursor: pointer; font-weight: 730; text-align: center; text-decoration: none; }
.button:hover:not(:disabled) { filter: brightness(1.1); }
.button.secondary, .icon-button { border-color: var(--line); background: var(--field); color: var(--ink); }
.button.secondary:hover:not(:disabled), .icon-button:hover { border-color: var(--accent); }
.button:disabled { opacity: .53; cursor: default; }
.invitation { width: min(435px, 100% - 2rem); padding: 1.4rem; border: 1px solid var(--line); border-radius: 14px; background: var(--raised); color: var(--ink); }
.invitation::backdrop { background: #07090cc7; }
.dialog-head { display: flex; justify-content: space-between; align-items: start; gap: .75rem; }
.dialog-head h2 { margin-top: .2rem; }
.icon-button { padding: .35rem .6rem; }
.invite-code { margin-block: .5rem; font-size: 1.6rem; }
.qr-holder img { display: block; width: min(170px, 100%); height: auto; border-radius: 6px; image-rendering: pixelated; }
.invitation > :not(:first-child) { margin-top: .7rem; }
.carnage-audio { width: min(540px, 100% - 2rem); }
.carnage-audio fieldset { min-width: 0; margin: 0; padding: .85rem; border: 1px solid var(--line); border-radius: 8px; }
.carnage-audio legend { padding-inline: .4rem; color: var(--accent); font-weight: 720; }
.carnage-audio h3 { color: var(--muted); font-size: .84rem; }
.carnage-sound-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; }
.carnage-sound-grid .button { padding-inline: .4rem; }
.carnage-volume { grid-template-columns: 1fr auto; align-items: center; }
.carnage-volume input[type='range'] { grid-column: 1; min-height: 24px; padding: 0; accent-color: var(--accent); }
.carnage-volume output { grid-column: 2; color: var(--muted); }
#espace-mj { scroll-margin-top: 1rem; }
.invitation label:has([data-fiction]) { display: flex; align-items: center; gap: .55rem; }
.invitation [data-fiction] { width: 1.2rem; min-height: 1.2rem; height: 1.2rem; margin: 0; accent-color: var(--accent); }
.feedback { position: fixed; right: 1rem; bottom: 1rem; z-index: 2; max-width: min(440px, 100% - 2rem); padding: .9rem 1.1rem; border: 1px solid #dc9c7c; border-radius: 9px; background: #2a1c18; color: #ffdfc8; box-shadow: 0 10px 30px #0b0d13aa; }

@media (max-width: 850px) {
  .game-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-body { grid-template-columns: minmax(0, 1fr) 215px; gap: .9rem; }
}
@media (max-width: 650px) {
  .layout { width: calc(100% - 1.5rem); }
  .game-cards, .entry-grid, .table-body { grid-template-columns: minmax(0, 1fr); }
  .header-inner { min-height: 60px; }
  .footer-inner { min-height: 70px; }
  .cover { background-image: var(--cover-mobile-filter, linear-gradient(0deg, #0d1119fc 0%, #0d1119bd 57%, #0d111936 100%)), var(--art); background-position: center, var(--cover-mobile-position, 65% 40%); }
  .cover h1 { font-size: clamp(2.65rem, 11vw, 4rem); }
  .cover-inner { min-height: 410px; gap: .8rem; padding-block: 1.5rem; }
  .cover.art-carnage { background-color: #100a07; background-size: 100% 100%, auto 68%; background-repeat: no-repeat; }
  .cover.art-carnage .cover-inner { min-height: 544px; }
  .lobby { padding-block: 2.4rem 3rem; }
  .card-art { aspect-ratio: 2/1; }
  .all-games { font-size: .8rem; }
  .journal { max-height: 280px; }
  .banner-inner { align-items: start; flex-direction: column; }
}
@media (max-width: 970px) { .banner-actions { max-width: 100%; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
