/* Minuit et l'école ensorcelée — styles */
@font-face { font-family: "IM Fell English SC"; src: url("../fonts/im-fell-english-sc-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../fonts/nunito-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../fonts/nunito-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../fonts/nunito-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../fonts/nunito-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: swap; }

:root { --ink: #15121C; --paper: #F3E9D2; --orange: #E8742C; --violet: #5A3F86; --teal: #3FB8A8; --gold: #F2B33D; --red: #B3262E; --night: #2A2C55; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); overflow: hidden; -webkit-tap-highlight-color: transparent; }
body { font-family: "Nunito", system-ui, sans-serif; color: var(--ink); }
#viewport { position: fixed; inset: 0; }
#stage { position: absolute; left: 50%; top: 50%; width: 1280px; height: 720px; transform-origin: center center; overflow: hidden; background: #CFDCE0; }
#scene, #ui { position: absolute; inset: 0; }
#scene svg, #ui svg { display: block; }
.abs { position: absolute; }
.fell { font-family: "IM Fell English SC", Georgia, serif; font-weight: 400; }
h1, h2, h3 { margin: 0; font-family: "IM Fell English SC", Georgia, serif; font-weight: 400; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px dashed var(--orange); outline-offset: 3px; }

/* Boutons */
.btn { background: var(--paper); color: var(--ink); border: 3px solid var(--ink); box-shadow: 3px 5px 0 rgba(0,0,0,.3); font-weight: 800; font-size: 18px; padding: 10px 22px; }
.btn:hover:not(:disabled) { filter: brightness(.95); }
.btn:active:not(:disabled) { transform: translate(1px, 2px); box-shadow: 2px 3px 0 rgba(0,0,0,.3); }
.btn.primary { background: var(--orange); }
.btn.dark { background: var(--ink); color: var(--paper); }
.btn.violet { background: var(--violet); color: var(--paper); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.small { font-size: 15px; padding: 6px 14px; }
.btn.big { font-size: 22px; padding: 14px 28px; min-width: 320px; }
.btn:disabled { opacity: .45; }
.icon-btn { display: inline-flex; align-items: center; gap: 8px; }
.icon-btn svg { width: 22px; height: 22px; }

/* Panneaux et pages */
.panel { background: var(--paper); border: 3px solid var(--ink); box-shadow: 6px 10px 0 rgba(0,0,0,.4); }
.overlay { position: absolute; inset: 0; background: rgba(21,18,28,.62); display: flex; align-items: center; justify-content: center; }
.page { position: absolute; inset: 24px; display: flex; flex-direction: column; }
.page-head { background: var(--ink); color: var(--paper); padding: 12px 16px 12px 26px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.page-head h2 { font-size: 32px; }
.page-body { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 30px 30px; font-size: 18px; line-height: 1.55; }
.page-body h3 { font-size: 26px; margin: 22px 0 8px; }
.page-body h3:first-child { margin-top: 0; }
.page-body p + p { margin-top: 10px; }
.page-body ul { margin: 8px 0; padding-left: 24px; }
.page-body li { margin: 4px 0; }
.page-body table { border-collapse: collapse; width: 100%; font-size: 15px; margin: 8px 0 16px; }
.page-body th, .page-body td { border: 2px solid var(--ink); padding: 6px 8px; text-align: left; vertical-align: top; }
.page-body th { background: #E2D3B2; }
.note { background: #E2D3B2; border-left: 0; padding: 12px 16px; border: 2px dashed var(--ink); }

/* Écran titre */
.title-wrap { position: absolute; left: 0; right: 0; top: 46px; text-align: center; }
.title-wrap h1 { font-size: 76px; line-height: 1; color: var(--ink); }
.title-wrap p { margin-top: 10px; font-size: 20px; font-weight: 700; color: var(--night); }
.menu-col { position: absolute; left: 50%; top: 250px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.menu-foot { position: absolute; left: 24px; right: 24px; bottom: 18px; display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 700; color: var(--paper); }

/* HUD */
.hud { position: absolute; left: 24px; top: 20px; display: flex; gap: 12px; align-items: center; }
.hud-pill { background: var(--ink); color: var(--paper); padding: 8px 16px; font-family: "IM Fell English SC", Georgia, serif; font-size: 18px; box-shadow: 2px 4px 0 rgba(0,0,0,.3); }
.hud-candy { background: var(--paper); padding: 6px 14px; font-weight: 800; font-size: 17px; display: flex; gap: 8px; align-items: center; box-shadow: 2px 4px 0 rgba(0,0,0,.3); }
.hud-right { position: absolute; right: 20px; top: 16px; display: flex; gap: 10px; }

/* Zones cliquables */
.hs { position: absolute; background: transparent; border: 0; padding: 0; border-radius: 6px; }
.hs:hover, .hs:focus-visible { outline: 3px dashed var(--orange); outline-offset: 3px; }
.badge { position: absolute; right: -6px; top: -6px; width: 28px; height: 28px; border-radius: 14px; background: var(--teal); display: flex; align-items: center; justify-content: center; }
.badge.badge-opt { background: var(--gold); }

/* Dialogue */
.dialog { position: absolute; left: 40px; right: 40px; bottom: 24px; height: 156px; background: var(--paper); border: 3px solid var(--ink); box-shadow: 4px 7px 0 rgba(0,0,0,.35); padding: 34px 40px 20px; text-align: left; }
.dialog-tab { position: absolute; left: 26px; top: -22px; color: var(--paper); padding: 6px 20px; font-family: "IM Fell English SC", Georgia, serif; font-size: 22px; box-shadow: 2px 3px 0 rgba(0,0,0,.35); }
.dialog-text { display: block; font-size: 24px; line-height: 1.45; font-weight: 600; }
.dialog-next { position: absolute; right: 22px; bottom: 12px; display: flex; gap: 8px; align-items: center; font-size: 14px; font-weight: 700; color: var(--violet); }
.dialog-voice { position: absolute; width: 44px; height: 44px; border: 2px solid var(--ink); background: #E2D3B2; display: flex; align-items: center; justify-content: center; padding: 0; }
.explore-bar { position: absolute; left: 40px; right: 40px; bottom: 24px; min-height: 72px; background: var(--paper); border: 3px solid var(--ink); box-shadow: 4px 7px 0 rgba(0,0,0,.35); padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.explore-bar .msg { font-size: 19px; font-weight: 600; line-height: 1.4; }
.explore-bar .door { flex-shrink: 0; background: var(--ink); color: var(--paper); padding: 8px 14px; font-weight: 800; font-size: 15px; }

/* Fenêtre d'énigme */
.modal { position: absolute; left: 90px; top: 26px; width: 1100px; height: 668px; display: flex; flex-direction: column; }
.modal-head { background: var(--ink); color: var(--paper); padding: 10px 14px 10px 24px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.modal-head .num { font-weight: 800; font-size: 15px; letter-spacing: 2px; color: var(--gold); }
.modal-head .ttl { font-family: "IM Fell English SC", Georgia, serif; font-size: 30px; }
.modal-head .fac { font-size: 13px; font-weight: 800; background: var(--gold); color: var(--ink); padding: 3px 8px; }
.modal-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 430px minmax(0, 1fr); gap: 28px; padding: 18px 26px 10px; }
.col-left { display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; overflow-y: auto; }
.col-right { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; padding-right: 4px; }
.statement { font-size: 20px; line-height: 1.5; display: flex; flex-direction: column; gap: 6px; }
.statement .q { font-weight: 800; margin-top: 4px; }
.modal-foot { padding: 8px 26px 10px; font-size: 13px; font-weight: 700; color: #3A2A5C; border-top: 2px solid var(--ink); display: flex; justify-content: space-between; }
.opts { display: flex; flex-wrap: wrap; gap: 10px; }
.opt { position: relative; min-width: 96px; min-height: 54px; padding: 8px 16px; background: #fff; border: 3px solid var(--ink); box-shadow: 3px 5px 0 rgba(0,0,0,.25); font-size: 20px; font-weight: 800; }
.opt.wide { flex: 1 1 100%; font-size: 17px; text-align: left; }
.opt.on { background: var(--ink); color: var(--paper); }
.opt.wrong { background: #F0D3CF; color: #8a1f26; text-decoration: line-through; }
.opt.small { min-height: 42px; min-width: 80px; font-size: 16px; padding: 4px 12px; box-shadow: none; border-width: 2px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row .lbl { min-width: 170px; font-weight: 800; font-size: 17px; }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; width: 290px; }
.keypad button { height: 48px; border: 2px solid var(--ink); background: #fff; font-size: 22px; font-weight: 800; }
.keypad button.k-c { background: #E2D3B2; font-size: 15px; }
.keypad button.k-ok { background: var(--orange); font-size: 15px; }
.screen { min-width: 140px; height: 64px; padding: 0 12px; background: var(--ink); color: var(--gold); font-size: 34px; font-weight: 800; display: flex; align-items: center; justify-content: center; letter-spacing: 2px; }
.seq { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 48px; padding: 8px 10px; background: #E2D3B2; border: 2px dashed var(--ink); }
.chip { background: var(--ink); color: var(--paper); padding: 6px 10px; font-weight: 800; font-size: 15px; }
.feedback { background: var(--ink); color: var(--paper); padding: 12px 16px; font-size: 17px; line-height: 1.4; }
.feedback strong { color: var(--teal); }
.warn { color: var(--red); font-weight: 700; font-size: 16px; }
.solved { background: var(--ink); color: var(--paper); padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; box-shadow: 3px 5px 0 rgba(0,0,0,.3); }
.solved .big { font-family: "IM Fell English SC", Georgia, serif; font-size: 30px; color: var(--gold); }
.solved .trouv { color: #9FD6A8; }
.hints { border-top: 2px dashed var(--ink); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.hints p { font-size: 15px; line-height: 1.4; }
.grid9 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; width: 390px; background: #fff; border: 4px solid var(--red); padding: 8px; }
.grid9 button { height: 84px; border: 2px solid var(--ink); font-size: 17px; font-weight: 800; background: var(--paper); }
.symgrid { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; width: 340px; padding: 8px; background: #fff; border: 3px solid var(--ink); }
.symgrid button { height: 50px; border: 1px solid #C9BEA4; padding: 0; background: #fff; }
.symgrid .axis { position: absolute; left: 167px; top: 2px; bottom: 2px; border-left: 4px dashed var(--violet); pointer-events: none; }
.pkgrid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; background: #E2D3B2; padding: 10px; border: 2px solid var(--ink); }
.pkgrid button { height: 52px; background: transparent; border: 0; padding: 0; display: flex; align-items: center; justify-content: center; }
.photo-obj { position: absolute; background: transparent; border: 0; padding: 0; }
.photo-obj:hover { outline: 3px dashed var(--orange); }
.photo-obj.wrong::after { content: ""; position: absolute; inset: 0; background: rgba(179,38,46,.3); }
.photo-obj.found { outline: 4px solid var(--orange); }

/* Cartes de personnages et profils */
.cards { position: absolute; left: 58px; right: 58px; top: 138px; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 20px; }
.card { position: relative; height: 396px; background: var(--paper); border: 3px solid var(--ink); box-shadow: 3px 6px 0 rgba(0,0,0,.3); padding: 10px 6px 12px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.card.sel::after { content: ""; position: absolute; inset: -9px; border: 5px solid var(--orange); pointer-events: none; }
.card .nm { font-family: "IM Fell English SC", Georgia, serif; font-size: 27px; line-height: 1.1; }
.card .cs { font-size: 15px; font-weight: 700; color: var(--violet); }
.profile { display: flex; align-items: center; gap: 16px; padding: 10px 14px; background: #fff; border: 3px solid var(--ink); }
.profile .info { flex: 1; }
.profile .nm { font-family: "IM Fell English SC", Georgia, serif; font-size: 26px; }
.profile .meta { font-size: 15px; font-weight: 700; color: #3A2A5C; }
input.name { font: 800 26px "Nunito", sans-serif; padding: 10px 14px; border: 3px solid var(--ink); width: 420px; background: #fff; }

/* Options */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 10px 0; border-bottom: 2px dashed #C9BEA4; font-size: 18px; font-weight: 700; }
.setting input[type=range] { width: 260px; accent-color: var(--orange); }
.toggle { min-width: 110px; }

/* Carnet */
.carnet { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 26px; }
.carnet .lieu { grid-column: 1 / -1; font-family: "IM Fell English SC", Georgia, serif; font-size: 22px; margin-top: 8px; border-bottom: 2px solid var(--ink); }
.carnet .item { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 16px; font-weight: 700; padding: 4px 0; }
.carnet .item.unk { color: #8F8A93; }

/* Texte agrandi */
#stage.big .dialog-text { font-size: 28px; }
#stage.big .statement { font-size: 23px; }
#stage.big .explore-bar .msg { font-size: 22px; }
#stage.big .hints p { font-size: 18px; }

/* Rotation et impression */
#rotate { position: fixed; inset: 0; background: rgba(21,18,28,.92); color: var(--paper); display: flex; align-items: center; justify-content: center; text-align: center; padding: 30px; font: 800 22px "Nunito", sans-serif; z-index: 10; }
#rotate[hidden] { display: none; }
#print-area { display: none; }
@media print {
  html, body { overflow: visible; background: #fff; height: auto; }
  #viewport, #rotate { display: none !important; }
  #print-area { display: block; font-family: "Nunito", sans-serif; color: #000; font-size: 12pt; line-height: 1.45; }
  #print-area h2 { font-family: "IM Fell English SC", Georgia, serif; font-size: 22pt; }
  #print-area h3 { font-family: "IM Fell English SC", Georgia, serif; font-size: 15pt; margin: 14pt 0 4pt; page-break-after: avoid; }
  #print-area table { border-collapse: collapse; width: 100%; font-size: 10pt; }
  #print-area th, #print-area td { border: 1px solid #000; padding: 3pt 5pt; text-align: left; vertical-align: top; }
  #print-area tr { page-break-inside: avoid; }
  #print-area .no-print { display: none; }
}
