:root {
  --bg: #0d0d0d;
  --surface: #1a1a1a;
  --surface-2: #242424;
  --border: #2e2e2e;
  --text: #e8e8e8;
  --text-muted: #888;
  --accent: #7c4dff;
  --accent-hover: #9c6dff;
  --status-completed: #22c55e;
  --status-blocked: #f97316;
  --status-development: #6366f1;
  --radius: 8px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* Notice banner */
.notice-banner {
  background: rgba(249, 115, 22, 0.1);
  border-bottom: 1px solid rgba(249, 115, 22, 0.3);
  color: #fdba74;
  font-size: 13px;
  text-align: center;
  padding: 10px 32px;
}

.notice-banner strong {
  color: #fb923c;
  font-weight: 600;
}

/* Header */
header {
  border-bottom: 1px solid var(--border);
  padding: 24px 32px;
  background: var(--surface);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
}

header h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}

.subtitle {
  color: var(--text-muted);
  margin-top: 4px;
  font-size: 13px;
}

/* Main */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px;
}

/* Grid */
#games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

/* Card */
.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s;
}

.game-card:hover {
  border-color: #444;
}

.card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
}

.card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
}

/* Status Badge */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-completed {
  background: rgba(34, 197, 94, 0.15);
  color: var(--status-completed);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-blocked {
  background: rgba(249, 115, 22, 0.15);
  color: var(--status-blocked);
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.badge-development {
  background: rgba(99, 102, 241, 0.15);
  color: var(--status-development);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

/* Meta row */
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

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

.card-links {
  display: flex;
  gap: 10px;
}

.card-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  transition: color 0.15s;
}

.card-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.card-link-disabled {
  color: #6b7280;
  cursor: default;
  pointer-events: none;
}

.card-link-disabled:hover {
  color: #6b7280;
  text-decoration: none;
  cursor: default;
}

/* Tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Status note */
.status-note {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  background: var(--surface-2);
  border-left: 3px solid var(--border);
  padding: 6px 10px;
  border-radius: 0 4px 4px 0;
}

/* Panel buttons */
.card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}

.panel-btn {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: center;
}

.panel-btn:hover {
  background: #2e2e2e;
  border-color: #444;
}

.panel-btn.active {
  background: rgba(124, 77, 255, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

.panel-btn-disabled {
  color: #6b7280;
  cursor: default;
  pointer-events: none;
}

.panel-btn-disabled:hover {
  background: var(--surface-2);
  border-color: var(--border);
}

/* Collapsible panels */
.card-panel {
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.card-panel.open {
  max-height: 600px;
  overflow-y: auto;
}

.panel-inner {
  padding: 16px;
}

/* Loading / error states */
.panel-loading {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 16px;
}

.panel-error {
  color: #ef4444;
  font-size: 13px;
  padding: 12px;
  background: rgba(239, 68, 68, 0.08);
  border-radius: 4px;
}

/* Achievements */
.achievements-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.achievement-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.achievement-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  overflow: hidden;
}

.achievement-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.achievement-name {
  font-size: 13px;
  font-weight: 500;
}

.achievement-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Leaderboard */
.lb-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.lb-table-wrap {
  overflow-x: auto;
}

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

.lb-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

.lb-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(46, 46, 46, 0.5);
  vertical-align: middle;
}

.lb-table tr:last-child td {
  border-bottom: none;
}

.lb-rank {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  width: 36px;
}

.lb-address-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  font-family: 'Courier New', monospace;
  padding: 0;
  text-align: left;
  transition: color 0.15s;
}

.lb-address-btn:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.lb-score {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: sticky;
  top: 0;
  float: right;
  margin: 12px 12px 0 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 1;
}

.modal-close:hover {
  background: #333;
}

#modal-content {
  padding: 20px 24px 24px;
  clear: both;
}

/* Player modal content */
.player-name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
  word-break: break-all;
}

.player-address {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 16px;
  word-break: break-all;
}

.player-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.player-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 16px 0 8px;
}

.identity-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
  font-size: 13px;
}

.identity-label {
  color: var(--text-muted);
  min-width: 60px;
}

.earned-achievements {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.achievement-pill {
  background: rgba(124, 77, 255, 0.15);
  border: 1px solid rgba(124, 77, 255, 0.3);
  color: var(--accent);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
}

.no-achievements {
  color: var(--text-muted);
  font-size: 13px;
}

/* Footer */
footer {
  border-top: 1px solid var(--border);
  padding: 20px 32px;
  margin-top: 16px;
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
}

footer a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.15s;
}

footer a:hover {
  color: var(--text);
}

/* Responsive */
@media (max-width: 600px) {
  #games-grid {
    grid-template-columns: 1fr;
  }

  main {
    padding: 16px;
  }

  header {
    padding: 16px;
  }

  .player-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}
