/* Copyright 2026 Adrian Ferguson
 * SPDX-License-Identifier: Apache-2.0 */
/* High contrast look for low vision: every colour is set here. */
:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  font-size: 1.05rem;
  --page: #000000;
  --panel: #111111;
  --text: #ffffff;
  --muted: #e6e6e6;
  --edge: #8c8c8c;
  --active: #ffd60a;
  --active-text: #000000;
  --info: #4cc9f0;
  --dot-off: #8c8c8c;
  color: var(--text);
  background: var(--page);
}

body { margin: 0; background: var(--page); }

main {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  min-height: 100vh;
  max-width: 62rem;
  margin: 0 auto;
  padding: 1rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 1.5rem;
  border-bottom: 4px solid var(--active);
}

h1 { margin: 0 0 0.5rem; font-size: clamp(1.9rem, 6vw, 2.6rem); color: var(--active); }
h2 { margin: 0 0 0.6rem; font-size: 1.1rem; color: var(--info); text-transform: uppercase; letter-spacing: 0.08em; }
p { margin: 0; }
.hero {
  background: var(--panel);
  border: 4px solid var(--active);
  border-radius: 0.4rem;
  padding: 0.7rem;
}
.keys { margin-top: auto; }
p { color: var(--muted); }
#connection { margin: 0 0 0.5rem; font-weight: 700; }
#connection.connected { color: var(--info); }
#row-reading {
  margin: 0.7rem 0 0;
  padding-top: 0.5rem;
  border-top: 2px solid var(--edge);
  color: var(--info);
  font-size: 1.1rem;
  font-weight: 700;
}
#row-text {
  display: block;
  min-height: 2.5em;
  margin-top: 0.3rem;
  font-family: ui-monospace, monospace;
  font-size: 1.7rem;
  line-height: 1.3;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
}
#route-help { margin-top: 0.4rem; font-size: 0.9rem; color: var(--muted); }

/* The 40 cells are one line of braille, folded into two rows of 20. */
#cells {
  display: grid;
  grid-template-columns: repeat(20, minmax(0, 1fr));
  gap: 0.25rem;
}

#display-keys {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

button {
  border: 2px solid var(--edge);
  border-radius: 0.3rem;
  background: var(--panel);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

button:disabled { cursor: default; }
button:not(:disabled):hover { border-color: var(--active); background: var(--active); color: var(--active-text); }
button:focus-visible { outline: 4px solid var(--active); outline-offset: 3px; }
/* Large keys with a thick lower edge, so they look pressable. */
#display-keys button {
  min-height: 4rem;
  padding: 0.4rem 0.9rem;
  font-size: 1.3rem;
  font-weight: 700;
  border: 3px solid var(--active);
  border-bottom-width: 8px;
  border-radius: 0.5rem;
}
#display-keys button:disabled { border-color: var(--edge); }
#display-keys button:not(:disabled):active { border-bottom-width: 3px; margin-top: 5px; }
#display-keys button:disabled { color: var(--muted); }

.cell {
  display: grid;
  justify-items: center;
  gap: 0.2rem;
  padding: 0.3rem 0 0.2rem;
  border: 2px solid var(--edge);
  border-radius: 0.25rem;
  background: var(--page);
}

.pattern {
  display: grid;
  grid-template: repeat(4, 0.72rem) / repeat(2, 0.72rem);
  gap: 0.22rem 0.3rem;
}

/* Raised dots are drawn solid yellow. A flat position is an empty ring. */
.dot { border-radius: 50%; box-sizing: border-box; border: 2px solid var(--dot-off); background: transparent; }
.dot.on { border-color: var(--active); background: var(--active); }
.dot:nth-child(1) { grid-area: 1 / 1; }
.dot:nth-child(2) { grid-area: 2 / 1; }
.dot:nth-child(3) { grid-area: 3 / 1; }
.dot:nth-child(4) { grid-area: 1 / 2; }
.dot:nth-child(5) { grid-area: 2 / 2; }
.dot:nth-child(6) { grid-area: 3 / 2; }
.dot:nth-child(7) { grid-area: 4 / 1; }
.dot:nth-child(8) { grid-area: 4 / 2; }
.character { font: 700 1.1rem/1.1rem ui-monospace, monospace; min-height: 1.1rem; }
.number { color: var(--info); font-size: 0.7rem; font-variant-numeric: tabular-nums; }
#key-status { min-height: 1.3em; margin-top: 0.4rem; color: var(--info); }

@media (max-width: 52rem) {
  #cells { grid-template-columns: repeat(10, minmax(0, 1fr)); }
  #display-keys { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
