:root {
  --bg: #070c0a;
  --surface: #101a16;
  --surface2: #14231d;
  --line: #1f312a;
  --text: #e8f5ee;
  --muted: #8fa79b;
  --green: #2fe38b;
  --green-dim: #1f9e61;
  --red: #ff6b6b;
  --amber: #ffc14d;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: radial-gradient(1200px 800px at 70% -10%, #0e1f18 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100%; display: flex; flex-direction: column; }

/* ------------------------------ topbar ------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 15, 13, .72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { border-radius: 8px; display: block; }
.brand-name { font-weight: 700; letter-spacing: .2px; }
.brand-sub { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.2; }

.chip {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.chip-off { color: var(--muted); background: rgba(255, 255, 255, .03); }
.chip-on { color: #052015; background: var(--green); border-color: var(--green); font-weight: 600; }
.chip-warn { color: #2a1a00; background: var(--amber); border-color: var(--amber); }

/* ------------------------------- main ------------------------------- */

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.card {
  background: linear-gradient(180deg, var(--surface), var(--surface2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.connect-card { max-width: 620px; margin: 4vh auto 0; width: 100%; }
.connect-card h1 { margin: 0 0 6px; font-size: 22px; }

.muted { color: var(--muted); }
em.muted { font-style: normal; font-size: 12.5px; }

.field-grid { display: grid; grid-template-columns: 1fr 130px; gap: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.field span { font-size: 12.5px; color: var(--muted); }
.field input {
  background: #0a120f;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font: inherit;
  outline: none;
  width: 100%;
}
.field input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(47, 227, 139, .15); }

.opt-row { display: flex; gap: 18px; margin-top: 14px; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; cursor: pointer; }
.check input { accent-color: var(--green); }

.btn {
  font: inherit;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 10px 14px;
  cursor: pointer;
}
.btn:hover { border-color: #2c463c; }
.btn:disabled { opacity: .5; cursor: default; }

.btn-primary {
  background: linear-gradient(180deg, #35ef97, #23c874);
  color: #04140c;
  border: none;
  font-weight: 700;
  width: 100%;
  margin-top: 16px;
  padding: 12px 16px;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:disabled { filter: none; opacity: .6; cursor: default; }

.btn-ghost { font-size: 13px; padding: 8px 10px; }
.btn-ghost.toggled { color: var(--green); border-color: var(--green-dim); }
.btn-sm { padding: 8px 12px; width: auto; margin: 0; }

.notice { font-size: 13.5px; margin: 10px 0 0; }
.notice-error { color: var(--red); }
.notice-info { color: var(--muted); }

.hint { margin-top: 16px; color: var(--muted); font-size: 13px; }
.hint summary { cursor: pointer; color: var(--text); }
.hint ul { margin: 8px 0 0; padding-left: 18px; }
.hint li { margin: 6px 0; }

/* ------------------------------ session ------------------------------ */

.session { flex: 1; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.session-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.session-info { font-size: 12.5px; }

.session-viewport {
  position: relative;
  flex: 1;
  min-height: 60vh;
}

.screen {
  position: absolute;
  inset: 0;
  background: #000;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clipboard-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: min(420px, 90vw);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  box-shadow: var(--shadow);
  z-index: 30;
}
.clipboard-panel textarea {
  width: 100%;
  height: 120px;
  background: #0a120f;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font: inherit;
  resize: vertical;
}
.clipboard-actions { display: flex; gap: 8px; margin-top: 8px; justify-content: flex-end; }

/* fullscreen session */
.session:fullscreen { background: #000; padding: 0; gap: 0; }
.session:fullscreen .session-viewport { min-height: 0; }
.session:fullscreen .screen { border-radius: 0; border: none; }
.session:fullscreen .session-toolbar {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 16, 14, .85);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  z-index: 50;
  opacity: .22;
  transition: opacity .18s ease;
  max-width: calc(100vw - 24px);
}
.session:fullscreen .session-toolbar:hover { opacity: 1; }
.session:fullscreen .spacer, .session:fullscreen .session-info { display: none; }

/* ------------------------------ footer ------------------------------- */

.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  color: var(--muted);
  font-size: 12.5px;
  border-top: 1px solid var(--line);
}

/* ------------------------------ Android ------------------------------ */

.tabs { display: flex; gap: 8px; margin: 14px 0 4px; flex-wrap: wrap; }

.tab {
  font: inherit;
  font-size: 13.5px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.tab:hover { border-color: #2c463c; }
.tab-active { color: var(--text); border-color: var(--green-dim); background: rgba(47, 227, 139, .08); }

.android-devices { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }

.device-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #0a120f;
}
.device-name { font-weight: 600; }
.device-meta { font-size: 12px; color: var(--muted); }
.device-row .spacer { flex: 1; }

.inline-field { display: flex; gap: 8px; margin-top: 12px; }
.inline-field input {
  flex: 1;
  background: #0a120f;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font: inherit;
  outline: none;
}
.inline-field input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(47, 227, 139, .15); }

.android-status { margin: 10px 0 0; font-size: 13px; }
.hint-line { margin-top: 14px; font-size: 12.5px; }

.phone-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.phone-screen img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  touch-action: none;
  cursor: crosshair;
  user-select: none;
  -webkit-user-drag: none;
}
.phone-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--muted);
  background: rgba(7, 12, 10, .8);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  pointer-events: none;
  white-space: nowrap;
}

.phone-typebar { display: flex; gap: 8px; padding-top: 10px; }
.phone-typebar input {
  flex: 1;
  background: #0a120f;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font: inherit;
  outline: none;
}
.phone-typebar input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(47, 227, 139, .15); }

/* --------------------------- Help sessions --------------------------- */

.help-stage {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #000;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.help-stage img,
.help-stage video { max-width: 100%; max-height: 70vh; display: block; }

.help-chat { margin-top: 12px; }
.help-chat-log {
  height: 150px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #0a120f;
  font-size: 13.5px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.help-chat-msg { color: var(--text); }
.help-chat-msg.mine { color: var(--green); text-align: right; }

/* ------------------------- get the app section ------------------------ */

.getapp { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.getapp-title { font-size: 15px; margin: 0 0 4px; color: var(--text); }
.getapp-sub { margin: 0 0 10px; font-size: 13px; }
.getapp-card { display: none; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 10px; background: #0d1712; }
.getapp-card.primary { display: block; }
#getapp.show-all .getapp-card { display: block; }
.getapp-head { font-weight: 600; margin-bottom: 4px; color: var(--green); }
.getapp-card p { margin: 0 0 8px; font-size: 13.5px; color: var(--text); }
.getapp-card .muted { color: #7d9a8c; }
.getapp-note { font-size: 12.5px; margin-top: 6px; }
.getapp .btn { margin-bottom: 4px; }
.getapp-steps { margin-top: 8px; }
.getapp-more { margin-top: 10px; }

/* ------------------------------ mobile ------------------------------- */

@media (max-width: 620px) {
  main { padding: 14px; }
  .field-grid { grid-template-columns: 1fr; gap: 0; }
  .connect-card { margin-top: 1.5vh; padding: 18px; }
  .session-toolbar .btn-ghost { font-size: 12px; padding: 7px 8px; }
  .session-viewport { min-height: 50vh; }
}
