:root {
  --bg: #070a0d;
  --bg-bar: #0d1218;
  --line: #1b2530;
  --text: #d7dee6;
  --dim: #7b8a99;
  --accent: #63d2b4;
  --accent-2: #4a9dd8;
  --bad: #e0675a;
  --warn: #e0b25a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 8px;
  background: var(--bg-bar);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 13px;
  color: var(--accent);
}

.status {
  font-size: 11px;
  color: var(--dim);
  white-space: nowrap;
}

.status[data-state="online"] {
  color: var(--accent);
}

.status[data-state="offline"] {
  color: var(--bad);
}

.spacer {
  flex: 1 1 auto;
}

.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: #121a22;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1;
  min-width: 38px;
  min-height: 34px;
  padding: 0 9px;
  border-radius: 8px;
  touch-action: manipulation;
}

.chip:active {
  background: #1d2a36;
}

.chip.primary {
  border-color: var(--accent);
  color: var(--accent);
  min-height: 42px;
  padding: 0 16px;
}

#terminal {
  flex: 1 1 auto;
  min-height: 0;
  padding: 4px 4px 0;
  overflow: hidden;
}

#terminal .xterm {
  height: 100%;
}

.keybar {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
  padding: 6px 8px;
  overflow-x: auto;
  background: var(--bg-bar);
  border-top: 1px solid var(--line);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.keybar::-webkit-scrollbar {
  display: none;
}

.key {
  appearance: none;
  flex: 0 0 auto;
  min-width: 46px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #121a22;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  touch-action: manipulation;
  user-select: none;
}

.key:active {
  background: #22303d;
  border-color: var(--accent-2);
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 7, 10, 0.72);
  z-index: 20;
}

.overlay[hidden] {
  display: none;
}

.overlay-card {
  max-width: 320px;
  text-align: center;
  background: var(--bg-bar);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
}

.overlay-card p {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--text);
}

@media (min-width: 800px) {
  #terminal {
    padding: 8px 10px 0;
  }

  .keybar {
    justify-content: center;
  }
}
