:root {
  --bg: #090909;
  --surface: #111111;
  --surface-2: #161616;
  --border: #222222;
  --text: #ececec;
  --text-muted: #777777;
  --green: #4ade80;
  --green-dim: rgba(74, 222, 128, 0.12);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.12);
  --yellow: #facc15;
  --yellow-dim: rgba(250, 204, 21, 0.12);
  --gray: #737373;
  --gray-dim: rgba(115, 115, 115, 0.12);
  --cyan: #22d3ee;
  --cyan-dim: rgba(34, 211, 238, 0.1);
  --discord: #5865f2;
  --redis: #dc382d;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 2rem 1rem 2.5rem;
}

.header {
  margin-bottom: 1.75rem;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.header h1 {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.last-updated {
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

#refresh-btn,
.btn-secondary,
#report-submit,
#request-submit {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

#refresh-btn:hover,
.btn-secondary:hover,
#report-submit:hover,
#request-submit:hover {
  background: var(--surface-2);
  border-color: #333;
}

#report-submit:disabled,
#request-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.tabs {
  display: flex;
  gap: 0.375rem;
  margin-bottom: 1rem;
}

.tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
}

.tab:hover {
  color: var(--text);
  background: var(--surface);
}

.tab.active {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.summary-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.875rem;
}

.summary-item .value {
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.summary-item .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.toolbar {
  position: relative;
  margin-bottom: 0.5rem;
}

#search-input {
  width: 100%;
  padding: 0.625rem 2.25rem 0.625rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  transition: border-color 0.12s;
}

#search-input::placeholder {
  color: var(--text-muted);
}

#search-input:focus {
  outline: none;
  border-color: #333;
}

#search-input::-webkit-search-cancel-button {
  display: none;
}

.clear-search {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
}

.clear-search:hover {
  color: var(--text);
}

.search-results {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.banner {
  padding: 0.75rem 0.875rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.banner-error {
  background: var(--red-dim);
  border: 1px solid rgba(248, 113, 113, 0.2);
  color: var(--red);
}

.banner-notice {
  background: var(--cyan-dim);
  border: 1px solid rgba(34, 211, 238, 0.15);
  color: var(--cyan);
}

.hidden {
  display: none;
}

.server-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.server-card {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.875rem;
}

.server-card:hover {
  border-color: #2a2a2a;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.running { background: var(--green); }
.status-dot.offline { background: var(--red); }
.status-dot.starting,
.status-dot.stopping,
.status-dot.installing { background: var(--yellow); }
.status-dot.suspended,
.status-dot.unknown { background: var(--gray); }

.server-info {
  flex: 1;
  min-width: 0;
}

.server-name-row {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.server-name {
  font-weight: 500;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-badges {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.service-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.discord-icon { color: var(--discord); }
.redis-icon { color: var(--redis); }

.server-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
  font-variant-numeric: tabular-nums;
}

.server-meta span {
  white-space: nowrap;
}

.server-status {
  flex-shrink: 0;
}

.status-label {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.status-label.running { background: var(--green-dim); color: var(--green); }
.status-label.offline { background: var(--red-dim); color: var(--red); }
.status-label.starting,
.status-label.stopping,
.status-label.installing { background: var(--yellow-dim); color: var(--yellow); }
.status-label.suspended,
.status-label.unknown { background: var(--gray-dim); color: var(--gray); }

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.footer {
  margin-top: 2.5rem;
  text-align: center;
}

.footer-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.sponsor {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
}

.sponsor-logo {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  object-fit: cover;
}

.sponsor-text {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.broadcast {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.broadcast-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 0.625rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  text-align: center;
}

.broadcast-logo {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.broadcast-text {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.45;
}

.loading .server-list {
  opacity: 0.45;
  pointer-events: none;
}

.modal-dialog {
  width: min(100% - 2rem, 420px);
  max-height: calc(100vh - 2rem);
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  overflow: auto;
}

.modal-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.modal-dialog form {
  padding: 1rem;
}

.discord-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.75rem 0.875rem;
  background: rgba(88, 101, 242, 0.1);
  border: 1px solid rgba(88, 101, 242, 0.25);
  border-radius: 8px;
  margin-bottom: 0.875rem;
}

.discord-notice-icon {
  width: 18px;
  height: 18px;
  color: var(--discord);
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.discord-notice p {
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text);
}

.discord-notice strong {
  color: var(--discord);
  font-weight: 600;
}

.field input[type="text"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  padding: 0.5rem 0.625rem;
}

.field input[type="text"]:focus {
  outline: none;
  border-color: #333;
}

.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  pointer-events: none;
}

.toast {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 260px;
  max-width: 360px;
  padding: 0.875rem 1rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  animation: toast-in 0.25s ease-out;
}

.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  background: var(--green-dim);
  color: var(--green);
  flex-shrink: 0;
}

.toast-icon svg {
  width: 0.875rem;
  height: 0.875rem;
}

.toast-message {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 100%;
  background: var(--green);
  transform-origin: left center;
  animation: toast-progress 4s linear forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(0.75rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-progress {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.dialog-header h2 {
  font-size: 0.9375rem;
  font-weight: 600;
}

.dialog-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.125rem 0.375rem;
}

.field {
  display: block;
  margin-bottom: 0.875rem;
}

.field span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}

.field select,
.field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  padding: 0.5rem 0.625rem;
}

.field textarea {
  resize: vertical;
  min-height: 96px;
}

.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: #333;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.report-feedback {
  font-size: 0.8125rem;
  margin-top: 0.25rem;
}

.report-feedback.is-error {
  color: var(--red);
}

.report-feedback.is-success {
  color: var(--green);
}

@media (max-width: 600px) {
  .summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .header-row {
    flex-wrap: wrap;
  }

  .server-card {
    flex-wrap: wrap;
  }

  .server-status {
    width: 100%;
    padding-left: calc(7px + 0.875rem);
  }
}
