/* The look of the "Web ticket" app: a purple page, light text, rounded dark-purple boxes. */
:root {
  --background: #3d245a;
  --text: #f9fafb;
  --muted-text: #9ca3af;
  --footer-text: #6b7280;
  --surface: #2f1c45;
  --primary: #f9fafb;
  --on-primary: #111827;
  --error: #f87171;
  --connected: #4ade80;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

/* Element resets only, so the class rules below (the gaps in .state) win over them. */
p,
h1,
ul {
  margin: 0;
}

html,
body {
  margin: 0;
  background: var(--background);
  color: var(--text);
}

body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 32px 24px;
  padding: max(32px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
}

.content {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

/* From the top of the page, however much it holds. */
.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.state > * + * {
  margin-top: 16px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(249, 250, 251, 0.2);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.state-text {
  font-size: 16px;
  color: var(--muted-text);
  text-align: center;
}

.error-text {
  margin-bottom: 8px;
  font-size: 16px;
  color: var(--error);
  text-align: center;
}

/* The user's balance, above the node list: BTC, and beside it what that is worth in USDT (under it
   if both do not fit on one line). As high as a .node: the same padding and line heights. */
.balance {
  width: 100%;
  min-height: 54px;
  padding: 9px 18px;
  border-radius: 14px;
  background: var(--surface);
}

.state > .balance {
  margin-bottom: 8px;
}

.balance-label {
  font-size: 13px;
  line-height: 17px;
  color: var(--muted-text);
}

.balance-amount {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  margin-top: 2px;
}

.balance-btc {
  margin-right: 10px;
  font: 600 16px/20px ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  overflow-wrap: anywhere;
}

.balance-usdt {
  font-size: 14px;
  line-height: 16px; /* within the BTC's line, baselines aligned: the row stays 20px */
  color: var(--muted-text);
  white-space: nowrap;
}

.header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 4px;
}

.label {
  font-size: 15px;
  font-weight: 600;
}

.state > .label {
  width: 100%;
  margin-bottom: 4px;
}

.count {
  font-size: 14px;
  color: var(--muted-text);
}

.notice {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(248, 113, 113, 0.12);
  font-size: 14px;
  color: var(--error);
}

.nodes {
  width: 100%;
  padding: 0;
  list-style: none;
}

.nodes > li + li {
  margin-top: 10px;
}

/* One button per node, the dot green like the bot's buttons: connected now. */
.node {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 54px;
  padding: 9px 18px;
  border: 0;
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font: 600 16px ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  text-align: left;
  cursor: pointer;
}

.node::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  margin-right: 14px;
  border-radius: 50%;
  background: var(--connected);
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.15);
}

/* The IP the node is connected from, and under it the id; only the id if there is no IP. */
.node-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.node-title,
.node-subtitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-title {
  line-height: 20px;
}

.node-subtitle {
  margin-top: 2px;
  font-size: 13px;
  line-height: 17px;
  font-weight: 400;
  color: var(--muted-text);
}

.node::after {
  content: "\203A";
  margin-left: auto;
  font: 400 24px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--muted-text);
}

.url-box {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 60px;
  padding: 16px;
  border-radius: 12px;
  background: var(--surface);
}

.url-text {
  font-size: 14px;
  line-height: 21px;
  word-break: break-all;
  -webkit-user-select: text;
  user-select: text;
}

.hint {
  font-size: 14px;
  line-height: 20px;
  color: var(--muted-text);
  text-align: center;
}

.button,
.secondary-button {
  border: 0;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}

.button {
  width: 100%;
  height: 54px;
  border-radius: 14px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 17px;
}

.state > .button {
  margin-top: 20px;
}

.secondary-button {
  height: 48px;
  padding: 0 24px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
}

.node:active,
.button:active,
.secondary-button:active {
  opacity: 0.8;
}

.footer {
  margin: 24px 0 0;
  font-size: 12px;
  color: var(--footer-text);
  text-align: center;
}
