/* Codex (templates/codex.html + js/codex.js). Colori = variabili del tema definite in css/input.css
   (--ink, --panel, --line, --acc, --muted...). Niente stili inline (CSP): tutto qui. */
.cx-title { color: rgb(var(--acc-l)); }
.cx-title:hover { color: #fff; }
.cx-muted { color: rgb(var(--muted)); }
.cx-small { font-size: .8rem; }

/* rarità (S_Item ItemQuality; 8/9 = rarità PvP, rosse come nel client) */
.q0 { color: #f2f0f7; } .q1 { color: #9d9aa6; } .q2 { color: #4ade6a; } .q3 { color: #5aa2ff; }
.q4 { color: #ffa23a; } .q5 { color: #ffe066; } .q6 { color: #c77dff; } .q7, .q8, .q9 { color: #ff5555; }
.qb0 { border-color: rgb(var(--line-hi)); } .qb1 { border-color: #6b6875; } .qb2 { border-color: #2f8f47; } .qb3 { border-color: #2f62b0; }
.qb4 { border-color: #b86b1e; } .qb5 { border-color: #b39b2e; } .qb6 { border-color: #8547b8; }
.qb7, .qb8, .qb9 { border-color: #b33333; }

/* barra di ricerca */
.cx-bar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.cx-tabs { display: flex; gap: .25rem; background: rgb(var(--panel)); border: 1px solid rgb(var(--line)); border-radius: .7rem; padding: .25rem; }
.cx-tab { padding: .45rem .9rem; border-radius: .5rem; color: rgb(var(--muted)); cursor: pointer; font-size: .9rem; }
.cx-tab:hover { color: rgb(var(--acc-l)); }
.cx-tab.on { background: rgb(var(--line)); color: rgb(var(--acc-l)); }
.cx-input, .cx-select { background: rgb(var(--panel)); border: 1px solid rgb(var(--line)); border-radius: .6rem; color: rgb(var(--body));
    padding: .55rem .8rem; font-size: .95rem; }
.cx-input:focus, .cx-select:focus { outline: none; border-color: rgb(var(--acc)); }
.cx-input.q { flex: 1 1 18rem; min-width: 0; }
.cx-input.lv { width: 6.5rem; }
.cx-count { color: rgb(var(--muted)); font-size: .85rem; margin: 1rem 0 .5rem; }

/* liste */
.cx-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: .5rem; }
.cx-row { display: flex; gap: .7rem; align-items: center; background: rgb(var(--panel) / .8); border: 1px solid rgb(var(--line));
    border-radius: .6rem; padding: .45rem .6rem; text-decoration: none; min-width: 0; }
.cx-row:hover { border-color: rgb(var(--acc)); background: rgb(var(--panel-hi)); }
.cx-row .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-row .sub { color: rgb(var(--muted)); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-row .txt { min-width: 0; flex: 1; }
.cx-row .rt { color: rgb(var(--acc-l)); font-size: .85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cx-more { margin: 1rem auto 0; display: block; }

/* icone */
.cx-ic { width: 36px; height: 36px; border: 1px solid rgb(var(--line-hi)); border-radius: .35rem; background: rgb(var(--ink));
    flex: none; image-rendering: auto; }
.cx-ic.big { width: 64px; height: 64px; border-width: 2px; border-radius: .5rem; }
.cx-ic.none { display: inline-block; }
.cx-mob { width: 36px; height: 36px; border-radius: 50%; background: rgb(var(--line)); display: flex; align-items: center;
    justify-content: center; color: rgb(var(--acc-l)); font-size: .75rem; font-weight: 700; flex: none; }

/* scheda */
.cx-back { color: rgb(var(--muted)); font-size: .9rem; }
.cx-back:hover { color: rgb(var(--acc-l)); }
.cx-card { background: rgb(var(--panel) / .8); border: 1px solid rgb(var(--line)); border-radius: .9rem; padding: 1.25rem; margin-top: 1rem; }
.cx-top { display: flex; gap: 1rem; align-items: flex-start; }
.cx-top h1 { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.cx-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.cx-tag { font-size: .78rem; border: 1px solid rgb(var(--line)); border-radius: 999px; padding: .1rem .6rem; color: rgb(var(--muted)); }
.cx-tag.gold { color: rgb(var(--acc-l)); border-color: rgb(var(--acc) / .4); }
.cx-tag.green { color: #7ee08a; border-color: #7ee08a55; }
.cx-tag.red { color: #ff8a80; border-color: #ff8a8066; }
.cx-flags-h { font-size: .8rem; color: rgb(var(--muted)); text-transform: uppercase; letter-spacing: .05em; }
.cx-set .cx-setb { margin: .4rem 0; }
.cx-cols { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 900px) { .cx-cols { grid-template-columns: 1fr 1fr; } }
.cx-sec h2 { font-family: Cinzel, serif; color: rgb(var(--acc-l)); font-size: 1.1rem; margin-bottom: .6rem; }
.cx-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .25rem 1rem; }
.cx-stat { display: flex; justify-content: space-between; border-bottom: 1px dashed rgb(var(--line)); padding: .2rem 0; font-size: .92rem; }
.cx-stat b { color: rgb(var(--acc-l)); font-weight: 600; }
.cx-fx { border-left: 3px solid rgb(var(--acc)); padding: .35rem .7rem; margin: .4rem 0; background: rgb(var(--ink) / .5); border-radius: 0 .4rem .4rem 0; }
.cx-fx .t { color: #7ee08a; }
.cx-tip { white-space: pre-line; color: rgb(var(--body) / .85); font-size: .92rem; line-height: 1.5; }
.cx-recipe { border: 1px solid rgb(var(--line)); border-radius: .6rem; padding: .7rem; margin-bottom: .6rem; }
.cx-recipe .mats { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.cx-recipe .mats .cx-row { flex: 1 1 14rem; }
.cx-kv { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; font-size: .88rem; color: rgb(var(--muted)); }
.cx-kv b { color: rgb(var(--body)); font-weight: 600; }
.cx-note { color: rgb(var(--muted)); font-size: .8rem; margin-top: .5rem; }
.cx-empty { color: rgb(var(--muted)); font-style: italic; }
.mt-3 { margin-top: .75rem; }

/* ===== v2: menu, home, liste con barra laterale ===== */
.cx-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; background: rgb(var(--panel)); border: 1px solid rgb(var(--line));
    border-radius: .8rem; padding: .35rem; position: relative; z-index: 20; }
.cx-mi { position: relative; }
.cx-mt { display: flex; align-items: center; gap: .3rem; padding: .5rem .85rem; border-radius: .55rem; color: rgb(var(--body) / .85);
    font-size: .92rem; font-weight: 600; text-decoration: none; }
.cx-mt:hover, .cx-mi:hover > .cx-mt, .cx-mi:focus-within > .cx-mt { background: rgb(var(--line)); color: rgb(var(--acc-l)); }
.cx-car { font-size: .7rem; opacity: .7; }
.cx-dd { display: none; position: absolute; top: 100%; left: 0; min-width: 14rem; background: rgb(var(--ink)); border: 1px solid rgb(var(--line-hi));
    border-radius: .7rem; padding: .4rem; box-shadow: 0 12px 32px #000a; }
.cx-mi:hover > .cx-dd, .cx-mi:focus-within > .cx-dd { display: block; }
.cx-mi.closed > .cx-dd { display: none; }
.cx-dd.wide { width: min(56rem, 92vw); padding: .8rem; }
.cx-dd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: .6rem 1rem; }
.cx-dd-h { display: block; color: rgb(var(--acc-l)); font-family: Cinzel, serif; font-weight: 700; font-size: .9rem; padding: .2rem .4rem;
    border-bottom: 1px solid rgb(var(--line)); margin-bottom: .2rem; }
.cx-dd-a { display: flex; justify-content: space-between; gap: .8rem; padding: .3rem .5rem; border-radius: .4rem; color: rgb(var(--body) / .85);
    font-size: .86rem; text-decoration: none; }
.cx-dd-a:hover, .cx-dd-h:hover { background: rgb(var(--line)); color: rgb(var(--acc-l)); }
.cx-dd-a.all { color: rgb(var(--acc-l)); font-weight: 600; }
.cx-dd-a .n, .cx-side-a .n { color: rgb(var(--muted) / .7); font-size: .78rem; font-variant-numeric: tabular-nums; }
.cx-gs { position: relative; flex: 1 1 16rem; margin-left: auto; min-width: 0; }
.cx-input.g { width: 100%; padding: .5rem .8rem; }
.cx-sugg { position: absolute; right: 0; top: calc(100% + .35rem); width: min(30rem, 92vw); max-height: 70vh; overflow-y: auto;
    background: rgb(var(--ink)); border: 1px solid rgb(var(--line-hi)); border-radius: .7rem; padding: .4rem; box-shadow: 0 12px 32px #000a;
    display: flex; flex-direction: column; gap: .3rem; }
.cx-sugg[hidden] { display: none; }
.cx-sg-h { color: rgb(var(--muted)); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; padding: .3rem .4rem 0; }
.cx-sg-all { text-align: center; color: rgb(var(--acc-l)); font-size: .85rem; padding: .45rem; border-top: 1px solid rgb(var(--line)); margin-top: .2rem; }
.cx-sg-all:hover { color: #fff; }

.cx-view { margin-top: 1.25rem; }
.cx-crumbs { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; font-size: .85rem; color: rgb(var(--muted)); }
.cx-crumbs a { color: rgb(var(--muted)); } .cx-crumbs a:hover { color: rgb(var(--acc-l)); }
.cx-crumbs .sep { color: rgb(var(--line-hi)); } .cx-crumbs .cur { color: rgb(var(--body)); }
.cx-h1 { font-family: Cinzel, serif; font-size: 1.8rem; color: rgb(var(--acc-l)); margin: .4rem 0 1rem; }
.cx-link { color: rgb(var(--acc-l)); font-size: .88rem; } .cx-link:hover { color: #fff; }

/* home */
.cx-hero { background: linear-gradient(135deg, rgb(var(--panel-hi)), rgb(var(--ink))); border: 1px solid rgb(var(--line)); border-radius: 1rem; padding: 1.5rem; }
.cx-hero h2 { font-family: Cinzel, serif; font-size: 1.6rem; color: rgb(var(--acc-l)); }
.cx-hero p { margin-top: .4rem; max-width: 48rem; }
.cx-stats-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }
.cx-stats-row a { display: flex; flex-direction: column; background: rgb(var(--ink) / .5); border: 1px solid rgb(var(--line)); border-radius: .7rem;
    padding: .6rem 1.1rem; color: rgb(var(--muted)); font-size: .82rem; text-decoration: none; min-width: 7.5rem; }
.cx-stats-row a:hover { border-color: rgb(var(--acc)); }
.cx-stats-row b { color: rgb(var(--acc-l)); font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.cx-block { margin-top: 1.75rem; }
.cx-bh { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .7rem; }
.cx-bh h2 { font-family: Cinzel, serif; color: rgb(var(--acc-l)); font-size: 1.25rem; }
.cx-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .6rem; }
.cx-cat { display: flex; gap: .8rem; align-items: center; background: rgb(var(--panel) / .8); border: 1px solid rgb(var(--line)); border-radius: .8rem;
    padding: .75rem .9rem; text-decoration: none; min-width: 0; transition: border-color .15s, transform .15s; }
.cx-cat:hover { border-color: rgb(var(--acc)); transform: translateY(-1px); background: rgb(var(--panel-hi)); }
.cx-cat .nm { color: rgb(var(--body)); font-weight: 700; }
.cx-cat .sub { color: rgb(var(--muted)); font-size: .8rem; }
.cx-cat .txt { min-width: 0; }

/* lista con barra laterale */
.cx-layout { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 900px) { .cx-layout { grid-template-columns: 15.5rem 1fr; } }
.cx-side { display: flex; flex-direction: column; gap: .8rem; min-width: 0; }
@media (min-width: 900px) { .cx-side { position: sticky; top: 1rem; align-self: start; max-height: calc(100vh - 2rem); overflow-y: auto; } }
.cx-box { background: rgb(var(--panel) / .8); border: 1px solid rgb(var(--line)); border-radius: .8rem; padding: .7rem; display: flex; flex-direction: column; gap: .15rem; }
.cx-box-h { font-family: Cinzel, serif; color: rgb(var(--acc-l)); font-weight: 700; font-size: .95rem; margin-bottom: .3rem; }
.cx-side-a { display: flex; justify-content: space-between; gap: .5rem; padding: .32rem .5rem; border-radius: .45rem; color: rgb(var(--body) / .85);
    font-size: .88rem; text-decoration: none; }
.cx-side-a:hover { background: rgb(var(--line)); color: rgb(var(--acc-l)); }
.cx-side-a.on { background: rgb(var(--line)); color: rgb(var(--acc-l)); font-weight: 700; }
.cx-side-a.sub { padding-left: 1.3rem; font-size: .84rem; }
.cx-f { display: flex; flex-direction: column; gap: .2rem; margin-bottom: .45rem; font-size: .78rem; color: rgb(var(--muted)); }
.cx-f .cx-input, .cx-f .cx-select { width: 100%; padding: .42rem .6rem; font-size: .88rem; }
.cx-f2 { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.cx-f2 .cx-input.lv { width: 100%; }
.cx-chk { display: flex; gap: .5rem; align-items: center; font-size: .86rem; color: rgb(var(--body) / .85); margin-bottom: .45rem; }
.cx-main { min-width: 0; }
.cx-main .cx-count { margin-top: 0; }

/* badge */
.cx-mob.boss { background: #5a1e2a; color: #ffb3b3; box-shadow: 0 0 0 1px #b33333; }
.cx-mob.elite { background: #3d2a5a; color: #e0c8ff; box-shadow: 0 0 0 1px #8547b8; }
.cx-mob.npc { background: #1e3a33; color: #8fe0c3; font-size: .62rem; }
.cx-mob.map { background: #1e2c4a; color: #9cc3ff; font-size: 1.05rem; }
.cx-mob.big { width: 64px; height: 64px; font-size: 1.6rem; }
a.cx-tag:hover { border-color: rgb(var(--acc)); color: rgb(var(--acc-l)); }
.cx-exl { display: grid; grid-template-columns: 1fr; gap: .1rem; }
@media (min-width: 900px) { .cx-exl { grid-template-columns: 1fr 1fr; gap: 0 .6rem; } }
.cx-more[hidden] { display: none; }
.cx-side { scrollbar-width: thin; scrollbar-color: rgb(var(--line-hi)) transparent; }
.cx-dd.wide { width: min(64rem, 94vw); max-height: 80vh; overflow-y: auto; }
.cx-dd-grid { grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); gap: .5rem .8rem; }
.cx-dd-grid .cx-dd-a { padding: .17rem .5rem; font-size: .82rem; }

/* barra strumenti sopra la lista: ricerca, ordinamento, bottone Filters + pannello a scomparsa */
.cx-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.cx-tools > .cx-input { flex: 1 1 16rem; min-width: 0; }
.cx-sort { display: flex; align-items: center; gap: .4rem; color: rgb(var(--muted)); font-size: .82rem; }
.cx-fbtn { display: flex; align-items: center; gap: .45rem; background: rgb(var(--panel)); border: 1px solid rgb(var(--line)); border-radius: .6rem;
    color: rgb(var(--body)); padding: .55rem .9rem; font-size: .92rem; font-weight: 600; cursor: pointer; }
.cx-fbtn:hover, .cx-fbtn.on { border-color: rgb(var(--acc)); color: rgb(var(--acc-l)); }
.cx-fbtn.on .cx-car { transform: rotate(180deg); }
.cx-fn { background: rgb(var(--acc)); color: rgb(var(--ink)); border-radius: 999px; font-size: .72rem; min-width: 1.2rem; height: 1.2rem;
    display: inline-flex; align-items: center; justify-content: center; padding: 0 .3rem; }
.cx-fn[hidden], .cx-fbtn[hidden] { display: none; }
.cx-fpanel { margin-top: .6rem; background: rgb(var(--panel) / .8); border: 1px solid rgb(var(--line-hi)); border-radius: .8rem; padding: .9rem; }
.cx-fpanel[hidden] { display: none; }
.cx-fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .3rem 1rem; align-items: end; }
.cx-main .cx-count { margin-top: 1rem; }

/* Dropped by: drop rate del giocatore */
.cx-dr { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; background: rgb(var(--ink) / .5); border: 1px solid rgb(var(--line));
    border-radius: .6rem; padding: .55rem .75rem; margin-bottom: .7rem; font-size: .9rem; color: rgb(var(--body)); font-weight: 600; }
.cx-dr-in { display: inline-flex; align-items: center; gap: .35rem; color: rgb(var(--acc-l)); }
.cx-input.dr { width: 6.5rem; padding: .35rem .6rem; font-size: .92rem; }
.cx-dr-hint { color: rgb(var(--muted)); font-size: .76rem; font-weight: 400; flex-basis: 100%; }

/* Ultimate Form */
.cx-forms { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 900px) { .cx-forms { grid-template-columns: 1fr 1fr; } }
.cx-form { background: linear-gradient(160deg, rgb(var(--panel-hi)), rgb(var(--ink))); border: 1px solid rgb(var(--line-hi)); border-radius: 1rem; padding: 1.2rem; }
.cx-form-top { display: flex; gap: .9rem; align-items: center; margin-bottom: .9rem; }
.cx-form-n { font-family: Cinzel, serif; font-size: 1.45rem; color: rgb(var(--acc-l)); font-weight: 700; }
.cx-fxl { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.cx-fxl li { border-left: 3px solid; padding: .35rem .7rem; background: rgb(var(--ink) / .5); border-radius: 0 .45rem .45rem 0;
    display: flex; flex-direction: column; gap: .1rem; }
.cx-fxl li.good { border-color: #4fd1c5; } .cx-fxl li.good .l { color: #6ee7f0; }
.cx-fxl li.bad { border-color: #e05555; } .cx-fxl li.bad .l { color: #ff7a7a; }
.cx-fxl .l { font-weight: 700; }
.cx-fxl .d { color: rgb(var(--muted)); font-size: .82rem; }
.cx-info { margin: 0; padding-left: 1.1rem; color: rgb(var(--body) / .85); font-size: .92rem; line-height: 1.6; list-style: disc; }
.cx-main > .cx-card:first-child, .cx-main > .cx-forms:first-child { margin-top: 0; }
.cx-main > .cx-forms + .cx-card { margin-top: 1rem; }

/* Mission Order */
.cx-tbl-wrap { overflow-x: auto; }
.cx-tbl { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 52rem; }
.cx-tbl th { text-align: left; color: rgb(var(--muted)); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
    padding: .5rem .6rem; border-bottom: 1px solid rgb(var(--line-hi)); white-space: nowrap; }
.cx-tbl td { padding: .55rem .6rem; border-bottom: 1px solid rgb(var(--line)); white-space: nowrap; }
.cx-tbl .n { text-align: right; font-variant-numeric: tabular-nums; }
.cx-tbl .gold { color: rgb(var(--acc-l)); } .cx-tbl .loy { color: #7ee08a; }
.cx-mo { cursor: pointer; } .cx-mo:hover, .cx-mo.on { background: rgb(var(--panel-hi)); }
.cx-mo-det > td { background: rgb(var(--ink)); white-space: normal; padding: .8rem; }
.cx-mo-det[hidden] { display: none; }
/* spawn dei boss (pagina mostro) */
.cx-sps { display: flex; flex-direction: column; gap: .6rem; }
.cx-sp { display: flex; flex-wrap: wrap; gap: .4rem .9rem; align-items: flex-start; }
.cx-row .sub.cx-sp-l { color: rgb(var(--acc-l)); }
.cx-sp > .cx-row { flex: 0 1 15rem; min-width: 12rem; }
.cx-sp-t { flex: 1 1 14rem; padding: .25rem 0 .4rem; font-size: .88rem; line-height: 1.45; }
.cx-sp-t .sub { color: rgb(var(--muted)); font-size: .8rem; }
.cx-sp-on { color: #4cc06a; font-weight: 700; }
/* indietro / avanti */
.cx-hist { display: flex; gap: .15rem; margin-right: .15rem; }
.cx-hb { background: none; border: 0; cursor: pointer; font-size: 1.35rem; line-height: 1; padding: .3rem .7rem .45rem; }
.cx-hb:disabled { opacity: .3; cursor: default; background: none; color: rgb(var(--body) / .85); }

/* sprite: skill nella riga */
.cx-sks { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .2rem; }
.cx-sk { font-size: .72rem; padding: 0 .45rem; }
.cx-sk b { color: rgb(var(--body)); font-weight: 600; }
.cx-sk.gold b { color: rgb(var(--acc-l)); }
.cx-stat a:hover { color: rgb(var(--acc-l)); }
/* tendina Sprites: compatta, a gruppi */
.cx-dd.sprites { width: min(40rem, 94vw); padding: .7rem; }
.cx-dd.sprites .cx-dd-grid { grid-template-columns: repeat(auto-fit, minmax(8.6rem, 1fr)); gap: .4rem .6rem; margin-top: .3rem; }
.cx-dd.sprites .cx-dd-h:hover { background: none; }
@media (max-width: 1199px) { .cx-dd.sprites { width: 11.5rem; min-width: 0; max-height: 70vh; overflow-y: auto; }
    .cx-dd.sprites .cx-dd-grid { grid-template-columns: 1fr; } }
