:root {
  --bg:      #0e0e14;
  --panel:   #16161f;
  --border:  #2a2a3a;
  --accent:  #c8972a;
  --accent2: #e8b84b;
  --text:    #d4d4e8;
  --muted:   #666688;
  --success: #4caf7d;
  --fail:    #e05c5c;
  --init:    #e09a3c;
  --safe:    #3a7fd4;
  --purple:  #a07ad4;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: 'Segoe UI', sans-serif; font-size: 14px; min-height: 100vh; padding: 24px; }

h1 { font-size: 20px; color: var(--accent2); letter-spacing: 2px; text-transform: uppercase; border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 20px; }
h1 span { color: var(--muted); font-size: 12px; letter-spacing: 1px; margin-left: 12px; text-transform: none; }

.tabs { display: flex; gap: 2px; margin-bottom: 20px; border-bottom: 2px solid var(--border); }
.tab-btn { background: none; border: none; color: var(--muted); font-size: 13px; letter-spacing: 1px; text-transform: uppercase; padding: 10px 20px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .2s; }
.tab-btn.active { color: var(--accent2); border-bottom-color: var(--accent); }
.tab-btn:hover { color: var(--text); }
.tab-content { display: none; }
.tab-content.active { display: block; }

.layout { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }
@media(max-width:900px){ .layout { grid-template-columns: 1fr; } }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 18px; margin-bottom: 16px; }
.panel:last-child { margin-bottom: 0; }
.panel-title { font-size: 10px; text-transform: uppercase; letter-spacing: 2px; color: var(--accent); margin-bottom: 14px; border-bottom: 1px solid var(--border); padding-bottom: 7px; }

label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 3px; margin-top: 11px; }
label:first-of-type { margin-top: 0; }

select, input[type="number"], input[type="text"] {
  width: 100%; background: #0a0a12; border: 1px solid var(--border);
  color: #d4d4e8; padding: 7px 10px; border-radius: 4px; font-size: 13px; outline: none;
  transition: border-color .2s;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23666688'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 28px; -webkit-appearance: none; appearance: none;
}
select:focus, input:focus { border-color: var(--accent); }
select option { background: #111111; color: #d4d4e8; }

.btn { display: inline-block; padding: 8px 18px; border-radius: 4px; border: none; cursor: pointer; font-size: 13px; font-weight: 600; letter-spacing: .5px; transition: opacity .15s, transform .1s; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.btn-primary   { background: var(--accent); color: #111; }
.btn-secondary { background: #1e2a3a; color: var(--text); border: 1px solid var(--border); }
.btn-danger    { background: #5a1a1a; color: #f08080; border: 1px solid #7a2222; }
.btn-purple    { background: #2a1a4a; color: #c090ff; border: 1px solid #5a3a8a; }
.btn-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

.rate-box { background: #0a0a12; border: 1px solid var(--border); border-radius: 4px; padding: 10px 12px; margin-top: 12px; }
.rate-header { display: flex; align-items: center; margin-bottom: 6px; }
.rate-label { font-size: 11px; color: var(--muted); flex: 1; }
.rate-value { font-size: 18px; font-weight: 700; }
.rate-bar-wrap { width: 100%; height: 5px; background: #222; border-radius: 3px; margin-bottom: 6px; }
.rate-bar { height: 5px; border-radius: 3px; transition: width .3s, background .3s; }
.rate-note { font-size: 11px; color: var(--muted); line-height: 1.5; }

.effect-badge { display: inline-block; font-size: 11px; padding: 3px 8px; border-radius: 3px; margin-top: 8px; }
.eff-jade { background: #0a2a1a; color: #5dca8a; border: 1px solid #1a5a3a; }
.eff-prot { background: #1a0a2a; color: #b070d8; border: 1px solid #4a2a6a; }

.item-display { display: flex; align-items: center; gap: 14px; background: #0a0a12; border: 1px solid var(--border); border-radius: 6px; padding: 14px; margin-bottom: 14px; }
.item-icon { width: 56px; height: 56px; background: #1a1a2a; border: 2px solid var(--accent); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 26px; flex-shrink: 0; }
.item-info { flex: 1; min-width: 0; }
.item-name  { font-size: 15px; font-weight: 700; color: var(--accent2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-level { font-size: 22px; font-weight: 900; color: #fff; margin: 2px 0; }
.item-stat  { font-size: 12px; color: var(--muted); }
.item-stat b { color: var(--text); }

.stats-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 12px; }
.stat-box { background: #0a0a12; border: 1px solid var(--border); border-radius: 4px; padding: 9px; text-align: center; }
.stat-box .val { font-size: 20px; font-weight: 700; color: var(--accent2); }
.stat-box .lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 1px; }

.destroyed-banner { background: #1a0000; border: 2px solid #6a1a1a; border-radius: 6px; padding: 12px; text-align: center; color: var(--fail); font-size: 14px; font-weight: bold; margin-bottom: 12px; display: none; }

#log, #addon-log { max-height: 260px; overflow-y: auto; background: #08080f; border: 1px solid var(--border); border-radius: 6px; padding: 8px; font-family: monospace; font-size: 12px; margin-top: 12px; }
.log-entry { padding: 2px 0; border-bottom: 1px solid #14141e; line-height: 1.6; }
.log-entry:last-child { border-bottom: none; }
.log-ok    { color: var(--success); }
.log-fail  { color: var(--fail); }
.log-init  { color: var(--init); }
.log-gone  { color: #f55; font-weight: bold; }
.log-info  { color: var(--muted); }
.log-warn  { color: var(--init); }
.log-addon { color: var(--purple); }
.log-count { font-size: 11px; color: var(--muted); margin-top: 5px; text-align: right; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { background: #0e0e1a; color: var(--accent); font-size: 10px; letter-spacing: 1px; text-transform: uppercase; padding: 7px 8px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 6px 8px; border-bottom: 1px solid #1a1a26; white-space: nowrap; }
tr.cur-row { background: #1a1a2e; }
tr.cur-row td { color: var(--accent2); font-weight: 700; }
.c-gain { color: var(--success); }
.c-ok   { color: var(--success); }
.c-warn { color: var(--init); }
.c-bad  { color: var(--fail); }
.c-zero { color: #333; }
.c-safe { color: var(--safe);  font-size: 11px; }
.c-reset{ color: var(--init); font-size: 11px; }
.c-dang { color: var(--fail); font-size: 11px; }
.c-max  { color: var(--muted);font-size: 11px; }

.addon-layout { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
@media(max-width:900px){ .addon-layout { grid-template-columns: 1fr; } }
.addon-slots { display: grid; grid-template-columns: repeat(5,1fr); gap: 6px; margin-top: 10px; }
.addon-slot { background: #0a0a12; border: 1px solid var(--border); border-radius: 4px; padding: 6px 4px; text-align: center; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.addon-slot.filled { border-color: var(--purple); background: #120a22; }
.addon-slot .slot-num  { font-size: 10px; color: var(--muted); margin-bottom: 2px; }
.addon-slot .slot-name { font-size: 10px; }
.addon-slot.filled .slot-name { color: #c090ff; font-weight: 600; }
.addon-slot:not(.filled) .slot-name { color: #333; }

.auto-row { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; }
.auto-row .flex1 { flex: 1; }

.vananta-wrap { margin-top: 4px; }
.vananta-slider {
  width: 100%; accent-color: var(--accent); cursor: pointer;
  margin-bottom: 8px;
}
.vananta-bars { display: flex; flex-direction: column; gap: 5px; margin-bottom: 6px; }
.vananta-bar-track {
  width: 100%; height: 8px; background: #2a2a3a;
  border-radius: 4px; overflow: hidden;
}
.vananta-bar-fill {
  height: 100%; width: 0%; border-radius: 4px;
  background: #3a3a4a;
  transition: width .15s, background .15s;
}
.vananta-bar-fill.active { background: var(--fail); }
.vananta-info {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--muted);
}
.vananta-info span:last-child { font-weight: 600; }

.item-picker { position: relative; }
.item-picker-list {
  position: absolute; z-index: 200; width: 100%;
  background: #0a0a12; border: 1px solid var(--accent);
  border-top: none; border-radius: 0 0 4px 4px;
  max-height: 220px; overflow-y: auto;
  list-style: none; margin: 0; padding: 0;
  display: none;
}
.item-picker-list li {
  padding: 6px 10px; cursor: pointer; font-size: 12px;
  color: var(--text); border-bottom: 1px solid #1a1a26;
}
.item-picker-list li:last-child { border-bottom: none; }
.item-picker-list li:hover,
.item-picker-list li.hl { background: #1e1e30; color: var(--accent2); }
.item-picker-list .no-res { color: var(--muted); cursor: default; font-style: italic; }
