/* Brain Intake. High contrast for sunlight, big targets for one thumb. */
:root {
  --green: #0b5d1e;
  --green-dark: #063d13;
  --ink: #000;
  --paper: #fff;
  --line: #222;
  --muted: #444;
  --yellow: #ffd400;
  --red: #b00020;
  --gap: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; background: var(--paper); color: var(--ink); }
body {
  font: 600 20px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

/* top bar */
.bar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 8px) var(--gap) 8px;
  border-bottom: 3px solid var(--line);
  min-height: 64px;
}
.farm { flex: 1; font-size: 22px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill {
  background: var(--yellow); color: var(--ink); border: 3px solid var(--ink);
  border-radius: 999px; padding: 8px 16px; font: inherit; font-size: 18px; font-weight: 800;
  min-height: 48px;
}
.pill.bad { background: var(--red); color: #fff; border-color: var(--red); }
.gear { background: none; border: 0; color: var(--ink); width: 52px; height: 52px; padding: 12px; margin-right: -12px; }

main { flex: 1; display: flex; flex-direction: column; }
.screen {
  flex: 1; display: flex; flex-direction: column; gap: var(--gap);
  padding: var(--gap) var(--gap) calc(env(safe-area-inset-bottom) + var(--gap));
}
.grow { flex: 1; }

h1 { font-size: 30px; margin: 8px 0 0; }
h2 { font-size: 24px; margin: 0; flex: 1; text-align: right; }
p { margin: 0; }
.hint { text-align: center; color: var(--muted); }
.small { font-size: 16px; }
.muted { color: var(--muted); }
.opt { font-weight: 500; color: var(--muted); }

/* buttons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; min-height: 64px; padding: 14px 20px;
  font: inherit; font-size: 22px; font-weight: 800; text-align: center;
  border-radius: 16px; border: 3px solid var(--ink);
  background: var(--paper); color: var(--ink);
  cursor: pointer; user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; }
.btn.primary { background: var(--green); border-color: var(--green-dark); color: #fff; }
.btn.primary:active { background: var(--green-dark); }
.btn.secondary { background: var(--paper); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.huge { min-height: 30vh; flex-direction: column; font-size: 34px; border-radius: 24px; }
#sendBtn.huge { min-height: 96px; flex-direction: row; font-size: 30px; }
.btn.link { border: 0; background: none; text-decoration: underline; min-height: 56px; font-weight: 700; color: var(--ink); }
.btn.link.small { width: auto; padding: 8px 4px; font-size: 20px; }

.row { display: flex; align-items: center; gap: 12px; }

/* setup */
textarea, input[type="text"] {
  width: 100%; font: inherit; font-size: 20px; font-weight: 600;
  padding: 14px; border: 3px solid var(--ink); border-radius: 12px;
  background: var(--paper); color: var(--ink);
}
textarea { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 17px; word-break: break-all; }
.msg { min-height: 1.4em; }
.msg.good { color: var(--green); }
.msg.warn { color: #7a5b00; }
.msg.bad { color: var(--red); }

/* review */
.thumbs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.thumb { position: relative; margin: 0; border: 3px solid var(--ink); border-radius: 12px; overflow: hidden; background: #eee; }
.thumb img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.thumb figcaption { position: absolute; left: 0; bottom: 0; padding: 4px 10px; background: var(--ink); color: #fff; font-size: 16px; border-top-right-radius: 10px; }
.remove {
  position: absolute; top: 6px; right: 6px; width: 48px; height: 48px;
  border-radius: 50%; border: 3px solid #fff; background: var(--ink); color: #fff;
  font-size: 30px; line-height: 1; font-weight: 700; padding: 0;
}

.tags { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tags legend { padding: 0; margin-bottom: 10px; }
.tag {
  min-height: 60px; font: inherit; font-size: 20px; font-weight: 800;
  border: 3px solid var(--ink); border-radius: 12px; background: var(--paper); color: var(--ink);
}
.tag[aria-pressed="true"] { background: var(--ink); color: var(--yellow); }
.lbl { margin-bottom: -8px; }

/* bin picker: search box with a dropdown arrow, list opens below it */
.bin-field { display: flex; flex-direction: column; gap: 16px; }
.combo { position: relative; }
.combo input[type="text"] { padding-right: 112px; }
.combo-arrow, .combo-clear {
  position: absolute; top: 3px; bottom: 3px; width: 54px;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: none; color: var(--ink); font: inherit; padding: 0;
}
.combo-arrow { right: 3px; border-left: 3px solid var(--ink); }
.combo-clear { right: 57px; font-size: 32px; line-height: 1; }
.combo-list {
  list-style: none; margin: -8px 0 0; padding: 0;
  border: 3px solid var(--ink); border-radius: 12px;
  max-height: 50vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.combo-opt { min-height: 56px; padding: 14px 16px; border-bottom: 1px solid #ccc; cursor: pointer; }
.combo-opt:last-child { border-bottom: 0; }
.combo-opt:active, .combo-opt.on { background: var(--ink); color: var(--yellow); }
.combo-opt.other { font-weight: 700; color: var(--muted); font-style: italic; }
.combo-opt.other:active { color: var(--yellow); }

.sendbar {
  position: sticky; bottom: 0; margin: 0 calc(-1 * var(--gap)) calc(-1 * var(--gap));
  padding: 12px var(--gap) calc(env(safe-area-inset-bottom) + 12px);
  background: var(--paper); border-top: 3px solid var(--line);
}

/* settings */
.facts { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; margin: 0; }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; font-weight: 800; text-align: right; }

/* overlay + toast */
.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px;
  padding: 32px; background: var(--paper); text-align: center;
}
.ov-icon svg { width: 160px; height: 160px; }
.ov-text { font-size: 28px; font-weight: 800; max-width: 22ch; }
.overlay .btn { max-width: 340px; }
.spinner {
  width: 110px; height: 110px; border-radius: 50%;
  border: 12px solid #ddd; border-top-color: var(--green);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; z-index: 20; left: var(--gap); right: var(--gap);
  bottom: calc(env(safe-area-inset-bottom) + 120px);
  padding: 16px; border-radius: 12px; background: var(--ink); color: #fff; text-align: center;
}

/* visually hidden but still clickable through its <label> (works on iPhone) */
.vh { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
