:root {
  color: #17202a;
  background: #eef1f4;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.9), transparent 38%),
    #eef1f4;
}

button,
textarea {
  font: inherit;
}

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

.app-shell {
  width: min(1380px, calc(100% - 48px));
  margin: 0 auto;
  padding: 30px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.eyebrow,
.section-label {
  margin: 0 0 5px;
  color: #66727e;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(26px, 3vw, 40px);
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 0;
  font-size: 21px;
  letter-spacing: -0.02em;
}

.connection-pill,
.revision,
.display-count {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #d4dae0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: #4e5a66;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.connection-pill {
  padding: 11px 15px;
}

.revision,
.display-count {
  padding: 7px 11px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d6921e;
  box-shadow: 0 0 0 4px rgba(214, 146, 30, 0.13);
}

.connection-pill[data-state="online"] .status-dot {
  background: #14894e;
  box-shadow: 0 0 0 4px rgba(20, 137, 78, 0.13);
}

.connection-pill[data-state="degraded"] .status-dot {
  background: #d6921e;
  box-shadow: 0 0 0 4px rgba(214, 146, 30, 0.13);
}

.connection-pill[data-state="offline"] .status-dot {
  background: #c23b38;
  box-shadow: 0 0 0 4px rgba(194, 59, 56, 0.13);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(330px, 0.75fr);
  gap: 22px;
  align-items: start;
}

.control-card,
.status-card {
  border: 1px solid rgba(195, 203, 211, 0.88);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 55px rgba(49, 58, 68, 0.08);
}

.control-card {
  padding: 26px;
}

.status-card {
  padding: 22px;
}

.status-column {
  display: grid;
  gap: 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.section-heading.compact {
  margin-bottom: 18px;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 24px;
  padding: 4px;
  border: 1px solid #d9dee3;
  border-radius: 12px;
  background: #edf0f2;
}

.mode-button {
  min-height: 48px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #606b75;
  font-weight: 700;
  cursor: pointer;
}

.mode-button[aria-pressed="true"] {
  background: #19232d;
  color: #fff;
  box-shadow: 0 3px 10px rgba(25, 35, 45, 0.2);
}

.signal-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.signal-panel[hidden],
.message-panel[hidden] {
  display: none;
}

.signal-button {
  min-height: 300px;
  border: 4px solid transparent;
  border-radius: 15px;
  color: #fff;
  cursor: pointer;
  transition: transform 100ms ease, border-color 100ms ease, box-shadow 100ms ease;
}

.signal-button:hover {
  transform: translateY(-2px);
}

.signal-button:active {
  transform: translateY(0);
}

.signal-button.green {
  background: #00b84f;
}

.signal-button.red {
  background: #e30b17;
}

.signal-button[aria-pressed="true"] {
  border-color: #17202a;
  box-shadow: 0 0 0 4px #fff, 0 0 0 7px #17202a;
}

.signal-button span {
  display: block;
  font-size: 110px;
  font-weight: 300;
  line-height: 1;
}

.signal-button strong {
  display: block;
  margin-top: 18px;
  font-size: 24px;
}

.message-panel label {
  display: block;
  margin-bottom: 10px;
  color: #3c4752;
  font-size: 14px;
  font-weight: 700;
}

textarea {
  display: block;
  width: 100%;
  min-height: 420px;
  resize: vertical;
  border: 2px solid #ccd3d9;
  border-radius: 13px;
  outline: none;
  background: #fbfcfd;
  color: #101820;
  padding: 18px;
  font-size: 18px;
  line-height: 1.6;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

textarea:focus {
  border-color: #286bff;
  box-shadow: 0 0 0 4px rgba(40, 107, 255, 0.12);
}

.input-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 9px;
  color: #77818b;
  font-size: 12px;
}

.message-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #e1e6ea;
}

.clear-message-button {
  min-width: 140px;
  border: 1px solid #d9a19d;
  border-radius: 10px;
  background: #fff;
  color: #a52a22;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.clear-message-button:hover:not(:disabled) {
  border-color: #b9382f;
  background: #fff3f2;
}

.clear-message-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(185, 56, 47, 0.14);
}

.clear-message-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.layout-alert {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-bottom: 20px;
  padding: 15px;
  border: 1px solid #d7dde2;
  border-radius: 12px;
  background: #f6f8f9;
}

.layout-alert[data-state="ok"] {
  border-color: #a9dec4;
  background: #edfaf3;
}

.layout-alert[data-state="warning"] {
  border-color: #ebcf87;
  background: #fff8e6;
}

.layout-alert[data-state="error"] {
  border-color: #e6aaa8;
  background: #fff0ef;
}

.alert-icon {
  display: grid;
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 50%;
  background: #dce2e7;
  font-weight: 800;
}

.layout-alert[data-state="ok"] .alert-icon {
  background: #13864c;
  color: #fff;
}

.layout-alert[data-state="warning"] .alert-icon {
  background: #d69313;
  color: #fff;
}

.layout-alert[data-state="error"] .alert-icon {
  background: #c83e3b;
  color: #fff;
}

.layout-alert strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
}

.layout-alert p {
  margin-bottom: 0;
  color: #68737d;
  font-size: 12px;
  line-height: 1.5;
}

.node-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-bottom: 20px;
}

.node-row {
  padding: 11px 12px;
  border: 1px solid #e0e5e9;
  border-radius: 10px;
  background: #fafbfc;
}

.node-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 700;
}

.node-state {
  color: #c23b38;
}

.node-row[data-state="online"] .node-state {
  color: #14894e;
}

.node-row p {
  margin-bottom: 0;
  color: #77818a;
  font-size: 11px;
  line-height: 1.5;
}

.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  overflow: hidden;
  margin: 0;
  border: 1px solid #e0e4e8;
  border-radius: 11px;
  background: #e0e4e8;
}

.status-grid div {
  padding: 13px;
  background: #fff;
}

.status-grid dt {
  margin-bottom: 5px;
  color: #7a848d;
  font-size: 11px;
}

.status-grid dd {
  margin: 0;
  color: #28333e;
  font-size: 13px;
  font-weight: 700;
}

.display-list {
  display: grid;
  gap: 9px;
}

.display-row {
  padding: 12px;
  border: 1px solid #e0e5e9;
  border-radius: 10px;
  background: #fafbfc;
}

.display-row-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
}

.display-row p,
.empty-state {
  margin-bottom: 0;
  color: #77818a;
  font-size: 11px;
  line-height: 1.5;
}

.empty-state {
  padding: 24px 12px;
  border: 1px dashed #d5dbe0;
  border-radius: 10px;
  text-align: center;
}

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

  .status-column {
    grid-row: 1;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 24px, 1380px);
    padding-top: 18px;
  }

  .topbar,
  .section-heading {
    align-items: flex-start;
  }

  .topbar {
    flex-direction: column;
  }

  .status-column,
  .signal-panel,
  .node-list {
    grid-template-columns: 1fr;
  }

  .signal-button {
    min-height: 180px;
  }

  .control-card,
  .status-card {
    padding: 17px;
  }

  textarea {
    min-height: 320px;
  }

  .clear-message-button {
    width: 100%;
  }
}
