:root {
  --bg: #0d1117;
  --bg-elevated: #161b22;
  --bg-hover: #21262d;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #f0c14b;
  --accent-hover: #ffd666;
  --accent-dim: rgba(240, 193, 75, 0.15);
  --success: #3fb950;
  --danger: #f85149;
  --radius: 10px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

/* Header */
.header {
  padding: 28px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-img {
  height: 52px;
  width: auto;
  display: block;
  border-radius: 6px;
  flex-shrink: 0;
}

.logo-text h1 {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.tagline {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 3px;
}

.copyable {
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  border-radius: 4px;
  padding: 2px 6px;
  margin: -2px -6px;
}

.copyable:hover {
  background: var(--accent-dim);
  color: var(--accent);
}

.copyable-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.copy-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.15s;
}

.copyable-row:hover .copy-hint {
  opacity: 1;
}

.header-actions {
  display: flex;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #0d1117;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn .icon {
  font-size: 1.1em;
  line-height: 1;
}

/* Stats */
.stats-bar {
  display: flex;
  gap: 24px;
  padding: 16px 0;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Section */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.section-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
}

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Inputs */
.input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.input:focus {
  border-color: var(--accent);
}

.input::placeholder {
  color: var(--text-muted);
}

.search-input {
  min-width: 220px;
}

.select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b949e' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

textarea.input {
  resize: vertical;
  min-height: 60px;
}

/* Table */
.table-wrapper {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  min-height: 180px;
}

.server-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.server-table th {
  text-align: left;
  padding: 12px 16px;
  background: rgba(0,0,0,0.25);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

.server-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.server-table tbody tr {
  transition: background 0.12s;
}

.server-table tbody tr:hover {
  background: var(--bg-hover);
}

.server-name {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lock-icon {
  font-size: 0.85em;
  opacity: 0.8;
}

.players-cell {
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.players-cell .full {
  color: var(--danger);
}

.ip-cell {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.region-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--accent-dim);
  color: var(--accent);
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--success);
}

.status-dot::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.desc-cell {
  color: var(--text-muted);
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
}

.empty-state.hidden {
  display: none;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.7;
}

.empty-state h3 {
  margin-bottom: 6px;
}

.empty-state p {
  color: var(--text-muted);
  margin-bottom: 18px;
}

/* How-to */
.howto-section {
  margin-top: 40px;
}

.howto-section h2 {
  font-size: 1.15rem;
  margin-bottom: 16px;
}

.howto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.howto-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.howto-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #0d1117;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.howto-card h3 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.howto-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.howto-card kbd {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 0.8em;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-size: 1.2rem;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.btn-close:hover {
  color: var(--text);
}

.form-row {
  margin-bottom: 14px;
}

.form-row label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.form-row .input {
  width: 100%;
}

.form-row.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.checkbox-row {
  display: flex;
  align-items: flex-end;
  padding-bottom: 4px;
}

.checkbox-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text);
  font-size: 0.9rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.form-hint {
  margin-top: 14px;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 200;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  animation: toast-in 0.25s ease;
}

.toast.hidden {
  display: none;
}

.toast.success {
  border-color: var(--success);
}

.toast.error {
  border-color: var(--danger);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Footer */
.footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 700px) {
  .server-table th:nth-child(5),
  .server-table td:nth-child(5),
  .server-table th:nth-child(6),
  .server-table td:nth-child(6) {
    display: none;
  }

  .form-row.two-cols {
    grid-template-columns: 1fr;
  }

  .search-input {
    min-width: 100%;
  }
}

/* Join Modal */
.join-modal-content {
  max-width: 520px;
}

.join-server-info {
  margin-bottom: 20px;
}

.join-ip-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  flex-wrap: wrap;
}

.join-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.join-ip-box code {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
  flex: 1;
  min-width: 140px;
}

.join-steps {
  margin-bottom: 20px;
}

.join-steps h3 {
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.join-steps ol {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.join-steps li {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.join-steps li strong {
  color: var(--text);
}

.join-steps kbd {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 0.8em;
}

.join-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.network-id {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 3px;
  opacity: 0.85;
}

.ping-cell {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.ping-good { color: #3fb950; }
.ping-ok { color: var(--accent); }
.ping-high { color: #f85149; }

.status-dot.offline {
  color: var(--text-muted);
}

.status-dot.offline::before {
  background: var(--text-muted);
  box-shadow: none;
}

.footer-credit {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-credit {
  color: var(--accent);
  opacity: 0.9;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.howto-card.animate-in {
  opacity: 0;
  animation: fadeUp 0.55s ease forwards;
  animation-delay: var(--delay, 0ms);
}

.header {
  animation: fadeUp 0.45s ease both;
}

.stats-bar {
  animation: fadeUp 0.5s ease both;
  animation-delay: 80ms;
}

.server-list-section {
  animation: fadeUp 0.5s ease both;
  animation-delay: 140ms;
}
