body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f4f6f8;
  color: #20242a;
}

main {
  width: min(1040px, calc(100% - 32px));
  margin: 24px auto;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.login-panel {
  width: min(420px, 100%);
  margin: 80px auto;
}

.topbar,
.toolbar,
.row,
.command-row,
.section-heading,
.switch-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  margin-bottom: 16px;
}

.toolbar {
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.toolbar h2 {
  margin: 0 auto 0 0;
}

.section-heading {
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-heading h2 {
  margin: 0;
}

.switch-row {
  color: #334155;
  font-size: 14px;
  user-select: none;
}

.switch-row input {
  width: auto;
}

.panel {
  background: #fff;
  border: 1px solid #d8dee6;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 10px;
  border: 1px solid #c7d0dc;
  border-radius: 6px;
}

textarea[hidden] {
  display: none;
}

button {
  border: 0;
  border-radius: 6px;
  background: #0b63ce;
  color: white;
  padding: 10px 12px;
  cursor: pointer;
  white-space: nowrap;
}

button.secondary {
  background: #eef2f7;
  color: #20242a;
}

button.danger {
  background: #b42318;
}

.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  font-size: 24px;
}

.device-list {
  display: grid;
  gap: 8px;
}

.device {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #d8dee6;
  border-radius: 8px;
  cursor: pointer;
}

.device:hover {
  background: #f8fafc;
}

.device-main,
.device-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.online {
  color: #137333;
}

.offline,
.muted {
  color: #64748b;
}

.success {
  color: #137333;
}

.failure {
  color: #b42318;
}

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

.media-grid {
  grid-template-columns: repeat(3, minmax(120px, 1fr));
}

.simple-media-grid {
  grid-template-columns: repeat(3, minmax(120px, 1fr));
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.span-3 {
  grid-column: 1 / -1;
}

.command-row {
  align-items: stretch;
}

.command-row button {
  min-width: 96px;
}

.mode-banner {
  display: inline-block;
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e6f0ff;
  color: #174ea6;
  font-size: 14px;
}

.modern-media {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #d8dee6;
  border-radius: 8px;
  background: #f8fafc;
}

.media-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.media-title {
  font-size: 16px;
  font-weight: 700;
}

.media-subtitle,
.media-source {
  margin-top: 4px;
  font-size: 13px;
}

.media-side {
  display: grid;
  gap: 4px;
  justify-items: end;
  text-align: right;
  max-width: 42%;
}

.media-progress input,
.volume-control input {
  width: 100%;
}

.media-times,
.media-status-row,
.volume-control {
  display: flex;
  gap: 10px;
  align-items: center;
}

.media-times {
  justify-content: space-between;
  font-size: 13px;
  color: #64748b;
}

.media-status-row {
  flex-wrap: wrap;
  font-size: 13px;
}

.media-icon {
  font-size: 20px;
  line-height: 1;
  min-height: 46px;
}

.primary-media {
  font-size: 24px;
}

.volume-control {
  margin-top: 12px;
}

.volume-control button {
  min-width: 44px;
}

#volumeLabel {
  min-width: 56px;
  text-align: right;
}

#clipboardImagePreview {
  display: block;
  max-width: 100%;
  max-height: 280px;
  margin: 8px 0;
  border: 1px solid #d8dee6;
  border-radius: 6px;
}

#clipboardImagePreview[hidden] {
  display: none;
}

.output-panel {
  padding-bottom: 10px;
}

.output-meta {
  margin-bottom: 8px;
  font-size: 14px;
}

.terminal {
  white-space: pre-wrap;
  overflow-x: auto;
  background: #111827;
  color: #e5e7eb;
  padding: 12px;
  border-radius: 6px;
  min-height: 120px;
  border: 2px solid transparent;
}

.success-border {
  border-color: #137333;
}

.warning-border {
  border-color: #c77700;
}

.failure-border {
  border-color: #b42318;
}

.ansi-black,
.ansi-bright-black {
  color: #9ca3af;
}

.ansi-red {
  color: #f87171;
}

.ansi-green {
  color: #4ade80;
}

.ansi-yellow {
  color: #facc15;
}

.ansi-blue {
  color: #60a5fa;
}

.ansi-magenta {
  color: #e879f9;
}

.ansi-cyan {
  color: #22d3ee;
}

.ansi-white {
  color: #f9fafb;
}

.ansi-bold {
  font-weight: 700;
}

@media (max-width: 720px) {
  .media-grid,
  .button-grid,
  .command-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .device {
    align-items: stretch;
    flex-direction: column;
  }

  .device-actions {
    justify-content: flex-end;
  }

  .media-meta {
    display: grid;
  }

  .media-side {
    justify-items: start;
    text-align: left;
    max-width: 100%;
  }
}
