:root {
  --stone: #E6E8E1;   /* page */
  --paper: #F6F7F2;   /* raised surfaces */
  --pine:  #1D3A2E;   /* ink + primary */
  --moss:  #5F6F63;   /* secondary text */
  --blaze: #E8601C;   /* hunter orange: action */
  --line:  #CDD2C8;
  --on-blaze: #FFFFFF;
  --head: "Barlow Semi Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Barlow", system-ui, -apple-system, sans-serif;
  --pad: 20px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --stone: #17291F; --paper: #1F3429; --pine: #E9ECE3; --moss: #9DAA9F;
    --blaze: #F07A36; --line: #2F4638; --on-blaze: #17291F;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--stone); color: var(--pine);
  font: 400 17px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top);
}
h1, h2, h3 { font-family: var(--head); font-weight: 700; line-height: 1.1; margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--blaze); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--moss); margin: 0; }
.center { text-align: center; }
.error { color: var(--blaze); min-height: 1.5em; }
[hidden] { display: none !important; }

/* ---------- buttons ---------- */
.btn-blaze, .btn-pine, .btn-quiet {
  border: 0; border-radius: 999px; padding: 12px 22px; font-weight: 600;
}
.btn-blaze { background: var(--blaze); color: var(--on-blaze); }
.btn-pine  { background: var(--pine); color: var(--stone); }
.btn-quiet { background: transparent; color: var(--pine); border: 1.5px solid var(--line); }
.small { padding: 8px 16px; font-size: 15px; }
.icon-btn { background: none; border: 0; color: var(--moss); padding: 8px; border-radius: 10px; }

/* ---------- sign in ---------- */
.signin { min-height: 100vh; display: grid; place-items: center; padding: var(--pad); }
.signin-inner { width: 100%; max-width: 320px; }
.signin h1 { font-size: 44px; margin: 18px 0 6px; }
.signin form { display: flex; gap: 10px; margin-top: 22px; }
.signin input {
  flex: 1; min-width: 0; border: 1.5px solid var(--line); background: var(--paper);
  border-radius: 12px; padding: 12px 14px; font-size: 22px; letter-spacing: .3em;
}
.mark { width: 56px; height: 56px; border-radius: 50%; background: var(--blaze);
        box-shadow: inset 0 0 0 14px var(--blaze), inset 0 0 0 30px var(--pine); }

/* ---------- layout ---------- */
.top { display: flex; justify-content: space-between; align-items: flex-start; padding: 22px var(--pad) 10px; }
#headline { font-size: 34px; }
main { padding: 0 var(--pad) calc(96px + env(safe-area-inset-bottom)); max-width: 640px; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around;
  background: var(--paper); border-top: 1px solid var(--line);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}
.tabs a {
  flex: 1; text-align: center; text-decoration: none; color: var(--moss);
  font: 600 17px var(--head); padding: 10px 0; border-radius: 10px;
}
.tabs a[aria-current="page"] { color: var(--pine); background: var(--stone); }

/* ---------- today ---------- */
.feed-item { border-left: 3px solid var(--blaze); padding: 2px 0 2px 12px; margin: 8px 0 20px; }
.feed-item strong { display: block; }
.project { margin: 26px 0 8px; }
.project h2 { font-size: 22px; }
.idea {
  background: var(--paper); border-radius: 14px; padding: 14px 16px; margin: 10px 0;
  display: grid; grid-template-columns: 2.2ch 1fr; column-gap: 10px;
}
.idea .n { font: 700 20px var(--head); color: var(--moss); }
.idea h3 { font: 600 18px/1.3 var(--body); }
.idea p { margin: 4px 0 0; color: var(--moss); font-size: 16px; }
.idea .actions { grid-column: 2; display: flex; gap: 8px; margin-top: 12px; }
.idea .status { grid-column: 2; margin-top: 10px; font-weight: 600; font-size: 15px; }
.idea.started .status { color: var(--blaze); }
.idea.later { opacity: .7; }
.empty { padding: 40px 0; }
.empty h2 { font-size: 26px; margin-bottom: 6px; }
#read-list { margin-top: 18px; width: 100%; }

/* ---------- reviews ---------- */
.review-card {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--pine); color: var(--stone); text-decoration: none;
  border-radius: 14px; padding: 14px 16px; margin: 4px 0 8px;
}
.review-card .muted { color: inherit; opacity: .75; flex: none; }
.review h2 { font-size: 22px; margin: 24px 0 8px; }
.review p, .review li { margin: 6px 0; }
.review ul, .review ol { padding-left: 22px; margin: 0; }
.review .when { color: var(--moss); margin: 0 0 4px; }
.wide { width: 100%; display: block; text-align: center; text-decoration: none; }
.back { margin-top: 28px; }
#checkin { margin: 6px 0 4px; }

/* ---------- queue ---------- */
.q-section { margin: 20px 0; }
.q-section h2 { font-size: 22px; margin-bottom: 6px; }
.q-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.q-item .meta { color: var(--moss); font-size: 14px; }

/* ---------- talk ---------- */
.talk { display: flex; flex-direction: column; }
#messages { display: flex; flex-direction: column; gap: 10px; padding: 6px 0 18px; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 16px; }
.msg.me { align-self: flex-end; background: var(--pine); color: var(--stone); border-bottom-right-radius: 4px; }
.msg.jarvis { align-self: flex-start; background: var(--paper); border-bottom-left-radius: 4px; }
.msg.thinking { color: var(--moss); }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea {
  flex: 1; resize: none; border: 1.5px solid var(--line); background: var(--paper);
  border-radius: 14px; padding: 11px 14px; max-height: 140px;
}
.send { border: 0; background: none; color: var(--blaze); font-weight: 600; padding: 12px 6px; }
.mic {
  align-self: center; margin-top: 22px; width: 92px; height: 92px; border-radius: 50%; border: 0;
  background: var(--blaze); color: var(--on-blaze); display: grid; place-items: center;
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--blaze) 18%, transparent);
}
.mic.live { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse {
  50% { box-shadow: 0 0 0 18px color-mix(in srgb, var(--blaze) 10%, transparent); }
}
#mic-hint { margin-top: 12px; min-height: 1.5em; }

/* ---------- settings ---------- */
.sheet {
  border: 0; border-radius: 20px 20px 0 0; width: 100%; max-width: 640px; margin: auto auto 0;
  background: var(--paper); color: var(--pine); padding: 22px var(--pad) calc(22px + env(safe-area-inset-bottom));
}
.sheet::backdrop { background: rgb(0 0 0 / .35); }
.sheet h2 { font-size: 28px; margin-bottom: 8px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.help { background: var(--stone); border-radius: 12px; padding: 12px 14px; font-size: 15px; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.sheet-actions .btn-pine { margin-left: auto; }
.switch { appearance: none; width: 50px; height: 30px; border-radius: 999px; background: var(--line); position: relative; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--paper); transition: transform .15s; }
.switch:checked { background: var(--blaze); }
.switch:checked::after { transform: translateX(20px); }

#toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--pine); color: var(--stone); padding: 10px 18px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw;
}
#toast.show { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .mic.live { animation: none; }
  .switch::after, #toast { transition: none; }
}
