/* Bean Jar: warm cream, honey and soft coral. Deliberately no dark green or teal. */
:root {
  --bg: #fbf5ea;
  --card: #ffffff;
  --ink: #3a2a1c;
  --ink-2: #6b5443;
  --rule: #ecdcc4;
  --honey: #f3c37a;
  --honey-soft: #fdecd0;
  --coral: #b24a26;          /* buttons: white text on this is 5.6:1 */
  --coral-ink: #ffffff;
  --coral-soft: #fbe1d6;
  --glass: #fffaf2;
  --glass-edge: #b98a5e;
  --lid: #c86f45;
  --focus: #b24a26;
  --shadow: 0 1px 2px rgb(58 42 28 / .06), 0 8px 24px rgb(58 42 28 / .08);
  --font: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1f1a16;
    --card: #2a231d;
    --ink: #f5ecdf;
    --ink-2: #d2c2ae;
    --rule: #43372c;
    --honey: #e7b467;
    --honey-soft: #3a2f22;
    --coral: #f2a582;
    --coral-ink: #2a1a12;
    --coral-soft: #45302a;
    --glass: #2f2822;
    --glass-edge: #a58362;
    --lid: #c86f45;
    --focus: #f2a582;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 1.0625rem/1.55 var(--font);
  padding-inline: clamp(16px, 4vw, 40px);
}
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.top { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.25rem; }
.brand img { border-radius: 9px; }
.home-link { text-decoration: none; font-weight: 700; font-size: .95rem; padding: 8px 14px; border: 1px solid var(--rule); border-radius: 999px; background: var(--card); white-space: nowrap; }

main { max-width: 1080px; margin: 0 auto; display: grid; gap: 22px; padding-bottom: 24px; }
.card { background: var(--card); border: 1px solid var(--rule); border-radius: 18px; padding: 20px 22px; box-shadow: var(--shadow); }

.btn {
  font: 700 1rem/1.2 var(--font); color: var(--ink); background: var(--card);
  border: 2px solid var(--rule); border-radius: 12px; padding: 11px 16px; min-height: 48px; cursor: pointer;
}
.btn:hover { border-color: var(--coral); }
.btn.primary { background: var(--coral); border-color: var(--coral); color: var(--coral-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.center { justify-content: center; }
input[type=text], input[type=password], textarea {
  font: 400 1.05rem/1.4 var(--font); color: var(--ink); background: var(--bg);
  border: 2px solid var(--rule); border-radius: 12px; padding: 11px 14px; min-height: 48px; width: 100%;
}
input:focus, textarea:focus { border-color: var(--coral); outline: none; }

/* Stage: jar + capture */
.stage { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 24px; align-items: start; }
.jar-wrap { display: grid; justify-items: center; gap: 10px; }
.jar { position: relative; width: min(340px, 100%); aspect-ratio: 300 / 360; }
.jar-glass { position: absolute; inset: 0; width: 100%; height: 100%; }
.jar-glass .glass { fill: var(--glass); stroke: var(--glass-edge); stroke-width: 7; stroke-linejoin: round; }
.jar-glass .lid { fill: var(--lid); }
.jar-glass .shine { stroke: #ffffff; stroke-width: 7; stroke-linecap: round; opacity: .55; }
.beans { position: absolute; inset: 0; }
.bean {
  position: absolute; width: 10.5%; height: 5.6%;
  border: 1.5px solid rgb(90 58 30 / .55); border-radius: 50%;
  background: var(--c, #e2cca0); padding: 0; cursor: pointer;
  transform: translate(-50%, -50%) rotate(var(--r, 0deg));
}
.bean::after { /* the dark "eye" a fava bean has */
  content: ''; position: absolute; left: 14%; top: 22%; width: 20%; height: 56%;
  border-left: 2px solid rgb(90 58 30 / .6); border-radius: 50%;
}
.bean:hover, .bean.active { outline: 3px solid var(--coral); outline-offset: 1px; }
@media (prefers-reduced-motion: no-preference) {
  .bean.drop { animation: drop .7s cubic-bezier(.3, .7, .3, 1) both; }
  @keyframes drop {
    from { transform: translate(-50%, -900%) rotate(0deg); opacity: 0; }
    60% { opacity: 1; }
    to { transform: translate(-50%, -50%) rotate(var(--r, 0deg)); }
  }
}
.jar-count { margin: 0; font-weight: 700; text-align: center; }
.bean-card { background: var(--honey-soft); border-radius: 14px; padding: 12px 16px; width: min(340px, 100%); }
.bean-card p { margin: 0; }
.bean-text { font-weight: 700; }
.bean-meta { color: var(--ink-2); font-size: .92rem; }

.side { display: grid; gap: 16px; }
.big-label { font-size: 1.4rem; font-weight: 700; display: block; }
.hint { margin: 2px 0 12px; color: var(--ink-2); }
.add-row { display: flex; gap: 10px; }
.add-row input { flex: 1; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  font: 400 .95rem/1.2 var(--font); color: var(--ink); background: var(--honey-soft);
  border: 1.5px solid transparent; border-radius: 999px; padding: 9px 14px; min-height: 44px; cursor: pointer;
}
.chip:hover { border-color: var(--coral); }
.chip[aria-pressed="true"] { background: var(--coral-soft); border-color: var(--coral); font-weight: 700; }
.feelings { border: 0; padding: 0; margin: 14px 0 0; }
.feelings legend { font-weight: 700; padding: 0; }
.optional { font-weight: 400; color: var(--ink-2); }

.btn.proof { background: var(--honey); border-color: var(--honey); color: #3a2a1c; font-size: 1.15rem; min-height: 56px; }

.memories { display: grid; gap: 12px; }
.memory { background: var(--honey-soft); border-radius: 16px; padding: 14px 18px; }
.memory h3 { margin: 0 0 4px; font-size: 1rem; }
.memory p { margin: 0 0 6px; }
.memory ul { margin: 4px 0 8px; padding-left: 1.2em; }
.memory .meta { color: var(--ink-2); font-size: .92rem; }
.memory .row { margin-top: 6px; }
.memory .btn { min-height: 40px; padding: 7px 12px; font-size: .95rem; }

/* List */
.list-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; }
.list-head h2 { margin: 0; font-size: 1.3rem; }
.switch { display: flex; gap: 8px; align-items: center; color: var(--ink-2); font-size: .95rem; cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--coral); }
.empty { color: var(--ink-2); }
.wins { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 4px; }
.day { margin: 14px 0 4px; font-size: .95rem; color: var(--ink-2); font-weight: 700; }
.win { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--bg); }
.win .dot { flex: none; width: 22px; height: 14px; border-radius: 50%; background: var(--c, #e2cca0); border: 1.5px solid rgb(90 58 30 / .5); }
.win .text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.win .tag { display: inline-block; margin-left: 6px; font-size: .82rem; color: var(--ink-2); background: var(--honey-soft); border-radius: 999px; padding: 1px 8px; }
.win .feel { color: var(--ink-2); font-size: .9rem; }
.win .acts { display: flex; gap: 6px; flex: none; }
.win .acts .btn { min-height: 40px; padding: 6px 12px; font-size: .9rem; }
.win input { min-height: 40px; }

.settings summary { font-weight: 700; cursor: pointer; font-size: 1.1rem; }
.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; margin-top: 14px; }
.settings h3 { margin: 0 0 6px; font-size: 1.05rem; }
.settings p { margin: 0 0 10px; color: var(--ink-2); }
.settings textarea { margin: 6px 0 10px; }
.small { font-size: .9rem; }
.file-btn { display: inline-flex; align-items: center; }
.msg { min-height: 1.4em; margin: 6px 0 0; font-weight: 700; }

.foot { max-width: 1080px; margin: 0 auto; padding-block: 18px 32px; color: var(--ink-2); font-size: .92rem; border-top: 1px solid var(--rule); }
.foot p { margin: 0 0 8px; }
.talk { color: var(--ink); }

/* Proof view */
.proof-view {
  border: 0; border-radius: 22px; padding: 28px clamp(18px, 4vw, 40px); width: min(640px, calc(100vw - 32px));
  background: var(--card); color: var(--ink); box-shadow: 0 30px 80px rgb(0 0 0 / .35);
}
.proof-view::backdrop { background: rgb(58 42 28 / .55); }
.proof-total { margin: 0 0 16px; text-align: center; font-weight: 700; color: var(--ink-2); }
.proof-bean { margin: 0 0 22px; background: var(--honey-soft); border-radius: 18px; padding: 26px 24px; text-align: center; }
.proof-bean blockquote { margin: 0; font-size: clamp(1.35rem, 3.4vw, 1.8rem); font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.proof-bean figcaption { margin-top: 10px; color: var(--ink-2); }

/* Lock screen */
.lock { position: fixed; inset: 0; z-index: 20; background: var(--bg); display: grid; place-items: center; padding: 16px; }
.lock-card { background: var(--card); border: 1px solid var(--rule); border-radius: 22px; padding: 28px; width: min(420px, 100%); display: grid; gap: 10px; text-align: center; box-shadow: var(--shadow); }
.lock-card h1 { margin: 0; font-size: 1.4rem; }
.lock-card label { text-align: left; font-weight: 700; }
.forgot { text-align: left; color: var(--ink-2); }
.forgot summary { cursor: pointer; }

.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 14px; display: flex; gap: 14px; align-items: center;
  box-shadow: var(--shadow); z-index: 30; max-width: calc(100vw - 32px);
}
.toast-btn { font: 700 1rem var(--font); background: transparent; color: var(--honey); border: 0; cursor: pointer; min-height: 40px; }

@media (max-width: 860px) {
  .stage { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .add-row { flex-direction: column; }
  .win { flex-wrap: wrap; }
  .win .acts { width: 100%; justify-content: flex-end; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
