/* Forever Gear Planner — desktop layout, full window width. Dark by default in dark mode, light otherwise. */
:root {
  --bg: #eef0f4; --side: #ffffff; --panel: #ffffff; --panel2: #f3f5f8; --raised: #ffffff; --text: #1b2130; --muted: #657085;
  --line: #dde1e8; --accent: #2f5aa8; --accent-text: #fff; --sel: #e4ecfb; --have: #1f8a3a; --havebg: #e3f4e7;
  --q2: #1a8a00; --q3: #0060c0; --q4: #8a35d6; --q5: #c45f00; --q1: #6b7280;
  --r3: #1e7b34; --r3t: #fff; --r2: #a7dab1; --r2t: #12391b; --r1: #fff0a8; --r1t: #5a4a00; --r0: #e6e7ea; --r0t: #6b7280;
  --easy: #ddefe0; --easyt: #1e5b2c; --trip: #fce7c8; --tript: #8a4b00; --hostile: #f4c7c3; --hostilet: #9c1c1c;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .07);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101318; --side: #161a21; --panel: #1a1f27; --panel2: #212733; --raised: #232a36; --text: #e7e9ee; --muted: #98a2b3;
    --line: #2c3340; --accent: #6d9cff; --accent-text: #0d1320; --sel: #22314f; --have: #4cc76a; --havebg: #1c3424;
    --q2: #3fd12a; --q3: #4fa3ff; --q4: #b77cff; --q5: #ff9a3c; --q1: #c9ced8;
    --r3: #2f9e4f; --r3t: #fff; --r2: #2c5a37; --r2t: #d6f5dd; --r1: #5a4f1c; --r1t: #fff2b3; --r0: #2a303b; --r0t: #9aa3b2;
    --easy: #1f3a27; --easyt: #9fe0b0; --trip: #4a3517; --tript: #ffcf8a; --hostile: #4d2220; --hostilet: #ffb3ab;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #101318; --side: #161a21; --panel: #1a1f27; --panel2: #212733; --raised: #232a36; --text: #e7e9ee; --muted: #98a2b3;
  --line: #2c3340; --accent: #6d9cff; --accent-text: #0d1320; --sel: #22314f; --have: #4cc76a; --havebg: #1c3424;
  --q2: #3fd12a; --q3: #4fa3ff; --q4: #b77cff; --q5: #ff9a3c; --q1: #c9ced8;
  --r3: #2f9e4f; --r3t: #fff; --r2: #2c5a37; --r2t: #d6f5dd; --r1: #5a4f1c; --r1t: #fff2b3; --r0: #2a303b; --r0t: #9aa3b2;
  --easy: #1f3a27; --easyt: #9fe0b0; --trip: #4a3517; --tript: #ffcf8a; --hostile: #4d2220; --hostilet: #ffb3ab;
  --shadow: none;
}

* { box-sizing: border-box; }
html { color-scheme: light dark; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--accent); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
.boot { padding: 2rem; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: 12px; } .nowrap { white-space: nowrap; }

/* ---------- shell */
.shell { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(to right, var(--side) 270px, var(--line) 270px, var(--line) 271px, transparent 271px); }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--side); border-right: 1px solid var(--line);
  padding: 16px 14px; display: flex; flex-direction: column; gap: 16px; }
.brand { font-weight: 800; font-size: 16px; letter-spacing: .01em; }
.brand small { display: block; color: var(--muted); font-weight: 500; font-size: 11.5px; letter-spacing: 0; }
.main { padding: 22px 28px 40px; min-width: 0; }

.charcard { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.charcard .who { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #14171d; font-size: 16px; }
.avatar.sm { width: 26px; height: 26px; font-size: 12px; }
.charcard .name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.charcard .meta { color: var(--muted); font-size: 12.5px; }
.charcard .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lvl { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.lvl button { border: 0; background: transparent; color: var(--text); width: 30px; height: 30px; cursor: pointer; font-size: 16px; }
.lvl button:hover { background: var(--sel); }
.lvl input { width: 44px; height: 30px; border: 0; border-radius: 0; padding: 0; text-align: center; background: transparent; color: var(--text);
  font-weight: 700; -moz-appearance: textfield; appearance: textfield; }
.lvl input::-webkit-outer-spin-button, .lvl input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.lvl-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button { text-align: left; border: 0; background: transparent; color: var(--text); padding: 9px 12px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; }
.nav button:hover { background: var(--panel2); }
.nav button.on { background: var(--sel); color: var(--accent); }
.side h4 { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 0 4px 6px; }
.charlist { display: flex; flex-direction: column; gap: 2px; }
.charlist button { display: flex; align-items: center; gap: 9px; border: 0; background: transparent; color: var(--text); padding: 6px 8px; border-radius: 8px;
  cursor: pointer; text-align: left; font: inherit; }
.charlist button:hover { background: var(--panel2); }
.charlist button.on { background: var(--sel); }
.charlist .cl-name { font-weight: 600; line-height: 1.15; }
.charlist .cl-meta { font-size: 11.5px; color: var(--muted); }
.side .foot { margin-top: auto; font-size: 11.5px; color: var(--muted); }

/* ---------- common */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 18px; }
.md > * > .panel:first-child, .iv > .panel, .md > .panel { margin-top: 0; }
.iv td:first-child { min-width: 230px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 12px; }
.panel-head h2 { font-size: 16px; } .panel-head .spacer { margin-left: auto; }
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 24px; margin-bottom: 18px; }
.pagehead h1 { font-size: 24px; }
.pagehead .sub { color: var(--muted); margin-top: 2px; }
.pagehead .spacer { margin-left: auto; }
.notice { background: var(--trip); color: var(--tript); border-radius: 8px; padding: 8px 12px; margin-bottom: 14px; }
select, input[type="text"], input[type="number"], input[type="search"] {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; }
.btn { font: inherit; border: 1px solid var(--line); background: var(--panel2); color: var(--text); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.danger:hover { border-color: #c0392b; color: #c0392b; }
.btn.sm { padding: 3px 9px; font-size: 12.5px; }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--panel); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; font: inherit; font-weight: 600; cursor: pointer; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--accent); color: var(--accent-text); }
.chipsel { display: flex; flex-wrap: wrap; gap: 6px; }
.chipsel button { border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 999px; padding: 3px 11px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.chipsel button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chipsel button.you { box-shadow: inset 0 -2px 0 var(--have); }

.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.r3 { background: var(--r3); color: var(--r3t); } .r2 { background: var(--r2); color: var(--r2t); }
.r1 { background: var(--r1); color: var(--r1t); } .r0 { background: var(--r0); color: var(--r0t); }
.t-easy { background: var(--easy); color: var(--easyt); } .t-long-trip { background: var(--trip); color: var(--tript); }
.t-hostile-city { background: var(--hostile); color: var(--hostilet); }
.val { display: inline-block; min-width: 36px; text-align: center; border-radius: 6px; font-weight: 700; font-size: 12px; padding: 1px 6px; }
.val.bis { background: var(--r3); color: var(--r3t); } .val.fit { background: var(--r2); color: var(--r2t); } .val.none { color: var(--muted); }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 5px; background: var(--panel2); color: var(--muted); white-space: nowrap; vertical-align: 1px; }
.tag.Alliance { background: #dbe7ff; color: #1f4aa8; } .tag.Horde { background: #f9dcdc; color: #9c1c1c; }
.tag.crafted { background: #efe2ff; color: #6a2bb5; } .tag.quest { background: #fff1c9; color: #7a5a00; }
.tag.instance, .tag.dungeon { background: #dff3e5; color: #1e6b37; } .tag.world { background: #e6e7ea; color: #4b5563; }
.tag.vendor { background: #dcf1f7; color: #0f5e75; } .tag.pvp, .tag.rep { background: #fde3ee; color: #9b1d55; } .tag.other { background: #e6e7ea; color: #4b5563; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag { filter: brightness(.82) saturate(1.25); } }
:root[data-theme="dark"] .tag { filter: brightness(.82) saturate(1.25); }

/* items */
.item { text-decoration: none; font-weight: 650; }
.item:hover { text-decoration: underline; }
.q2 { color: var(--q2); } .q3 { color: var(--q3); } .q4 { color: var(--q4); } .q5 { color: var(--q5); } .q1, .q0 { color: var(--q1); }
.ico { position: relative; flex: none; display: inline-block; width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--line); background: var(--panel2) center/cover;
  vertical-align: middle; overflow: hidden; }
.ico img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.ico.lg { width: 44px; height: 44px; border-radius: 8px; border-width: 2px; }
.ico.md { width: 32px; height: 32px; border-radius: 6px; border-width: 2px; }
.ico.b2 { border-color: color-mix(in srgb, var(--q2) 70%, transparent); } .ico.b3 { border-color: color-mix(in srgb, var(--q3) 70%, transparent); }
.ico.b4 { border-color: color-mix(in srgb, var(--q4) 70%, transparent); } .ico.b5 { border-color: color-mix(in srgb, var(--q5) 70%, transparent); }
.iname { display: inline-flex; align-items: center; gap: 7px; }
.owned { opacity: .5; }
.owned:hover { opacity: .85; }
input.own { width: 16px; height: 16px; margin: 0; vertical-align: -3px; cursor: pointer; accent-color: var(--have); }
.havebox { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); cursor: pointer; user-select: none; white-space: nowrap; }

/* tables */
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 650; white-space: nowrap; background: var(--panel); position: sticky; top: 0; z-index: 1; }
th.sort { cursor: pointer; } th.sort:hover { color: var(--text); }
td.num, th.num { text-align: right; } td.c, th.c { text-align: center; }
tbody tr:hover td { background: var(--panel2); }
.stats { color: var(--muted); font-size: 12px; }

/* ---------- character sheet: fills the window; 7 slots left, summary in the middle, 7 right, weapons along the bottom */
.main.fit { height: 100vh; display: flex; flex-direction: column; padding-bottom: 16px; }
.main.fit .pagehead { margin-bottom: 12px; }
.sheet { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr); grid-template-rows: repeat(8, minmax(52px, 1fr));
  gap: 9px 18px; }
.main.fit .sheet { flex: 1 1 auto; min-height: 470px; }
.sheet .center { grid-column: 2; grid-row: 1 / 8; display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow-y: auto; padding-right: 2px; }
.sheet .center .panel + .panel { margin-top: 0; }
.slot { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 11px; align-items: center; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 7px 12px; cursor: pointer; box-shadow: var(--shadow); min-height: 0; overflow: hidden; transition: border-color .12s; }
.slot:hover { border-color: var(--accent); }
.slot.bis { background: linear-gradient(90deg, var(--havebg), var(--panel) 70%); border-color: color-mix(in srgb, var(--have) 45%, var(--line)); }
.slot.vacant { border-style: dashed; }
.slot .sb { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.slot .slabel { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; display: flex; gap: 6px; align-items: center; }
.slot .slabel .ok, .slot .starget .ok { color: var(--have); letter-spacing: 0; text-transform: none; font-weight: 700; }
.slot .sname, .slot .sst, .slot .starget { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot .sst { font-size: 11.5px; color: var(--muted); }
.slot .starget { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.slot .starget .tl { white-space: nowrap; }
.slot .starget .item { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.slot .starget .havebox { margin-left: auto; }
.btn.xs { padding: 0 8px; font-size: 11.5px; line-height: 18px; border-radius: 6px; margin-left: auto; }
.summary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 22px; }
.big { font-size: 24px; font-weight: 800; line-height: 1.1; }
.big small { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.bar { height: 8px; border-radius: 99px; background: var(--panel2); overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--have); border-radius: 99px; }
.next-dungeon { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: var(--panel2); cursor: pointer; }
.next-dungeon:hover { outline: 1px solid var(--accent); }
.hint { grid-column: 1 / -1; font-size: 12.5px; color: var(--accent); }
.srcgroups { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.srcgroup { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--raised); }
.srcgroup.link { cursor: pointer; } .srcgroup.link:hover { border-color: var(--accent); }
.srcgroup h3 { font-size: 14px; display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.srcgroup h3 .count { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 600; }
.srcgroup ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.srcgroup li { display: flex; align-items: center; gap: 7px; font-size: 13px; min-width: 0; }
.srcgroup li .slotname { margin-left: auto; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.alldone { text-align: center; padding: 18px 8px; color: var(--muted); }

table.plan th.now, table.plan td.now { background: var(--sel); }
table.plan td { min-width: 170px; vertical-align: top; }
table.plan td.slotname { min-width: 90px; font-weight: 700; position: sticky; left: 0; background: var(--panel); z-index: 1; }
.pick { display: flex; gap: 7px; align-items: flex-start; margin-bottom: 7px; }
.pick:last-child { margin-bottom: 0; }
.pick .src { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.same { color: var(--muted); font-size: 12px; }

/* ---------- dungeons: list + detail */
.md { display: grid; grid-template-columns: 370px minmax(0, 1fr); gap: 20px; align-items: start; }
.mlist { position: sticky; top: 22px; max-height: calc(100vh - 44px); overflow-y: auto; padding: 12px; }
.mlist h4 { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 12px 6px 6px; }
.drow { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 4px 8px; align-items: center; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.drow:hover { background: var(--panel2); }
.drow.sel { background: var(--sel); box-shadow: inset 3px 0 0 var(--accent); }
.drow .rk { color: var(--muted); font-weight: 800; font-size: 13px; }
.drow .dn { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drow .dm { grid-column: 2; font-size: 12px; color: var(--muted); }
.drow .dr { grid-row: 1 / span 2; grid-column: 3; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.drow.out .dn { color: var(--muted); font-weight: 500; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; margin-top: 14px; }
.tile { background: var(--panel2); border-radius: 10px; padding: 9px 12px; }
.tile .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.tile .v { font-size: 20px; font-weight: 800; margin-top: 2px; }
.tile .v small { font-size: 12px; color: var(--muted); font-weight: 600; }
.route { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; }
.itemtiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.itile { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 9px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--raised); }
.itile .t1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.itile .t2 { font-size: 12px; color: var(--muted); }
.bosses { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 14px; }
.boss { border: 1px solid var(--line); border-radius: 12px; background: var(--raised); overflow: hidden; }
.boss h3 { font-size: 14px; padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: baseline; }
.boss h3 .count { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 600; }
.boss .brow { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 10px; align-items: center; padding: 6px 14px; border-bottom: 1px solid var(--line); }
.boss .brow:last-child { border-bottom: 0; }
.boss .brow .bslot { font-size: 12px; color: var(--muted); white-space: nowrap; }
.boss .brow .iname { min-width: 0; }
.boss .brow .iname .item { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- items: filters + results */
.iv { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 20px; align-items: start; }
.filters { position: sticky; top: 22px; display: flex; flex-direction: column; gap: 14px; }
.filters label.blk { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.filters label.blk select, .filters label.blk input { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text); font-size: 14px; }
.filters .grp { display: flex; flex-direction: column; gap: 7px; }
.filters .grp .ttl { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* ---------- drawer (slot picker) */
.drawer-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(780px, 62vw); background: var(--panel); border-left: 1px solid var(--line); z-index: 41;
  display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0, 0, 0, .25); }
.drawer header { padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.drawer header h2 { font-size: 18px; display: flex; align-items: center; gap: 10px; }
.drawer header h2 .x { margin-left: auto; }
.drawer .dfilters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: 10px; }
.drawer .dbody { overflow-y: auto; padding: 6px 12px 20px; }
.cand { display: grid; grid-template-columns: 44px minmax(0, 1fr) 56px 56px 96px; gap: 12px; align-items: center; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.cand.target { background: var(--sel); border-radius: 10px; }
.cand.worn { background: var(--havebg); border-radius: 10px; }
.cand .acts { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.drawer .current { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 8px 10px; background: var(--panel2); border-radius: 10px; min-height: 48px; }
.drawer .current .btn { margin-left: auto; }
.drawer .dsearch { width: 100%; margin-top: 10px; font-size: 15px; padding: 9px 12px; }
.cand .c1 { min-width: 0; }
.cand .c1 .nm { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cand .c1 .sr { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cand .c1 .st { font-size: 12px; color: var(--muted); margin-top: 1px; }
.cand .lv { text-align: center; font-size: 12px; color: var(--muted); } .cand .lv b { display: block; font-size: 15px; color: var(--text); }

/* ---------- forms, dialog, tooltip */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; align-items: start; }
.grid2 > .panel + .panel { margin-top: 0; }
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 22px; }
.formgrid label { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.formgrid input { width: 90px; }
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); padding: 20px 22px; width: 440px; }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog h2 { font-size: 18px; margin-bottom: 14px; }
dialog label { display: block; margin-bottom: 11px; font-weight: 650; font-size: 13px; }
dialog label input:not([type="checkbox"]), dialog label select { display: block; width: 100%; margin-top: 4px; font-weight: 400; }
dialog .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
dialog .check { font-weight: 400; }
.dlg-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
#tip { position: fixed; z-index: 60; max-width: 340px; background: #0f131a; color: #e6e8ec; border: 1px solid #3a4152; border-radius: 9px;
  padding: 10px 12px; font-size: 12.5px; pointer-events: none; box-shadow: 0 8px 28px rgba(0, 0, 0, .4); }
#tip .th { display: flex; gap: 9px; align-items: center; margin-bottom: 4px; }
#tip .tn { font-weight: 700; font-size: 14px; }
#tip .tn.q2 { color: #3fd12a; } #tip .tn.q3 { color: #4fa3ff; } #tip .tn.q4 { color: #b77cff; } #tip .tn.q5 { color: #ff9a3c; }
#tip .tl { color: #ffd100; } #tip .tc { color: #8fd3ff; } #tip .tm { color: #9aa3b2; } #tip .ts { color: #3fd12a; } #tip hr { border: 0; border-top: 1px solid #3a4152; margin: 7px 0; }
.prose p, .prose li { margin: 6px 0; } .prose h3 { margin-top: 16px; font-size: 15px; } .prose ul { padding-left: 20px; }
.empty { text-align: center; padding: 60px 16px; }
.empty h2 { margin-bottom: 8px; }


/* short windows: keep the slot cards to name + best-in-slot line (stats are in the hover tooltip) */
@media (max-height: 900px) { .slot .sst { display: none; } .big { font-size: 21px; } }
.next-dungeon { flex-wrap: wrap; row-gap: 4px; }
.next-dungeon .small { white-space: nowrap; }

/* narrower windows (small laptops, or Windows display scaling at 125-150%): shrink instead of overflowing */
@media (max-width: 1440px) {
  .shell { grid-template-columns: 228px minmax(0, 1fr); background: linear-gradient(to right, var(--side) 228px, var(--line) 228px, var(--line) 229px, transparent 229px); }
  .side { padding: 14px 10px; }
  .main { padding: 16px 16px 28px; }
  .main.fit { padding-bottom: 12px; }
  .sheet { gap: 8px 12px; }
  .pagehead { gap: 6px 14px; margin-bottom: 12px; }
  .pagehead h1 { font-size: 21px; }
  .chipsel { gap: 4px; }
  .chipsel button { padding: 2px 8px; font-size: 12.5px; }
  .seg button { padding: 5px 10px; }
  .summary { grid-template-columns: 1fr 1fr; gap: 10px 14px; }
  .md { grid-template-columns: 320px minmax(0, 1fr); gap: 14px; }
  .iv { grid-template-columns: 240px minmax(0, 1fr); gap: 14px; }
}
@media (max-width: 1180px) { .summary { grid-template-columns: 1fr; } .sheet .center .panel { padding: 12px; } }
/* short windows: tighter slot cards */
@media (max-height: 760px) {
  .slot { padding: 4px 10px; grid-template-columns: 36px minmax(0, 1fr); gap: 9px; }
  .slot .ico.lg { width: 36px; height: 36px; }
  .slot .slabel { font-size: 9.5px; }
  .pagehead .sub { display: none; }
}
@media (max-width: 1440px) {
  .slot .starget .tag { display: none; }
  .slot .starget .havebox { font-size: 0; gap: 0; }
}
@media (max-height: 700px) {
  .slot { line-height: 1.25; padding-top: 3px; padding-bottom: 3px; }
  .slot .sname { font-size: 13px; }
  .slot .starget { margin-top: 0; }
}

/* power score */
.slot .slabel .pw { margin-left: auto; font-size: 11px; letter-spacing: 0; color: var(--text); background: var(--panel2); border-radius: 6px; padding: 0 6px; }
.gain { color: var(--have); font-weight: 800; white-space: nowrap; }
.delta { display: block; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.delta.up { color: var(--have); } .delta.down { color: #d0453a; }
.pill.xs { font-size: 10px; padding: 0 6px; }
.tag.rq { background: #fde7c8; color: #8a4b00; }
#tip .tp { color: #ffd100; margin: 2px 0 4px; }

.tag.cx { background: #fde2e1; color: #9c1c1c; }
#tip .tw { color: #ff9b8f; margin: 2px 0 4px; }

/* talents */
.tlayout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(330px, 400px); gap: 16px; align-items: start; }
.ttrees { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.ttrees > .panel + .panel { margin-top: 0; }
.ttree.mine { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.tgrid { display: grid; grid-template-columns: repeat(4, 48px); grid-template-rows: repeat(7, 48px); gap: 12px 14px; justify-content: center; padding: 4px 0 6px; }
.tcell { position: relative; width: 48px; height: 48px; padding: 0; border-radius: 8px; border: 2px solid var(--line); background: var(--panel2); cursor: pointer; }
.tcell img { width: 100%; height: 100%; border-radius: 6px; display: block; }
.tcell.st-locked img { filter: grayscale(1) brightness(.6); }
.tcell.st-locked { cursor: default; }
.tcell.st-open { border-color: #3fb950; }
.tcell.st-some { border-color: #3fb950; box-shadow: 0 0 0 1px #3fb950; }
.tcell.st-max { border-color: #e3b341; box-shadow: 0 0 0 1px #e3b341; }
.tcell .trank { position: absolute; right: -8px; bottom: -8px; font-size: 10.5px; font-weight: 800; background: #10141c; color: #e6e8ec; border-radius: 6px; padding: 0 4px; line-height: 16px; }
.tcell.st-max .trank { color: #e3b341; } .tcell.st-some .trank, .tcell.st-open .trank { color: #3fb950; }
.tcell.has-fx::after { content: ""; position: absolute; left: 2px; top: 2px; border-top: 9px solid #e3b341; border-right: 9px solid transparent; border-top-left-radius: 4px; }
.tweights { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
.fxlist { margin: 0 0 10px; padding-left: 18px; font-size: 12.5px; } .fxlist li { margin: 3px 0; }
.wtable td, .wtable th { padding: 4px 6px; font-size: 12.5px; }
.wtable input { width: 70px; padding: 2px 6px; text-align: right; }
.wtable tr.chg td:nth-child(3) { color: var(--have); font-weight: 700; }
.wtable tr.ovr td:first-child { font-weight: 700; }
@media (max-width: 1440px) { .tlayout { grid-template-columns: minmax(0, 1fr) 330px; } .tgrid { grid-template-columns: repeat(4, 42px); grid-template-rows: repeat(7, 42px); gap: 10px 10px; } .tcell { width: 42px; height: 42px; } }

/* ---------- item sets, stat totals, hit cap (power sheet center tabs) */
.tag.set { background: #fff1c9; color: #7a5a00; }
.slot .sst .setname { color: #a8780a; font-weight: 600; }
.ctabs button { padding: 5px 11px; font-size: 13px; }
.ctitle { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 12px 0 6px; }
.ctitle:first-child { margin-top: 0; }
.setcard { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; margin-bottom: 8px; background: var(--panel2); }
.setcard h3 { font-size: 14px; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin-bottom: 4px; }
.setcard h3 .count { margin-left: auto; color: var(--have); font-weight: 800; font-size: 13px; }
.setcard ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.setcard li { display: flex; align-items: center; gap: 7px; font-size: 13px; min-width: 0; }
.setcard li .slotname { margin-left: auto; color: var(--muted); font-size: 11.5px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.setcard .ok, .hitbox .ok { color: var(--have); font-weight: 700; }
.setb li { display: block; font-size: 12.5px; }
.setb li.off { color: var(--muted); }
.setb li.on b:first-child { color: var(--have); }
.warn { color: #b4541a; font-weight: 700; }
.hitbox { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: var(--panel2); }
.hitbox h3 { font-size: 14px; }
.seg.sm button { padding: 3px 9px; font-size: 12px; }
table.stattable { width: 100%; font-size: 13px; }
table.stattable td, table.stattable th { padding: 4px 8px; }
table.stattable th { position: static; }
#tip .tset .off { color: #7d8596; } #tip .tset .on { color: #ffd100; } #tip .tset .sb.on { color: #3fd12a; } #tip .tset .sb { font-size: 12px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag.set { background: #4a3d12; color: #ffe08a; } :root:not([data-theme="light"]) .warn { color: #ff9a5c; } }
:root[data-theme="dark"] .tag.set { background: #4a3d12; color: #ffe08a; } :root[data-theme="dark"] .warn { color: #ff9a5c; }
.setcard li.skip > a, .setcard li.skip > .ico { opacity: .55; }

/* ---------- random suffix picker */
.tag.rnd { background: #e2f0ff; color: #1d4f91; }
.sfxn { color: inherit; font-weight: 600; margin-left: 3px; }
.sfx { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 3px 0 1px; }
.sfx select { font: inherit; font-size: 12px; padding: 2px 4px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--text); max-width: 100%; }
.sfx .warn { font-size: 11.5px; }
.drawer .current .sfx { display: inline-flex; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag.rnd { background: #1d3557; color: #a9cdff; } }
:root[data-theme="dark"] .tag.rnd { background: #1d3557; color: #a9cdff; }
.sfx { flex-wrap: nowrap; }
.sfx select { flex: 1 1 0; min-width: 0; }
.sfx .warn { flex: none; }
.sfx-edit { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0 3px; }
.sfx-edit:hover { color: var(--accent); }

/* ---------- accounts (web mode) */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .panel { max-width: 460px; width: 100%; }
.login .brand { margin-bottom: 14px; }
.btn.discord { background: #5865F2; border-color: #5865F2; color: #fff; text-decoration: none; display: inline-block; }
.foot.acct { display: flex; flex-direction: column; gap: 4px; }
.who-sm { display: inline-flex; align-items: center; gap: 7px; }
.avatar.img { overflow: hidden; padding: 0; background: var(--panel2); }
.avatar.img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sync { color: var(--muted); } .sync.bad { color: #b4541a; font-weight: 700; }
.linkbtn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font: inherit; }
.notice.ok { border-color: color-mix(in srgb, var(--have) 45%, var(--line)); }
.copyfield { width: min(100%, 520px); font-family: ui-monospace, Consolas, monospace; font-size: 12px; margin: 6px 0; }
