/* ธีมมืดโทนน้ำเงินกรมท่า สไตล์ฐานข้อมูลเกม */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0b1d2c;
  --panel: #0f2638;
  --panel-2: #153147;
  --border: #2e5270;
  --text: #e5fbff;
  --text-dim: #9fc3d8;
  --text-faint: #6f97ad;
  --accent: #17f0ff;
  --green: #7ef29b;
  --gold: #ffd95e;
  --rare: #58aae9;
  --epic: #c377f2;
  --legendary: #ffb347;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', 'Leelawadee UI', Tahoma, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- header ---------- */
.site-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  background: rgba(11, 29, 44, 0.9);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(6px);
}
.logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.5px;
}
.logo span { color: var(--accent); }
.site-header nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
}
.site-header nav a:hover, .site-header nav a.active { color: var(--accent); background: rgba(23, 240, 255, 0.08); }

/* ---------- layout ---------- */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 28px 20px 60px; flex: 1; }
h1 { font-size: 30px; margin-bottom: 6px; }
.subtitle { color: var(--text-dim); margin-bottom: 22px; }

/* ---------- controls ---------- */
.controls {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
}
.controls .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.controls .row:last-child { margin-bottom: 0; }
.controls input[type="search"], .controls select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
}
.controls input[type="search"] { flex: 1; min-width: 220px; }
.controls input:focus, .controls select:focus { outline: none; border-color: var(--accent); }
.filter-label { color: var(--text-faint); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; min-width: 90px; }
.icon-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 5px 9px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  transition: all 0.15s;
}
.icon-btn img { width: 20px; height: 20px; }
.icon-btn:hover { border-color: var(--accent); color: var(--text); }
.icon-btn.on { border-color: var(--accent); background: rgba(23, 240, 255, 0.12); color: var(--accent); }
.count { color: var(--accent); font-weight: 700; margin-top: 10px; }

/* ---------- pal grid ---------- */
.pal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.pal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 8px 10px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.pal-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 6px 18px rgba(23, 240, 255, 0.15); }
.pal-card.rare { border-color: rgba(88, 170, 233, 0.5); }
.pal-card.epic { border-color: rgba(195, 119, 242, 0.5); }
.pal-card.legendary { border-color: rgba(255, 179, 71, 0.6); }
.pal-card .els { position: absolute; top: 8px; left: 8px; display: flex; flex-direction: column; gap: 3px; }
.pal-card .els img { width: 20px; height: 20px; }
.pal-card .img img { width: 64px; height: 64px; border-radius: 50%; background: var(--panel-2); }
.pal-card .nm { font-size: 13px; font-weight: 700; text-align: center; margin-top: 8px; line-height: 1.3; }
.pal-card .nm .idx { color: var(--text-faint); font-weight: 400; font-size: 11px; }
.pal-card .rar {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; margin-top: 6px; padding: 2px 8px; border-radius: 20px;
  background: var(--panel-2); color: var(--text-dim);
}
.pal-card .rar b { color: var(--text); }
.pal-card .rar.rare { color: var(--rare); }
.pal-card .rar.epic { color: var(--epic); }
.pal-card .rar.legendary { color: var(--legendary); }
.pal-card .wks { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: 8px; min-height: 20px; }
.pal-card .wk { display: flex; align-items: center; gap: 2px; font-size: 11px; color: var(--text-dim); }
.pal-card .wk img { width: 16px; height: 16px; }
.pal-card .wk b { color: var(--green); }

/* ---------- detail page ---------- */
.loading { color: var(--text-dim); text-align: center; padding: 60px 0; }
.hero {
  display: flex;
  gap: 24px;
  align-items: center;
  background: linear-gradient(135deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
}
.hero.rare { border-color: rgba(88, 170, 233, 0.5); }
.hero.epic { border-color: rgba(195, 119, 242, 0.5); }
.hero.legendary { border-color: rgba(255, 179, 71, 0.6); }
.hero-img img { width: 120px; height: 120px; border-radius: 50%; background: var(--bg); border: 2px solid var(--border); }
.hero-info .no { color: var(--text-faint); font-size: 14px; }
.hero-info h1 { font-size: 34px; margin: 2px 0; }
.hero-info .prefix { color: var(--text-dim); font-style: italic; margin-bottom: 6px; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.rar-chip {
  padding: 4px 12px; border-radius: 20px; font-size: 13px;
  background: var(--panel); border: 1px solid var(--border); color: var(--text-dim);
}
.rar-chip.rare { color: var(--rare); border-color: var(--rare); }
.rar-chip.epic { color: var(--epic); border-color: var(--epic); }
.rar-chip.legendary { color: var(--legendary); border-color: var(--legendary); }
.el-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 20px; font-size: 13px;
  background: var(--panel); border: 1px solid var(--c, var(--border)); color: var(--c, var(--text-dim));
}
.el-chip img { width: 18px; height: 18px; }
.capture { color: var(--text-dim); font-size: 14px; }
.capture .dim { color: var(--text-faint); }

.grid-2 { display: grid; grid-template-columns: 1fr 1.2fr; gap: 20px; align-items: start; }
@media (max-width: 760px) {
  .grid-2 { grid-template-columns: 1fr; }
  .hero { flex-direction: column; text-align: center; }
  .hero-chips { justify-content: center; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 20px;
}
.panel h2 {
  font-size: 16px;
  color: var(--accent);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.none { color: var(--text-faint); }

.stats-table, .drop-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.stats-table td, .drop-table td, .drop-table th { padding: 7px 4px; border-bottom: 1px solid rgba(46, 82, 112, 0.4); }
.stats-table tr:last-child td, .drop-table tr:last-child td { border-bottom: none; }
.stats-table td:first-child { color: var(--text-dim); }
.stats-table td:last-child { text-align: right; font-weight: 700; color: var(--text); }
.drop-table th { text-align: left; color: var(--text-faint); font-weight: 600; font-size: 12px; }
.drop-table td:nth-child(2), .drop-table td:nth-child(3) { text-align: right; color: var(--text-dim); }

.work-list { display: flex; flex-direction: column; gap: 8px; }
.work-item { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.work-item img { width: 24px; height: 24px; }
.work-item span { color: var(--text-dim); flex: 1; }
.work-item b { color: var(--green); }

.lore {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.6;
  margin: 4px 0 10px;
  max-width: 620px;
  border-left: 3px solid var(--border);
  padding-left: 12px;
}
.en { color: var(--text-faint); font-size: 0.85em; }
.sk-desc { color: var(--text-dim); font-size: 13.5px; line-height: 1.6; margin: 6px 0 2px; }
.skill-block { padding: 6px 0; border-bottom: 1px solid rgba(46, 82, 112, 0.4); }
.skill-block:last-child { border-bottom: none; }

.combo-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid rgba(46, 82, 112, 0.4); }
.combo-row:last-child { border-bottom: none; }
.combo-pal {
  display: flex; align-items: center; gap: 8px;
  color: var(--text); text-decoration: none; font-size: 13px; font-weight: 600;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 5px 12px 5px 6px;
}
.combo-pal:hover { border-color: var(--accent); }
.combo-pal img { border-radius: 50%; background: var(--bg); }
.combo-op { color: var(--accent); font-weight: 800; font-size: 16px; }

.skill-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 4px 0; }
.sk-name { font-weight: 700; }
.sk-meta { color: var(--text-faint); font-size: 13px; }
.tag {
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text-dim); font-size: 12px; padding: 2px 10px; border-radius: 14px;
}

.active-skill { border-bottom: 1px solid rgba(46, 82, 112, 0.4); padding: 12px 0; }
.active-skill:last-child { border-bottom: none; }
.as-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sk-lv { color: var(--gold); font-size: 13px; margin-left: auto; }
.as-stats { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; color: var(--text-faint); }
.as-stats b { color: var(--text-dim); }

/* ---------- table page ---------- */
.container.wide { max-width: 1500px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
.pal-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 1100px; }
.pal-table th, .pal-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(46, 82, 112, 0.4);
  text-align: left;
  vertical-align: top;
}
.pal-table thead th {
  position: sticky; top: 0;
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  z-index: 5;
}
.pal-table th.sortable { cursor: pointer; user-select: none; }
.pal-table th.sortable:hover { color: var(--accent); }
.pal-table th.sortable::after { content: ' ↕'; color: var(--text-faint); }
.pal-table th.sortable.asc::after { content: ' ▲'; color: var(--accent); }
.pal-table th.sortable.desc::after { content: ' ▼'; color: var(--accent); }
.pal-table tbody tr:hover { background: rgba(23, 240, 255, 0.04); }
.pal-table tbody tr:last-child td { border-bottom: none; }
.cell-img img { border-radius: 50%; background: var(--panel-2); display: block; }
.cell-no { color: var(--text-faint); white-space: nowrap; }
.cell-name a { color: var(--text); font-weight: 700; text-decoration: none; font-size: 15px; }
.cell-name a:hover { color: var(--accent); }
.cell-prefix { color: var(--text-dim); font-style: italic; font-size: 12.5px; margin-top: 2px; }
.cell-els { white-space: nowrap; }
.el-chip.sm { font-size: 12px; padding: 2px 9px; }
.el-chip.sm img { width: 15px; height: 15px; }
.rar-chip.sm { font-size: 12px; padding: 2px 9px; white-space: nowrap; }
.cell-lore { color: var(--text-dim); line-height: 1.55; min-width: 260px; max-width: 360px; }
.cell-capture { white-space: nowrap; }
.cell-capture .dim { color: var(--text-faint); font-size: 12px; }
.cell-partner, .cell-passives { min-width: 240px; max-width: 340px; line-height: 1.55; }
.cell-desc { color: var(--text-dim); font-size: 12.5px; }
.cell-skill { margin-bottom: 6px; }
.cell-skill:last-child { margin-bottom: 0; }

/* ---------- teams page ---------- */
.cat-filter {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 14px;
}
.cat-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 20px;
  padding: 7px 16px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.15s;
}
.cat-btn:hover { border-color: var(--accent); color: var(--text); }
.cat-btn.on { border-color: var(--accent); background: rgba(23, 240, 255, 0.12); color: var(--accent); }
.cat-filter .count { margin-left: auto; margin-top: 0; }

.synergy-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  color: var(--text-faint); font-size: 12.5px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 22px;
}
.syn-tag {
  display: inline-block; padding: 1px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
  border: 1px solid var(--border); color: var(--text-dim);
}
.syn-tag.combo { color: #ffd95e; border-color: #ffd95e66; background: #ffd95e14; }
.syn-tag.buff { color: #7ef29b; border-color: #7ef29b66; background: #7ef29b14; }
.syn-tag.stack { color: #17f0ff; border-color: #17f0ff66; background: #17f0ff14; }
.syn-tag.pair { color: #c377f2; border-color: #c377f266; background: #c377f214; }
.syn-tag.heal { color: #8fe8ff; border-color: #8fe8ff66; background: #8fe8ff14; }
.syn-tag.warn { color: #ff7752; border-color: #ff775266; background: #ff775214; }

.team-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 24px;
}
.team-card h2 { font-size: 20px; color: var(--accent); margin-bottom: 4px; }
.team-concept { color: var(--text-dim); font-size: 14px; margin-bottom: 16px; }
.team-pals { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.team-pal {
  display: flex; flex-direction: column; align-items: center;
  width: 110px; padding: 12px 8px 10px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px;
  text-decoration: none; color: var(--text);
  transition: transform 0.12s, border-color 0.12s;
}
.team-pal:hover { transform: translateY(-3px); border-color: var(--accent); }
.team-pal.rare { border-color: rgba(88, 170, 233, 0.5); }
.team-pal.epic { border-color: rgba(195, 119, 242, 0.5); }
.team-pal.legendary { border-color: rgba(255, 179, 71, 0.6); }
.tp-img { position: relative; }
.tp-img > img { border-radius: 50%; background: var(--bg); display: block; }
.tp-els { position: absolute; bottom: -4px; right: -6px; display: flex; gap: 2px; }
.mini-el { width: 18px; height: 18px; }
.tp-name { font-size: 13px; font-weight: 700; margin-top: 8px; text-align: center; }
.tp-partner { font-size: 11px; color: var(--text-faint); text-align: center; margin-top: 2px; line-height: 1.3; }
.syn-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.syn-list li { color: var(--text-dim); font-size: 13.5px; line-height: 1.65; }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 18px 24px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}
