:root {
  --bg: #08090b;
  --panel: #12141a;
  --panel-2: #1a1d24;
  --gold: #d7a93f;
  --gold-bright: #f3d37a;
  --text: #f4f0e8;
  --muted: #b8b0a1;
  --line: #4b3b1a;
  --danger: #d45b4f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  background:
    linear-gradient(rgba(215, 169, 63, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(215, 169, 63, 0.08) 1px, transparent 1px),
    var(--bg);
  background-size: 42px 42px;
}

.app {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.panel {
  border: 1px solid var(--line);
  background: rgba(18, 20, 26, 0.94);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

.hero {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 28px;
  align-items: center;
  min-height: 300px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  font-size: 13px;
}

h1,
h2 {
  margin: 0;
}

h1 {
  max-width: 700px;
  font-size: 48px;
  line-height: 1.02;
}

h2 {
  color: var(--gold-bright);
  font-size: 25px;
}

.note,
.hint {
  color: var(--muted);
  line-height: 1.5;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 24px;
}

.status-strip span {
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0c0d11;
  color: var(--muted);
}

.status-strip strong {
  display: block;
  color: var(--gold-bright);
  font-size: 17px;
}

.halo-visual {
  position: relative;
  min-height: 240px;
}

.ring {
  position: absolute;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
}

.ring-outer {
  width: 390px;
  height: 150px;
  border: 2px solid var(--gold-bright);
}

.ring-inner {
  width: 330px;
  height: 110px;
  border: 6px solid var(--gold);
}

.core {
  position: absolute;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  padding: 16px 24px;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--gold-bright);
  font-weight: 900;
}

.node {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 24px rgba(243, 211, 122, 0.35);
}

.n1 { left: 48px; top: 143px; }
.n2 { left: 116px; top: 158px; }
.n3 { left: 198px; top: 168px; }
.n4 { right: 116px; top: 158px; }
.n5 { right: 48px; top: 143px; }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.section-title {
  margin-bottom: 18px;
}

.commands {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.command {
  min-height: 58px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 6px;
  font-weight: 800;
  cursor: pointer;
}

.command.active {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 6px;
  font-weight: 900;
  cursor: pointer;
}

.primary-button {
  background: var(--gold);
  color: #120f08;
}

.secondary-button {
  margin-top: 20px;
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold-bright);
}

.meter {
  height: 18px;
  background: #06070a;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

#confidenceBar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  transition: width 240ms ease;
}

.result {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-top: 18px;
}

#decodedCommand {
  color: var(--gold-bright);
  font-size: 34px;
  font-weight: 900;
}

.flow-panel {
  margin-top: 18px;
}

.flow {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.flow span {
  display: grid;
  place-items: center;
  min-height: 64px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  text-align: center;
  font-weight: 700;
}

.flow span.active {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
  box-shadow: inset 0 0 0 1px rgba(243, 211, 122, 0.25);
}

.receiver {
  min-height: 120px;
  display: grid;
  place-items: center;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #090a0d;
}

.receiver strong {
  display: block;
  color: var(--gold-bright);
  font-size: 32px;
}

.receiver.alert {
  border-color: var(--danger);
}

.channels {
  display: grid;
  gap: 9px;
}

.channel {
  display: grid;
  grid-template-columns: 48px 1fr 44px;
  gap: 10px;
  align-items: center;
  min-height: 28px;
  color: var(--muted);
  font-weight: 700;
}

.channel-track {
  height: 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #07080a;
  overflow: hidden;
}

.channel-fill {
  width: 18%;
  height: 100%;
  background: linear-gradient(90deg, #8a6822, var(--gold-bright));
  transition: width 220ms ease;
}

.log {
  display: grid;
  gap: 8px;
  max-height: 248px;
  overflow: auto;
}

.log-entry,
.check-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0c10;
  color: var(--muted);
  line-height: 1.35;
}

.log-entry strong,
.check-item.done {
  color: var(--gold-bright);
}

.roadmap {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.roadmap span {
  display: grid;
  place-items: center;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 900;
}

.roadmap span.done {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
}

.checklist {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.connector-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.connector-grid div {
  min-height: 82px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0c10;
}

.connector-grid strong {
  display: block;
  color: var(--gold-bright);
  margin-bottom: 7px;
}

.connector-grid span {
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.chat-shell {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #090a0d;
  padding: 14px;
}

.chat-toolbar {
  display: grid;
  grid-template-columns: 1.35fr 0.8fr 1fr 110px 86px;
  gap: 10px;
  align-items: end;
}

.chat-toolbar label,
.advanced-grid label {
  display: block;
  color: var(--gold-bright);
  font-weight: 800;
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #07080a;
  color: var(--text);
  font: inherit;
  line-height: 1.45;
}

.chat-toolbar input,
.chat-toolbar select,
.advanced-grid input,
.advanced-grid select {
  margin-top: 7px;
  min-height: 44px;
}

textarea {
  min-height: 112px;
  resize: vertical;
}

.compact-button {
  margin-top: 0;
  min-height: 46px;
}

.advanced-chat-settings {
  color: var(--muted);
}

.advanced-chat-settings summary {
  cursor: pointer;
  color: var(--gold-bright);
  font-weight: 800;
}

.advanced-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.connection-status {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #07080a;
}

.connection-status.ready {
  border-color: var(--gold);
  color: var(--gold-bright);
}

.connection-status.error {
  border-color: var(--danger);
  color: #ffb8b1;
}

.chat-log {
  display: grid;
  gap: 14px;
  min-height: 360px;
  max-height: 540px;
  overflow: auto;
  padding: 12px;
  border: 1px solid #221b10;
  border-radius: 8px;
  background: #06070a;
}

.chat-message {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-message .avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--gold-bright);
  font-size: 12px;
  font-weight: 900;
}

.chat-message .bubble {
  max-width: 820px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101217;
  line-height: 1.5;
}

.chat-message strong {
  display: block;
  margin-bottom: 6px;
  color: var(--gold-bright);
}

.user-message {
  grid-template-columns: minmax(0, 1fr) 38px;
}

.user-message .avatar {
  grid-column: 2;
  grid-row: 1;
  background: #21190d;
}

.user-message .bubble {
  justify-self: end;
  grid-column: 1;
  grid-row: 1;
  border-color: #5b4720;
  background: #15120c;
}

.chat-input-row {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 10px;
  align-items: end;
}

.switch-row {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  color: var(--text);
}

input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--gold);
}

@media (max-width: 860px) {
  .hero,
  .grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 36px;
  }

  .commands,
  .flow,
  .roadmap,
  .checklist,
  .connector-grid,
  .chat-toolbar,
  .advanced-grid,
  .chat-input-row,
  .status-strip {
    grid-template-columns: 1fr;
  }

  .halo-visual {
    transform: scale(0.82);
    transform-origin: center;
  }
}
