@font-face {
  font-family: "Fredoka";
  src: url("/fonts/fredoka-latin.woff") format("woff");
  font-weight: 400 600;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("/fonts/nunito-latin.woff") format("woff");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  /* Theme tokens (default theme "Meadow", working name). More themes arrive in a later milestone. */
  --bg: #f6f3ea;
  --surface: #fffdf7;
  --text: #2c3a2f;
  --muted: #5d6b5f;
  --accent: #2f7d4f;
  --on-accent: #ffffff;
  --accent-soft: #e1efdf;
  --positive: #2f7d4f;
  --caution: #5a3d00;
  --caution-soft: #fbecc8;
  --line: #e3dfd0;
  /* spacing scale 4, 8, 16, 24, 32 */
  --s1: 4px;
  --s2: 8px;
  --s3: 16px;
  --s4: 24px;
  --s5: 32px;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 2px 10px rgba(44, 58, 47, 0.07);
  --font-head: "Fredoka", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.page { max-width: 640px; margin: 0 auto; padding: var(--s3) var(--s3) var(--s5); }

.top { display: flex; align-items: center; gap: var(--s2); min-height: 52px; margin-bottom: var(--s3); }
.top h1 { font-family: var(--font-head); font-weight: 600; font-size: 26px; margin: 0; flex: 1; line-height: 1.2; }
.back { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; padding: 0 var(--s2); color: var(--accent); font-weight: 700; text-decoration: none; border-radius: var(--radius-sm); }

.btn, .lang {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 48px; min-width: 48px; padding: 0 var(--s4);
  border: 0; border-radius: 999px; cursor: pointer;
  font-family: var(--font-body); font-weight: 700; font-size: 17px; text-decoration: none;
  background: var(--accent); color: var(--on-accent);
}
.btn.secondary, .lang { background: var(--accent-soft); color: var(--text); }
.btn.quiet { background: transparent; color: var(--accent); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.block { width: 100%; }
.lang { padding: 0 var(--s3); min-height: 44px; font-size: 15px; }
.btn:focus-visible, .lang:focus-visible, .back:focus-visible, input:focus-visible, .linkish:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
label.btn:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--s4); margin-bottom: var(--s3); }
.card h2 { font-family: var(--font-head); font-weight: 600; font-size: 22px; margin: 0 0 var(--s2); }
.card p { margin: 0 0 var(--s3); }
.card p:last-child { margin-bottom: 0; }
.muted { color: var(--muted); }
.notice { background: var(--caution-soft); color: var(--caution); border-radius: var(--radius-sm); padding: var(--s3); margin-bottom: var(--s3); font-size: 15px; }
.stack { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s3); }
.row-actions { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s3); }

.stats { list-style: none; margin: 0 0 var(--s3); padding: 0; }
.stats li { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
.stats li:last-child { border-bottom: 0; }
.stats .num { font-family: var(--font-head); font-weight: 600; font-size: 22px; }

.field { display: block; margin: var(--s3) 0 var(--s2); }
.field span { display: block; font-weight: 700; margin-bottom: var(--s1); }
input[type="text"] {
  width: 100%; min-height: 52px; padding: 0 var(--s3); font: inherit; font-size: 20px;
  color: var(--text); background: var(--bg); border: 2px solid var(--line); border-radius: var(--radius-sm);
}
.check { display: flex; align-items: center; gap: var(--s2); min-height: 44px; margin: var(--s2) 0; }
.check input { width: 24px; height: 24px; accent-color: var(--accent); }
.error-text { color: var(--caution); font-weight: 700; margin: var(--s2) 0 0; }

.tx { list-style: none; margin: 0; padding: 0; }
.tx li { display: grid; grid-template-columns: 1fr auto; gap: 0 var(--s3); padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
.tx li:last-child { border-bottom: 0; }
.tx .who { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx .what { grid-column: 1; color: var(--muted); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx .when { grid-column: 1; color: var(--muted); font-size: 14px; }
.tx .amt { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-weight: 700; white-space: nowrap; }
.tx .amt.pos { color: var(--positive); }

.kv { margin: 0; }
.kv div { display: flex; justify-content: space-between; gap: var(--s3); padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
.kv div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 700; text-align: right; }
.tags { display: flex; flex-wrap: wrap; gap: var(--s2); padding: 0; margin: var(--s2) 0 var(--s3); list-style: none; }
.tags li { background: var(--accent-soft); border-radius: 999px; padding: var(--s1) var(--s3); font-size: 15px; }

.foot { display: flex; justify-content: space-between; align-items: center; margin-top: var(--s4); color: var(--muted); font-size: 14px; }
.linkish { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; min-height: 44px; padding: 0 var(--s2); }
.noscript { padding: var(--s4); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
