/* Pannello Facile - tema scuro con accento ambra */
:root {
  --bg: #15110e;
  --side: #1a1512;
  --surface: #1c1814;
  --surface2: #221d18;
  --line: #2f2923;
  --line2: #3d352d;
  --text: #ece5da;
  --text2: #c9c0b4;
  --muted: #968b7e;
  --amber: #eaa53e;
  --amber-soft: rgba(234, 165, 62, .12);
  --amber-line: rgba(234, 165, 62, .55);
  --red: #e5534b;
  --red-soft: rgba(229, 83, 75, .14);
  --green: #57b35d;
  --green-soft: rgba(87, 179, 93, .14);
  --blue: #4f8fe8;
  --blue-soft: rgba(79, 143, 232, .12);
  --violet: #8a7cf0;
  --radius: 8px;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 Inter, "Segoe UI", system-ui, -apple-system, sans-serif; }
a { color: var(--amber); cursor: pointer; text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
h1 { font-size: 21px; margin: 0 0 4px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 10px; font-weight: 650; }
h3 { font-size: 14px; margin: 18px 0 8px; font-weight: 650; }
p { margin: 6px 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.err { color: var(--red); }
.ok-t { color: var(--green); }
.amber { color: var(--amber); }
.spacer { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
svg.i { width: 20px; height: 20px; fill: currentColor; flex: none; vertical-align: middle; }
svg.i.sm { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- struttura */
.app { display: flex; height: 100vh; }
.side { width: 230px; flex: none; background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; transition: width .15s; }
.brand { font-weight: 700; font-size: 16px; padding: 16px 20px 12px; white-space: nowrap; overflow: hidden; }
#nav { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
#nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin: 2px 0; border-radius: var(--radius); color: var(--text2); text-decoration: none; white-space: nowrap; font-size: 14.5px; }
#nav a svg { color: var(--text2); }
#nav a:hover { background: var(--surface2); color: var(--text); }
#nav a.active { background: var(--amber-soft); color: var(--amber); }
#nav a.active svg { color: var(--amber); }
.nav-q { margin: 2px 12px 8px; padding: 7px 10px; border: 1px solid var(--line2); border-radius: var(--radius); background: var(--surface2); color: var(--text); font: inherit; font-size: 13.5px; outline: none; }
.nav-q:focus { border-color: var(--amber); }
.nav-gh { display: flex; justify-content: space-between; width: 100%; background: none; border: 0; font: inherit; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 12px 12px 4px; cursor: pointer; }
.nav-gh:hover { color: var(--text); }
.nav-gh:disabled { cursor: default; color: var(--amber); }
.nav-gh span { font-size: 14px; line-height: 1; }
.nav-g.closed .nav-items { display: none; }
.nav-none { color: var(--muted); padding: 10px 12px; font-size: 13px; }
.app.compact .nav-gh, .app.compact .nav-q { display: none; }
.app.compact .nav-g.closed .nav-items { display: block; }
.page-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 24px 0; border-bottom: 1px solid var(--line); }
.page-tabs a { padding: 7px 14px; border-radius: var(--radius) var(--radius) 0 0; color: var(--text2); border: 1px solid transparent; border-bottom: 0; margin-bottom: -1px; }
.page-tabs a:hover { color: var(--text); background: var(--surface2); }
.page-tabs a.on { color: var(--amber); background: var(--bg); border-color: var(--line); font-weight: 600; }
#nav .nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 12px 4px; }
.side-toggle { background: none; border: 0; color: var(--muted); padding: 10px; cursor: pointer; text-align: right; }
.side-toggle:hover { color: var(--text); }
.app.compact .side { width: 64px; }
.app.compact .brand, .app.compact #nav a span, .app.compact .nav-sep { display: none; }
.app.compact #nav a { justify-content: center; padding: 10px 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; height: 52px; flex: none; padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--bg); }
.env-badge { background: var(--green); color: #0d1a0e; font-weight: 800; font-size: 12px; padding: 3px 10px; border-radius: 6px; letter-spacing: .04em; }
.top-srv { color: var(--text2); }
.top-status { display: flex; gap: 16px; font-size: 12.5px; color: var(--text2); }
.top-status span { display: inline-flex; align-items: center; gap: 6px; }
.user-chip { border: 1px solid var(--line2); border-radius: 999px; padding: 2px 10px; font-size: 12.5px; }
.icon-btn { background: none; border: 0; color: var(--text2); cursor: pointer; padding: 6px; border-radius: 6px; display: inline-flex; }
.icon-btn:hover { background: var(--surface2); color: var(--text); }
.only-mobile { display: none; }
main#page { flex: 1; overflow-y: auto; padding: 22px 24px 90px; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: var(--green); }
.dot.off { background: var(--red); }
.dot.warn { background: var(--amber); }

/* ---------------------------------------------------------------- intestazioni pagina */
.page-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .t { flex: 1; min-width: 260px; }
.sub { color: var(--text2); margin: 2px 0 0; font-size: 13.5px; }
.sub code { color: var(--text2); }

/* ---------------------------------------------------------------- riquadri */
.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.box > h2:first-child, .box > .box-head:first-child { margin-top: 0; }
.box-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.box-head h2 { margin: 0; }
.box-head .r { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.box-sub { color: var(--muted); font-size: 12.5px; margin: -6px 0 12px; }
.box.flush { padding: 0; overflow: hidden; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
.fields.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fields .full { grid-column: 1 / -1; }
.lim-parts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 12px; }
.lim-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 12px; grid-column: 1 / -1; }
.bonus-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; column-gap: 16px; align-items: start; }
.bonus-row[hidden] { display: none; }
.bonus-row > .icon-btn { margin-top: 9px; }
.bonus-add { display: flex; align-items: center; gap: 10px; margin: 2px 0 6px; }

.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat-card .k { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text2); }
.stat-card .v { font-size: 24px; font-weight: 700; margin-top: 4px; }
.stat-card .v small { font-size: 15px; color: var(--muted); font-weight: 500; }
.stat-card .d { font-size: 12.5px; color: var(--text2); margin-top: 6px; display: flex; align-items: center; gap: 6px; }

.alert { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line2); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; background: var(--surface); }
.alert svg { margin-top: 1px; }
.alert.warn { border-color: rgba(234, 165, 62, .35); background: rgba(234, 165, 62, .06); }
.alert.warn svg { color: var(--amber); }
.alert.danger { border-color: rgba(229, 83, 75, .4); background: rgba(229, 83, 75, .07); }
.alert.danger svg { color: var(--red); }
.alert.info { border-color: rgba(79, 143, 232, .35); background: rgba(79, 143, 232, .07); }
.alert.info svg { color: var(--blue); }
.alert b { display: block; margin-bottom: 2px; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------------------------------------------------------------- pulsanti */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--amber-line); background: transparent;
  color: var(--amber); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--amber-soft); }
.btn.primary { background: var(--amber); color: #1b1309; border-color: var(--amber); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--red); border-color: rgba(229, 83, 75, .6); }
.btn.danger:hover { background: var(--red-soft); }
.btn.danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn.ok { color: var(--green); border-color: rgba(87, 179, 93, .6); }
.btn.ghost { border-color: transparent; color: var(--text2); }
.btn.ghost:hover { background: var(--surface2); color: var(--text); }
.btn.plain { border-color: var(--line2); color: var(--text); }
.btn.plain:hover { background: var(--surface2); }
.btn.link { border: 0; height: auto; padding: 0; background: none; }
.btn.link:hover { text-decoration: underline; background: none; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled, .btn.disabled { opacity: .45; cursor: default; pointer-events: none; }
.btn.muted-btn { background: var(--surface2); border-color: var(--surface2); color: var(--muted); }

/* ---------------------------------------------------------------- campi con etichetta sul bordo */
.fld { position: relative; display: block; margin-top: 14px; }
.fld > .lb { position: absolute; top: -8px; left: 10px; padding: 0 4px; font-size: 11.5px; color: var(--text2); background: var(--surface); line-height: 16px; pointer-events: none; z-index: 1; max-width: calc(100% - 20px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-bg .fld > .lb, .login .fld > .lb { background: var(--bg); }
.fld input, .fld select, .fld textarea, input.inp, select.inp, textarea.inp {
  width: 100%; height: 38px; background: transparent; border: 1px solid var(--line2); border-radius: 6px; color: var(--text); font: inherit; padding: 0 12px; outline: none; }
.fld textarea, textarea.inp { height: auto; min-height: 70px; padding: 10px 12px; resize: vertical; }
.fld select, select.inp { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text2) 50%), linear-gradient(135deg, var(--text2) 50%, transparent 50%);
  background-position: calc(100% - 17px) 16px, calc(100% - 12px) 16px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.fld select option, select.inp option { background: var(--surface2); color: var(--text); }
.fld input:focus, .fld select:focus, .fld textarea:focus, .inp:focus { border-color: var(--amber); }
.fld input:disabled { color: var(--muted); }
.fld.has-suf input { padding-right: 70px; }
.fld > .suf { position: absolute; right: 12px; top: 10px; color: var(--text2); font-size: 13px; pointer-events: none; }
.fld input.changed, .fld select.changed, .fld textarea.changed, input.changed, select.changed { border-color: var(--amber); box-shadow: inset 3px 0 0 var(--amber); }
.fh { font-size: 12px; color: var(--muted); margin: 5px 14px 0; line-height: 1.4; }
.fh .col { color: var(--muted); }
.fld-wrap { margin-bottom: 10px; }
.fld.mono input { font-family: var(--mono); font-weight: 600; }
input[type=number]::-webkit-inner-spin-button { opacity: .35; }
input[type=checkbox], input[type=radio] { accent-color: var(--amber); width: 16px; height: 16px; margin: 0; }
.check { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; font-size: 14px; }
.checks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 16px; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 9px; color: var(--text2); }
.search input { padding-left: 38px; }

/* chip e interruttori */
.chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line2); border-radius: 999px; padding: 1px 9px; font-size: 12px; color: var(--text2); white-space: nowrap; }
.chip.amber { border-color: var(--amber-line); color: var(--amber); }
.chip.green { border-color: rgba(87, 179, 93, .6); color: var(--green); }
.chip.red { border-color: rgba(229, 83, 75, .6); color: var(--red); }
.chip.solid-green { background: var(--green); color: #0d1a0e; border-color: var(--green); }
.chip.solid-red { background: var(--red); color: #fff; border-color: var(--red); }
.chip.fill { background: var(--surface2); border-color: var(--surface2); color: var(--text); font-weight: 600; }
.chip.click { cursor: pointer; }
.chip.click:hover { border-color: var(--amber-line); color: var(--text); }
.tgls { display: flex; flex-wrap: wrap; gap: 6px 6px; }
.tg { border: 1px solid #6c6258; border-radius: 999px; padding: 2px 9px; font-size: 12.5px; color: var(--text); background: none; cursor: pointer; font: inherit; font-size: 12.5px; line-height: 20px; }
.tg:hover { border-color: var(--amber-line); }
.tg.on { background: var(--amber); border-color: var(--amber); color: #1b1309; font-weight: 600; }
.tg.changed { outline: 2px solid var(--amber-line); outline-offset: 1px; }
.sw { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text2); }
.sw input { display: none; }
.sw i { width: 30px; height: 16px; border-radius: 999px; background: var(--line2); position: relative; transition: .15s; }
.sw i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--text2); transition: .15s; }
.sw input:checked + i { background: var(--amber-line); }
.sw input:checked + i::after { left: 16px; background: var(--amber); }

/* ---------------------------------------------------------------- schede (tabs) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 11px 16px; color: var(--text2); border-bottom: 2px solid transparent; text-decoration: none; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--amber); border-bottom-color: var(--amber); }
.tabs.big a { padding: 14px 18px; font-size: 15px; }
.box > .tabs:first-child { margin: -16px -18px 14px; padding: 0 8px; }

/* ---------------------------------------------------------------- tabelle */
.table-wrap { overflow: auto; max-height: 68vh; border: 1px solid var(--line); border-radius: var(--radius); }
.box .table-wrap { border: 0; border-radius: 0; margin: 0 -18px -16px; }
.box.flush .table-wrap { margin: 0; }
thead tr:nth-child(2) th { top: 37px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text2); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; white-space: nowrap; }
td { padding: 8px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td, tr.hl td { background: var(--surface2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono { font-family: var(--mono); font-size: 12.5px; }
td input, td select { height: 30px; background: transparent; border: 1px solid var(--line2); border-radius: 5px; color: var(--text); font: inherit; padding: 0 8px; width: 90px; }
td input:focus, td select:focus { border-color: var(--amber); outline: none; }
.empty { color: var(--muted); padding: 30px; text-align: center; }
.empty svg { width: 34px; height: 34px; color: var(--line2); display: block; margin: 0 auto 8px; }
.name-cell b { font-weight: 600; }

/* ---------------------------------------------------------------- elenco a sinistra + editor */
.split { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.list-pane { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; position: sticky; top: 0; }
.list-pane .add-link { display: flex; justify-content: center; gap: 6px; padding: 10px; font-weight: 600; }
.plist { max-height: calc(100vh - 290px); overflow-y: auto; margin: 0 -12px -12px; border-top: 1px solid var(--line); }
.plist a { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.plist a:hover { background: var(--surface2); }
.plist a.active { background: var(--amber-soft); border-left: 3px solid var(--amber); padding-left: 11px; }
.plist a.active .pt { color: var(--amber); }
.plist .pt { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plist .ps { font-size: 12px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plist .ps.mono { font-size: 11.5px; }
.plist .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 14px 4px; }

/* barra salva in basso */
.savebar { position: sticky; bottom: -90px; margin: 16px -24px -90px; padding: 12px 24px; background: rgba(28, 24, 20, .96); border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px; z-index: 5; backdrop-filter: blur(4px); }
.split .savebar, .box .savebar { position: sticky; bottom: 8px; margin: 16px 0 0; border: 1px solid var(--line2); border-radius: var(--radius); }
.savebar .what { flex: 1; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.savebar .what.dirty { color: var(--amber); }

/* raccolte di scorciatoie (recenti) */
.recent { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; color: var(--muted); }

/* sezioni della panoramica */
.sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 24px; }
.sections a { display: flex; gap: 14px; padding: 10px 8px; border-radius: 6px; color: var(--text); text-decoration: none; }
.sections a:hover { background: var(--surface2); }
.sections a svg { color: var(--amber); margin-top: 1px; }
.sections a small { display: block; color: var(--text2); font-size: 12.5px; }

/* drop / righe di editor */
.drow { display: grid; gap: 8px; align-items: center; margin-bottom: 8px; }
.drop-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; background: var(--bg); }
.drop-group .fld > .lb { background: var(--bg); }
.drop-group .gh { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.ditems th { position: static; background: none; padding: 6px 6px; }
.ditems td { padding: 4px 6px; border: 0; }
.ditems td input { width: 100%; height: 36px; }
.share { font-size: 12.5px; color: var(--text2); white-space: nowrap; }
.item-pick { position: relative; }
.suggest { background: var(--surface2); border: 1px solid var(--line2); border-radius: 6px; max-height: 260px; overflow-y: auto; min-width: 280px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.suggest div { padding: 7px 10px; cursor: pointer; font-size: 13px; }
.suggest div:hover, .suggest div.sel { background: var(--amber-soft); }
.suggest b { color: var(--amber); font-family: var(--mono); font-weight: 600; margin-right: 6px; }
.suggest div { display: flex; align-items: center; gap: 0; }
.suggest .gi { margin-right: 8px; }
.suggest .chip { margin-left: auto; }
/* icone di oggetti e mostri prese dal client (web/icone, crea_icone.py) */
.gi { display: inline-block; width: 30px; height: 30px; object-fit: contain; vertical-align: middle; flex: none;
  background: #0f0c09; border: 1px solid var(--line2); border-radius: 5px; image-rendering: auto; }
.gi.cat { object-fit: cover; }
.gi.sm { width: 22px; height: 22px; border-radius: 4px; }
.gi.lg { width: 46px; height: 46px; border-radius: 7px; }
.gi.none { background: transparent; border-style: dashed; font-size: 12px; line-height: 20px; text-align: center; }
.gi.none.lg { line-height: 44px; font-size: 20px; }
h1 .gi, h2 .gi { margin-right: 10px; vertical-align: -12px; }
.plist .pt .gi, .sp-mi .gi { margin-right: 6px; }

/* flag degli eventi */
.flag-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.flag-row:last-child { border-bottom: 0; }
.flag-row .d { color: var(--muted); font-size: 12.5px; }
.flag-row input { height: 32px; background: transparent; border: 1px solid var(--line2); border-radius: 6px; color: var(--text); padding: 0 8px; width: 100%; }

/* barra modifiche in attesa */
.pending { margin: 14px 24px 0; border: 1px solid rgba(234, 165, 62, .35); background: rgba(234, 165, 62, .07); border-radius: var(--radius); padding: 12px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.pending .txt { flex: 1; min-width: 260px; font-size: 13px; }
.pending ul { margin: 2px 0 6px; padding-left: 18px; color: var(--text2); }

/* modale */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: flex; align-items: flex-start; justify-content: center; z-index: 100; overflow-y: auto; padding: 50px 16px; }
.modal-box { background: var(--surface); border: 1px solid var(--line2); border-radius: 10px; width: min(760px, 100%); padding: 20px 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.modal-head h2 { margin: 0; flex: 1; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--surface2); border: 1px solid var(--green); color: var(--text); padding: 11px 18px; border-radius: 8px; z-index: 300; max-width: min(720px, 92vw); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); font-size: 13.5px; }
.toast.bad { border-color: var(--red); }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { width: 340px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px; }
.login-box .fld > .lb { background: var(--surface); }
.login-brand { font-size: 34px; }
.login-box h1 { margin-top: 6px; }
.login-box .btn { margin-top: 20px; height: 40px; }

/* spawn */
.spawn-tab td input { width: 76px; }
.spawn-tab td input.vn { width: 90px; }

/* monitor */
.emp { font-family: var(--mono); font-weight: 600; }
.emp .r { color: #e5534b; } .emp .y { color: #eaa53e; } .emp .b { color: #4f8fe8; }

/* ---------------------------------------------------------------- telefono e schermi stretti */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .list-pane { position: static; }
  .plist { max-height: 300px; }
  .checks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .side { position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s; width: 240px; }
  .app.menu-open .side { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .6); }
  .app.compact .side { width: 240px; }
  .app.compact .nav-gh { display: flex; }
  .app.compact .nav-q { display: block; }
  .app.compact .nav-g.closed .nav-items { display: none; }
  .page-tabs { padding: 10px 14px 0; }
  .only-mobile { display: inline-flex; }
  .top { padding: 0 12px; gap: 8px; }
  .top-status, .top-srv, .user-chip { display: none; }
  main#page { padding: 16px 14px 90px; }
  .g2, .g3, .g4, .fields, .fields.c3, .sections, .checks { grid-template-columns: 1fr; }
  .lim-parts { grid-template-columns: repeat(2, minmax(0, 1fr)); } .lim-row { grid-template-columns: 1fr; }
  .bonus-row { grid-template-columns: minmax(0, 1fr) auto; } .bonus-row > .icon-btn { grid-row: 1 / span 2; grid-column: 2; }
  .savebar { margin: 16px -14px -90px; padding: 10px 14px; }
  .box > .row.nowrap, .box > .row { flex-wrap: wrap; }
  .box > .row > div[style*="flex:1"], .box > .row.nowrap > div { flex: 1 1 100% !important; width: auto !important; }
  .pending { margin: 10px 14px 0; }
}

/* ---------------------------------------------------------------- spawn mappe (editor sulla minimappa) */
.sp-grid { display: grid; grid-template-columns: 250px minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.sp-grid > .box { margin: 0; }
.sp-maps { padding: 12px; }
.sp-mlist { max-height: calc(100vh - 290px); overflow: auto; margin: 0 -4px; }
.sp-mlist a { display: flex; gap: 10px; padding: 8px; border-radius: var(--radius); color: var(--text); text-decoration: none; margin-bottom: 2px; }
.sp-mlist a:hover { background: var(--surface2); }
.sp-mgrp { position: sticky; top: 0; z-index: 1; background: var(--surface); padding: 8px 8px 6px; margin-top: 4px; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--line); }
.sp-mlist a.active { background: var(--amber-soft); box-shadow: inset 3px 0 0 var(--amber); }
.sp-thumb { width: 54px; height: 54px; flex: none; border-radius: 6px; background: #100e0c; display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--muted); }
.sp-thumb img { max-width: 100%; max-height: 100%; }
.sp-mi { display: flex; flex-direction: column; min-width: 0; }
.sp-mi .pt { font-weight: 600; line-height: 1.25; }
.sp-center { padding: 12px; min-width: 0; }
.sp-tools { display: inline-flex; border: 1px solid var(--line2); border-radius: 6px; overflow: hidden; }
.sp-tools .icon-btn { border-radius: 0; padding: 7px 9px; }
.sp-tools .icon-btn.on { background: var(--amber-soft); color: var(--amber); }
.sp-canvas-wrap { position: relative; height: calc(100vh - 330px); min-height: 380px; border-radius: 6px; overflow: hidden; background: #0f0d0b; }
.sp-canvas-wrap canvas { display: block; touch-action: none; }
.sp-noimg { position: absolute; left: 10px; top: 10px; background: rgba(0,0,0,.6); padding: 4px 10px; border-radius: 6px; font-size: 12px; color: var(--text2); pointer-events: none; }
.sp-status { margin: 8px 2px; }
.sp-actions { border-top: 1px solid var(--line); padding-top: 10px; }
.sp-actions .dirty { color: var(--amber); }
.sp-side { padding: 0 14px 14px; max-height: calc(100vh - 170px); overflow-y: auto; overflow-x: hidden; }
.sp-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 8px; }
.sp-layer { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.sp-opts { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 10px 0; padding: 4px 0; }
.sp-vn { max-height: 260px; overflow: auto; }
.sp-vn a { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; color: var(--text); text-decoration: none; }
.sp-vn a:hover { background: var(--surface2); }
.sp-vn a.active { background: var(--amber-soft); }
@media (max-width: 1250px) { .sp-grid { grid-template-columns: 220px minmax(0, 1fr); } .sp-side { grid-column: 1 / -1; max-height: none; } }
@media (max-width: 800px) { .sp-grid { grid-template-columns: 1fr; } }


/* ---------------------------------------------------------------- catena di raffinamento */
.info-line { display: flex; align-items: center; gap: 12px; color: var(--text); padding: 12px 18px; }
.info-line .i { color: var(--blue); flex: none; }
.chain-rings { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.ring { min-width: 42px; height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line2); background: transparent; color: var(--text); cursor: pointer; font: 600 13px/1 var(--mono); }
.ring:hover { border-color: var(--amber-line); }
.ring.on { background: var(--amber); border-color: var(--amber); color: #1b1309; }
.chain-ref td { vertical-align: top; }
.chain-ref input { width: 100%; }
.scale-warn { display: flex; gap: 12px; border: 1px solid var(--amber-line); background: var(--amber-soft); border-radius: var(--radius); padding: 12px 14px; margin: 10px 0; }
.scale-warn > .i { color: var(--amber); flex: none; }

/* Note del team */
.note-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px; background: var(--surface2); }
.note-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.note-text { white-space: normal; line-height: 1.5; }
.note-fatta { border-color: #2e7d4f; box-shadow: inset 3px 0 0 #3fbf6f; }
.note-claude { margin-top: 8px; padding: 8px 10px; border-radius: 6px; background: rgba(63, 191, 111, .08); border: 1px solid rgba(63, 191, 111, .35); }
.chip.note-ok { background: #1f6f43; color: #fff; }
.note-riaperta-card { box-shadow: inset 3px 0 0 #e0a030; }
.note-riaperta { margin-top: 8px; }
#noteText { width: 100%; resize: vertical; }

/* Abilità: valori della scala di potenza */
.sk-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; margin: 6px 0; }
.sk-lab { width: 90px; font-size: 12.5px; color: var(--muted); align-self: center; }
.sk-cell { display: flex; flex-direction: column; align-items: center; font-size: 11.5px; color: var(--text2); }
.sk-cell input { width: 56px; text-align: center; padding: 4px 2px; }
.sk-mul { width: 200px; }

/* ---- System del gioco (sistemi.js) ---- */
.sist-bar { margin-bottom: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 6px; overflow: hidden; }
.seg a { padding: 6px 12px; color: var(--text2); font-size: 13px; text-decoration: none; }
.seg a + a { border-left: 1px solid var(--line2); }
.seg a.active { background: var(--amber-soft); color: var(--amber); }
.sist-cat { margin: 18px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.sist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.sist-card { display: flex; gap: 14px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface2); transition: border-color .15s, background .15s; }
.sist-card.on { border-color: var(--amber-line); background: linear-gradient(0deg, var(--amber-soft), var(--amber-soft)), var(--surface2); }
.sist-ico { flex: none; width: 64px; height: 64px; display: grid; place-items: center; border-radius: 10px; background: #0f0c0a; border: 1px solid var(--line2); }
.sist-ico img { max-width: 52px; max-height: 52px; image-rendering: pixelated; filter: grayscale(1) brightness(.6); transition: filter .15s; }
.sist-ico svg { width: 30px; height: 30px; color: var(--muted); }
.sist-card.on .sist-ico img { filter: none; }
.sist-card.on .sist-ico svg { color: var(--amber); }
.sist-txt { flex: 1; min-width: 0; }
.sist-head { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.sist-desc { color: var(--text2); font-size: 13px; margin: 4px 0 8px; }
.sist-meta { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
kbd { font: 11px var(--mono); border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--text2); background: var(--surface); }
.sist-sw { flex: none; margin-top: 2px; }
.sist-sw span { min-width: 48px; }
.sist-sw input:checked ~ span { color: var(--amber); font-weight: 600; }
.sist-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.sist-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.sist-row:last-child { border-bottom: 0; }
.sist-row.on { background: var(--amber-soft); }
.sist-maps { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.sist-map { display: flex; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface2); align-items: center; }
.sist-map.on { border-color: var(--amber-line); }
.sist-map-img { flex: none; width: 72px; height: 72px; border-radius: 6px; overflow: hidden; background: #0f0c0a; display: grid; place-items: center; }
.sist-map-img img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(.85) brightness(.55); }
.sist-map.on .sist-map-img img { filter: none; }
.sist-map-txt { min-width: 0; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.sist-map-txt b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
@media (max-width: 760px) { .sist-grid { grid-template-columns: 1fr; } .sist-card { flex-wrap: wrap; } }
.ev-emo { font-size: 34px; line-height: 1; }
.cal-riga { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0; font-size: 12.5px; }
.cal-giorni { color: var(--text2); }
.cal-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; margin-bottom: 4px; }
@media (max-width: 760px) { .cal-edit { grid-template-columns: 1fr; } }
.req { margin-top: 8px; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 12.5px; background: var(--surface); }
.req summary { cursor: pointer; color: var(--text2); font-weight: 600; }
.req[open] summary { margin-bottom: 6px; }
.sist-card.on .req[open] summary { color: var(--amber); }
.req-r { display: flex; gap: 8px; align-items: flex-start; padding: 2px 0; color: var(--text2); }
.req-st { flex: none; width: 14px; text-align: center; font-weight: 700; }
.req-r.ok .req-st, .req-ok { color: var(--green); }
.req-r.no .req-st { color: var(--red); }
.req-r.nd .req-st { color: var(--amber); }
.req-r.nota .req-st { color: var(--muted); }
.req-tipo { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.req .btn { margin-top: 6px; }
.req-warn { color: var(--amber); font-size: 12px; font-weight: 600; }

/* ---- Raffinamento per oggetto (raffinamento.js) ---- */
.raff-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.raff-grid > * { min-width: 0; }
.raff-side { position: sticky; top: 12px; max-height: calc(100vh - 140px); display: flex; flex-direction: column; }
.raff-lista { overflow-y: auto; margin: 0 -8px; }
.raff-voce { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 6px; color: var(--text); cursor: pointer; text-decoration: none; }
.raff-voce:hover { background: var(--surface2); text-decoration: none; }
.raff-voce.on { background: var(--amber-soft); box-shadow: inset 3px 0 0 var(--amber); }
.raff-testa { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.raff-tutti { display: flex; align-items: center; gap: 6px; }
.raff-passo { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 10px; }
.raff-passo-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.raff-livelli { font-size: 18px; font-weight: 700; }
.raff-prob { display: flex; align-items: center; gap: 6px; }
.raff-num { width: 64px !important; flex: none; text-align: center; padding: 4px 6px; }
.raff-barra { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 8px 0 10px; }
.raff-barra i { display: block; height: 100%; border-radius: 999px; transition: width .15s; }
.raff-riga { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.raff-costo { display: flex; align-items: center; gap: 6px; }
.raff-costo input { width: 130px !important; text-align: right; }
.raff-mats { display: flex; flex-direction: column; gap: 6px; }
.raff-mat { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--line2); border-radius: 6px; background: var(--surface2); }
.raff-mat-nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.raff-add input { width: 100%; }
@media (max-width: 1000px) { .raff-grid { grid-template-columns: minmax(0, 1fr); } .raff-side { position: static; max-height: 360px; } }
.dur-cell { display: flex; gap: 4px; align-items: center; }
.dur-cell select { flex: 1; min-width: 0; }
.dur-cell input { width: 64px !important; flex: none; }
.dur-cell select { width: auto !important; }

/* ---- Missioni di caccia (caccia.js) ---- */
.cc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 12px; }
.cc-lv { flex: none; width: 64px; height: 64px; border-radius: 10px; background: #0f0c0a; border: 1px solid var(--line2); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; color: var(--text2); }
.cc-lv span { font-size: 11px; font-weight: 500; color: var(--muted); }
.cc-card.on .cc-lv { color: var(--amber); border-color: var(--amber-line); }
.cc-obj { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.cc-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; padding: 2px 8px; border: 1px solid var(--line2); border-radius: 6px; background: var(--surface); }
.cc-ed { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; max-height: 70vh; overflow-y: auto; }
.cc-ed > * { min-width: 0; }
.cc-scroll { background: linear-gradient(#e9d9b5, #d9c38f); color: #3b2a12; border-radius: 8px; padding: 14px 16px; font-size: 13px; line-height: 1.45; box-shadow: inset 0 0 0 2px #b89a5e, 0 2px 10px rgba(0,0,0,.35); min-height: 200px; }
.cc-s-title { font-weight: 700; font-size: 15px; margin-bottom: 6px; color: #5a2c06; }
.cc-s-gold { font-weight: 700; color: #8a5a00; }
.cc-s-rew { font-weight: 700; color: #2d6a1f; }
.cc-scroll .muted { color: #8c7650; }
@media (max-width: 900px) { .cc-ed { grid-template-columns: 1fr; } .cc-grid { grid-template-columns: 1fr; } }
.mis-bar { gap: 8px; margin-bottom: 12px; align-items: center; }
.bio-b { border-color: rgba(87, 179, 93, .5); }
.bio-s { border-color: var(--amber-line); color: var(--amber); }
.bio-sel { flex: 1; min-width: 0; }
/* anteprima della finestra del biologo (biologo.js) */
.bio-win { background: #1b1410; border: 1px solid #5a3a22; border-radius: 6px; padding: 0 12px 12px; font-size: 13px; color: #e8dcc2; text-align: center; min-height: 200px; }
.bio-win-bar { margin: 0 -12px 8px; padding: 5px; background: linear-gradient(#6b2d16, #3d180b); border-radius: 6px 6px 0 0; font-weight: 700; color: #f6e3b4; }
.bio-win-name { font-weight: 700; color: #f3d9a0; margin-bottom: 8px; cursor: help; }
.bio-win-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 6px 0; }
.bio-win-slot { width: 32px; height: 32px; border: 1px solid #5a3a22; display: inline-block; }
.bio-win-btn { padding: 4px 14px; border: 1px solid #8a5a2a; border-radius: 4px; background: #3a2414; }
.bio-win-gold { color: #b29e6d; font-weight: 600; }
.bio-win-tip { margin-top: 4px; padding: 8px; background: #0e0b09; border: 1px solid #3a2a1c; border-radius: 4px; text-align: left; color: #c2c2c2; }
.lib-fase { margin: 2px 0; color: var(--text2); }
.lib-faseb { border: 1px solid var(--line2); border-radius: var(--radius); padding: 10px 12px; margin: 12px 0 8px; background: var(--surface2); }
.lib-objs { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.lib-obj { border: 1px dashed var(--line2); border-radius: 6px; padding: 8px 10px; background: var(--surface); }
.sist-card.on .ev-emo, .sist-ico .ev-emo { filter: grayscale(1) brightness(.7); transition: filter .15s; }
.sist-card.on .sist-ico .ev-emo { filter: none; }
.sist-meta span { overflow-wrap: anywhere; }
.chip .gi.sm { width: 18px; height: 18px; margin-left: -6px; border: 0; }

/* Starter pack */
.st-pg { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 14px; }
.st-pg a { position: relative; display: flex; flex-direction: column; padding: 8px 12px; border: 1px solid var(--line2); border-radius: 6px; color: var(--text2); cursor: pointer; text-decoration: none; }
.st-pg a small { color: var(--muted); }
.st-pg a.on { border-color: var(--amber-line); background: var(--amber-soft); color: var(--text); }
.st-pg em { position: absolute; top: 6px; right: 8px; font-style: normal; font-size: 12px; font-weight: 700; }
.st-pg em.ok { color: var(--green); } .st-pg em.warn { color: var(--amber); } .st-pg em.err { color: var(--red); }
.st-err { color: var(--red); }
.st-flow { display: flex; flex-direction: column; gap: 0; }
.st-step { display: flex; gap: 12px; position: relative; padding-bottom: 12px; }
.st-step:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--line2); }
.st-dot { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--amber-line); color: var(--amber); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; background: var(--surface); z-index: 1; }
.st-step.off .st-dot { border-color: var(--line2); color: var(--muted); }
.st-card { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface2); padding: 10px 12px; }
.st-step.off .st-card { opacity: .75; }
.st-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.st-sub { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 8px 0 4px; }
.st-its { display: flex; flex-wrap: wrap; gap: 6px; }
.st-it { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; font-size: 12.5px; padding: 2px 8px 2px 3px; border: 1px solid var(--line2); border-radius: 6px; background: var(--surface); }
.st-it-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-it b { color: var(--amber); }
.st-slot { font-style: normal; font-size: 11px; color: var(--muted); }
.st-mini { gap: 3px; margin: 6px 0; }
.st-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px; border: 1px solid var(--line2); border-radius: 6px; background: var(--surface2); margin-bottom: 6px; }
.st-row .raff-mat-nome { min-width: 180px; }
.st-vinc { padding: 0; font-size: 12.5px; gap: 5px; }
.st-dur .raff-num { width: 52px !important; }
.st-cls { display: inline-flex; border: 1px solid var(--line2); border-radius: 6px; overflow: hidden; }
.st-cls a { padding: 3px 7px; font-size: 12px; color: var(--muted); cursor: pointer; text-decoration: none; }
.st-cls a + a { border-left: 1px solid var(--line2); }
.st-cls a.on { background: var(--amber-soft); color: var(--amber); }
.st-sex { width: auto !important; height: 28px; padding: 0 6px; }
.st-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.st-col h2 { margin: 0 0 6px; }
.st-cr { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; border-top: 1px solid var(--line); }
.st-cr .gi { margin-top: 2px; }
.st-ev { padding: 12px 16px; }
@media (max-width: 760px) { .st-row .raff-mat-nome { min-width: 0; flex-basis: 100%; } }

/* Spawn: gruppi */
.sp-gi { font-size: 12px; line-height: 1.5; margin-top: 4px; color: var(--text2); }
.sp-gi a { cursor: pointer; color: var(--amber); }
.sp-gi .gi.sm, .ditems .gi.sm, .suggest .small .gi.sm { width: 18px; height: 18px; margin-right: 3px; }

/* mostri divisi per categoria (Oggetti e mostri → Modifica) */
.mc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px; max-height: 260px; overflow: auto; padding: 2px; }
.mc-grid a { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); min-width: 0; }
.mc-grid a:hover, .mc-grid a.active { border-color: var(--amber-line); background: var(--amber-soft); }
.mc-grid .mc-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.mc-grid .mc-l { color: var(--text2); font-size: 11.5px; white-space: nowrap; }
/* gruppi di mostri */
.g-mob { display: inline-flex; align-items: center; gap: 4px; margin: 1px 8px 1px 0; white-space: nowrap; }
/* percentuali della mappa */
.mp-row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }

/* Livelli e teletrasporto */
.lv-thumb { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: 5px; background: var(--surface2); overflow: hidden; color: var(--muted); }
.lv-thumb img { width: 44px; height: 44px; object-fit: cover; display: block; }
.lv-rim { padding: 10px 14px; }
.lv-grp td { border-top: 2px solid var(--line2); }
.lv-tree { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lv-node { display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px calc(10px + var(--d, 0) * 26px); border-bottom: 1px solid var(--line); }
.lv-node:last-child { border-bottom: 0; }
.lv-node:hover { background: var(--surface2); }
.lv-node.off .lv-body { opacity: .5; }
.lv-node.lv-addrow { padding-top: 3px; padding-bottom: 3px; }
.lv-body { flex: 1; min-width: 0; }
.lv-lab { font-weight: 600; }
.lv-tog { flex: none; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--text2); cursor: pointer; font-size: 14px; padding: 0; }
button.lv-tog:hover { color: var(--amber); }
.lv-act { display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; opacity: .6; }
.lv-node:hover .lv-act { opacity: 1; }
.lv-rg { display: inline-flex; width: 16px; height: 16px; border-radius: 4px; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: #111; }
.lv-rg.r1 { background: #e5534b; } .lv-rg.r2 { background: #e5c13e; } .lv-rg.r3 { background: #4f8fe8; }
.lv-regno { border: 1px solid var(--line); border-radius: var(--radius); padding: 2px 12px 12px; margin-top: 12px; }
.lv-map { position: relative; width: 100%; max-width: 560px; margin-top: 10px; border: 1px solid var(--line2); border-radius: 6px; overflow: hidden; cursor: crosshair; background: var(--surface2); }
.lv-map img { display: block; width: 100%; height: 100%; object-fit: fill; user-select: none; }
.lv-pin { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--amber); border: 2px solid #1b1309; box-shadow: 0 0 0 3px rgba(234, 165, 62, .35); pointer-events: none; }
.lv-testi { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); column-gap: 14px; }
.lv-bar { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 0; background: var(--surface); border-top: 1px solid var(--line); }
.lv-lua { max-height: 60vh; overflow: auto; background: var(--surface2); border-radius: 6px; padding: 12px; font: 12px/1.45 var(--mono); white-space: pre; }
@media (max-width: 700px) { .lv-node { flex-wrap: wrap; } .lv-act { width: 100%; justify-content: flex-start; } }

/* ---------------------------------------------------------------- battle pass */
.bp-tab td { vertical-align: top; }
.bp-tab td.nowrap, .bp-tab .nowrap { white-space: nowrap; }
.bp-tab td input.inp, .bp-tab td select.inp { height: 32px; }
.bp-tab .bp-exp { width: 100px; text-align: right; }
.bp-tab .bp-q { width: 80px; text-align: right; }
.bp-prem { display: flex; gap: 6px; align-items: flex-start; }
.bp-pick { min-width: 200px; flex: 1; }
.bp-pick input.inp { width: 100%; }
.bp-pick-nome { margin-top: 3px; color: var(--text2); display: flex; align-items: center; gap: 5px; min-height: 18px; }
.bp-lv { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--amber-soft); color: var(--amber); font-weight: 700; }
.bp-bar { height: 6px; border-radius: 3px; background: var(--line2); overflow: hidden; margin-bottom: 3px; }
.bp-bar i { display: block; height: 100%; background: var(--amber); }
.bp-ogg .fld-wrap { width: 220px; margin-bottom: 0; }
.bp-ogg .row { align-items: center; }
@media (max-width: 760px) { .bp-prem { flex-wrap: wrap; } .bp-pick { min-width: 150px; } }

/* Sblocco sistemi: anteprima della finestra in gioco */
.sb-prev{max-width:380px;background:#1b1712;border:1px solid #5a4a36;border-radius:6px;padding:12px 16px;color:#d4c3a0;font:12px Tahoma,Verdana,sans-serif;text-shadow:0 0 2px #000}
.sb-prev-t{text-align:center;font-weight:bold;background:#4a1d17;border-radius:3px;padding:3px;margin:-4px -8px 10px}
.sb-prev-m{text-align:center;margin-bottom:10px}
.sb-prev-r{color:#ff8c78;margin:3px 0}
.sb-prev-r.ok{color:#78dc78}
.sb-prev-b{margin:12px auto 0;width:90px;text-align:center;border:1px solid #6b5a40;border-radius:3px;padding:3px;background:#2b241b}

/* barra della vita delle metin (nuovo_mob.js) */
.mbar { position: relative; height: 34px; margin: 64px 14px 4px; border-radius: 6px; cursor: crosshair;
  background: var(--surface2); border: 1px solid var(--line2); }
.mbar-fill { position: absolute; inset: 3px; border-radius: 4px; background: linear-gradient(90deg, #5c1612, var(--red) 60%, #ff8a5c); opacity: .85; }
.mbar-mk { position: absolute; top: -58px; bottom: -20px; width: 0; cursor: pointer; }
.mbar-ln { position: absolute; left: -1px; top: 40px; bottom: 16px; width: 2px; background: var(--text2); }
.mbar-bub { position: absolute; top: 0; left: 0; transform: translateX(-50%); display: flex; align-items: center; gap: 3px;
  padding: 3px 7px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line2); white-space: nowrap; font-size: 12px; }
.mbar-pc { position: absolute; bottom: 0; left: 0; transform: translateX(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; }
.mbar-mk.on .mbar-bub { border-color: var(--amber); color: var(--amber); box-shadow: 0 0 0 2px var(--amber-soft); }
.mbar-mk.on .mbar-ln { background: var(--amber); }
.mbar-mk.on .mbar-pc { color: var(--amber); font-weight: 600; }
.mbar-scale { display: flex; justify-content: space-between; margin: 20px 14px 0; font-size: 11.5px; color: var(--muted); }

/* catalogo costumi */
.cc-grp { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; padding: 0 14px; }
.cc-grp > summary { cursor: pointer; padding: 11px 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cc-grp[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.cc-grp[open] { padding-bottom: 14px; }
.cc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.cc-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface2); color: var(--text); text-decoration: none; text-align: center; min-width: 0; }
.cc-card:hover { border-color: var(--amber-line); }
.cc-card img { width: 64px; height: 64px; object-fit: contain; image-rendering: pixelated; } /* poi 2x della misura vera */
.cc-none { display: flex; align-items: center; justify-content: center; width: 64px; height: 64px; border: 1px dashed var(--line2); border-radius: 6px;
  font-size: 11px; color: var(--muted); line-height: 1.2; }
.cc-n { font-size: 12px; line-height: 1.25; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-v { font-size: 11px; color: var(--muted); }
.cc-set { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.cc-set-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.cc-set-parti { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.cc-parte { min-width: 0; }
.cc-grid.mini { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.cc-card.cc-mini { padding: 6px 4px 4px; width: 78px; }
.cc-card.cc-mini img { width: 48px; height: 48px; }

/* Finestra dungeon (dungeon_lista.js) */
.fd-row { border: 1px solid var(--line2); border-radius: 8px; margin-bottom: 6px; background: var(--bg2, transparent); }
.fd-row.fd-off { opacity: .55; }
.fd-row.fd-over { border-color: var(--amber); }
.fd-row.fd-drag { opacity: .35; }
.fd-head { display: flex; align-items: center; gap: 10px; padding: 6px 10px; flex-wrap: wrap; }
.fd-grip { cursor: grab; color: var(--text2); font-size: 16px; user-select: none; }
.fd-n { width: 22px; text-align: right; color: var(--text2); }
.fd-ico { width: 44px; height: 44px; object-fit: contain; border-radius: 4px; background: rgba(0,0,0,.25); display: inline-block; }
.fd-nome { min-width: 220px; }
.fd-edit { padding: 6px 12px 12px; border-top: 1px solid var(--line2); }

/* Comandi GM */
.cgm-search { position: sticky; top: -22px; z-index: 5; }
.cgm-q { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line2); border-radius: var(--radius); padding: 0 14px; background: var(--surface2); }
.cgm-q:focus-within { border-color: var(--amber); }
.cgm-q svg { color: var(--muted); flex: none; }
.cgm-q input { flex: 1; height: 48px; background: none; border: 0; outline: none; color: var(--text); font: inherit; font-size: 17px; min-width: 0; }
.cgm-esempi { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cgm-card { border-top: 1px solid var(--line); padding: 12px 0; }
.box > h2 + .cgm-card { border-top: 0; }
.cgm-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cgm-sint { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--amber);
  background: var(--amber-soft); border: 1px solid transparent; border-radius: 6px; padding: 4px 10px; cursor: pointer; text-align: left; white-space: normal; word-break: break-word; }
.cgm-sint:hover { border-color: var(--amber-line); }
.cgm-sint svg { width: 15px; height: 15px; opacity: .7; flex: none; }
.cgm-desc { color: var(--text2); margin: 6px 0 0 2px; }
.cgm-tab { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; background: var(--bg); }
.cgm-tab summary { cursor: pointer; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.cgm-tab summary svg { width: 16px; height: 16px; color: var(--muted); }
.cgm-uso { color: var(--text2); }
.cgm-filtro { margin: 8px 0; width: 100%; max-width: 320px; height: 34px; padding: 0 10px; border: 1px solid var(--line2); border-radius: 6px; background: var(--surface2); color: var(--text); font: inherit; }
.cgm-tw { max-height: 340px; }
.box .cgm-tw { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); }

/* Icone oggetti (icone_oggetti.js): anteprima come una casella dell'inventario */
.io-slot { display: inline-flex; align-items: center; justify-content: center; min-width: 60px; min-height: 60px; padding: 8px;
  margin-top: 4px; border-radius: 6px; background: #17110c; border: 1px solid var(--line2); }
.io-slot canvas { image-rendering: pixelated; display: block; }
.io-slot.small1 { min-width: 44px; min-height: 44px; }

/* ---------------------------------------------------------------- versione cellulare (flag "mobile")
   html.mobile: la accende index.html da solo sui telefoni (touch, schermo piu' piccolo di 900px).
   Stesso impianto di @media (max-width: 760px) ma vale a qualsiasi larghezza, piu' spazi grandi per le dita. */
html.mobile body { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
html.mobile .app { height: 100vh; height: 100dvh; }
html.mobile .side { position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s; width: min(300px, 86vw); }
html.mobile .app.menu-open .side { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .6); }
html.mobile .app.compact .side { width: min(300px, 86vw); }
html.mobile .app.compact .brand, html.mobile .app.compact #nav a span, html.mobile .app.compact .nav-sep { display: revert; }
html.mobile .app.compact #nav a { justify-content: flex-start; padding: 12px; }
html.mobile .app.compact .nav-gh { display: flex; }
html.mobile .app.compact .nav-q { display: block; }
html.mobile .app.compact .nav-g.closed .nav-items { display: none; }
html.mobile .side-toggle { display: none; }
html.mobile .side-back { display: none; position: fixed; inset: 0; z-index: 49; background: rgba(0, 0, 0, .5); }
html.mobile .app.menu-open .side-back { display: block; }
html.mobile #nav a { padding: 12px; font-size: 15.5px; }
html.mobile .nav-gh { padding: 14px 12px 6px; font-size: 12px; }
html.mobile .nav-q { font-size: 16px; padding: 10px 12px; }
html.mobile .only-mobile { display: inline-flex; }
html.mobile .top { padding: 0 8px; gap: 4px; height: 56px; }
html.mobile .top-status, html.mobile .top-srv, html.mobile .user-chip { display: none; }
html.mobile .page-tabs { padding: 8px 10px 0; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
html.mobile .page-tabs a { white-space: nowrap; padding: 10px 14px; }
html.mobile main#page { padding: 14px 10px 110px; }
html.mobile .page-head .t { min-width: 0; }
html.mobile h1 { font-size: 19px; }
html.mobile .box { padding: 12px; }
html.mobile .g2, html.mobile .g3, html.mobile .g4, html.mobile .fields, html.mobile .fields.c3, html.mobile .sections, html.mobile .checks { grid-template-columns: 1fr; }
html.mobile .lim-parts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html.mobile .lim-row { grid-template-columns: 1fr; }
html.mobile .split, html.mobile .sp-grid, html.mobile .raff-grid, html.mobile .cc-ed, html.mobile .cc-grid, html.mobile .sist-grid, html.mobile .cal-edit, html.mobile .pr-fin { grid-template-columns: minmax(0, 1fr); }
html.mobile .list-pane, html.mobile .raff-side, html.mobile .pr-fin-prev { position: static; }
html.mobile .sp-side { grid-column: auto; max-height: none; }
html.mobile .plist { max-height: 45vh; }
html.mobile .plist a { padding: 12px 14px; }
html.mobile .pending { margin: 10px 10px 0; }
/* dita: niente zoom automatico di iPhone sui campi (serve testo >= 16px) e bersagli alti almeno 44px */
html.mobile input, html.mobile select, html.mobile textarea { font-size: 16px; }
html.mobile .fld input, html.mobile .fld select, html.mobile input.inp, html.mobile select.inp, html.mobile .ditems td input, html.mobile td input, html.mobile td select { height: 44px; }
html.mobile td input, html.mobile td select { width: 100%; min-width: 64px; }
html.mobile .btn { height: 44px; padding: 0 16px; }
html.mobile .btn.sm { height: 38px; }
html.mobile .btn.link { height: auto; min-height: 40px; }
html.mobile .icon-btn { padding: 10px; min-width: 40px; min-height: 40px; justify-content: center; align-items: center; }
html.mobile input[type=checkbox], html.mobile input[type=radio] { width: 22px; height: 22px; }
html.mobile .check, html.mobile label.sw { min-height: 40px; }
html.mobile .suggest { max-height: 50vh; }
html.mobile .suggest div { padding: 11px 10px; font-size: 15px; }
/* righe affiancate: una sotto l'altra, ignorando le larghezze fisse scritte nelle pagine */
html.mobile .box > .row.nowrap, html.mobile .box > .row, html.mobile .drop-group .gh { flex-wrap: wrap; }
html.mobile .box > .row > div[style*="width"], html.mobile .box > .row > div[style*="flex:1"], html.mobile .box > .row.nowrap > div,
html.mobile .gh > div[style*="width"], html.mobile .gh > div[style*="flex:1"], html.mobile .row > div[style*="min-width"] { flex: 1 1 100% !important; width: auto !important; min-width: 0 !important; }
html.mobile .page-head .row, html.mobile .modal-foot { flex-wrap: wrap; }
html.mobile [style*="width:"][style*="px"]:not(img):not(canvas):not(svg):not(.gi):not(input[type=checkbox]) { max-width: 100%; }
/* tabelle normali: scorrono di lato invece di uscire dallo schermo */
html.mobile table:not(.ditems) { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
html.mobile th { position: static; }
html.mobile td, html.mobile th { padding: 8px 10px; }
/* tabelle-editor (.ditems: oggetti dei negozi, drop, ricette...): ogni riga diventa una scheda */
html.mobile .ditems, html.mobile .ditems tbody { display: block; width: 100%; }
html.mobile .ditems thead { display: none; }
html.mobile .ditems tr { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; padding: 10px; margin-bottom: 8px; border: 1px solid var(--line2); border-radius: var(--radius); background: var(--surface); }
html.mobile .ditems td { display: block; padding: 0; width: auto !important; flex: 1 1 calc(50% - 8px); min-width: 0; text-align: left !important; }
html.mobile .ditems td:first-child { flex-basis: 100%; }
html.mobile .ditems td:last-child { flex: 0 0 100%; display: flex; justify-content: flex-end; gap: 4px; }
html.mobile .ditems td.share { white-space: normal; }
html.mobile .savebar { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-radius: 0; border: 0; border-top: 1px solid var(--line2); z-index: 40; }
html.mobile .savebar .btn { flex: none; }
html.mobile .modal { padding: 10px 8px; }
html.mobile .modal-box { padding: 16px 14px; }
html.mobile .modal-foot .btn { flex: 1 1 auto; justify-content: center; }
html.mobile .toast { left: 10px; right: 10px; bottom: 76px; transform: none; max-width: none; }
html.mobile .login-box { width: min(420px, 100%); }
html.mobile .ditems td:has(.item-pick), html.mobile .ditems td:has([data-prezzi]) { flex-basis: 100%; }
html.mobile .ditems td[data-th]:not(:last-child)::before { content: attr(data-th); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 3px 2px; }

select option, select optgroup { background: #221d18 !important; color: #ece5da !important; }
/* Titoli (titoli.js) */
.ti-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.ti-nome { text-shadow: 0 0 2px #000, 0 0 2px #000; font-size: 15px; }
.ti-ant { background: #1b1714; border: 1px solid var(--line); border-radius: 8px; padding: 18px 12px; text-align: center; }
.ti-testa { font-weight: 700; font-size: 15px; text-shadow: 0 0 2px #000, 0 0 2px #000, 0 0 3px #000; }
.ti-pg { color: #e8e3d4; font-size: 13px; text-shadow: 0 0 2px #000; }
html.mobile .ti-grid { grid-template-columns: minmax(0, 1fr); }
/* stemmi animati dei titoli (2026-10-28) */
.ti-num { min-width: 64px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ti-mini { width: 60px; height: 52px; object-fit: contain; }
.ti-stemmi { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-bottom: 10px; }
.ti-st { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; background: #17140f; border: 1px solid var(--line); border-radius: 8px; color: #ece5da; cursor: pointer; font-size: 12px; }
.ti-st img { width: 76px; height: 64px; object-fit: contain; }
.ti-st:hover { border-color: #8a6f3c; }
.ti-st.on { border-color: #d9b46a; background: #241d13; box-shadow: 0 0 0 1px #d9b46a inset; }
.ti-st .muted { font-size: 11px; }
.ti-st-vuoto { width: 76px; height: 64px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 22px; }
.ti-scena { background: radial-gradient(ellipse at 50% 85%, #4d5a34 0%, #2c321f 55%, #1b1714 100%); border-radius: 8px; padding: 14px 8px 10px; display: flex; flex-direction: column; align-items: center; }
.ti-stemma-ant { height: 110px; object-fit: contain; margin-bottom: -6px; }
.ti-targa { display: inline-block; padding: 2px 16px; margin-bottom: 8px; background: linear-gradient(#221a12, #0a0806); border: 1px solid #d9b46a;
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 8px 100%, 0 50%); font-weight: 700; font-size: 14px; text-shadow: 0 0 2px #000, 0 0 2px #000; }
/* Starter pack e Biologo usano "sist-card cc-card" dentro .cc-grid: il catalogo costumi (piu' sopra) ridefinisce
   .cc-grid/.cc-card per le sue miniature (colonne da 118px, card in colonna e centrate) e le schiacciava. */
.cc-grid:has(> .sist-card) { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 12px; }
.sist-card.cc-card { flex-direction: row; align-items: flex-start; gap: 14px; padding: 14px; border-radius: var(--radius); text-align: left; }
html.mobile .cc-grid:has(> .sist-card) { grid-template-columns: minmax(0, 1fr); }

/* Atlante dell'anello (livelli.js lvAtlanteTab) */
.at-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 0 14px; }
.at-sw { width: 18px; height: 18px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 2px var(--line2); }
.at-esclusi { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 12px; }
.at-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.at-cat-h { font-weight: 600; margin-bottom: 6px; color: var(--accent, #d9502f); }
.at-dest { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; }
.at-dest.boss { border-color: #b3261e; background: rgba(179, 38, 30, .08); }
.at-dest.boss b { color: #e0533f; }
.at-dest.citta b { color: #c99a2e; }
