* {
  box-sizing: border-box;
}

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

body {
  background: radial-gradient(circle at top, #1e293b 0%, #020617 55%, #000 100%);
  color: #e5e7eb;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  gap: 12px;
  padding: 16px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.9);
}

.connect-box {
  display: flex;
  gap: 10px;
}

input,
textarea,
button {
  border-radius: 10px;
  font: inherit;
}

input,
textarea {
  border: 1px solid #334155;
  background: #020617;
  color: #e5e7eb;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

#port {
  width: 140px;
  padding: 10px 12px;
}

button {
  border: 0;
  padding: 10px 14px;
  background: #2563eb;
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
}

button:hover:not(:disabled) {
  background: #1d4ed8;
}

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

.echo-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #cbd5e1;
  user-select: none;
}

#terminal {
  flex: 1;
  min-height: 420px;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  overflow: hidden;
  background: #0b1020;
}

.hex-panel {
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.9);
}

.hex-panel label {
  display: block;
  margin-bottom: 8px;
  color: #cbd5e1;
  font-weight: 700;
}

#hex {
  width: 100%;
  min-height: 90px;
  padding: 10px;
  resize: vertical;
  font-family: Consolas, "Courier New", monospace;
}

.hex-buttons {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

@media (max-width: 720px) {
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .connect-box {
    flex-wrap: wrap;
  }

  #port {
    flex: 1;
    min-width: 140px;
  }
}
.connection-panel {
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.9);
}

.panel-title {
  display: block;
  margin-bottom: 8px;
  color: #cbd5e1;
  font-weight: 700;
}

.panel-help {
  margin: 0 0 12px;
  color: #94a3b8;
  font-size: 14px;
}

.connection-grid {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 12px;
  margin-bottom: 12px;
}

.connection-grid label {
  display: block;
  margin-bottom: 6px;
  color: #cbd5e1;
  font-weight: 600;
}

.connection-grid input {
  width: 100%;
  padding: 10px;
}

.connection-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

  .connection-actions {
    flex-wrap: wrap;
  }
}
