:root {
  --bg:       #0d1117;
  --surface:  #161b22;
  --surface2: #21262d;
  --border:   #30363d;
  --text:     #e6edf3;
  --muted:    #8b949e;
  --green:    #3fb950;
  --red:      #f85149;
  --amber:    #d29922;
  --blue:     #58a6ff;
  --radius:   6px;
  --font:     'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono:     'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.auth-wall {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  text-align: center;
  padding: 40px 32px;
}

.auth-icon {
  font-size: 34px;
  color: var(--muted);
  margin-bottom: 18px;
}

.auth-card h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.auth-card .muted {
  margin-bottom: 22px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 54px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.topbar-title i { color: var(--blue); font-size: 13px; }

.topbar-sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.status-dots {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sdot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.25s, box-shadow 0.25s;
}

.dot.dot-ok  { background: var(--green); box-shadow: 0 0 6px rgba(63,185,80,0.5); }
.dot.dot-bad { background: var(--red);   box-shadow: 0 0 6px rgba(248,81,73,0.5); }

.username {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
  letter-spacing: 0.04em;
}

.badge-green {
  color: var(--green);
  background: rgba(63,185,80,0.1);
  border-color: rgba(63,185,80,0.25);
}

.badge-blue {
  color: var(--blue);
  background: rgba(88,166,255,0.1);
  border-color: rgba(88,166,255,0.25);
}

.badge-amber {
  color: var(--amber);
  background: rgba(210,153,34,0.1);
  border-color: rgba(210,153,34,0.25);
}

.page-body {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.card-heading {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.field-row {
  margin-bottom: 14px;
}

.field-row:last-child { margin-bottom: 0; }

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}

.input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 6px 10px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

.input:focus { border-color: var(--blue); }

.select-input {
  cursor: pointer;
  max-width: 520px;
}

.radio-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.radio-opt {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.radio-opt input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface2);
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  user-select: none;
}

.radio-opt input[type="radio"]:checked + .radio-label {
  color: var(--text);
  border-color: var(--blue);
  background: rgba(88,166,255,0.08);
}

.radio-opt:hover .radio-label {
  color: var(--text);
  border-color: var(--muted);
}

.radio-opt:focus-within .radio-label {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.checkboxes {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.check-opt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
}

.check-opt input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--blue);
  cursor: pointer;
  flex-shrink: 0;
}

.search-wrap {
  position: relative;
  max-width: 440px;
}

.search-icon-inner {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
}

.search-input { padding-left: 30px; }

.results-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 200;
  max-height: 260px;
  overflow-y: auto;
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
}

.result-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(48,54,61,0.7);
  transition: background 0.1s;
}

.result-item:last-child { border-bottom: none; }

.result-item:hover,
.result-item:focus { background: rgba(88,166,255,0.07); outline: none; }

.result-icon { color: var(--muted); font-size: 12px; flex-shrink: 0; }

.result-name { font-size: 13px; font-weight: 500; flex: 1; }

.result-meta { font-size: 11px; font-family: var(--mono); }

.result-loading,
.result-empty,
.result-error {
  padding: 12px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.result-error { color: var(--red); }

.selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(63,185,80,0.06);
  border: 1px solid rgba(63,185,80,0.22);
  border-radius: var(--radius);
  max-width: 520px;
}

.selected-icon { color: var(--green); font-size: 13px; }

.sel-name { font-size: 13px; font-weight: 600; }

.sel-meta { font-size: 11px; font-family: var(--mono); }

.notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 10px;
}

.notice-warn {
  background: rgba(210,153,34,0.08);
  border: 1px solid rgba(210,153,34,0.3);
  color: var(--amber);
}

.notice-warn i { margin-top: 2px; flex-shrink: 0; }

.qb-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.qb-loaded { font-size: 11px; font-family: var(--mono); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.5;
  transition: background 0.1s, border-color 0.1s;
  white-space: nowrap;
}

.btn:hover {
  background: #30363d;
  border-color: var(--muted);
  text-decoration: none;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-xs { padding: 2px 6px; font-size: 11px; }

.btn-link {
  background: transparent;
  border-color: transparent;
  color: var(--blue);
  padding-inline: 0;
  font-size: 12px;
}

.btn-link:hover {
  background: transparent;
  border-color: transparent;
  text-decoration: underline;
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #0d1117;
  font-weight: 600;
  padding: 8px 20px;
  font-size: 13px;
}

.btn-primary:hover { background: #79b8ff; border-color: #79b8ff; }

.reset-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.btn-reset {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 24px;
  background: var(--red);
  border: 1px solid rgba(248,81,73,0.55);
  border-radius: var(--radius);
  color: #fff;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}

.btn-reset:hover:not(:disabled) {
  background: #ff6b63;
  box-shadow: 0 4px 24px rgba(248,81,73,0.38);
  transform: translateY(-1px);
}

.btn-reset:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

.btn-reset:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

.reset-hint {
  font-size: 12px;
  min-height: 18px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.toolbar .card-heading { margin-bottom: 0; }

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

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 640px;
}

.table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface2); }

.muted { color: var(--muted); font-size: 12px; }

.loader {
  padding: 32px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.error {
  padding: 14px 16px;
  background: rgba(248,81,73,0.06);
  border: 1px solid rgba(248,81,73,0.3);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
}

.swal2-popup.swal-dark-popup {
  font-family: var(--font) !important;
  font-size: 14px !important;
}

@media (max-width: 680px) {
  .topbar {
    height: auto;
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .topbar-left { flex-wrap: wrap; }

  .page-body { padding: 14px 16px 32px; }

  .radio-group { gap: 6px; }

  .search-wrap,
  .select-input,
  .selected-chip { max-width: 100%; }
}

/* login form (auth wall) — stacked, full width; overrides inline .field row layout */
#login-form { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; text-align: left; }
#login-form .field { display: flex; flex-direction: column; gap: 6px; }
#login-form .field > span { font-size: 13px; color: var(--muted); }
#login-form input { width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text); font-size: 14px; }
#login-form input:focus { outline: none; border-color: var(--blue); }
#login-form .btn { width: 100%; justify-content: center; margin-top: 4px; }
#login-error { text-align: left; }

/* FTB quest-map reset UI */
.ftb-shell {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 0;
  min-height: calc(100vh - 54px);
  background: #0a0d12;
}

.target-panel {
  border-right: 2px solid #1f2630;
  background: linear-gradient(180deg, rgba(22,27,34,.98), rgba(12,16,22,.98));
  padding: 14px;
  overflow-y: auto;
}

.target-card,
.selected-target-card,
.audit-card {
  background: rgba(22,27,34,.92);
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}

.selected-target-card { margin-top: 12px; }

.panel-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #c9d1d9;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 12px;
}
.panel-heading-green { color: var(--green); }

.target-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.target-toggle label { cursor: pointer; }
.target-toggle input { position: absolute; opacity: 0; }
.target-toggle span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #111820;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.target-toggle input:checked + span { color: #fff; border-color: #6aa4ff; background: rgba(88,166,255,.12); }

.target-search-row,
.quest-search-row {
  position: relative;
  display: flex;
  align-items: center;
}
.target-search-row i,
.quest-search-row i { position: absolute; left: 10px; color: var(--muted); font-size: 12px; }
.target-search-row input,
.quest-search-row input {
  width: 100%;
  background: #090d12;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: var(--text);
  padding: 8px 10px 8px 31px;
  outline: none;
}
.target-search-row input:focus,
.quest-search-row input:focus { border-color: var(--blue); }

.target-count {
  margin: 10px 0 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.target-list { display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow-y: auto; padding-right: 3px; }
.target-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 1px solid #27313d;
  border-radius: 6px;
  background: rgba(33,38,45,.75);
  color: var(--text);
  padding: 8px 9px;
  text-align: left;
  cursor: pointer;
}
.target-row:hover { border-color: #6aa4ff; background: rgba(88,166,255,.10); }
.target-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 700; }
.target-meta { color: var(--muted); font-family: var(--mono); font-size: 10px; }
.target-empty { color: var(--muted); text-align: center; padding: 18px; }
.selected-target-name { font-weight: 800; font-size: 15px; }
.selected-target-meta { color: var(--muted); font-family: var(--mono); font-size: 11px; margin: 4px 0 10px; overflow-wrap: anywhere; }

.quest-workspace { min-width: 0; display: flex; flex-direction: column; }
.empty-workspace {
  margin: 24px;
  min-height: 360px;
  border: 1px dashed #30363d;
  border-radius: 10px;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
}
.empty-workspace i { font-size: 36px; margin: 0 auto 12px; color: var(--blue); }
.empty-workspace h2 { color: var(--text); margin-bottom: 6px; }

.questbook-workspace { min-height: calc(100vh - 54px); display: flex; flex-direction: column; }
.quest-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(260px, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid #202833;
  background: rgba(13,17,23,.96);
}
.workspace-label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.workspace-target-title { font-weight: 800; }
.workspace-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: end; }
.mini-check { color: var(--muted); font-size: 12px; white-space: nowrap; }
.mini-check input { accent-color: var(--blue); margin-right: 4px; }

.quest-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  background: #151b23;
  border: 1px solid #30363d;
  border-radius: 8px;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 16px 36px rgba(0,0,0,.5);
}
.quest-search-item,
.quest-search-empty {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #30363d;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 9px 12px;
  cursor: pointer;
}
.quest-search-item:hover { background: rgba(88,166,255,.10); }
.quest-search-empty { color: var(--muted); cursor: default; }

.quest-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 360px;
  flex: 1;
  min-height: 0;
  height: calc(100vh - 54px - 60px - 56px);
}
.chapter-tree {
  background: rgba(18,24,31,.90);
  border-right: 2px solid #2a333f;
  overflow-y: auto;
  padding: 8px 0;
}
.chapter-root,
.chapter-group-title,
.chapter-button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  color: #d4d9df;
  padding: 6px 10px;
  font-size: 15px;
}
.chapter-root { font-size: 18px; font-weight: 800; border-bottom: 1px solid #30363d; margin-bottom: 4px; }
.chapter-group-title { color: #c3cad2; font-weight: 800; margin-top: 6px; }
.chapter-button {
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-family: var(--font);
}
.chapter-button:hover,
.chapter-button.active { background: rgba(88,166,255,.12); color: #fff; }
.chapter-button.active { box-shadow: inset 3px 0 0 var(--blue); }
.mc-icon { width: 22px; height: 22px; display: inline-grid; place-items: center; color: #f0c674; text-shadow: 0 1px 0 #000; }
.mc-icon .item-img { width: 20px; height: 20px; image-rendering: pixelated; object-fit: contain; }
.mc-icon .item-glyph { font-size: 18px; line-height: 1; color: #f0c674; }
.chapter-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.quest-map-wrap {
  position: relative;
  overflow: auto;
  min-height: 0;
  height: 100%;
  background-color: #1a2028;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px),
    radial-gradient(circle at 45% 30%, rgba(88,166,255,.08), transparent 36%);
  background-size: 16px 16px, 16px 16px, 100% 100%;
}
.quest-lines,
.quest-map { position: absolute; left: 0; top: 0; }
.quest-lines { pointer-events: none; z-index: 1; }
.quest-link { stroke: rgba(165,130,142,.65); stroke-width: 8; stroke-linecap: square; filter: drop-shadow(0 1px 0 rgba(0,0,0,.7)); }
.quest-map { z-index: 2; }
.quest-node {
  position: absolute;
  width: 46px;
  height: 46px;
  margin-left: -23px;
  margin-top: -23px;
  border: 2px solid #8b95a1;
  background: linear-gradient(145deg, #6b7480, #3a424c);
  color: #f2d58a;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 5px 12px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.18);
}
.quest-node:hover { border-color: #d7dde5; transform: scale(1.08); z-index: 5; }
.quest-node.selected { outline: 3px solid var(--blue); z-index: 6; }
.quest-node.quest-completed { border-color: #3fb950; box-shadow: 0 5px 12px rgba(0,0,0,.55), inset 0 1px 0 rgba(63,185,80,.35), 0 0 0 2px rgba(63,185,80,.35), 0 0 14px rgba(63,185,80,.55); }
.quest-node.quest-completed.selected { outline-color: #3fb950; }
.quest-node.quest-completed .quest-icon { filter: brightness(0.7) saturate(0.6); }
.quest-node.quest-started { border-color: #d29922; box-shadow: 0 5px 12px rgba(0,0,0,.55), inset 0 1px 0 rgba(210,153,34,.35), 0 0 0 2px rgba(210,153,34,.30), 0 0 12px rgba(210,153,34,.45); }
.quest-node.quest-started.selected { outline-color: #d29922; }
.quest-node.quest-locked { border-color: #4a525a; opacity: 0.42; filter: grayscale(0.55); }
.quest-node.quest-locked .quest-icon { filter: brightness(0.5); }
.quest-node.quest-locked::after { content: '🔒'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 18px; pointer-events: none; opacity: 0.85; }
.quest-check { position: absolute; right: -6px; bottom: -6px; width: 18px; height: 18px; border-radius: 50%; background: #3fb950; color: #0d1117; display: grid; place-items: center; font-size: 12px; font-weight: 800; line-height: 1; box-shadow: 0 0 0 2px #0a0d12; pointer-events: none; }
.quest-map-wrap { cursor: grab; }
.quest-map-wrap.dragging { cursor: grabbing; user-select: none; }
.quest-map-wrap.dragging .quest-node { pointer-events: none; }
.shape-gear { border-radius: 18%; box-shadow: 0 0 0 4px rgba(255,255,255,.06), 0 5px 12px rgba(0,0,0,.55); }
.shape-diamond { transform: rotate(45deg); }
.shape-diamond .quest-icon { transform: rotate(-45deg); }
.shape-hexagon,
.shape-octagon { clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0 50%); }
.quest-icon { display: grid; place-items: center; width: 100%; height: 100%; }
.quest-icon .item-img { width: 32px; height: 32px; image-rendering: pixelated; object-fit: contain; pointer-events: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,.6)); }
.quest-icon .item-glyph { font-size: 24px; line-height: 1; color: #f2d58a; }
.quest-detail {
  background: rgba(13,17,23,.96);
  border-left: 2px solid #2a333f;
  padding: 14px;
  overflow-y: auto;
  min-height: 0;
  max-height: 100%;
}
.detail-empty { color: var(--muted); text-align: center; padding: 38px 14px; border: 1px dashed #30363d; border-radius: 8px; }
.detail-header { display: grid; grid-template-columns: 54px 1fr; gap: 12px; align-items: center; margin-bottom: 12px; }
.detail-icon { width: 54px; height: 54px; display: grid; place-items: center; border: 2px solid #77808a; background: #222b35; clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0 50%); overflow: hidden; }
.detail-icon .item-img { width: 40px; height: 40px; image-rendering: pixelated; object-fit: contain; }
.detail-icon .item-glyph { font-size: 28px; color: #f2d58a; }
.detail-header h3 { font-size: 15px; margin: 0 0 4px; }
.detail-header p { color: var(--muted); font-size: 11px; font-family: var(--mono); overflow-wrap: anywhere; }
.detail-text { color: #c9d1d9; font-size: 12px; border: 1px solid #30363d; border-radius: 6px; padding: 10px; margin-bottom: 12px; }
.detail-list { margin-bottom: 14px; }
.detail-list h4 { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; }
.detail-row { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid #242b35; }
.detail-row-icon { width: 22px; height: 22px; display: grid; place-items: center; }
.detail-row-icon .item-img { width: 20px; height: 20px; image-rendering: pixelated; object-fit: contain; }
.detail-row-icon .item-glyph { font-size: 16px; color: #f0c674; }
.detail-row-main { font-size: 12px; overflow-wrap: anywhere; }
.detail-row-count { color: var(--amber); font-family: var(--mono); font-size: 11px; }
.detail-small { color: var(--muted); font-size: 12px; }
.detail-actions { display: flex; flex-direction: column; gap: 8px; }

.chapter-reset-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid #202833;
  background: #0d1117;
}
.active-chapter-label { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.chapter-reset-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-danger { border-color: rgba(248,81,73,.55); color: #ffb4ae; background: rgba(248,81,73,.10); }
.btn-danger:hover { background: rgba(248,81,73,.18); }
.btn-nuke { border-color: rgba(248,81,73,.75); color: #fff; background: #b42318; font-weight: 800; }
.btn-nuke:hover { background: #dc2f24; }
.confirm-table { text-align: left; width: 100%; font-size: 13px; border-collapse: collapse; }
.confirm-table td { padding: 4px 10px; }
.confirm-table td:first-child { color: var(--muted); white-space: nowrap; }

@media (max-width: 1180px) {
  .ftb-shell { grid-template-columns: 280px minmax(0, 1fr); }
  .quest-layout { grid-template-columns: 260px minmax(0, 1fr); }
  .quest-detail { grid-column: 1 / -1; border-left: 0; border-top: 2px solid #2a333f; max-height: 360px; }
}

@media (max-width: 820px) {
  .ftb-shell { display: block; }
  .target-panel { border-right: 0; border-bottom: 2px solid #1f2630; max-height: 420px; }
  .quest-toolbar { grid-template-columns: 1fr; }
  .workspace-actions { justify-content: start; }
  .quest-layout { grid-template-columns: 1fr; }
  .chapter-tree { max-height: 260px; border-right: 0; border-bottom: 2px solid #2a333f; }
  .quest-map-wrap { min-height: 520px; }
}
