:root {
  --ink: #17342d;
  --muted: #71847e;
  --paper: #f6f1e8;
  --panel: #fffcf7;
  --line: #ddd8cd;
  --green: #15795b;
  --workshop: #2474b9;
  --vigilance: #dc5c4e;
  --agir: #dfa62f;
  --inrae: #805aa8;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  color: var(--ink);
  background: var(--paper);
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button { color: inherit; }

.mode-gate {
  position: fixed; inset: 0; z-index: 1000000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px;
  background: radial-gradient(circle at 50% 15%, #fffdf8 0, #f4eee3 52%, #e8e1d5 100%);
  overflow-x: hidden; overflow-y: auto; transition: opacity .25s, visibility .25s;
}
.mode-gate.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.mode-gate-card {
  width: min(1080px, 100%); min-width: 0; display: grid; grid-template-columns: 1fr; gap: 34px;
  padding: 34px; border: 1px solid #ded7ca; border-radius: 30px; background: #fffdf9e8;
  box-shadow: 0 26px 70px #203b3220;
}
.mode-gate-card.has-cover { grid-template-columns: minmax(280px, .85fr) minmax(440px, 1.15fr); align-items: center; }
.game-intro-visual { overflow: hidden; aspect-ratio: 1; border-radius: 22px; background: #e9e1d3; box-shadow: 0 18px 38px #203b3226; }
.game-intro-visual[hidden] { display: none; }
.game-intro-visual img { width: 100%; height: 100%; display: block; object-fit: cover; }
.game-intro-copy { min-width: 0; text-align: left; }
.mode-gate-card:not(.has-cover) .game-intro-copy { width: min(760px, 100%); margin: auto; text-align: center; }
.mode-gate-card h2 { margin: 9px 0 12px; font-size: clamp(38px, 5vw, 62px); line-height: .98; color: #24473d; }
.game-intro-comment { margin: 0 0 25px; color: #52665f; font-size: 15px; line-height: 1.6; }
.mode-gate-card h3 { margin: 0 0 13px; color: #71847e; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.mode-options { width: 100%; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.mode-options.single-mode { grid-template-columns: minmax(0, 1fr); }
.mode-option {
  width: 100%; min-width: 0; min-height: 150px; padding: 22px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 15px; align-items: center;
  text-align: left; border: 1px solid #ded8cd; border-radius: 20px; background: #fffdfa; box-shadow: 0 12px 28px #203b3212;
}
.mode-option[hidden] { display: none; }
.mode-option:hover { transform: translateY(-4px); border-color: var(--green); box-shadow: 0 20px 45px #203b3220; }
.mode-option .mode-icon { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 16px; color: white; background: var(--green); font: 700 22px Georgia, serif; }
.mode-option.workshop .mode-icon { background: var(--workshop); }
.mode-option strong { display: block; margin-bottom: 8px; font: 700 22px Georgia, serif; }
.mode-option small { display: block; color: var(--muted); font-size: 12px; line-height: 1.55; }
.mode-option i { font-size: 23px; font-style: normal; }
.go-label { display: none; }
.mode-options.single-mode .mode-option.solo {
  width: min(320px, 100%); min-height: 96px; margin: 8px auto 0; padding: 20px 42px; display: flex; justify-content: center;
  color: #fff; text-align: center; border: 0; border-radius: 999px; background: var(--green); box-shadow: 0 16px 32px #1c7f6240;
}
.mode-options.single-mode .mode-option.solo:hover { background: #146c54; box-shadow: 0 20px 40px #1c7f6250; }
.mode-options.single-mode .mode-option.solo .mode-icon,
.mode-options.single-mode .mode-option.solo .solo-detail,
.mode-options.single-mode .mode-option.solo i { display: none; }
.mode-options.single-mode .mode-option.solo .go-label { display: block; margin: 0; font: 700 clamp(32px, 5vw, 46px)/1 Georgia, serif; }
.intro-admin-link {
  display: inline-flex; flex: 0 0 auto; align-items: center; gap: 7px; margin: 0; padding: 8px 12px;
  color: #7d8c87; border: 1px solid #d9d5cc; border-radius: 999px; background: #fffdf89c;
  font-size: 10px; font-weight: 700; text-decoration: none; letter-spacing: .04em;
}
.intro-admin-link:hover { color: var(--green); border-color: #9fc5b5; background: #fffdf8; transform: translateY(-1px); }

.solo-shell { display: none; height: calc(100vh - 82px); overflow: auto; background: radial-gradient(circle at 50% 30%, #fffaf1, #eee7db); }
body[data-mode="solo"] .solo-shell { display: block; }
body[data-mode="solo"] .app-shell { display: none; }
body[data-mode="solo"] .progress, body[data-mode="solo"] #resetBtn, body[data-mode="solo"] #helpBtn { display: none; }
.solo-stage { width: min(1040px, 100%); min-height: 100%; margin: auto; padding: 38px 24px 46px; text-align: center; }
.solo-heading h2 { margin: 7px 0 8px; font-size: clamp(27px, 4vw, 40px); color: #29483f; }
.solo-heading > p:last-child { margin: 0; color: var(--muted); font-size: 13px; }
.solo-deck-area { display: flex; align-items: center; justify-content: center; gap: 70px; margin: 34px auto 20px; }
.solo-draw { width: 180px; color: var(--ink); }
.solo-draw strong, .solo-draw small { display: block; }
.solo-draw strong { margin-top: 18px; font-size: 14px; }
.solo-draw small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.solo-stack { position: relative; display: grid; place-items: center; width: 145px; height: 210px; margin: auto; border-radius: 17px; color: white; background: var(--green); box-shadow: 9px 10px 0 #c7d8cf, 17px 18px 0 #dce4df, 0 20px 35px #254b3e2a; transition: .2s; }
.solo-draw:hover .solo-stack { transform: translateY(-5px) rotate(-1deg); }
.solo-stack::before { content: ""; position: absolute; inset: 12px; border: 1px solid #ffffff45; border-radius: 11px; }
.solo-stack i { position: absolute; inset: 0; z-index: -1; border-radius: 17px; background: #2b8a6d; box-shadow: 0 8px 20px #203b3220; }
.solo-stack i:nth-child(1) { transform: translate(8px, 8px) rotate(2deg); background: #a9c8b9; }
.solo-stack i:nth-child(2) { transform: translate(15px, 15px) rotate(4deg); background: #d4dfd8; }
.solo-stack i:nth-child(3) { transform: translate(21px, 21px) rotate(5deg); background: #e6e9e5; }
.solo-stack b { font: 700 60px Georgia, serif; }
.solo-draw.shuffling .solo-stack { animation: shuffleDeck .24s ease-in-out 4 alternate; }
.solo-draw.shuffling .solo-stack i:nth-child(1) { animation: shuffleLeft .24s ease-in-out 4 alternate; }
.solo-draw.shuffling .solo-stack i:nth-child(2) { animation: shuffleRight .24s ease-in-out 4 alternate; }
.solo-draw.intro-shuffling .solo-stack { animation: shuffleDeck .28s cubic-bezier(.25,.8,.25,1) 5 alternate; }
.solo-draw.intro-shuffling .solo-stack i:nth-child(1) { animation: shuffleLeft .28s cubic-bezier(.25,.8,.25,1) 5 alternate; }
.solo-draw.intro-shuffling .solo-stack i:nth-child(2) { animation: shuffleRight .28s .04s cubic-bezier(.25,.8,.25,1) 5 alternate; }
.solo-draw.intro-shuffling .solo-stack i:nth-child(3) { animation: shuffleMiddle .28s .08s cubic-bezier(.25,.8,.25,1) 5 alternate; }
.solo-draw:disabled { cursor: wait; opacity: 1; }
@keyframes shuffleDeck { to { transform: translateY(-7px) rotate(-3deg); } }
@keyframes shuffleLeft { to { transform: translate(-42px, 7px) rotate(-10deg); } }
@keyframes shuffleRight { to { transform: translate(48px, 12px) rotate(12deg); } }
@keyframes shuffleMiddle { to { transform: translate(-20px, -16px) rotate(-6deg); } }
@media (prefers-reduced-motion: reduce) {
  .solo-draw.intro-shuffling .solo-stack,
  .solo-draw.intro-shuffling .solo-stack i { animation: none; }
}
.solo-card-slot {
  width: 440px; height: var(--solo-card-height, 540px); flex: 0 0 var(--solo-card-height, 540px);
  display: grid; place-items: center; perspective: 1200px; transition: height .25s ease, flex-basis .25s ease;
}
.solo-card-slot.empty { border: 1.5px dashed #b9c8c1; border-radius: 24px; color: #81918b; }
.solo-card-slot.empty p { padding: 20px; font-size: 12px; }
.solo-card-slot.waiting { animation: waitingPulse .5s ease-in-out infinite alternate; }
.solo-card-slot.dealing .solo-card { animation: dealFromStack .62s cubic-bezier(.18,.82,.24,1); }
@keyframes waitingPulse { to { background: #ffffff55; } }
@keyframes dealFromStack { from { opacity: 0; transform: translateX(-190px) scale(.72) rotate(-8deg); } to { opacity: 1; transform: none; } }
.solo-card { width: 100%; height: 100%; cursor: pointer; text-align: left; }
.solo-card-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.2,.75,.25,1); }
.solo-card.flipped .solo-card-inner { transform: rotateY(180deg); }
.solo-face { position: absolute; inset: 0; padding: 30px; display: flex; flex-direction: column; border-radius: 24px; overflow: hidden; backface-visibility: hidden; box-shadow: 0 22px 48px #203b3228; }
.solo-front { justify-content: space-between; color: white; background: linear-gradient(145deg, color-mix(in srgb, var(--card-color), white 10%), color-mix(in srgb, var(--card-color), black 15%)); }
.solo-back { transform: rotateY(180deg); color: #294039; background: #fffdf8; border-top: 8px solid var(--card-color); }
.solo-card-meta { display: flex; justify-content: space-between; font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.solo-question small { display: block; margin-bottom: 13px; font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; opacity: .75; }
.solo-question h3 { margin: 0; font: 700 clamp(26px, 3vw, 36px)/1.18 Georgia, serif; }
.solo-flip-hint { font-size: 10px; opacity: .8; }
.solo-back > h3 { margin: 20px 0 16px; color: var(--card-color); font: 700 29px/1.1 Georgia, serif; }
.solo-back h4 { margin: 0 0 6px; color: var(--card-color); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.solo-back p { margin: 0; font-size: 13px; line-height: 1.5; }
.solo-answer { padding: 15px; border-radius: 13px; background: color-mix(in srgb, var(--card-color), white 92%); }
.solo-extension { margin-top: 16px; }
.solo-extension:last-child p { display: flex; flex-wrap: wrap; gap: 7px; }
.solo-actions { display: flex; justify-content: center; gap: 10px; }
.solo-actions button:disabled { opacity: .45; cursor: not-allowed; }
.solo-actions .return-deck-btn { color: #6f817c; border-color: #cfc8bc; background: #f5f1e8; }
.solo-actions .return-deck-btn:hover { color: #29483f; border-color: #9ba9a4; background: #ebe7de; }
.solo-history { width: min(980px, 100%); margin: 42px auto 0; padding-top: 25px; border-top: 1px solid #d9d4ca; text-align: left; }
.solo-history-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 16px; }
.solo-history-head h3 { margin: 4px 0 0; font: 700 22px Georgia, serif; color: #29483f; }
.solo-history-tools { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; }
.solo-history-tools button { padding: 4px 0; color: #899690; font-size: 9px; text-decoration: underline; text-decoration-color: #bfc7c3; text-underline-offset: 3px; }
.solo-history-tools button:hover { color: #a74e45; text-decoration-color: #a74e45; }
.solo-history-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 18px 14px; }
.solo-history-item { position: relative; min-width: 0; padding: 12px 10px 0 0; }
.history-stack-layer {
  position: absolute; top: calc(12px - var(--stack-offset)); right: calc(10px - var(--stack-offset)); z-index: var(--stack-z);
  width: calc(100% - 10px); height: 165px; border: 2px solid #fff9; border-radius: 14px;
  background: linear-gradient(150deg, color-mix(in srgb, var(--card-color), white 15%), color-mix(in srgb, var(--card-color), black 10%));
  box-shadow: 0 5px 13px #203b3219;
}
.solo-history-card {
  position: relative; z-index: 4; width: 100%; height: 165px; min-height: 165px; padding: 16px 13px 30px; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden;
  text-align: left; color: white; border: 3px solid transparent; border-radius: 14px;
  background: linear-gradient(150deg, color-mix(in srgb, var(--card-color), white 9%), color-mix(in srgb, var(--card-color), black 15%));
  box-shadow: 0 7px 17px #203b321b;
}
.solo-history-card::before { content: ""; position: absolute; width: 95px; height: 95px; top: -45px; right: -38px; border: 1px solid #ffffff32; border-radius: 50%; }
.solo-history-card:hover { transform: translateY(-3px); box-shadow: 0 11px 23px #203b3228; }
.solo-history-card.active { border-color: #fff; outline: 2px solid var(--card-color); outline-offset: 2px; }
.history-card-number { position: absolute; top: 10px; left: 11px; display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; background: #ffffff2d; font-size: 10px; font-weight: 800; }
.history-card-meta { margin-bottom: 7px; font-size: 8px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; opacity: .78; }
.solo-history-card strong {
  position: relative; display: -webkit-box; overflow: hidden;
  font: 700 15px/1.16 Georgia, serif; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
}
.solo-return-card {
  position: absolute; z-index: 5; right: 19px; bottom: 8px; padding: 3px 6px;
  color: #ffffffc7; border-radius: 999px; background: #17342d38;
  font-size: 8px; font-weight: 750; letter-spacing: .04em;
}
.solo-return-card:hover { color: white; background: #17342d70; }

.topbar {
  height: 82px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 252, 247, .96);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 15px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 14px; background: var(--green);
  display: grid; place-content: center; grid-template-columns: repeat(3, 6px); gap: 3px;
  transform: rotate(-3deg);
}
.brand-mark span { width: 6px; height: 21px; background: #fff; border-radius: 6px; transform: rotate(var(--r)); }
.brand-mark span:first-child { height: 13px; margin-top: 8px; --r: -16deg; }
.brand-mark span:last-child { height: 16px; margin-top: 5px; --r: 16deg; }
.eyebrow {
  margin: 0 0 3px; font-size: 10px; line-height: 1; text-transform: uppercase;
  letter-spacing: .19em; font-weight: 700; color: #719083;
}
h1, h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; }
h1 { font-size: 24px; line-height: 1; }
h1 em { color: var(--green); font-style: normal; }
.experimental-note {
  margin: 5px 0 0; color: #8a9994; font-size: 8px; line-height: 1;
  letter-spacing: .02em;
}
.session { display: flex; align-items: center; gap: 12px; }
.progress { margin-right: 9px; font-size: 13px; font-weight: 700; }
.muted { color: var(--muted); font-weight: 500; }
button {
  border: 0; background: none; cursor: pointer; transition: .2s ease;
}
.ghost-btn, .primary-btn {
  padding: 10px 15px; border-radius: 10px; font-size: 12px; font-weight: 700;
}
.ghost-btn { border: 1px solid var(--line); background: white; }
.ghost-btn:hover { border-color: #aaa; }
.primary-btn { color: white; background: var(--green); box-shadow: 0 4px 12px #15795b2b; }
.primary-btn:hover { transform: translateY(-1px); }
.primary-btn span {
  display: inline-grid; place-items: center; width: 17px; height: 17px; border: 1px solid #ffffff99;
  border-radius: 50%; margin-right: 5px;
}

.app-shell { display: flex; height: calc(100vh - 82px); }
.sidebar {
  width: 310px; min-width: 310px; padding: 8px 19px 18px;
  background: rgba(255, 252, 247, .94); border-right: 1px solid #e5ded2;
  box-shadow: 6px 0 26px #203b3208;
  transition: margin .28s ease, transform .25s ease; position: relative; z-index: 10;
  display: flex; flex-direction: column;
}
.sidebar.collapsed { margin-left: -310px; }
.sidebar-head { height: 0; min-height: 0; padding: 0; }
.sidebar-head h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sidebar-head .icon-btn { position: absolute; top: 12px; right: -15px; z-index: 12; }
.icon-btn {
  display: grid; place-items: center; width: 30px; height: 42px; border: 1px solid var(--line);
  background: #fffefa; border-radius: 0 16px 16px 0; font-size: 21px;
  box-shadow: 5px 5px 16px #203b3212;
}
.sidebar.collapsed .icon-btn { left: 319px; right: auto; top: 12px; transform: rotate(180deg); border-radius: 16px 0 0 16px; }
.search {
  height: 40px; margin-top: 0; padding: 0 12px; display: flex; align-items: center; gap: 8px;
  border: 1px solid #e3ddd2; border-radius: 14px; background: #fffefa; color: #8b9994; box-shadow: inset 0 1px 0 #ffffff;
}
.search input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 12px; }
.search:focus-within { border-color: #9dc5b5; box-shadow: 0 0 0 3px #15795b18; }
.filter-title {
  margin: 16px 4px 8px;
  color: #81918b;
  font-size: 10px;
  font-weight: 760;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.filters {
  display: grid; gap: 4px;
  margin: 0 0 10px; position: relative; align-items: start;
}
.filter {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px;
  width: 100%; padding: 8px 10px; border-radius: 12px; border: 1px solid transparent; background: transparent;
  color: #294039; font-size: 12px; font-weight: 650; position: relative; text-align: left;
}
.filter-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c), transparent 84%); }
.filter-label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.filter-count {
  min-width: 24px; padding: 2px 6px; border-radius: 999px;
  color: #72827c; background: #f2eee5; font-size: 10px; font-weight: 650; text-align: center;
}
.filter:hover { background: #fffefa; border-color: #e8e1d6; }
.filter.active {
  color: color-mix(in srgb, var(--c), #17342d 30%);
  border-color: color-mix(in srgb, var(--c), white 70%);
  background: color-mix(in srgb, var(--c), white 91%);
}
.filter.active .filter-count { color: color-mix(in srgb, var(--c), #17342d 24%); background: #fffefa; }
.filter::after {
  content: attr(data-tooltip); position: absolute; z-index: 30; left: 8px; top: calc(100% + 6px);
  width: 220px; padding: 9px 11px; border-radius: 10px; color: white; background: #24473d;
  box-shadow: 0 7px 20px #19382e35; font-size: 9px; font-weight: 500; line-height: 1.45;
  text-align: left; text-transform: none; letter-spacing: normal;
  opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(-4px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s;
}
.filter:hover::after, .filter:focus-visible::after {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.filter:hover, .filter:focus-visible { z-index: 40; }
.debate-toggle {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px;
  margin: 8px 0 12px; padding: 9px 10px; border: 1px solid #e5ded2;
  border-radius: 13px; background: #fffefa99; color: #40534f; cursor: pointer;
}

.debate-toggle[hidden] {
  display: none;
}
.debate-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.debate-toggle-track {
  position: relative; width: 30px; height: 17px; border-radius: 999px;
  background: #cfd8d5; box-shadow: inset 0 0 0 1px #bdc9c5; transition: background .2s;
}
.debate-toggle-track i {
  position: absolute; width: 13px; height: 13px; left: 2px; top: 2px;
  border-radius: 50%; background: white; box-shadow: 0 1px 4px #20352b38; transition: transform .2s;
}
.debate-toggle input:checked + .debate-toggle-track { background: #167f86; }
.debate-toggle input:checked + .debate-toggle-track i { transform: translateX(13px); }
.debate-toggle input:focus-visible + .debate-toggle-track { outline: 2px solid #167f86; outline-offset: 2px; }
.debate-toggle strong { display: block; font-size: 12px; font-weight: 650; }
.debate-toggle small { display: block; margin-top: 3px; color: #6f817c; font-size: 9px; }

.deck-title {
  margin: 16px 4px 8px;
  color: #81918b;
  font-size: 10px;
  font-weight: 760;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.deck-meta {
  display: flex; justify-content: space-between; padding: 0 3px 10px; border-bottom: 1px solid #e9e4da;
  font-size: 10px; color: var(--muted);
}
.deck {
  flex: 1; overflow-y: auto; padding: 14px 5px 30px; display: grid; gap: 10px;
  align-content: start; grid-auto-rows: max-content;
  scrollbar-width: thin; scrollbar-color: #c9c5bb transparent;
}
.deck-section {
  width: 100%; display: flex; align-items: center; gap: 8px; margin: 7px 2px 0; padding: 4px 2px;
  color: var(--section-color); font-size: 9px; text-transform: uppercase;
  letter-spacing: .14em; text-align: left;
}
.deck-section span { width: 18px; height: 2px; border-radius: 2px; background: var(--section-color); }
.deck-section strong { font-weight: 800; }
.deck-section i { margin-left: auto; font-size: 15px; font-style: normal; line-height: 1; }
.deck-section:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.deck-card.section-hidden { display: none; }
.deck-card {
  position: relative; min-height: 64px; padding: 12px 15px 11px 18px; border: 1px solid #e0dcd3;
  border-radius: 14px; background: #fffefa; box-shadow: 0 2px 8px #203b3210; cursor: grab;
}
.deck-card::before {
  content: ""; position: absolute; inset: 10px auto 10px 0; width: 4px;
  background: var(--card-color); border-radius: 0 4px 4px 0;
}
.deck-card:active { cursor: grabbing; }
.deck-card:hover { border-color: var(--card-color); transform: translateX(2px); box-shadow: 0 5px 14px #203b3215; }
.deck-card .card-top { display: flex; justify-content: space-between; }
.card-code { font-size: 9px; color: var(--card-color); font-weight: 500; letter-spacing: .08em; opacity: .82; }
.card-code strong { font-weight: 700; }
.drag-dots { color: #b5bbb7; font-size: 14px; letter-spacing: -1px; }
.deck-card h3 { margin: 6px 0 1px; font-family: Georgia, "Times New Roman", serif; font-size: 16px; line-height: 1.12; font-weight: 700; }

.workspace { position: relative; flex: 1; min-width: 0; overflow: hidden; }
.canvas-viewport {
  width: 100%; height: 100%; overflow: auto;
  background-color: #f4efe5;
  background-image: radial-gradient(#aaac9c59 0.7px, transparent 0.7px);
  background-size: 21px 21px;
}
.canvas {
  width: 2600px; height: 7200px; position: relative; transform-origin: 0 0;
  background: radial-gradient(circle at 42% 32%, #ffffff5c, transparent 36%);
}
.guide-zone-overlay { position: absolute; inset: 0; opacity: 0; pointer-events: none; transition: opacity .25s; }
.guide-zone-overlay.visible { opacity: 1; }
.group-guides { position: absolute; inset: 0; pointer-events: none; }
.learning-zone {
  position: absolute; padding: 17px 20px; border: 1px dashed #6fa3c540;
  border-radius: 24px; background: #ffffff1c; color: #47758f;
}
.learning-zone span, .learning-zone strong { position: relative; z-index: 2; }
.learning-zone span {
  display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 8px;
  border-radius: 50%; color: white; background: #4d8fb8; font-size: 10px; font-weight: 700;
}
.learning-zone strong { font-family: Georgia, "Times New Roman", serif; font-size: 15px; }
.group-zone {
  display: none; border-color: color-mix(in srgb, var(--zone-color), transparent 62%);
  background: color-mix(in srgb, var(--zone-color), transparent 97%);
  color: color-mix(in srgb, var(--zone-color), #263c35 30%);
}
.group-zone span { background: var(--zone-color); }
.zone-situer { left: 40px; top: 80px; width: 780px; height: 410px; }
.zone-fonctionnement { left: 40px; top: 535px; width: 780px; height: 755px; }
.zone-limites { left: 40px; top: 1335px; width: 780px; height: 755px; }
.zone-humain { left: 40px; top: 2135px; width: 780px; height: 410px; }
.workspace-tools {
  position: absolute; z-index: 100000; top: 14px; left: auto; right: 18px;
  display: flex; justify-content: flex-end; align-items: center; gap: 7px; pointer-events: none;
  padding: 7px; border: 1px solid #e2dccfbd; border-radius: 18px;
  background: #fffdf4db; box-shadow: 0 10px 30px #223a3020; backdrop-filter: blur(10px);
}
.workspace-tools button, .zoom-controls { pointer-events: auto; }
.zoom-controls, .tool-btn {
  height: 34px; border: 1px solid #e2dccf; border-radius: 11px; background: #fffefa;
  box-shadow: none;
}
.zoom-controls { display: flex; align-items: center; }
.zoom-controls button { width: 32px; font-size: 19px; }
.zoom-controls span { width: 49px; text-align: center; color: var(--muted); font-size: 10px; }
.tool-btn { padding: 0 12px; margin-left: 0; font-size: 10px; font-weight: 750; }
.tool-btn:hover, .zoom-controls button:hover { background: #f3efe6; }
.tool-btn:disabled { opacity: .42; cursor: default; }
.workspace-tools > .tool-btn:first-of-type { margin-left: 0; }
.canvas-intro {
  position: absolute; top: 220px; left: 335px; width: 620px; min-height: 250px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 34px 48px; text-align: center; color: #587068;
  border: 1.5px dashed #b8d6e7; border-radius: 34px;
  background: linear-gradient(135deg, #ffffff22, #dbeff722);
  box-shadow: inset 0 0 0 1px #ffffff4a, 0 18px 44px #2442360d;
  transition: opacity .25s, transform .25s;
}
.canvas-intro.hidden { opacity: 0; pointer-events: none; }
.intro-orbit { display: none; }
.canvas-intro h2 { margin: 8px 0; font-size: 30px; color: #38574e; }
.canvas-intro > p:not(.eyebrow) { font-size: 12px; line-height: 1.6; }
.legend {
  position: absolute; left: 20px; bottom: 16px; z-index: 8; display: flex; gap: 16px;
  padding: 9px 13px; border: 1px solid var(--line); border-radius: 9px; background: #fffdf9eb;
  box-shadow: 0 3px 12px #273d3416;
}
.legend-item { font-size: 9px; font-weight: 700; }
.legend-item::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--c); }
.tip { position: absolute; z-index: 8; right: 20px; bottom: 18px; color: #72857e; font-size: 9px; }
.tip span { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-right: 5px; border: 1px solid #a5b1ac; border-radius: 50%; }

.board-card {
  position: absolute; width: 300px; height: 540px; perspective: 1000px; cursor: default; user-select: none;
  filter: drop-shadow(0 8px 10px #1e342b24);
}
.board-card.dragging { cursor: grabbing; z-index: 1000 !important; filter: drop-shadow(0 15px 15px #1e342b30); }

.board-card .card-front,
.board-card .back-head,
.board-card .back-section:not(.links) { cursor: grab; }
.board-card.dragging .card-front,
.board-card.dragging .back-head,
.board-card.dragging .back-section { cursor: grabbing; }
.board-card button,
.board-card a,
.board-card [role="button"] { cursor: pointer; }
.card-inner { width: 100%; height: 100%; position: relative; transition: transform .5s cubic-bezier(.2,.75,.25,1); transform-style: preserve-3d; }
.board-card.flipped .card-inner { transform: rotateY(180deg); }
.card-face {
  position: absolute; inset: 0; overflow: hidden; border-radius: 15px; backface-visibility: hidden;
  border: 1px solid #ffffff95;
}
.card-front {
  padding: 19px; display: flex; flex-direction: column; justify-content: space-between; color: white;
  background: linear-gradient(145deg, color-mix(in srgb, var(--card-color), white 10%), color-mix(in srgb, var(--card-color), black 14%));
}
.card-front::before, .card-front::after { content: ""; position: absolute; border: 1px solid #ffffff30; border-radius: 50%; }
.card-front::before { width: 210px; height: 210px; top: -75px; right: -90px; }
.card-front::after { width: 150px; height: 150px; bottom: -75px; left: -55px; }
.front-category { font-size: 9px; text-transform: uppercase; letter-spacing: .16em; font-weight: 700; opacity: .84; }
.front-center { position: relative; z-index: 1; }
.front-center h3 { margin: 6px 0 13px; font-family: Georgia, "Times New Roman", serif; font-size: 30px; line-height: 1.1; font-weight: 700; }
.front-line { width: 36px; height: 3px; border-radius: 3px; background: #ffffffb5; }
.front-bottom { display: flex; justify-content: space-between; align-items: end; font-size: 9px; opacity: .9; }
.front-bottom strong { font-size: 15px; letter-spacing: .08em; }
.flip-hint { display: flex; align-items: center; gap: 4px; }
.card-back { transform: rotateY(180deg); padding: 18px; background: #fffdf8; color: #294039; }
.back-band { height: 6px; margin: -18px -18px 15px; background: var(--card-color); }
.back-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 10px; border-bottom: 1px solid #e7e1d7; }
.back-head h3 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 22px; line-height: 1.08; font-weight: 700; }
.back-head > div { display: flex; align-items: center; gap: 7px; }
.back-head span { color: var(--card-color); font-size: 11px; font-weight: 500; opacity: .78; }
.remove-card {
  display: grid; place-items: center; width: 20px; height: 20px; padding: 0;
  border: 1px solid #ded8ce; border-radius: 50%; color: #7f8c87; background: white;
  font-size: 15px; line-height: 1;
}
.remove-card:hover { color: white; border-color: #b65348; background: #c55b50; }
.front-remove {
  position: absolute; z-index: 3; top: 12px; right: 12px;
  color: #ffffffcc; border-color: #ffffff55; background: #17342d24;
  backdrop-filter: blur(4px); opacity: .72;
}
.front-remove:hover { opacity: 1; color: white; border-color: #ffffff88; background: #17342d55; }
.back-section { margin-top: 10px; }
.back-section h4 { margin: 0 0 5px; color: var(--card-color); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.back-section p { margin: 0; font-size: 13px; line-height: 1.42; }
.back-section.question { margin-top: 14px; padding: 11px; border-radius: 10px; background: color-mix(in srgb, var(--card-color), white 91%); }
.links { color: #70827c; }
.board-card.dense .card-back { padding: 15px; }
.board-card.dense .back-band { margin: -15px -15px 10px; }
.board-card.dense .back-section { margin-top: 8px; }
.board-card.dense .back-section p { font-size: 11.5px; line-height: 1.34; }
.board-card.dense .back-section.question { margin-top: 12px; padding: 8px; }
dialog { width: min(500px, 90vw); padding: 34px; border: 0; border-radius: 20px; color: var(--ink); box-shadow: 0 25px 70px #15382d42; }
dialog::backdrop { background: #15382d72; backdrop-filter: blur(3px); }
dialog h2 { font-size: 28px; }
dialog ol { padding-left: 22px; color: #52665f; font-size: 13px; line-height: 1.65; }
dialog li { margin: 10px 0; padding-left: 5px; }
.dialog-close { position: absolute; top: 12px; right: 15px; font-size: 25px; color: #84918d; }
.dialog-note { margin: 20px 0 0; padding: 12px; border-radius: 9px; background: #eff6f2; color: var(--green); font-size: 11px; }

@media (max-width: 800px) {
  .mode-gate { min-height: 100dvh; justify-content: safe center; padding: max(16px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom)); }
  .mode-gate-card, .mode-gate-card.has-cover { grid-template-columns: 1fr; gap: 16px; padding: 16px; border-radius: 22px; }
  .game-intro-visual { width: 100%; max-height: 44dvh; }
  .game-intro-copy { text-align: left; }
  .mode-gate-card h2 { font-size: clamp(34px, 10vw, 48px); }
  .mode-options { grid-template-columns: 1fr; }
  .mode-option { min-height: 122px; padding: 17px 16px; gap: 13px; }
  .mode-option .mode-icon { width: 44px; height: 44px; border-radius: 13px; }
  .mode-option strong { font-size: 21px; }
  .mode-option i { display: none; }
  .solo-shell { height: calc(100dvh - 70px); }
  .solo-deck-area { flex-direction: column; gap: 30px; }
  .solo-draw { width: 150px; }
  .solo-stack { width: 92px; height: 130px; border-radius: 12px; }
  .solo-stack i { border-radius: 12px; }
  .solo-stack b { font-size: 40px; }
  .solo-card-slot { width: min(440px, 92vw); height: var(--solo-card-height, 510px); flex-basis: var(--solo-card-height, 510px); }
  .solo-history { margin-top: 30px; }
  .solo-history-list { display: flex; gap: 10px; margin: 0 -24px; padding: 4px 24px 18px; overflow-x: auto; scroll-snap-type: x proximity; }
  .solo-history-item { min-width: 140px; width: 140px; scroll-snap-align: start; }
  .solo-history-card { width: 130px; height: 150px; min-height: 150px; }
  .history-stack-layer { width: 130px; height: 150px; }
  .topbar { height: 70px; padding: 0 14px; }
  h1 { font-size: 19px; }
  .brand .eyebrow, .progress, .session > .ghost-btn { display: none; }
  .session .primary-btn { padding: 9px; font-size: 0; }
  .session .primary-btn span { margin: 0; font-size: 12px; }
  .app-shell { height: calc(100vh - 70px); }
  .sidebar { width: 265px; min-width: 265px; }
  .sidebar.collapsed { margin-left: -265px; }
  .sidebar.collapsed .icon-btn { left: 274px; }
  .legend { max-width: calc(100% - 40px); flex-wrap: wrap; gap: 7px 12px; }
  .tip { display: none; }
}

/* Très petits écrans : garder l’accueil complet dans le premier viewport. */
@media (max-width: 800px) and (max-height: 700px) {
  .mode-gate { padding-block: 5px; }
  .mode-gate-card, .mode-gate-card.has-cover { gap: 10px; padding: 12px; }
  .game-intro-visual { width: min(100%, 170px); height: min(30dvh, 170px); max-height: none; justify-self: center; border-radius: 16px; }
  .game-intro-comment { margin-bottom: 12px; font-size: 13px; line-height: 1.4; }
  .mode-gate-card h2 { margin: 5px 0 8px; font-size: 34px; }
  .mode-gate-card h3 { margin-bottom: 8px; font-size: 11px; }
  .mode-option { min-height: 92px; padding: 12px; gap: 10px; border-radius: 16px; }
  .mode-option .mode-icon { width: 38px; height: 38px; border-radius: 11px; font-size: 18px; }
  .mode-option strong { margin-bottom: 5px; font-size: 18px; }
  .mode-option small { font-size: 11px; line-height: 1.35; }
  .intro-admin-link { padding: 6px 10px; font-size: 9px; }
}

.board-card.dense .back-head { padding-bottom: 8px; }
.board-card.dense .back-head h3 { font-size: 20px; line-height: 1.06; }
.board-card.dense .links { margin-top: 5px; }


.links p { display: flex; flex-wrap: wrap; gap: 7px 9px; align-items: center; font-size: 11.5px; line-height: 1.3; }
.board-card.dense .links p { gap: 6px 8px; font-size: 10px; line-height: 1.25; }

.associated-link {
  padding: 2px 5px; border: 1px solid color-mix(in srgb, var(--card-color), white 70%); border-radius: 999px; color: var(--card-color); background: color-mix(in srgb, var(--card-color), white 94%);
  font: inherit; font-weight: 500; text-align: left; text-decoration: none;
}
.associated-link:hover { color: color-mix(in srgb, var(--card-color), black 20%); }
.associated-separator { display: none; }
.board-card.attention { animation: cardPulse .7s ease-out; }
@keyframes cardPulse { 0%, 100% { filter: drop-shadow(0 8px 10px #1e342b24); } 45% { filter: drop-shadow(0 0 18px color-mix(in srgb, var(--card-color), transparent 35%)); } }

.flip-switch {
  display: inline-flex; align-items: center; gap: 7px; min-width: 112px;
  color: var(--muted);
}
.flip-switch span { font-size: 9px; font-weight: 800; }
.flip-switch i {
  position: relative; width: 28px; height: 16px; border-radius: 999px;
  background: #d8e1dc; box-shadow: inset 0 0 0 1px #c5d1cb;
}
.flip-switch i::after {
  content: ""; position: absolute; width: 12px; height: 12px; left: 2px; top: 2px;
  border-radius: 50%; background: white; box-shadow: 0 1px 4px #20352b38; transition: transform .2s;
}
.flip-switch[aria-pressed="true"] { color: var(--green); }
.flip-switch[aria-pressed="true"] i { background: #b9d7c7; }
.flip-switch[aria-pressed="true"] i::after { transform: translateX(12px); }

.history-controls { display: inline-flex; margin-left: 0; pointer-events: auto; }
.history-controls .tool-btn { margin-left: 0; border-radius: 0; min-width: 34px; padding: 0 10px; }
.history-controls .tool-btn:first-child { border-radius: 9px 0 0 9px; }
.history-controls .tool-btn:last-child { border-left: 0; border-radius: 0 9px 9px 0; }
.workspace-tools > .history-controls:first-of-type { margin-left: 0; }


.presentation-btn[aria-pressed="true"] { color: white; border-color: var(--green); background: var(--green); }
body.presentation-mode .topbar,
body.presentation-mode .sidebar,
body.presentation-mode .legend,
body.presentation-mode .tip { display: none; }
body.presentation-mode .app-shell { height: 100vh; }
body.presentation-mode .workspace { width: 100vw; }
body.presentation-mode .workspace-tools { top: 16px; right: 16px; left: auto; }
body.presentation-mode .workspace-tools > *:not(.presentation-btn) { display: none; }
body.presentation-mode .presentation-btn { display: inline-flex; align-items: center; height: 38px; padding: 0 14px; }
body.presentation-mode .canvas-viewport { background-size: 24px 24px; }

.footer-admin-link {
  position: fixed;
  right: 14px;
  bottom: 10px;
  z-index: 210;
  display: none;
  padding: 5px 9px;
  border: 1px solid #24473d20;
  border-radius: 999px;
  color: #24473d;
  background: #fffdf8d9;
  box-shadow: 0 3px 12px #203b3212;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-decoration: none;
  opacity: .58;
  transition: opacity .18s ease, border-color .18s ease;
}
body[data-mode="solo"] .footer-admin-link,
body[data-mode="workshop"] .footer-admin-link { display: inline-flex; }
.footer-admin-link:hover,
.footer-admin-link:focus-visible { opacity: 1; border-color: #24473d66; }
body.presentation-mode .footer-admin-link { display: none; }

/* Adaptation téléphone : panneau de cartes escamotable et commandes tactiles. */
@media (max-width: 700px), (max-height: 500px) and (pointer: coarse) {
  body { overflow: hidden; }
  .topbar { height: 64px; padding: 0 10px; }
  .brand { min-width: 0; gap: 9px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; transform: none; }
  .brand-mark span { width: 5px; height: 17px; }
  .brand-mark span:first-child { height: 11px; margin-top: 6px; }
  .brand-mark span:last-child { height: 13px; margin-top: 4px; }
  h1 { overflow: hidden; max-width: 220px; font-size: 17px; line-height: 1.05; white-space: nowrap; text-overflow: ellipsis; }
  .experimental-note, .brand .eyebrow, .progress, .session > .ghost-btn { display: none; }
  .session { gap: 6px; }
  .session .primary-btn { min-width: 40px; min-height: 40px; padding: 8px; }
  .solo-actions { width: min(440px, 92vw); margin: 0 auto; flex-wrap: wrap; }
  .solo-actions .primary-btn, .solo-actions .ghost-btn { min-height: 42px; padding: 0 16px; font-size: 11px; }

  .app-shell { position: relative; height: calc(100dvh - 64px); min-height: 0; }
  .sidebar {
    position: absolute; inset: 0 auto 0 0; z-index: 200000;
    width: min(86vw, 320px); min-width: min(86vw, 320px); height: 100%;
    padding: 18px 14px 14px; margin-left: 0;
    box-shadow: 12px 0 30px #203b3230; transform: translateX(0);
    transition: transform .25s ease;
  }
  .sidebar.collapsed { margin-left: 0; transform: translateX(-100%); }
  .sidebar .icon-btn { width: 38px; height: 38px; }
  .sidebar.collapsed .icon-btn {
    position: absolute; left: calc(100% + 10px); top: 10px; z-index: 2;
    width: auto; min-width: 72px; height: 40px; padding: 0 12px; transform: none;
    background: #fffdf9; box-shadow: 0 3px 12px #273d3428; font-size: 0; border-radius: 999px;
  }
  .sidebar.collapsed .icon-btn::after { content: "Cartes"; font-size: 12px; font-weight: 800; }
  .search { margin-top: 12px; }
  .filter-title, .deck-title { margin-top: 12px; }
  .filters { margin: 0 0 10px; }
  .deck { padding-bottom: 22px; }
  .deck-card { min-height: 68px; touch-action: manipulation; }

  .workspace { width: 100%; }
  .canvas-viewport {
    overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
  }
  .board-card { touch-action: none; }

  .workspace-tools {
    top: 8px; left: auto; right: 8px; gap: 6px;
    justify-content: flex-end; align-items: center; flex-wrap: wrap; padding: 6px; border-radius: 16px;
  }
  .zoom-controls, .tool-btn { height: 38px; }
  .zoom-controls button { width: 36px; }
  .history-controls { margin-left: 0; }
  .history-controls .tool-btn { min-width: 38px; padding: 0 9px; }
  .flip-switch { min-width: 106px; padding: 0 8px; }
  .overview-btn, .restore-view-btn { width: 40px; min-width: 40px; padding: 0; overflow: hidden; font-size: 0; }
  .overview-btn::before { content: "⊙"; font-size: 16px; }
  .restore-view-btn::before { content: "↩"; font-size: 16px; }
  .presentation-btn { min-width: 40px; padding: 0 10px; font-size: 0; }
  .presentation-btn::before { content: "◉"; font-size: 14px; }
  .presentation-btn[aria-pressed="true"]::before { content: "×"; }
  #tidyBtn { width: 40px; min-width: 40px; padding: 0; overflow: hidden; font-size: 0; }
  #tidyBtn::before { content: "↗"; font-size: 17px; }
  .legend, .tip { display: none; }

  dialog { width: calc(100vw - 28px); max-height: calc(100dvh - 28px); padding: 28px 22px; overflow: auto; }
}
