:root {
  color-scheme: light;
  --bg: #f4f7f9;
  --panel: #ffffff;
  --ink: #17212b;
  --muted: #667384;
  --line: #d9e1ea;
  --soft-line: #e9eef4;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-hover: #0b5f59;
  --blue: #2563eb;
  --amber: #b45309;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(26, 37, 55, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(290px, 370px) minmax(0, 1fr);
  min-height: 100vh;
}

.app-shell > * {
  min-width: 0;
}

.panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
  padding: 28px;
}

.brand-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand > div {
  min-width: 0;
}

.brand-mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 850;
  box-shadow: inset 0 -8px 20px rgba(0, 0, 0, 0.12);
}

.home-link,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 760;
  text-decoration: none;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.home-link {
  flex: 0 0 auto;
  min-width: max-content;
  height: 36px;
  padding: 0 14px;
  white-space: nowrap;
}

.secondary-action {
  width: 100%;
  padding: 0 12px;
}

.home-link:hover,
.home-link:focus-visible,
.secondary-action:hover:not(:disabled),
.secondary-action:focus-visible:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.secondary-action:hover:not(:disabled) {
  transform: translateY(-1px);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.15;
  word-break: keep-all;
}

h2 {
  font-size: 19px;
  line-height: 1.2;
}

.brand p,
.toolbar p,
.status,
.source-card span,
.source-card small,
.side-info span,
.metric-card span,
.details-heading span,
.details-list dt,
.device-panel > span,
.device-meta span {
  color: var(--muted);
}

.control-group {
  display: grid;
  gap: 14px;
}

.source-card {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: #f9fbfd;
}

.source-card strong {
  overflow: hidden;
  font-size: 17px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-card small {
  font-size: 12px;
}

.primary-action {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  font-weight: 780;
  transition: background 0.18s ease, transform 0.18s ease;
}

.primary-action:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.primary-action:disabled,
.secondary-action:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  pointer-events: none;
}

.side-info {
  display: grid;
  gap: 8px;
}

.side-info div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--soft-line);
}

.side-info div:last-child {
  border-bottom: 0;
}

.side-info strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status {
  min-height: 44px;
  font-size: 13px;
}

.status.is-error {
  color: var(--danger);
}

.copyright {
  margin-top: auto;
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  display: grid;
  align-content: start;
  gap: 24px;
  min-width: 0;
  padding: 28px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
}

.toolbar > div {
  min-width: 0;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  height: 36px;
  border: 1px solid #cfdbef;
  border-radius: var(--radius);
  background: #f7faff;
  color: var(--blue);
  font-size: 13px;
  font-weight: 820;
  white-space: nowrap;
}

.device-panel,
.metric-card,
.details-panel {
  background: var(--panel);
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.device-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 24px;
}

.device-panel output {
  display: block;
  min-width: 0;
  color: var(--ink);
  font: 800 clamp(34px, 7vw, 64px)/1 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.device-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  min-width: 0;
}

.device-meta strong,
.device-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-meta strong {
  font-size: 16px;
}

.device-meta span {
  font-size: 13px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 12px;
}

.metric-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 16px;
}

.metric-card strong {
  overflow: hidden;
  font-size: 24px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.details-panel {
  display: grid;
  overflow: hidden;
}

.details-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--soft-line);
}

.details-list {
  display: grid;
  grid-template-columns: minmax(120px, 0.32fr) minmax(0, 1fr);
  margin: 0;
}

.details-list dt,
.details-list dd {
  min-width: 0;
  margin: 0;
  padding: 13px 18px;
  border-bottom: 1px solid var(--soft-line);
}

.details-list dt {
  font-weight: 760;
}

.details-list dd {
  overflow-wrap: anywhere;
}

.details-list dt:last-of-type,
.details-list dd:last-of-type {
  border-bottom: 0;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .controls,
  .workspace {
    padding: 20px;
  }
}

@media (max-width: 640px) {
  .brand-row,
  .toolbar,
  .details-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .details-list {
    grid-template-columns: 1fr;
  }

  .details-list dt {
    padding-bottom: 4px;
    border-bottom: 0;
  }

  .details-list dd {
    padding-top: 0;
  }
}
