/* Talk — warm, high contrast, large. Designed for an 85-year-old holding a
   phone at arm's length in a lit room, not for a developer at night. */

:root {
  --bg: #1c1a17;
  --panel: #26231f;
  --ink: #f4efe7;
  --dim: #a49b8d;
  --mine: #3a5a40;
  --theirs: #2f2b26;
  --accent: #c9a227;
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  -webkit-text-size-adjust: 100%;
}

/* The one knob the site config turns. "large" is not a preference, it is the
   difference between reading it and not. */
body[data-scale="large"] { font-size: 21px; line-height: 1.55; }
body[data-scale="normal"] { font-size: 17px; line-height: 1.45; }

#gate {
  height: 100%;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 2rem;
  gap: 1rem;
}
#gate h1 { font-size: 2rem; margin: 0; color: var(--accent); }
#gate p { color: var(--dim); max-width: 22rem; margin: 0 auto; }

#app {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  max-width: 46rem;
  margin: 0 auto;
}

#bar {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: max(.7rem, env(safe-area-inset-top)) 1rem .7rem;
  background: var(--panel);
  border-bottom: 1px solid #000;
}
#room-name { flex: 1; font-size: .95em; color: var(--dim); }
#rooms-btn {
  background: none; border: 0; color: var(--ink);
  font-size: 1.3em; cursor: pointer; padding: .2rem .4rem;
}

/* Connection state, always visible. Silence reads as death. */
#state { width: .7rem; height: .7rem; border-radius: 50%; background: var(--dim); }
#state.ok { background: #6a994e; }
#state.bad { background: #bc4749; }

#rooms {
  position: absolute;
  top: 3.4rem; left: 0; right: 0;
  background: var(--panel);
  border-bottom: 1px solid #000;
  display: flex; flex-direction: column;
  max-height: 70vh; overflow-y: auto;
  z-index: 5;
}
#rooms .room {
  background: none; border: 0; border-bottom: 1px solid #000;
  color: var(--ink); text-align: left; font: inherit;
  padding: 1rem 1.2rem; cursor: pointer;
}
#rooms .room:active { background: #322e28; }

#timeline {
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .9rem;
  overscroll-behavior: contain;
}

.msg {
  max-width: 85%;
  padding: .7rem .95rem;
  border-radius: var(--radius);
  background: var(--theirs);
  align-self: flex-start;
}
.msg.mine { background: var(--mine); align-self: flex-end; }
.who { font-size: .78em; color: var(--accent); margin-bottom: .25rem; }
.text { white-space: pre-wrap; word-wrap: break-word; }
.caption { font-size: .85em; color: var(--dim); margin-top: .4rem; }
.photo { max-width: 100%; border-radius: 12px; display: block; }
.msg audio { width: min(20rem, 60vw); }
.when { display: block; font-size: .7em; color: var(--dim); margin-top: .35rem; text-align: right; }

#composer {
  display: flex;
  gap: .6rem;
  padding: .7rem 1rem max(.7rem, env(safe-area-inset-bottom));
  background: var(--panel);
  border-top: 1px solid #000;
  align-items: flex-end;
}
#input {
  flex: 1;
  resize: none;
  font: inherit;
  color: var(--ink);
  background: #16140f;
  border: 1px solid #3a352d;
  border-radius: var(--radius);
  padding: .65rem .9rem;
  max-height: 160px;
}
#input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

#rec-hint {
  margin: 0;
  padding: 0 1rem;
  color: var(--accent);
  font-size: .9em;
  text-align: center;
}
#rec-hint:empty { display: none; }

/* Recording panel. While she is talking this is the only thing on screen that
   matters, so it is the only thing competing for attention. */
#recbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: .8rem;
  padding: 1rem 1rem max(1rem, env(safe-area-inset-bottom));
  background: var(--panel);
  border-top: 1px solid #000;
}
#recmeta { display: flex; align-items: center; gap: .6rem; color: var(--dim); font-size: .9em; }
#recmeta .dot {
  width: .8rem; height: .8rem; border-radius: 50%;
  background: #bc4749;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .25 } }
#recmeta .hint { margin-left: auto; }
#wave { width: 100%; height: 56px; display: block; }

/* The largest control in the app. She may need to find it mid-sentence,
   possibly without her glasses. */
#stop {
  width: 100%;
  padding: 1.1rem;
  font: inherit;
  font-size: 1.15em;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #1c1a17;
  cursor: pointer;
}

#rec {
  flex: 0 0 auto;
  width: 3.1rem; height: 3.1rem;
  border-radius: 50%;
  border: 1px solid #3a352d;
  background: #16140f;
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
}
body[data-scale="large"] #rec { width: 3.6rem; height: 3.6rem; font-size: 1.5rem; }

/* Big enough to hit with a shaky hand: comfortably past the 44px minimum. */
#send {
  flex: 0 0 auto;
  width: 3.1rem; height: 3.1rem;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: #1c1a17;
  font-size: 1.4rem;
  cursor: pointer;
}
#send:active { transform: scale(.95); }
