@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Roboto+Mono:wght@400;700&display=swap');

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

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Roboto Mono', monospace;
  background: #3a3a3a;
  color: #000;
}

#canvas-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
}

#ui {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  padding: 16px;
}

#ui > * {
  pointer-events: auto;
}

.paint-header {
  text-align: center;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.88);
  border: 4px solid #000;
  padding: 6px 20px 4px;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
  position: relative;
}

.paint-header h1 {
  font-family: 'Press Start 2P', monospace;
  font-size: 20px;
  margin: 0;
  color: #000;
  text-shadow: 3px 3px 0 #c0c0c0;
  letter-spacing: 1px;
}

.paint-header .subtitle {
  font-family: 'Roboto Mono', monospace;
  font-size: 11px;
  margin: 4px 0 0;
  color: #555;
}

.table-wrap {
  max-height: 62vh;
  overflow-y: auto;
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.85);
  border: 4px solid #000;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
  position: relative;
  width: 100%;
  max-width: 900px;
}

.table-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.table-wrap::-webkit-scrollbar-track {
  background: rgba(224, 224, 224, 0.6);
  border-left: 2px solid #000;
}
.table-wrap::-webkit-scrollbar-thumb {
  background: rgba(192, 192, 192, 0.8);
  border: 2px solid #000;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 560px;
}

thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

th {
  background: #000;
  color: #fff;
  font-weight: 700;
  padding: 7px 10px;
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

th:not(:last-child) {
  border-right: 2px solid #555;
}

td {
  padding: 5px 10px;
  white-space: nowrap;
  border-bottom: 1px solid rgba(200, 200, 200, 0.5);
  background: rgba(255, 255, 255, 0.7);
}

tr:nth-child(even) td {
  background: rgba(240, 240, 240, 0.7);
}

tr:hover td {
  background: rgba(255, 255, 204, 0.9);
}

td:first-child {
  font-weight: 700;
  color: #888;
  width: 30px;
  text-align: center;
}

td:nth-child(2) {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

td:nth-child(2) a {
  color: #000;
  text-decoration: underline;
  text-decoration-style: wavy;
  text-underline-offset: 3px;
}

td:nth-child(2) a:hover {
  background: #ffff00;
  text-decoration: none;
}

td:nth-child(3) { color: #c0392b; font-weight: 700; }
td:nth-child(4) { color: #7f8c8d; }
td:nth-child(5) { font-weight: 700; }
td:nth-child(6) { color: #27ae60; }
td:nth-child(7) { color: #e67e22; }

.top1 td:first-child {
  color: #f1c40f;
  text-shadow: 1px 1px 0 #000;
  font-size: 15px;
}
.top2 td:first-child { color: #bdc3c7; }
.top3 td:first-child { color: #e67e22; }

.paint-footer {
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.88);
  border: 3px solid #000;
  padding: 3px 14px;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
  font-size: 10px;
  color: #888;
}

.paint-header::before {
  content: '';
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border: 2px dashed #c0392b;
  pointer-events: none;
  border-radius: 2px;
}

.paint-header::after {
  content: '//';
  position: absolute;
  top: -12px;
  right: -12px;
  font-size: 14px;
  color: #c0392b;
  font-weight: 700;
  transform: rotate(15deg);
}

#loading, #error, #empty {
  background: rgba(255, 255, 255, 0.88);
  border: 4px solid #000;
  padding: 18px 36px;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  text-align: center;
}

#error { color: #c0392b; }
#empty { color: #7f8c8d; }

.hidden { display: none !important; }

/* Mobile */
@media (max-width: 768px) {
  #ui {
    padding: 8px;
    justify-content: flex-start;
    padding-top: 12px;
  }

  .paint-header {
    margin-bottom: 8px;
    padding: 4px 12px 3px;
  }

  .paint-header h1 {
    font-size: 12px;
    text-shadow: 2px 2px 0 #c0c0c0;
  }

  .paint-header .subtitle {
    font-size: 9px;
  }

  .paint-header::before {
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
  }

  .paint-header::after {
    display: none;
  }

  .table-wrap {
    max-height: 55vh;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
  }

  table {
    font-size: 11px;
    min-width: 480px;
  }

  th {
    padding: 5px 6px;
    font-size: 9px;
  }

  td {
    padding: 4px 6px;
  }

  td:first-child {
    width: 24px;
    font-size: 11px;
  }

  td:nth-child(2) {
    max-width: 120px;
  }

  #loading, #error, #empty {
    padding: 12px 20px;
    font-size: 9px;
  }

  .paint-footer {
    font-size: 8px;
    padding: 2px 10px;
  }
}

@media (max-width: 480px) {
  .table-wrap {
    max-height: 50vh;
  }

  table {
    font-size: 10px;
    min-width: 400px;
  }

  th {
    padding: 4px 4px;
    font-size: 8px;
  }

  td {
    padding: 3px 4px;
  }

  td:nth-child(2) {
    max-width: 80px;
  }
}
