/* ef2-calc web - dark palette matching the desktop app's own theme */
:root {
  color-scheme: dark;
  --bg: #21222c;
  --bg-control: #282a36;
  --bg-hover: #313341;
  --border: #6272a4;
  --fg: #cdd7eb;
  --fg-muted: #a6acbe;
  --accent: #75bfff;
  --warn: #ff9933;
  --good: #7fe6a0;
  --bad: #ff9b9b;
  --header: #9e5b8b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 "Segoe UI", -apple-system, system-ui, sans-serif;
}

/* Sidebar shell - docfx-TOC style: a fixed-width left column holding the
   brand header and the nav tree, with the tab content filling the rest of
   the viewport width beside it. */
.shell {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
}

.sidebar {
  flex: 0 0 220px;
  width: 220px;
  min-height: 100vh;
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  align-self: flex-start;
  overflow-y: auto;
  max-height: 100vh;
}

header.topbar {
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

header.topbar h1 { font-size: 17px; margin: 0; color: var(--header); }
header.topbar .sub { color: var(--fg-muted); font-size: 11.5px; line-height: 1.4; }
header.topbar a { color: var(--accent); }

/* Top-level entries, stacked vertically. Each direct button (or a
   .tab-group wrapping a parent + its children, currently just Account) is
   one row - the docfx pattern of "main header is clickable, sub-headers
   live indented underneath it" instead of a second horizontal bar. */
nav.tabs {
  display: flex;
  flex-direction: column;
  padding: 6px 0 20px;
}

nav.tabs > button, .tab-parent {
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  color: var(--fg-muted);
  padding: 9px 16px;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  width: 100%;
}

nav.tabs > button:hover, .tab-parent:hover { color: var(--fg); background: var(--bg-hover); }
/* Every top-level ("mother") entry shares one distinct open-color, separate
   from the accent blue used for active sub-headers - true for all 9 of
   them, not just Account (the only one with children today). That keeps
   the color meaningful ("this is a top-level tab, currently open") rather
   than tied to whether a given tab happens to have children yet - a plain
   tab gaining subtabs later needs no color change here. */
nav.tabs > button.active, .tab-parent.active { color: var(--header); border-left-color: var(--header); background: var(--bg-hover); }

.tab-parent { display: flex; align-items: center; justify-content: space-between; }
.tab-parent .chev { font-size: 11px; color: var(--fg-muted); transition: transform 0.15s ease; }
.tab-parent.active .chev { color: var(--header); }
.tab-group.expanded .tab-parent .chev { transform: rotate(90deg); }

/* Sub-headers - hidden until the parent group is expanded, then revealed
   indented directly beneath it (not a separate nav bar). */
.tab-group nav.subtabs {
  display: none;
  flex-direction: column;
  padding: 2px 0 6px;
}
.tab-group.expanded nav.subtabs { display: flex; }

nav.subtabs button {
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  color: var(--fg-muted);
  padding: 7px 16px 7px 30px;
  font: inherit;
  font-weight: 600;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  width: 100%;
}

nav.subtabs button:hover { color: var(--fg); background: var(--bg-hover); }
nav.subtabs button.active { color: var(--accent); border-left-color: var(--accent); background: var(--bg-hover); }

main { flex: 1 1 auto; min-width: 0; padding: 18px 24px 60px; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.subtab-panel { display: none; }
.subtab-panel.active { display: block; }

/* Below this width the sidebar collapses back to a horizontal top bar so
   the app stays usable on narrow screens (same idea, different orientation). */
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { position: static; width: 100%; min-height: 0; max-height: none; border-right: none; border-bottom: 1px solid var(--border); }
  nav.tabs { flex-direction: row; flex-wrap: wrap; padding: 4px 8px; }
  nav.tabs > button, .tab-parent { width: auto; border-left: none; border-bottom: 2px solid transparent; }
  nav.tabs > button.active, .tab-parent.active { border-left: none; border-bottom-color: var(--accent); }
  .tab-group { width: 100%; }
  nav.subtabs button { padding-left: 16px; }
}

.card {
  background: var(--bg-control);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.card h2 { margin: 0 0 10px; font-size: 15px; color: var(--accent); }
.card h3 { margin: 14px 0 8px; font-size: 13px; color: var(--fg-muted); text-transform: uppercase; letter-spacing: .03em; }

.row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.row label { min-width: 150px; color: var(--fg-muted); font-size: 13px; }
.row .note { color: var(--fg-muted); font-size: 12px; }

input[type=number], input[type=text], select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 6px;
  padding: 5px 8px;
  font: inherit;
  font-size: 13px;
  width: 130px;
}

select { width: auto; min-width: 220px; }

input[readonly] {
  color: var(--fg-muted);
  background: rgba(255,255,255,.02);
  cursor: default;
}

input[type=range] { flex: 1; min-width: 160px; accent-color: var(--accent); }

button.step, button.action {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
button.step:hover, button.action:hover { background: var(--bg-hover); }
button.action.primary { background: var(--accent); color: #12141c; font-weight: 700; border-color: var(--accent); }

label.check { display: inline-flex; align-items: center; gap: 6px; color: var(--fg); font-size: 13px; cursor: pointer; }

table { border-collapse: collapse; width: 100%; font-size: 13px; }
table th, table td { padding: 5px 8px; text-align: right; border-bottom: 1px solid rgba(255,255,255,.06); }
table th:first-child, table td:first-child { text-align: left; }
table th { color: var(--fg-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
table tr.boss td { color: var(--warn); }
table tr.miniboss td { color: var(--accent); }
table.compact td, table.compact th { padding: 3px 6px; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.ok { background: rgba(127,230,160,.15); color: var(--good); }
.pill.fail { background: rgba(255,155,155,.15); color: var(--bad); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 10px; }
.stat-box { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.stat-box .label { color: var(--fg-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; }
.stat-box .value { font-size: 19px; font-weight: 700; color: var(--fg); margin-top: 2px; }
.stat-box .value.accent { color: var(--accent); }

.result-block { white-space: pre-wrap; font-family: Consolas, "Cascadia Mono", monospace; font-size: 12.5px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; overflow-x: auto; }

.warn-box { background: rgba(255,153,51,.12); border: 1px solid var(--warn); color: var(--warn); border-radius: 8px; padding: 8px 12px; font-size: 12.5px; margin-bottom: 10px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; } }

.scroll-x { overflow-x: auto; }

footer { text-align: center; color: var(--fg-muted); font-size: 12px; padding: 20px; }
footer a { color: var(--accent); }

.loading { padding: 40px; text-align: center; color: var(--fg-muted); }

/* preset switcher */
.preset-btn {
  background: var(--bg); color: var(--fg); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 14px; font: inherit; font-weight: 600; cursor: pointer;
}
.preset-btn:hover { background: var(--bg-hover); }
.preset-btn.active { background: var(--accent); color: #12141c; border-color: var(--accent); }
.preset-btn .count { font-weight: 400; opacity: .75; margin-left: 4px; }

/* relic sprite icons - a fixed-size clipped box holding a scaled native-size
   layer, so one small sheet can render crisp icons at any display size */
.relic-icon { width: 32px; height: 32px; overflow: hidden; position: relative; display: inline-block;
  border-radius: 6px; background: rgba(255,255,255,.04); vertical-align: middle; flex: none; }
.relic-icon > span { position: absolute; top: 0; left: 0; transform-origin: top left; background-repeat: no-repeat; }
.relic-icon.missing { display: flex; align-items: center; justify-content: center; color: var(--fg-muted); font-size: 10px; }

.set-bonus-block { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.set-bonus-block h4 { margin: 0 0 6px; font-size: 13px; color: var(--accent); }
.set-bonus-block .tier { margin: 4px 0; padding-left: 10px; border-left: 2px solid var(--border); }
.set-bonus-block .tier.inactive { opacity: .45; }

table.compact td, table.compact th { padding: 4px 7px; font-size: 12.5px; }
table.compact td:first-child { padding: 3px 7px; }
