:root {
  --lcd-bg: #b8c4a0;
  --lcd-ink: #1e2618;
  --body: #2b2d30;
  --body-hi: #3a3d41;
  --bezel: #141516;
}

* { box-sizing: border-box; }

/* The page itself never scrolls or bounces (incl. pull-to-refresh); only the message list scrolls */
html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  touch-action: manipulation;   /* no double-tap zoom */
  background: var(--body) url("images/plastic.jpg") repeat;
  background-size: 160px;
  margin: 0;
  font-family: 'Doto', monospace;
  font-weight: 700;
}

/* Phone body: fills the viewport, the plastic shows as a border around the screen */
.phone {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 20px 16px 24px;
}

.speaker {
  width: 72px;
  height: 6px;
  margin: 0 auto 20px;
  border-radius: 3px;
  background: var(--bezel);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* Recessed frame around the LCD */
.bezel {
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 14px;
  border-radius: 14px;
  background: var(--bezel);
  box-shadow:
    inset 0 3px 6px rgba(0, 0, 0, 0.8),
    0 1px 0 rgba(255, 255, 255, 0.06);
}

.screen {
  /* One row of LCD dots, used for every divider line so they match the dot-matrix font */
  --dots: radial-gradient(circle, var(--lcd-ink) 1.2px, transparent 1.5px);
  background: var(--lcd-bg);
  color: var(--lcd-ink);
  border-radius: 6px;
  padding: 14px 16px 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 0 18px rgba(30, 38, 24, 0.35);
}

.counter, .label { text-align: center; }

.lcd {
  font-size: 5rem;
  font-weight: 900;
  line-height: 1;
}

.label { margin: 4px 0 0; letter-spacing: 0.1em; }

.messages { list-style: none; padding: 0; margin: 16px 0 0; font-size: 1.5rem; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.messages li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 0 12px;
  background: var(--dots) 0 100% / 5px 4px repeat-x;
}
.messages .delete { margin-left: auto; }

.messages button {
  background: none;
  border: none;
  padding: 0 4px;
  color: var(--lcd-ink);
  font: inherit;
  line-height: 1;
  cursor: pointer;
}
.messages .delete { font-size: 1.8rem; }
.messages li.confirming {
  background: var(--lcd-ink);
  color: var(--lcd-bg);
}
.messages li.confirming > :not(.confirm) { display: none; }
.messages .confirm { display: flex; align-items: center; gap: 16px; width: 100%; padding: 0 4px 0 12px; }
.messages .confirm .ask { animation: blink 1s steps(1) infinite; }
.messages .confirm .yes { margin-left: auto; }
.messages .confirm button { color: var(--lcd-bg); }
.messages .confirm button:hover,
.messages .confirm button:focus-visible { background: var(--lcd-bg); color: var(--lcd-ink); outline: none; }

@keyframes blink { 50% { opacity: 0; } }

.messages li.playing .play { background: var(--lcd-ink); color: var(--lcd-bg); }
.messages li.new { font-weight: 900; }

.tag {
  padding: 0 4px;
  background: var(--lcd-ink);
  color: var(--lcd-bg);
}

/* Shares the preview's slot and sizing, so REC and playback appear in the same place */
#status {
  margin: 12px 0 0;
  padding: 12px 0;
  font-size: 2.25rem;
  text-align: center;
}
#status:empty { display: none; }

/* Softkeys drawn on the LCD, pinned to the bottom of the screen.
   Divider lines use --dots, defined on .screen. */
.softkeys {
  display: flex;
  margin: 0 -16px;
  padding-top: 4px;
  background: var(--dots) 0 0 / 5px 4px repeat-x;
}

.softkeys button {
  flex: 1;
  padding: 14px 0;
  border: none;
  background: none;
  color: var(--lcd-ink);
  font: inherit;
  font-size: 1.2rem;
  letter-spacing: 0.1em;
  cursor: pointer;
}
.softkeys button + button { background: var(--dots) 0 0 / 4px 5px repeat-y; }
.softkeys .icon { margin-right: 0.4em; }

.softkeys button:active:not(:disabled) { background: var(--lcd-ink); color: var(--lcd-bg); }
/* Fade the label only, so the dotted divider stays solid */
.softkeys button:disabled { color: rgba(30, 38, 24, 0.3); cursor: default; }
.softkeys button[hidden] { display: none; }

/* Dot-matrix icons to match Doto, drawn with a mask so they take the text colour */
/* Sized to cap height and sat on the baseline so it lines up with the text beside it */
.icon {
  display: inline-block;
  height: 0.7em;
  height: 1cap;
  background: currentColor;
  mask: var(--icon) center / contain no-repeat;
  -webkit-mask: var(--icon) center / contain no-repeat;
  vertical-align: baseline;
}
.icon-play { aspect-ratio: 0.5714; --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 7'><circle cx='0.5' cy='0.5' r='.4'/><circle cx='0.5' cy='1.5' r='.4'/><circle cx='1.5' cy='1.5' r='.4'/><circle cx='0.5' cy='2.5' r='.4'/><circle cx='1.5' cy='2.5' r='.4'/><circle cx='2.5' cy='2.5' r='.4'/><circle cx='0.5' cy='3.5' r='.4'/><circle cx='1.5' cy='3.5' r='.4'/><circle cx='2.5' cy='3.5' r='.4'/><circle cx='3.5' cy='3.5' r='.4'/><circle cx='0.5' cy='4.5' r='.4'/><circle cx='1.5' cy='4.5' r='.4'/><circle cx='2.5' cy='4.5' r='.4'/><circle cx='0.5' cy='5.5' r='.4'/><circle cx='1.5' cy='5.5' r='.4'/><circle cx='0.5' cy='6.5' r='.4'/></svg>"); }
.icon-pause { aspect-ratio: 0.7143; --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5 7'><circle cx='0.5' cy='0.5' r='.4'/><circle cx='1.5' cy='0.5' r='.4'/><circle cx='3.5' cy='0.5' r='.4'/><circle cx='4.5' cy='0.5' r='.4'/><circle cx='0.5' cy='1.5' r='.4'/><circle cx='1.5' cy='1.5' r='.4'/><circle cx='3.5' cy='1.5' r='.4'/><circle cx='4.5' cy='1.5' r='.4'/><circle cx='0.5' cy='2.5' r='.4'/><circle cx='1.5' cy='2.5' r='.4'/><circle cx='3.5' cy='2.5' r='.4'/><circle cx='4.5' cy='2.5' r='.4'/><circle cx='0.5' cy='3.5' r='.4'/><circle cx='1.5' cy='3.5' r='.4'/><circle cx='3.5' cy='3.5' r='.4'/><circle cx='4.5' cy='3.5' r='.4'/><circle cx='0.5' cy='4.5' r='.4'/><circle cx='1.5' cy='4.5' r='.4'/><circle cx='3.5' cy='4.5' r='.4'/><circle cx='4.5' cy='4.5' r='.4'/><circle cx='0.5' cy='5.5' r='.4'/><circle cx='1.5' cy='5.5' r='.4'/><circle cx='3.5' cy='5.5' r='.4'/><circle cx='4.5' cy='5.5' r='.4'/><circle cx='0.5' cy='6.5' r='.4'/><circle cx='1.5' cy='6.5' r='.4'/><circle cx='3.5' cy='6.5' r='.4'/><circle cx='4.5' cy='6.5' r='.4'/></svg>"); }

.icon-rec { aspect-ratio: 1.0000; --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5 5'><circle cx='1.5' cy='0.5' r='.4'/><circle cx='2.5' cy='0.5' r='.4'/><circle cx='3.5' cy='0.5' r='.4'/><circle cx='0.5' cy='1.5' r='.4'/><circle cx='1.5' cy='1.5' r='.4'/><circle cx='2.5' cy='1.5' r='.4'/><circle cx='3.5' cy='1.5' r='.4'/><circle cx='4.5' cy='1.5' r='.4'/><circle cx='0.5' cy='2.5' r='.4'/><circle cx='1.5' cy='2.5' r='.4'/><circle cx='2.5' cy='2.5' r='.4'/><circle cx='3.5' cy='2.5' r='.4'/><circle cx='4.5' cy='2.5' r='.4'/><circle cx='0.5' cy='3.5' r='.4'/><circle cx='1.5' cy='3.5' r='.4'/><circle cx='2.5' cy='3.5' r='.4'/><circle cx='3.5' cy='3.5' r='.4'/><circle cx='4.5' cy='3.5' r='.4'/><circle cx='1.5' cy='4.5' r='.4'/><circle cx='2.5' cy='4.5' r='.4'/><circle cx='3.5' cy='4.5' r='.4'/></svg>"); }
.icon-stop { aspect-ratio: 1.0000; --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5 5'><circle cx='0.5' cy='0.5' r='.4'/><circle cx='1.5' cy='0.5' r='.4'/><circle cx='2.5' cy='0.5' r='.4'/><circle cx='3.5' cy='0.5' r='.4'/><circle cx='4.5' cy='0.5' r='.4'/><circle cx='0.5' cy='1.5' r='.4'/><circle cx='1.5' cy='1.5' r='.4'/><circle cx='2.5' cy='1.5' r='.4'/><circle cx='3.5' cy='1.5' r='.4'/><circle cx='4.5' cy='1.5' r='.4'/><circle cx='0.5' cy='2.5' r='.4'/><circle cx='1.5' cy='2.5' r='.4'/><circle cx='2.5' cy='2.5' r='.4'/><circle cx='3.5' cy='2.5' r='.4'/><circle cx='4.5' cy='2.5' r='.4'/><circle cx='0.5' cy='3.5' r='.4'/><circle cx='1.5' cy='3.5' r='.4'/><circle cx='2.5' cy='3.5' r='.4'/><circle cx='3.5' cy='3.5' r='.4'/><circle cx='4.5' cy='3.5' r='.4'/><circle cx='0.5' cy='4.5' r='.4'/><circle cx='1.5' cy='4.5' r='.4'/><circle cx='2.5' cy='4.5' r='.4'/><circle cx='3.5' cy='4.5' r='.4'/><circle cx='4.5' cy='4.5' r='.4'/></svg>"); }

/* Recording preview */
.preview {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 16px;
  margin: 12px -16px 0;
  padding: 12px 16px;
  font-size: 2.25rem;
}
.preview[hidden] { display: none; }

.preview button {
  padding: 0 4px;
  border: none;
  background: none;
  color: var(--lcd-ink);
  font: inherit;
  line-height: 1;
  cursor: pointer;
}
.preview button:active { background: var(--lcd-ink); color: var(--lcd-bg); }

.preview .time { font-variant-numeric: tabular-nums; }

#status.recording { animation: blink 1s steps(1) infinite; }

/* Login screen */
.login-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

.lcd-input {
  width: 100%;
  max-width: 320px;
  padding: 8px 4px 12px;
  border: none;
  border-radius: 0;
  outline: none;
  background: var(--dots) 0 100% / 5px 4px repeat-x;
  color: var(--lcd-ink);
  caret-color: var(--lcd-ink);
  font: inherit;
  font-size: 2.25rem;
  letter-spacing: 0.2em;
  text-align: center;
}

.login-error { margin: 0; animation: blink 1s steps(1) infinite; }
