/* The taste of Rin (below v0): text only, phone first. Deliberately plain: no visual style has been chosen yet. */

:root {
  --bg: #f4f1ea;
  --card: #fbf9f4;
  --ink: #1d1b18;
  --muted: #6b655c;
  --line: #ddd6c8;
  --accent: #1d1b18;
  --on-accent: #f4f1ea;
  --bad: #8a2b1e;
  --good: #2f5d3a;
  --new: #efe4c6;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141311;
    --card: #1c1a17;
    --ink: #ece6da;
    --muted: #9a9387;
    --line: #34302a;
    --accent: #ece6da;
    --on-accent: #141311;
    --bad: #e08a78;
    --good: #8fc79c;
    --new: #2e2818;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { margin: 0 0 0.4rem; line-height: 1.2; }
h1 { font-size: 2.2rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: 1rem; margin-top: 1rem; }
h4 { font-size: 1rem; }
p { margin: 0.35rem 0; }
b { font-weight: 650; }
ol, ul { margin: 0.35rem 0; padding-left: 1.3rem; }

.boot { text-align: center; margin-top: 40vh; font-size: 2rem; color: var(--muted); }

/* The bar at the top: who you are, breath, kopal. */
.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: calc(env(safe-area-inset-top) + 0.45rem) 1rem 0.45rem;
  /* Two steady rows: name and breath, then kopal and refresh. */
  display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 0.1rem 1rem;
}
.top > :nth-child(even) { justify-self: end; }
.top .who { font-weight: 650; }
.top .stat { color: var(--muted); font-size: 0.9rem; }
.top .stat b { color: var(--ink); }
.top button.icon { min-height: 0; padding: 0 0.3rem; border: 0; background: none; color: var(--muted); font-size: 1.1rem; }

main {
  max-width: 36rem; margin: 0 auto;
  padding: 0.75rem 0.75rem calc(5rem + env(safe-area-inset-bottom));
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.9rem;
  margin-bottom: 0.75rem;
}
.hint { color: var(--muted); font-size: 0.9rem; }
.meta { color: var(--muted); font-size: 0.86rem; font-weight: 400; }
.banner { background: var(--new); border-radius: 10px; padding: 0.6rem 0.8rem; margin-bottom: 0.75rem; }
.saying, .verse { color: var(--muted); font-style: italic; font-size: 0.92rem; text-align: center; margin: 1rem 0.5rem; }
.verse { text-align: left; margin: 0.6rem 0 0; }
.bad { color: var(--bad); }
.good { color: var(--good); }

.money { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem 1rem; }
.money span { display: block; color: var(--muted); font-size: 0.85rem; }
.money b { font-size: 1.35rem; }

button {
  font: inherit; color: var(--ink);
  min-height: 44px; padding: 0.5rem 0.9rem;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
  touch-action: manipulation;
}
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.45; cursor: default; transform: none; }
button.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
button.quiet { background: none; }
button.link { min-height: 0; padding: 0; border: 0; background: none; text-decoration: underline; font-weight: 650; }
.card > button, .sheet > button, main > button { width: 100%; margin-top: 0.5rem; }
.row { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.row > button { flex: 1; }
body.busy button { pointer-events: none; }

/* Lists of news, deeds and colonists. */
.list { list-style: none; padding: 0; margin: 0.3rem 0 0; }
.list li { padding: 0.45rem 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list li.new { background: var(--new); margin: 0 -0.9rem; padding-left: 0.9rem; padding-right: 0.9rem; }
.list time { display: block; color: var(--muted); font-size: 0.8rem; }
.list button.person { width: 100%; text-align: left; border: 0; background: none; padding: 0.2rem 0; min-height: 44px; }
.dots { letter-spacing: 0.05em; }

.rumour .row button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

.boards { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
@media (min-width: 30rem) { .boards { grid-template-columns: 1fr 1fr 1fr; } }
.boards ol { padding-left: 1.2rem; font-size: 0.95rem; }

.rules li { margin-bottom: 0.45rem; }

/* The bottom navigation. */
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs button {
  flex: 1; border: 0; border-radius: 0; background: none;
  min-height: 52px; font-size: 0.92rem; color: var(--muted);
}
nav.tabs button[aria-current="page"] { color: var(--ink); font-weight: 650; box-shadow: inset 0 2px 0 var(--ink); }

/* Sheets: the keypad, pickers, confirmations, readings. */
#modal:empty { display: none; }
#modal {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 10;
  display: flex; align-items: flex-end; justify-content: center;
}
#modal .backdrop { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; background: rgb(0 0 0 / 0.45); border: 0; border-radius: 0; }
.sheet {
  position: relative;
  width: 100%; max-width: 36rem; max-height: 88vh; overflow-y: auto;
  background: var(--card);
  border-radius: 16px 16px 0 0;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
}
.pad-value { font-size: 2.4rem; font-weight: 650; text-align: center; margin: 0.3rem 0 0; }
.pad-value small { font-size: 1rem; color: var(--muted); font-weight: 400; }
.pad-hint { text-align: center; min-height: 2.6em; }
.pad-short, .pad { display: grid; gap: 0.45rem; margin-top: 0.5rem; }
.pad-short { grid-template-columns: repeat(4, 1fr); }
.pad { grid-template-columns: repeat(3, 1fr); }
.pad button { min-height: 54px; font-size: 1.35rem; }
.reading-person { border-top: 1px solid var(--line); padding: 0.6rem 0; }

/* The login screen. */
.login { max-width: 22rem; padding-top: 18vh; }
.login label { display: block; margin: 0.7rem 0; color: var(--muted); font-size: 0.9rem; }
.login input {
  display: block; width: 100%; margin-top: 0.25rem;
  font: inherit; font-size: 16px; color: var(--ink);
  padding: 0.65rem 0.75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--card);
}
.login form button { width: 100%; margin-top: 0.5rem; }
.login > button { width: 100%; margin-top: 0.75rem; }

/* Messages from the server, at the top: clear of the thumb and of open sheets. */
#toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 0.5rem); z-index: 20;
  transform: translateX(-50%) translateY(-1rem);
  width: min(34rem, calc(100% - 1.5rem));
  background: var(--accent); color: var(--on-accent);
  border-radius: 12px; padding: 0.75rem 0.9rem;
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
#toast.error { background: var(--bad); color: #fff; }
