/* ------- Minecraft-ish whimsical theme ------- */

:root {
  --grass-top: #7cbd3f;
  --grass-shadow: #5a9f2a;
  --dirt: #866043;
  --dirt-dark: #5a3f2a;
  --stone: #8d8d8d;
  --stone-dark: #4f4f4f;
  --oak: #b38a54;
  --oak-dark: #7a5a32;
  --bg: #efe4c9;                /* parchment-y sand */
  --bg-shade: #e3d5b2;
  --ink: #1f1a14;
  --ink-soft: #4a3e2c;
  --accent: #d94a2b;            /* redstone */
  --accent-soft: #f5a623;       /* torch glow */
  --diamond: #4cd6d6;
  --panel: #fbf4df;
  --panel-border: #8d6a3a;
  --panel-shadow: #3a2b1b;
  --shame: #c0392b;
  --shame-soft: #f3c4be;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'VT323', 'Courier New', monospace;
  font-size: 20px;
  line-height: 1.45;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    repeating-linear-gradient(45deg, rgba(0,0,0,0.025) 0 2px, transparent 2px 6px),
    repeating-linear-gradient(-45deg, rgba(0,0,0,0.025) 0 2px, transparent 2px 6px);
  image-rendering: pixelated;
  min-height: 100vh;
}

img { image-rendering: pixelated; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ------- Header ------- */

.site-header {
  background: linear-gradient(var(--grass-top), var(--grass-shadow) 70%, var(--dirt) 70%, var(--dirt-dark));
  border-bottom: 4px solid var(--panel-shadow);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 4px 0 rgba(0,0,0,0.12);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
}

.logo-block {
  display: inline-block;
  width: 40px;
  height: 40px;
  background:
    linear-gradient(var(--grass-top), var(--grass-top) 25%, var(--dirt) 25%, var(--dirt));
  border: 2px solid var(--panel-shadow);
  box-shadow: inset -3px -3px 0 rgba(0,0,0,0.2), inset 3px 3px 0 rgba(255,255,255,0.15);
}

.logo-text {
  font-family: 'Press Start 2P', 'VT323', monospace;
  font-size: 16px;
  letter-spacing: 1px;
}

.site-nav {
  display: flex;
  gap: 14px;
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
}

.site-nav a {
  color: #fff;
  text-decoration: none;
  padding: 10px 14px;
  background: var(--oak-dark);
  border: 2px solid var(--panel-shadow);
  box-shadow: inset -2px -2px 0 rgba(0,0,0,0.25), inset 2px 2px 0 rgba(255,255,255,0.15);
  text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
  transition: transform 0.05s;
}

.site-nav a:hover,
.site-nav a.active {
  background: var(--accent-soft);
  color: var(--ink);
  text-shadow: none;
  transform: translateY(-1px);
}

/* ------- Hero + typography ------- */

.hero {
  padding: 36px 0 12px;
}

.hero h1,
.section-title,
.panel h1,
.panel h2,
.panel h3 {
  font-family: 'Press Start 2P', monospace;
  letter-spacing: 1px;
  line-height: 1.4;
  margin: 0 0 10px;
}

.hero h1 { font-size: 28px; }
.section-title { font-size: 16px; margin: 28px 0 14px; }
.panel h3 { font-size: 13px; }

.lede {
  font-size: 22px;
  color: var(--ink-soft);
  margin: 0;
}

.shame-hero h1 { color: var(--shame); }

.muted { color: var(--ink-soft); opacity: 0.8; }
.tiny { font-size: 14px; }

/* ------- Panels ------- */

.panel {
  background: var(--panel);
  border: 3px solid var(--panel-border);
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow:
    inset -3px -3px 0 rgba(0,0,0,0.08),
    inset 3px 3px 0 rgba(255,255,255,0.4),
    6px 6px 0 rgba(58,43,27,0.25);
  position: relative;
}

.panel.error { border-color: var(--shame); }

/* ------- Cards: players ------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.player-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: var(--panel);
  border: 3px solid var(--panel-border);
  text-decoration: none;
  color: var(--ink);
  box-shadow:
    inset -2px -2px 0 rgba(0,0,0,0.08),
    inset 2px 2px 0 rgba(255,255,255,0.35),
    4px 4px 0 rgba(58,43,27,0.2);
  transition: transform 0.07s, box-shadow 0.07s;
}

.player-card:hover {
  transform: translate(-2px, -2px);
  box-shadow:
    inset -2px -2px 0 rgba(0,0,0,0.08),
    inset 2px 2px 0 rgba(255,255,255,0.35),
    6px 6px 0 rgba(58,43,27,0.25);
}

.avatar {
  width: 56px;
  height: 56px;
  border: 2px solid var(--panel-shadow);
  background: var(--bg-shade);
  flex-shrink: 0;
}

.player-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  margin-bottom: 4px;
}

.player-sub { font-size: 16px; color: var(--ink-soft); }

/* ------- Boards ------- */

.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.board .board-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px dashed var(--panel-border);
}

.board-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}

.board-desc { margin: 0; font-size: 15px; color: var(--ink-soft); }

.board-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.board-list li {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px dotted rgba(0,0,0,0.15);
}

.board-list li:last-child { border-bottom: none; }

.rank {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: var(--accent);
}

.board-list li:nth-child(1) .rank { color: #f1c40f; }
.board-list li:nth-child(2) .rank { color: #bdc3c7; }
.board-list li:nth-child(3) .rank { color: #cd7f32; }

.board-name { color: var(--ink); text-decoration: none; border-bottom: 1px solid transparent; }
.board-name:hover { border-bottom-color: var(--accent); }

.board-value {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: var(--ink-soft);
}

.board.shame { border-color: var(--shame); background: var(--shame-soft); }
.board.shame h3 { color: var(--shame); }

/* ------- Death by ------- */

.death-by h2 { color: var(--shame); }

.death-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.death-list li {
  padding: 8px 0;
  border-bottom: 1px dotted rgba(0,0,0,0.15);
  font-size: 18px;
}

.death-list .mob {
  background: var(--ink);
  color: #fff;
  padding: 2px 6px;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
}

.death-count {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--accent);
}

/* ------- Player page ------- */

.player-header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.player-body {
  height: 180px;
  width: auto;
  background: var(--bg-shade);
  padding: 6px;
  border: 2px solid var(--panel-shadow);
}

.player-header-text h1 {
  font-size: 22px;
  margin: 0 0 8px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-tile {
  background: var(--panel);
  border: 3px solid var(--panel-border);
  padding: 14px;
  text-align: center;
  box-shadow:
    inset -2px -2px 0 rgba(0,0,0,0.08),
    inset 2px 2px 0 rgba(255,255,255,0.35);
}

.stat-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--ink-soft);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.stat-value {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  color: var(--accent);
}

.roast {
  background: #fff4c4;
  border-color: var(--accent-soft);
  font-size: 18px;
}

/* ------- Tabs ------- */

.tabs-section { margin-top: 24px; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 0;
}

.tab {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  background: var(--oak);
  color: #fff;
  border: 2px solid var(--panel-shadow);
  border-bottom: none;
  padding: 10px 14px;
  cursor: pointer;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.4);
  box-shadow: inset -2px -2px 0 rgba(0,0,0,0.2), inset 2px 2px 0 rgba(255,255,255,0.2);
}

.tab:hover { background: var(--oak-dark); }
.tab.active {
  background: var(--panel);
  color: var(--ink);
  text-shadow: none;
  position: relative;
  top: 2px;
}

.tab-count {
  font-size: 8px;
  opacity: 0.7;
  margin-left: 4px;
}

.tab-panel {
  display: none;
  background: var(--panel);
  border: 3px solid var(--panel-border);
  padding: 16px;
  box-shadow:
    inset -3px -3px 0 rgba(0,0,0,0.08),
    inset 3px 3px 0 rgba(255,255,255,0.4);
}

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

.table-controls {
  margin-bottom: 10px;
}

.tab-search {
  font-family: 'VT323', monospace;
  font-size: 18px;
  padding: 6px 10px;
  border: 2px solid var(--panel-shadow);
  background: var(--bg);
  color: var(--ink);
  width: 100%;
  max-width: 320px;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
}

.stats-table th,
.stats-table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px dotted rgba(0,0,0,0.15);
}

.stats-table th {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  cursor: pointer;
  user-select: none;
  background: var(--bg-shade);
  position: relative;
}

.stats-table th:hover { background: var(--accent-soft); }

.stats-table th.sorted-asc::after { content: ' ▲'; }
.stats-table th.sorted-desc::after { content: ' ▼'; }

.stats-table td.num {
  font-family: 'VT323', monospace;
  font-size: 20px;
  text-align: right;
  color: var(--accent);
}

/* ------- Buttons ------- */

.button {
  display: inline-block;
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  padding: 10px 14px;
  background: var(--oak);
  color: #fff;
  text-decoration: none;
  border: 2px solid var(--panel-shadow);
  box-shadow: inset -2px -2px 0 rgba(0,0,0,0.2), inset 2px 2px 0 rgba(255,255,255,0.2);
  text-shadow: 1px 1px 0 rgba(0,0,0,0.4);
}

.button:hover { background: var(--accent-soft); color: var(--ink); text-shadow: none; }

/* ------- Footer ------- */

.site-footer {
  margin-top: 60px;
  padding: 24px 0;
  background: var(--dirt-dark);
  color: #e8d8b8;
  font-size: 16px;
  border-top: 4px solid var(--panel-shadow);
}

.site-footer p { margin: 4px 0; }

/* ------- Responsive nudges ------- */

@media (max-width: 600px) {
  body { font-size: 18px; }
  .hero h1 { font-size: 20px; }
  .logo-text { font-size: 12px; }
  .site-nav { font-size: 9px; }
  .player-header-inner { gap: 14px; }
  .player-body { height: 140px; }
}
