:root{
  --bg:#07120c;
  --panel:#0b1a12;
  --line:#1fe38a;
  --text:#b7ffd9;
  --muted:#62d6a0;
  --danger:#ff5c7a;
}

*{ box-sizing:border-box; }
html, body { height: 100%; }

body{
  margin:0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  background: radial-gradient(1000px 600px at 20% 0%, #0e2a1b 0%, var(--bg) 55%, #050b07 100%);
  color:var(--text);
}

/* BARRE DU HAUT */
.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:12px 14px;
  border-bottom:1px solid rgba(31,227,138,.25);
  background: linear-gradient(180deg, rgba(11,26,18,.92), rgba(7,18,12,.75));
}

.brand{ letter-spacing:1px; }
.clock{ color:var(--muted); }

/* Topbar actions */
.topbarActions{
  display:flex;
  align-items:center;
  gap:10px;
}

.miniBtn{
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(183,255,217,.35);
  background: rgba(10, 30, 20, .55);
  color: #b7ffd9;
  font-weight: 700;
  letter-spacing: .08em;
}

.miniBtn.danger{
  border-color: rgba(255, 90, 90, .45);
  color: rgba(255, 140, 140, 1);
}

/* CONTENEUR PRINCIPAL */
.shell{
  padding: 12px 12px 18px;
  max-width: 900px;
  margin: 0 auto;
}

/* ONGLETs */
.tabs{
  display:flex;
  gap:8px;
  padding:10px;
  background: rgba(11,26,18,.65);
  border:1px solid rgba(31,227,138,.25);
  border-radius:14px;
}

.tab{
  flex:1;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(31,227,138,.25);
  background: rgba(7,18,12,.7);
  color:var(--text);
}

.tab.active{
  outline: 2px solid rgba(31,227,138,.35);
  box-shadow: 0 0 0 2px rgba(31,227,138,.12) inset;
}

/* VUES */
.view{ display:none; margin-top:12px; }
.view.active{ display:block; }

h1{ font-size:18px; margin:10px 2px; color:var(--muted); }
h2{ font-size:14px; margin:0 0 10px; color:var(--text); }
h3{ font-size:13px; margin:0 0 10px; color:var(--text); }

/* GRILLE (legacy) */
.grid{
  display:grid;
  grid-template-columns: 1fr;
  gap:12px;
}
@media (min-width: 760px){
  .grid{ grid-template-columns: 1fr 1fr 1fr; }
}

/* CARTES */
.card{
  background: rgba(11,26,18,.65);
  border:1px solid rgba(31,227,138,.22);
  border-radius:16px;
  padding:12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}

/* BARRES */
.bar{
  height:12px;
  border-radius:999px;
  border:1px solid rgba(31,227,138,.25);
  background: rgba(7,18,12,.75);
  overflow:hidden;
}

.barfill{
  height:100%;
  background: linear-gradient(90deg, rgba(31,227,138,.95), rgba(31,227,138,.35));
}

/* LIGNES */
.row{
  display:flex;
  align-items:center;
  gap:10px;
  margin-top:10px;
}
.row.right{ justify-content:flex-end; }
input[type="range"]{ width:100%; }

/* INPUTS */
select, input[type="text"], input[type="number"], textarea{
  width:100%;
  background: rgba(7,18,12,.75);
  border:1px solid rgba(31,227,138,.25);
  border-radius:12px;
  color:var(--text);
  padding:10px;
  outline:none;
}

/* BOUTONS */
button{
  background: rgba(31,227,138,.12);
  border:1px solid rgba(31,227,138,.35);
  border-radius:12px;
  color:var(--text);
  padding:10px 12px;
}
button.danger{
  border-color: rgba(255,92,122,.45);
  background: rgba(255,92,122,.12);
}
button.mini{
  padding:6px 10px;
  border-radius:10px;
}

/* LISTE INVENTAIRE */
.list{
  list-style:none;
  padding:0;
  margin:10px 0 0;
}
.list li{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  padding:10px;
  border-radius:12px;
  border:1px solid rgba(31,227,138,.18);
  background: rgba(7,18,12,.55);
  margin-bottom:8px;
}

/* TEXTE AIDE */
.hint{ color: var(--muted); margin:10px 0 0; font-size:12px; }
.tiny{ color: var(--muted); font-size:12px; letter-spacing:.5px; }

/* FOOTER */
.footnote{
  margin-top: 12px;
  padding: 12px 14px;
  border-top:1px solid rgba(31,227,138,.25);
  background: linear-gradient(180deg, rgba(11,26,18,.65), rgba(7,18,12,.55));
  border-radius: 14px;
}

/* Sauvegarde: zone JSON console */
textarea#backupBox,
textarea#backupProfileBox{
  margin-top: 10px;
  min-height: 180px;
  font-size: 12px;
  line-height: 1.35;
  white-space: pre;
}

/* Bouton import fichier */
.filebtn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(31,227,138,.35);
  background: rgba(31,227,138,.12);
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.filebtn input{ display:none; }

/* Séparateur */
.sep{
  border:0;
  border-top:1px solid rgba(31,227,138,.22);
  margin:12px 0;
}

/* NOM EN SVG */
.nameSvg{
  width:100%;
  height:auto;
  border:1px solid rgba(31,227,138,.22);
  border-radius:16px;
  background: rgba(7,18,12,.55);
  padding:10px;
  filter: drop-shadow(0 0 10px rgba(31,227,138,.18));
}

.nameSvg text{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 72px;
  letter-spacing: 6px;
  fill: var(--text);
}

/* Quêtes */
.questSection{ margin-top: 6px; }
.questSectionTitle{
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 1px;
  padding: 6px 2px;
}

/* Modal */
.modal{
  position: fixed;
  inset: 0;
  display: none;
  z-index: 9999; /* sous le boot */
}
.modal.show{ display: block; }

.modalBackdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
}

.modalPanel{
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  width: min(720px, calc(100vw - 20px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(183,255,217,.25);
  background: rgba(8, 20, 14, .96);
  box-shadow: 0 12px 40px rgba(0,0,0,.55);
}

.modalHead{
  position: sticky;
  top: 0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 12px 12px;
  border-bottom: 1px solid rgba(183,255,217,.15);
  background: rgba(8, 20, 14, .98);
}

.modalTitle{
  font-weight: 900;
  letter-spacing: .14em;
}

.modalBody{ padding: 12px; }

/* ===== Fiche PJ layout ===== */
.gridSheet{
  display:grid;
  grid-template-columns: 1fr;
  gap:12px;
}
@media (min-width: 860px){
  .gridSheet{ grid-template-columns: 1fr 1fr; }
}

.card.sub{
  border: 1px solid rgba(183,255,217,.12);
  background: rgba(10, 30, 20, .35);
}

.statsGrid{ display:grid; gap:10px; }
.statLine{
  display:grid;
  grid-template-columns: 70px 1fr 44px;
  gap:10px;
  align-items:center;
}
.statName{ font-weight:900; letter-spacing:.12em; }
.statVal{ text-align:right; font-weight:900; }

.skillsGrid{
  display:grid;
  grid-template-columns: 1fr;
  gap:10px;
}
@media (min-width: 860px){
  .skillsGrid{ grid-template-columns: 1fr 1fr; }
}

.field{ display:flex; flex-direction:column; gap:6px; }
.field > span{ font-size: 12px; opacity:.85; }

.combatGrid{
  display:grid;
  grid-template-columns: 1fr;
  gap:10px;
}
@media (min-width: 860px){
  .combatGrid{ grid-template-columns: 1fr 1fr 1fr; }
}

.weaponsGrid{
  display:grid;
  grid-template-columns: 1fr;
  gap:10px;
  margin-top:10px;
}
@media (min-width: 860px){
  .weaponsGrid{ grid-template-columns: 1fr 1fr; }
}

.weaponCard{
  border: 1px dashed rgba(183,255,217,.18);
  border-radius: 14px;
  padding: 10px;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.specList{ display:flex; flex-direction:column; gap:8px; margin-top:10px; }
.specRow{
  display:grid;
  grid-template-columns: 1fr 80px 44px;
  gap:10px;
  align-items:center;
  border: 1px solid rgba(183,255,217,.10);
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(0,0,0,.15);
}

/* Patch: titre fiche + lock */
.sheetHead{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

/* Patch: MAX au-dessus du champ */
.maxBox{
  display:flex;
  flex-direction:column;
  gap:6px;
  width:90px;
  min-width:90px;
}
.maxLabel{
  font-size:11px;
  letter-spacing:.12em;
  color: var(--muted);
  opacity:.95;
}
.maxBox input{
  width:100%;
  text-align:center;
  padding:10px 8px;
  border-radius:12px;
}

/* Patch: verrouillage visuel */
.lockedDim{
  opacity:.55;
  filter:saturate(.85);
}
input[disabled], select[disabled], textarea[disabled]{
  opacity:.55;
  cursor:not-allowed;
}

/* ===== BOOT OVERLAY (force plein écran) ===== */
#boot{
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
  display: none;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, rgba(20,80,55,.18), rgba(0,0,0,.92));
  color: #b7ffd9;
}

#boot.show{ display:flex !important; }

#boot .bootInner{
  width: min(720px, calc(100vw - 28px));
  border: 1px solid rgba(183,255,217,.22);
  border-radius: 18px;
  padding: 18px 16px;
  background: rgba(8, 20, 14, .92);
  box-shadow: 0 12px 44px rgba(0,0,0,.6);
  position: relative;
  overflow: hidden;
}

/* scanlines */
#boot .bootInner::before{
  content:"";
  position:absolute; inset:-40px 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(183,255,217,.06) 0px,
    rgba(183,255,217,.06) 1px,
    rgba(0,0,0,0) 5px,
    rgba(0,0,0,0) 10px
  );
  opacity:.25;
  animation: bootScan 1.6s linear infinite;
  pointer-events:none;
}

@keyframes bootScan{
  0%{ transform: translateY(-20px); }
  100%{ transform: translateY(20px); }
}

#boot .bootBrand{
  font-weight:900;
  letter-spacing:.18em;
  font-size:18px;
  margin-bottom:12px;
}

#boot .bootLines{ display:flex; flex-direction:column; gap:6px; }
#boot .bootLine{ opacity:.9; font-size:13px; }
#boot .bootLine:nth-child(1){ opacity:1; }

#boot .bootBar{
  margin-top:14px;
  height:12px;
  border-radius:999px;
  border:1px solid rgba(183,255,217,.22);
  background: rgba(0,0,0,.35);
  overflow:hidden;
}

#boot .bootFill{
  height:100%;
  width:0%;
  background: rgba(183,255,217,.75);
  filter: drop-shadow(0 0 8px rgba(183,255,217,.35));
}

#boot .bootHint{
  margin-top:10px;
  font-size:12px;
  opacity:.7;
}

@media (prefers-reduced-motion: reduce){
  #boot .bootInner::before{ animation:none; }
}

.archivesList{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top:10px;
}

.archItem{
  border: 1px solid rgba(183,255,217,.12);
  border-radius: 14px;
  padding: 10px;
  background: rgba(0,0,0,.12);
}

.archHead{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:8px;
}

.archDate{
  color: var(--muted);
  font-size:12px;
  letter-spacing:.08em;
  font-weight:900;
}

.archActions{
  display:flex;
  gap:8px;
}

.archText{
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.35;
  opacity:.95;
}
.lockedDim{
  opacity: .65;
  filter: saturate(.7);
}

