:root {
  color-scheme: dark;
  --bg: #080b12;
  --panel: #101827;
  --panel-2: #0d1422;
  --line: #233148;
  --text: #eef4ff;
  --muted: #9fb0c8;
  --accent: #4da3ff;
  --accent-2: #70e1b3;
  --danger: #ff6878;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(77, 163, 255, 0.2), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(112, 225, 179, 0.12), transparent 30rem),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 0.8rem 1.05rem;
  background: linear-gradient(135deg, var(--accent), #2660ff);
  color: white;
  cursor: pointer;
  font-weight: 700;
}

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

button.secondary {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

input {
  width: 100%;
  margin-top: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  background: rgba(2, 8, 23, 0.78);
  color: var(--text);
}

label {
  display: block;
  margin: 0.9rem 0;
  color: var(--muted);
  font-weight: 650;
}

.hidden {
  display: none !important;
}

.shell {
  width: min(1320px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.panel,
.console {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(16, 24, 39, 0.96), rgba(8, 13, 23, 0.96));
  box-shadow: var(--shadow);
}

.panel {
  max-width: 680px;
  margin: 8vh auto 0;
  padding: 32px;
}

.brand,
.topbar,
.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  justify-content: flex-start;
}

.dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent-2);
  box-shadow: 0 0 28px rgba(112, 225, 179, 0.8);
}

.eyebrow {
  margin: 0 0 0.2rem;
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1;
}

h2 {
  font-size: 1.15rem;
}

.intro {
  margin: 24px 0;
  color: var(--muted);
}

.notice {
  border: 1px solid rgba(77, 163, 255, 0.35);
  border-radius: 16px;
  padding: 0.85rem 1rem;
  background: rgba(77, 163, 255, 0.09);
  color: #cfe5ff;
}

.notice.error {
  border-color: rgba(255, 104, 120, 0.45);
  background: rgba(255, 104, 120, 0.09);
  color: #ffd2d7;
}

.card {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.035);
}

.console {
  min-height: calc(100vh - 64px);
  padding: 24px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.profiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin: 24px 0;
}

.profile {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.035);
}

.profile h2 {
  margin-bottom: 0.2rem;
}

.profile p {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.2rem 0 1rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.badge::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: #718096;
}

.badge.running::before {
  background: var(--accent-2);
  box-shadow: 0 0 14px rgba(112, 225, 179, 0.9);
}

.terminal-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #020617;
}

.console:not(.profile-active) .terminal-card {
  display: none;
}

.console.profile-active .profiles,
.console.profile-active .passkey-card {
  display: none;
}

.console.profile-active .terminal-card {
  margin-top: 24px;
}

.terminal-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.terminal-scrollbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #0b1322;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.terminal-scrollbar button {
  min-height: 42px;
  padding: 0.55rem 0.8rem;
}

.scroll-hint {
  margin-left: auto;
  color: var(--accent-2);
  font-weight: 600;
}

.terminal-led {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  margin-right: 0.45rem;
  border-radius: 999px;
  background: #718096;
}

.terminal-led.active {
  background: var(--accent-2);
  box-shadow: 0 0 12px rgba(112, 225, 179, 0.9);
}

#terminal {
  width: 100%;
  height: min(70vh, 760px);
  padding: 8px;
  touch-action: pan-y;
}

#terminal .xterm-viewport {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: none;
}

.xterm {
  height: 100%;
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 16px, 1320px);
    padding: 8px 0;
  }

  .panel,
  .console {
    border-radius: 18px;
    padding: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    width: 100%;
  }

  .actions button,
  .profile button {
    width: 100%;
  }

  .terminal-scrollbar {
    align-items: stretch;
  }

  .terminal-scrollbar > span:first-child {
    width: 100%;
  }

  .terminal-scrollbar button {
    flex: 1;
  }

  .scroll-hint {
    width: 100%;
    margin-left: 0;
    text-align: center;
  }

  #terminal {
    height: 68vh;
  }
}
