/* ═══════════════════════════════════════════════
   ePT Ranking — Priston Tale  |  style.css
   Dark Fantasy MMORPG Theme
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900&family=Crimson+Pro:ital,wght@0,300;0,400;0,600;1,400&display=swap');

:root {
  --bg:          #0d0d10;
  --bg2:         #13131a;
  --bg3:         #1a1a24;
  --surface:     #1e1e2a;
  --surface2:    #252535;
  --border:      #2e2e42;
  --border2:     #3a3a52;

  --gold:        #c9932a;
  --gold-light:  #e8b84b;
  --gold-dim:    #8a6520;
  --gold-glow:   rgba(201,147,42,0.15);

  --green:       #3a8c4e;
  --green-light: #52c46e;

  --text:        #d4cfc7;
  --text-muted:  #7a7590;
  --text-dim:    #4a4760;

  --rank-gold:   #ffd700;
  --rank-silver: #c0c0c0;
  --rank-bronze: #cd7f32;

  --radius:      4px;
  --font-head:   'Cinzel', serif;
  --font-body:   'Crimson Pro', Georgia, serif;

  /* ── Class Colours (edit these or use the in-page colour picker) ── */
  /* Morion Tribe */
  --cls-Knight:        #7aa8d8;
  --cls-Priestess:     #e8c870;
  --cls-Magician:      #b060f0;
  --cls-Shaman:        #a070d0;
  --cls-Atalanta:      #e060a0;
  /* Tempskron Tribe */
  --cls-Fighter:       #e07070;
  --cls-Pikeman:       #d0a050;
  --cls-Mechanician:   #70a0e0;
  --cls-MartialArtist: #e08c3a;
  --cls-Archer:        #80c060;
  --cls-Assassin:      #90a090;
}

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

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 40% at 50% -10%, rgba(201,147,42,0.07) 0%, transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ─── LAYOUT ─────────────────────────────────────── */

/* Outer three-column wrapper: [ad] [content] [ad] */
.page-outer {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 0;
  width: 100%;
}

.site-wrap {
  flex: 1 1 auto;
  max-width: 960px;
  min-width: 0;
  padding: 0 16px 48px;
}

/* ─── AD SIDEBARS ────────────────────────────────── */
.ad-sidebar {
  flex: 0 0 160px;
  width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 32px;
}

.ad-sidebar-sticky {
  position: sticky;
  top: 24px;
}

.ad-sidebar ins.adsbygoogle {
  display: block;
  width: 160px;
  height: 600px;
}

/* Hide sidebars when viewport is too narrow to fit them */
@media (max-width: 1299px) {
  .ad-sidebar { display: none; }
}

/* ─── HEADER ─────────────────────────────────────── */
.site-header {
  text-align: center;
  padding: 32px 16px 0;
  position: relative;
}
.site-header::after {
  content: '';
  display: block;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 18px 0 0;
  opacity: 0.6;
}
.site-title {
  font-family: var(--font-head);
  font-size: clamp(22px, 5vw, 36px);
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-light);
  text-shadow: 0 0 30px rgba(232,184,75,0.3), 0 2px 4px rgba(0,0,0,0.8);
  line-height: 1.2;
}
.site-subtitle {
  font-family: var(--font-head);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── NAV ────────────────────────────────────────── */
.site-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 14px 0 0;
}
.site-nav a {
  font-family: var(--font-head);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: color .2s, border-color .2s, background .2s;
}
.site-nav a:hover,
.site-nav a.active {
  color: var(--gold-light);
  border-color: var(--gold-dim);
  background: var(--gold-glow);
}

/* ─── INFO BAR ───────────────────────────────────── */
.info-bar {
  text-align: center;
  padding: 16px 0 4px;
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}
.info-bar a { color: var(--gold-dim); text-decoration: none; }
.info-bar a:hover { color: var(--gold-light); }

/* ─── STATS ROW ──────────────────────────────────── */
.stats-row {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  padding: 14px 0 0;
}
.stat-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 16px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-pill strong { color: var(--gold-light); font-family: var(--font-head); font-size: 14px; }

/* ─── DIVIDER ────────────────────────────────────── */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border2), transparent);
  margin: 20px 0;
}

/* ─── SECTION HEADING ────────────────────────────── */
.section-heading {
  font-family: var(--font-head);
  font-size: 13px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-heading::before,
.section-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── SEARCH BAR ─────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 16px 0;
}
.search-bar input {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  padding: 8px 14px;
  width: 260px;
  outline: none;
  transition: border-color .2s;
}
.search-bar input:focus { border-color: var(--gold-dim); }
.search-bar input::placeholder { color: var(--text-dim); }
.btn {
  font-family: var(--font-head);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--surface2);
  border: 1px solid var(--gold-dim);
  color: var(--gold-light);
  padding: 8px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background .2s, border-color .2s;
}
.btn:hover { background: var(--gold-glow); border-color: var(--gold-light); }
.btn-sm { font-size: 10px; padding: 5px 12px; }
.btn-ghost {
  background: transparent;
  border-color: var(--border2);
  color: var(--text-muted);
}
.btn-ghost:hover { border-color: var(--gold-dim); color: var(--gold-light); background: var(--gold-glow); }

/* ─── MAIN TABLE ─────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg2);
}
table.rank-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.rank-table thead th {
  font-family: var(--font-head);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold-dim);
  padding: 10px 12px;
  text-align: left;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color .2s;
}
table.rank-table thead th:hover { color: var(--gold-light); }
table.rank-table thead th .sort-icon { opacity: 0.4; margin-left: 4px; }
table.rank-table thead th.sorted { color: var(--gold-light); }
table.rank-table thead th.sorted .sort-icon { opacity: 1; }

table.rank-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
table.rank-table tbody tr:last-child { border-bottom: none; }
table.rank-table tbody tr:hover { background: rgba(201,147,42,0.04); }
table.rank-table tbody td {
  padding: 9px 12px;
  vertical-align: middle;
}
table.rank-table tbody td.td-rank {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  width: 60px;
  text-align: center;
}
td.td-rank.r1 { color: var(--rank-gold); text-shadow: 0 0 8px rgba(255,215,0,0.4); }
td.td-rank.r2 { color: var(--rank-silver); }
td.td-rank.r3 { color: var(--rank-bronze); }

table.rank-table tbody td.td-name a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  transition: color .15s;
}
table.rank-table tbody td.td-name a:hover { color: var(--gold-light); }

table.rank-table tbody td.td-clan a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  transition: color .15s;
}
table.rank-table tbody td.td-clan a:hover { color: var(--green-light); }

.class-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border2);
  color: var(--text-muted);
  background: var(--surface);
  letter-spacing: 0.04em;
  font-family: var(--font-head);
}
/* Morion Tribe */
.class-badge.Knight       { border-color: color-mix(in srgb, var(--cls-Knight) 60%, #000);       color: var(--cls-Knight);       background: color-mix(in srgb, var(--cls-Knight) 18%, transparent); }
.class-badge.Priestess    { border-color: color-mix(in srgb, var(--cls-Priestess) 60%, #000);    color: var(--cls-Priestess);    background: color-mix(in srgb, var(--cls-Priestess) 18%, transparent); }
.class-badge.Magician     { border-color: color-mix(in srgb, var(--cls-Magician) 60%, #000);     color: var(--cls-Magician);     background: color-mix(in srgb, var(--cls-Magician) 18%, transparent); }
.class-badge.Shaman       { border-color: color-mix(in srgb, var(--cls-Shaman) 60%, #000);       color: var(--cls-Shaman);       background: color-mix(in srgb, var(--cls-Shaman) 18%, transparent); }
.class-badge.Atalanta     { border-color: color-mix(in srgb, var(--cls-Atalanta) 60%, #000);     color: var(--cls-Atalanta);     background: color-mix(in srgb, var(--cls-Atalanta) 18%, transparent); }
/* Tempskron Tribe */
.class-badge.Fighter      { border-color: color-mix(in srgb, var(--cls-Fighter) 60%, #000);      color: var(--cls-Fighter);      background: color-mix(in srgb, var(--cls-Fighter) 18%, transparent); }
.class-badge.Pikeman      { border-color: color-mix(in srgb, var(--cls-Pikeman) 60%, #000);      color: var(--cls-Pikeman);      background: color-mix(in srgb, var(--cls-Pikeman) 18%, transparent); }
.class-badge.Mechanician  { border-color: color-mix(in srgb, var(--cls-Mechanician) 60%, #000);  color: var(--cls-Mechanician);  background: color-mix(in srgb, var(--cls-Mechanician) 18%, transparent); }
.class-badge.MartialArtist{ border-color: color-mix(in srgb, var(--cls-MartialArtist) 60%, #000);color: var(--cls-MartialArtist);background: color-mix(in srgb, var(--cls-MartialArtist) 18%, transparent); }
.class-badge.Archer       { border-color: color-mix(in srgb, var(--cls-Archer) 60%, #000);       color: var(--cls-Archer);       background: color-mix(in srgb, var(--cls-Archer) 18%, transparent); }
.class-badge.Assassin     { border-color: color-mix(in srgb, var(--cls-Assassin) 60%, #000);     color: var(--cls-Assassin);     background: color-mix(in srgb, var(--cls-Assassin) 18%, transparent); }

.td-level {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  color: var(--green-light);
  text-align: center;
}
.level-gain {
  color: var(--green-light);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 13px;
}
.level-gain::before { content: '+'; }

/* ─── PAGINATION ─────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 18px 0 0;
}
.pg-btn {
  font-family: var(--font-head);
  font-size: 10px;
  letter-spacing: 0.1em;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 5px 11px;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
}
.pg-btn:hover { border-color: var(--gold-dim); color: var(--gold-light); background: var(--gold-glow); }
.pg-btn.active { border-color: var(--gold); color: var(--gold-light); background: var(--gold-glow); }
.pg-btn:disabled { opacity: 0.35; cursor: default; }
.pg-info { font-size: 12px; color: var(--text-dim); padding: 0 6px; }

/* ─── CHAR / CLAN PAGE ───────────────────────────── */
.page-hero {
  text-align: center;
  padding: 20px 0 10px;
}
.page-hero-title {
  font-family: var(--font-head);
  font-size: clamp(20px, 4vw, 30px);
  color: var(--gold-light);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.page-hero-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}
.char-stats {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin: 14px 0;
}
.char-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 20px;
  text-align: center;
}
.char-stat-label {
  font-family: var(--font-head);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 2px;
}
.char-stat-value {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  color: var(--gold-light);
}

/* ─── CLASS GRID ─────────────────────────────────── */
.class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin: 16px 0;
}
.class-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 18px;
  text-decoration: none;
  display: block;
  transition: border-color .2s, background .2s;
}
.class-card:hover { border-color: var(--gold-dim); background: var(--gold-glow); }
.class-card-name {
  font-family: var(--font-head);
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
}
.class-card-count {
  font-size: 12px;
  color: var(--text-muted);
}
.class-card-count strong { color: var(--gold-light); font-family: var(--font-head); }

/* ─── LOADING / EMPTY ────────────────────────────── */
.loading-row td,
.empty-row td {
  text-align: center;
  padding: 32px !important;
  color: var(--text-dim);
  font-style: italic;
}
.loading-row td::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border2);
  border-top-color: var(--gold-dim);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 10px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── BREADCRUMB ─────────────────────────────────── */
.breadcrumb {
  font-size: 12px;
  color: var(--text-dim);
  padding: 14px 0 0;
}
.breadcrumb a { color: var(--gold-dim); text-decoration: none; }
.breadcrumb a:hover { color: var(--gold-light); }
.breadcrumb span { margin: 0 5px; }

/* ─── FOOTER ─────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 24px 0 0;
  font-size: 12px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  margin-top: 32px;
}
.site-footer a { color: var(--gold-dim); text-decoration: none; }
.site-footer a:hover { color: var(--gold-light); }

/* ─── RESPONSIVE ─────────────────────────────────── */
@media (max-width: 600px) {
  .hide-mobile { display: none !important; }
  .search-bar input { width: 100%; }
}

/* ─── CLICKABLE CLASS & LEVEL HOVER EFFECTS ──────────────────────── */
a .class-badge {
  transition: filter .18s, box-shadow .18s, border-color .18s;
}
a:hover .class-badge {
  filter: brightness(1.55) saturate(1.3);
  box-shadow: 0 0 8px currentColor;
}

.td-level a {
  transition: color .18s, text-shadow .18s;
  display: block;
}
.td-level a:hover {
  color: #a8ffbe !important;
  text-shadow: 0 0 10px rgba(130,255,180,0.7);
}
/* ─── COLOUR CUSTOMIZER PANEL ────────────────────────────────────── */
.colour-btn {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 900;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
  transition: border-color .2s, background .2s;
}
.colour-btn:hover { border-color: var(--gold-dim); background: var(--bg3); }

.colour-panel {
  position: fixed;
  bottom: 72px;
  right: 18px;
  z-index: 901;
  width: 300px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  padding: 16px;
  display: none;
  max-height: 80vh;
  overflow-y: auto;
}
.colour-panel.open { display: block; }
.colour-panel-title {
  font-family: var(--font-head);
  font-size: 11px;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 14px;
  text-align: center;
}
.colour-tribe-label {
  font-family: var(--font-head);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 10px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.colour-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
}
.colour-row label {
  flex: 1;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}
.colour-row input[type=color] {
  width: 32px;
  height: 24px;
  border: 1px solid var(--border2);
  border-radius: 3px;
  cursor: pointer;
  background: none;
  padding: 1px;
}
.colour-panel-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.colour-panel-actions button {
  flex: 1;
  padding: 6px 0;
  font-family: var(--font-head);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text-muted);
  transition: background .18s, color .18s, border-color .18s;
}
.colour-panel-actions button.primary {
  background: var(--gold-glow);
  border-color: var(--gold-dim);
  color: var(--gold-light);
}
.colour-panel-actions button:hover { border-color: var(--gold-dim); color: var(--gold-light); }

/* ─── TRIBE GROUPING (classPage overview) ────────────────────────── */
.tribe-block {
  margin: 18px 0 24px;
}
.tribe-label {
  font-family: var(--font-head);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 12px;
  border-left: 3px solid;
}
.tribe-morion {
  color: #a0c8f0;
  border-color: #4a7aaa;
  background: rgba(74,122,170,0.12);
}
.tribe-tempskron {
  color: #f0c880;
  border-color: #aa7a30;
  background: rgba(170,122,48,0.12);
}

