:root {
  --bg: #181a20;
  --panel: #20232b;
  --text: #e6e6e6;
  --muted: #9aa0ab;
  --btn: #2c313c;
  --btn-border: #3b4250;
  --accent: #facc15;
  --accent-text: #181a20;
  --sel: #3a4a2a;
  --sel-border: #8bc34a;
  --p0: #ff6b6b;
  --p1: #6ea8ff;
  --p2: #5fd38d;
  --p3: #ffd43b;
  --p4: #e599f7;
}

* { box-sizing: border-box; }

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

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Roboto Mono", monospace;
}

#screen {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 8px 0;
  -webkit-overflow-scrolling: touch;
}

#out {
  margin: 0;
  /* the route is 42 characters wide; this keeps it on one line on a phone */
  font-size: clamp(10px, 3.3vw, 15px);
  line-height: 1.3;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
}

.b { font-weight: 700; }
.c91 { color: var(--p0); }
.c94 { color: var(--p1); }
.c92 { color: var(--p2); }
.c93 { color: var(--p3); }
.c95 { color: var(--p4); }

#panel {
  flex: 0 0 auto;
  max-height: 52dvh;
  overflow-y: auto;
  background: var(--panel);
  border-top: 1px solid var(--btn-border);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#status { color: var(--muted); font-size: 13px; min-height: 1.2em; }
#status:empty { display: none; }
#title { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
#title:empty { display: none; }

#selection {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
#selection b { color: var(--text); }

#options, #keys {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
#options:empty, #keys:empty { display: none; }

button {
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--btn);
  border: 1px solid var(--btn-border);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 44px;
  cursor: pointer;
  text-align: left;
  touch-action: manipulation;
}
button:disabled { opacity: 0.45; cursor: default; }
button:active:not(:disabled) { filter: brightness(1.25); }

#options button { flex: 1 1 100%; }
#options.compact button { flex: 1 1 calc(50% - 6px); }

#keys button { font-size: 14px; padding: 8px 12px; min-height: 40px; }

button.selected { background: var(--sel); border-color: var(--sel-border); }
button.primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 700;
}
button.wide { flex: 1 1 100%; text-align: center; }

.badge {
  display: inline-block;
  min-width: 1.5em;
  margin-right: 6px;
  padding: 0 4px;
  border-radius: 6px;
  background: var(--sel-border);
  color: var(--accent-text);
  text-align: center;
  font-weight: 700;
}

#typed { display: flex; gap: 6px; }
#text {
  flex: 1 1 auto;
  min-width: 0;
  font: inherit;
  font-size: 16px; /* 16px stops phones from zooming in */
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--btn-border);
  border-radius: 8px;
  padding: 8px 10px;
}
#send { text-align: center; }
button.mode {
  font-size: 13px;
  color: var(--muted);
  background: transparent;
  padding: 8px 10px;
  text-align: center;
}
