:root {
  color-scheme: dark;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 400;
  line-height: 1.5;
  background-color: #020617;
  color: #e2e8f0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: #020617;
}

button {
  font-family: inherit;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #0f172a;
  color: #e2e8f0;
  padding: 1.5rem;
  gap: 1.5rem;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
  padding-bottom: 0.75rem;
}

.header-leading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.title {
  font-size: 1.5rem;
  font-weight: 600;
}

.usage-guide-button {
  border-radius: 9999px;
  padding: 0.35rem 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.12);
  color: #e2e8f0;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.usage-guide-button:hover,
.usage-guide-button:focus-visible {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(96, 165, 250, 0.6);
  color: #bfdbfe;
}

.usage-guide-button:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.8);
  outline-offset: 2px;
}

.usage-guide-button:active {
  background: rgba(59, 130, 246, 0.28);
}

.usage-guide-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.badge {
  background: rgba(148, 163, 184, 0.2);
  color: #94a3b8;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.85rem;
}

.banner-host:empty {
  display: none;
}

.banner-host {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.banner {
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.9rem;
  border: 1px solid transparent;
}

.banner.info {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(96, 165, 250, 0.35);
  color: #bfdbfe;
}

.banner.warning {
  background: rgba(234, 179, 8, 0.12);
  border-color: rgba(250, 204, 21, 0.35);
  color: #fef08a;
}

.banner.error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.main {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 1.5rem;
  flex: 1;
}

.sidebar {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 0.75rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.statusRow {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.statusLabel {
  font-size: 0.95rem;
  color: rgba(148, 163, 184, 0.9);
}

.statusValue {
  font-weight: 600;
}

.buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.button {
  flex: 1 1 140px;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(148, 163, 184, 0.12);
  color: #e2e8f0;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.button:hover:not(:disabled) {
  background: rgba(148, 163, 184, 0.2);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.button.secondary {
  background: transparent;
}

.meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: rgba(148, 163, 184, 0.8);
}

.error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
  border-radius: 0.75rem;
  padding: 0.75rem;
  font-size: 0.9rem;
}

.devHelp {
  font-size: 0.8rem;
  color: rgba(148, 163, 184, 0.7);
  line-height: 1.4;
}

.devHelp-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: #60a5fa;
  text-decoration: underline;
  cursor: pointer;
}

.devHelp-link:focus {
  outline: 2px solid rgba(96, 165, 250, 0.7);
  outline-offset: 2px;
}

.devHelp-link:hover {
  color: #93c5fd;
}

.axis .title {
  font-size: 0.95rem;
}

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.option {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(148, 163, 184, 0.12);
  color: #e2e8f0;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.option[data-active='true'] {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(96, 165, 250, 0.6);
}

.option input {
  accent-color: #60a5fa;
}

.helper {
  font-size: 0.8rem;
  color: rgba(148, 163, 184, 0.8);
}

.supported-dialog,
.usage-dialog {
  display: none;
  position: fixed;
  inset: 0;
  margin: auto;
  z-index: 1000;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 0.75rem;
  padding: 0;
  background: rgba(15, 23, 42, 0.95);
  color: #e2e8f0;
  width: min(460px, 90vw);
  max-height: 90vh;
}

.supported-dialog[open],
.supported-dialog.dialog-polyfill-open,
.usage-dialog[open],
.usage-dialog.dialog-polyfill-open {
  display: block;
}

.supported-dialog::backdrop,
.usage-dialog::backdrop {
  background: rgba(2, 6, 23, 0.75);
}

.dialog-polyfill-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.75);
  display: none;
  z-index: 999;
  pointer-events: none;
}

.dialog-polyfill-backdrop-open {
  display: block;
  pointer-events: auto;
}

.supported-dialog__content,
.usage-dialog__content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem;
}

.supported-dialog__content h2,
.usage-dialog__content h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.supported-dialog__content ul {
  margin: 0 0 0.25rem 1.25rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.supported-dialog__content li {
  list-style: disc;
}

.usage-dialog__section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.usage-dialog__intro {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(226, 232, 240, 0.88);
  line-height: 1.55;
}

.usage-dialog__intro + .usage-dialog__intro {
  margin-top: -0.35rem;
}

.usage-dialog__intro a {
  color: #93c5fd;
  text-decoration: underline;
}

.usage-dialog__intro a:hover,
.usage-dialog__intro a:focus-visible {
  color: #e0f2fe;
}

.usage-dialog__section + .usage-dialog__section {
  padding-top: 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.usage-dialog__section h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #f1f5f9;
}

.usage-dialog__list {
  margin: 0;
  padding-left: 1.2rem;
  list-style: disc;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: rgba(226, 232, 240, 0.9);
}

.usage-dialog__list strong {
  color: #f8fafc;
  font-weight: 600;
}

.usage-dialog__download {
  list-style: none;
  padding-left: 0;
  margin-left: -1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.usage-dialog__label {
  font-weight: 600;
  color: #f8fafc;
}

.usage-dialog__links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.usage-dialog__links a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.65rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(96, 165, 250, 0.4);
  color: #bfdbfe;
  text-decoration: none;
  background: rgba(59, 130, 246, 0.12);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.usage-dialog__links a:hover,
.usage-dialog__links a:focus-visible {
  background: rgba(59, 130, 246, 0.22);
  border-color: rgba(147, 197, 253, 0.7);
  color: #e0f2fe;
}

.usage-dialog__links a:focus-visible {
  outline: 2px solid rgba(147, 197, 253, 0.9);
  outline-offset: 2px;
}

.usage-dialog__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.button.small {
  align-self: flex-end;
  flex: 0 0 auto;
  font-size: 0.85rem;
  padding: 0.5rem 0.9rem;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 0.75rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 0.75rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stat-card .label {
  font-size: 0.85rem;
  color: rgba(148, 163, 184, 0.85);
}

.stat-card .value {
  font-size: 1.6rem;
  font-weight: 600;
}

.stat-card .unit {
  font-size: 0.75rem;
  color: rgba(148, 163, 184, 0.7);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chart .subtitle {
  font-size: 0.85rem;
  color: rgba(148, 163, 184, 0.8);
}

.canvasWrapper {
  position: relative;
  width: 100%;
  height: 280px;
}

.canvasWrapper canvas {
  width: 100%;
  height: 100%;
}

.canvasWrapper .empty {
  margin: 0;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(148, 163, 184, 0.7);
}

.log {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 0.75rem;
  padding: 1rem;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.log .header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.log .headerText {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.log .headerActions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.log .subtitle {
  font-size: 0.85rem;
  color: rgba(148, 163, 184, 0.8);
}

.tableWrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th,
td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

th {
  color: rgba(148, 163, 184, 0.9);
  font-weight: 500;
}

tbody tr:hover {
  background: rgba(148, 163, 184, 0.1);
}

@media (max-width: 960px) {
  .main {
    grid-template-columns: 1fr;
  }

  .sidebar {
    flex-direction: column;
  }

  .button {
    flex: 1 1 120px;
  }
}

@media (max-width: 600px) {
  .app {
    padding: 1rem;
  }

  .canvasWrapper {
    height: 220px;
  }
}
