/* GLUG! — Lichtenstein comic design system (see design/design_handoff_glug_wine_app).
   Ink outlines on everything, hard offset shadows (no blur), Ben-Day dots per view. */
:root {
  --ink: #141210;
  --cream: #fffdf5;
  --yellow: #FFD400;
  --red: #E63946;
  --blue: #1D5DEC;
  --green: #2fbf71;
  --grey: #8a8474;
  --grey-dark: #5c564a;
}

* { box-sizing: border-box; }
/* The hidden attribute must ALWAYS win: any class that sets display
   (e.g. .nudge's flex) silently overrides the browser's [hidden] rule
   otherwise — that's how the review nudge showed as an empty red bar
   whenever the queue was empty. */
[hidden] { display: none !important; }
html, body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Archivo', -apple-system, sans-serif;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

/* Ben-Day dots — color follows the active view */
body { background-size: 14px 14px; min-height: 100vh; }
body.dots-rate    { background-image: radial-gradient(var(--red) 2px, transparent 2.2px); }
body.dots-suggest { background-image: radial-gradient(var(--blue) 2px, transparent 2.2px); }
body.dots-history { background-image: radial-gradient(var(--green) 2px, transparent 2.2px); }
body.dots-palate  { background-image: radial-gradient(var(--yellow) 2px, transparent 2.2px); }

.bangers { font-family: 'Bangers', cursive; }
.mono { font-family: 'Space Mono', monospace; }

button { cursor: pointer; }
input[type="text"], textarea {
  width: 100%;
  padding: 10px 12px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-family: 'Space Mono', monospace;
  font-size: 16px; /* prevents iOS zoom-on-focus */
  outline: none;
}
input:focus, textarea:focus { box-shadow: 3px 3px 0 var(--ink); }

/* --- header band --- */
header.app {
  background: var(--yellow);
  border-bottom: 5px solid var(--ink);
  padding: 14px 18px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 20;
}
.wordmark {
  font-family: 'Bangers', cursive;
  font-size: 32px;
  color: var(--red);
  line-height: 0.85;
  letter-spacing: 2px;
  -webkit-text-stroke: 2px var(--ink);
  user-select: none;
}
.header-right { display: flex; align-items: center; gap: 7px; }
nav.views {
  font-family: 'Bangers', cursive;
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 2px;
}
nav.views button {
  font-family: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  background: none;
  border: 2px solid transparent;
  color: var(--ink);
  padding: 1px 5px;
}
nav.views button.sel[data-view="rate"]    { background: var(--red);   color: #fff; border-color: var(--ink); }
nav.views button.sel[data-view="suggest"] { background: var(--blue);  color: #fff; border-color: var(--ink); }
nav.views button.sel[data-view="history"] { background: var(--green); color: var(--ink); border-color: var(--ink); }
nav.views button.sel[data-view="palate"]  { background: var(--ink);   color: var(--yellow); border-color: var(--ink); }
nav.views .dot { opacity: 0.9; }
/* Plain B&W gear glyph — no chrome, keeps the header flowing. */
.gear {
  border: none;
  background: none;
  color: var(--ink);
  font-size: 21px;
  padding: 0 2px;
  line-height: 1;
}

main { padding: 16px 18px 40px; max-width: 480px; margin: 0 auto; }
.view { display: none; flex-direction: column; gap: 15px; }
.view.active { display: flex; }

/* --- comic building blocks --- */
.stamp { transition: transform .05s; }
.stamp:active { transform: translate(3px, 3px) rotate(-2deg) !important; }

.comic-card {
  background: #fff;
  border: 4px solid var(--ink);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 6px 6px 0 var(--ink);
  position: relative;
}
/* Headings get a cream backing so they read cleanly over the dots. */
.heading {
  font-family: 'Bangers', cursive;
  font-size: 22px;
  letter-spacing: 1px;
  color: var(--ink);
  background: rgba(255, 253, 245, 0.94);
  border-radius: 10px;
  padding: 4px 10px;
  align-self: flex-start;
}
.heading-sub {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  color: var(--grey-dark);
  letter-spacing: 0;
}
.hint {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  color: var(--grey-dark);
  text-align: center;
  background: rgba(255, 253, 245, 0.92);
  border-radius: 8px;
  padding: 3px 8px;
  align-self: center;
  max-width: 100%;
}
.error {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  color: #fff;
  background: var(--red);
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 8px 12px;
}
.chip {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  border: 2px solid var(--ink);
  padding: 1px 6px;
  background: #fff;
  white-space: nowrap;
}
.chip.price { background: var(--yellow); }

/* --- RATE view --- */
.camera-cta {
  width: 100%;
  background: var(--blue);
  border: 4px solid var(--ink);
  border-radius: 20px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 6px 6px 0 var(--ink);
  text-align: left;
}
.camera-cta .lens {
  width: 50px; height: 50px;
  background: var(--yellow);
  border: 3px solid var(--ink);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}
.camera-cta .t1 { font-family: 'Bangers', cursive; font-size: 24px; letter-spacing: 1px; color: #fff; }
.camera-cta .t2 { font-family: 'Space Mono', monospace; font-size: 12px; color: #cfe0ff; }
.camera-cta.armed { background: var(--green); }
.camera-cta.armed .t1 { color: var(--ink); }
.camera-cta.armed .t2 { color: #14401f; }

.verdicts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.verdicts button {
  border: 4px solid var(--ink);
  border-radius: 16px;
  box-shadow: 5px 5px 0 var(--ink);
  padding: 13px 2px 9px;
  text-align: center;
}
.verdicts button .e { font-size: 36px; line-height: 1; display: block; }
.verdicts button .l {
  font-family: 'Bangers', cursive;
  font-size: 16px;
  letter-spacing: 1px;
  color: var(--ink);
  margin-top: 4px;
  display: block;
}
.verdicts button[data-v="up"]   { background: var(--green); }
.verdicts button[data-v="fine"] { background: var(--blue); }
.verdicts button[data-v="fine"] .l { color: #fff; }
.verdicts button[data-v="meh"]  { background: var(--yellow); }
.verdicts button[data-v="down"] { background: var(--red); }
.verdicts button[data-v="down"] .l { color: #fff; }
.verdicts button:disabled { opacity: 0.55; }
.verdicts.small button { padding: 8px 2px 6px; box-shadow: 4px 4px 0 var(--ink); }
.verdicts.small button .e { font-size: 24px; }
.verdicts.small button .l { font-size: 12px; }

details.note {
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 10px 12px;
}
details.note summary {
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  color: var(--grey-dark);
  cursor: pointer;
  list-style: none;
}
details.note summary::-webkit-details-marker { display: none; }
details.note textarea { margin-top: 8px; min-height: 76px; font-size: 16px; border-width: 2px; }

.status-line {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: var(--grey-dark);
  text-align: center;
  background: rgba(255, 253, 245, 0.92);
  border-radius: 8px;
  padding: 3px 8px;
  align-self: center;
}

/* extracted-wine card */
.wine-card .row { display: flex; gap: 13px; }
.wine-card .thumb {
  width: 72px; height: 88px; flex: 0 0 auto;
  border: 3px solid var(--ink);
  background: repeating-linear-gradient(45deg, var(--blue) 0 7px, #4b82f5 7px 14px);
  display: flex; align-items: flex-end; justify-content: center;
  font-size: 26px; padding-bottom: 6px;
  object-fit: cover;
}
img.thumb { padding: 0; }
.wine-card .wname {
  font-family: 'Bangers', cursive;
  font-size: 24px;
  letter-spacing: 1px;
  line-height: 0.95;
  text-transform: uppercase;
}
.wine-card .wsub { font-family: 'Archivo', sans-serif; font-weight: 900; font-size: 15px; color: var(--blue); }
.wine-card .chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.gotit {
  position: absolute;
  top: -14px; right: 16px;
  background: var(--red);
  color: #fff;
  font-family: 'Bangers', cursive;
  font-size: 13px;
  letter-spacing: 1px;
  padding: 2px 10px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  transform: rotate(-4deg);
}
.fix-link {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  color: var(--grey-dark);
  text-decoration: underline;
  background: none; border: none; padding: 0;
  margin-top: 10px;
}
.wine-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.wine-fields label {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  color: var(--grey);
  text-transform: uppercase;
  display: block;
}
.wine-fields label.wide { grid-column: 1 / -1; }
.wine-fields input {
  display: block;
  width: 100%;
  margin-top: 3px;
  font-size: 16px; /* ≥16px prevents iOS zoom-on-focus */
  padding: 6px 8px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  font-family: 'Space Mono', monospace;
  outline: none;
}
.wine-fields input:focus { box-shadow: 2px 2px 0 var(--ink); }
.btn {
  font-family: 'Bangers', cursive;
  font-size: 16px;
  letter-spacing: 1px;
  background: var(--yellow);
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 7px 16px;
  color: var(--ink);
}
.btn.blue { background: var(--blue); color: #fff; }
.btn:disabled { opacity: 0.55; }

/* --- SUGGEST view --- */
.seg {
  display: flex;
  border: 4px solid var(--ink);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 4px 4px 0 var(--ink);
}
.seg button {
  flex: 1;
  background: #fff;
  border: none;
  padding: 10px 4px;
  font-family: 'Bangers', cursive;
  font-size: 16px;
  letter-spacing: 1px;
  color: var(--ink);
}
.seg button:first-child { border-right: 3px solid var(--ink); }
.seg button.sel { background: var(--red); color: #fff; }

.go-btn {
  width: 100%;
  background: var(--blue);
  border: 4px solid var(--ink);
  border-radius: 16px;
  box-shadow: 5px 5px 0 var(--ink);
  padding: 12px;
  font-family: 'Bangers', cursive;
  font-size: 22px;
  letter-spacing: 1px;
  color: #fff;
}
.go-btn:disabled { opacity: 0.55; }

.pick-card {
  background: #fff;
  border: 4px solid var(--ink);
  border-radius: 16px;
  padding: 11px 13px;
  box-shadow: 5px 5px 0 var(--ink);
  position: relative;
  margin-top: 6px;
}
.pick-card .badge {
  position: absolute;
  top: -13px; left: -9px;
  width: 32px; height: 32px;
  background: var(--yellow);
  border: 3px solid var(--ink);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bangers', cursive;
  font-size: 18px;
}
.pick-card .toprow { display: flex; justify-content: space-between; align-items: baseline; padding-left: 22px; gap: 8px; }
.pick-card .pname { font-family: 'Bangers', cursive; font-size: 19px; letter-spacing: .5px; }
.pick-card .pprice { font-family: 'Bangers', cursive; font-size: 19px; color: var(--green); white-space: nowrap; }
.pick-card .preason { font-family: 'Space Mono', monospace; font-size: 13px; color: var(--grey-dark); margin-top: 4px; padding-left: 22px; }

/* Real Talk — the sommelier's take, elevated not footnoted */
.real-talk {
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  background: var(--yellow);
  box-shadow: 5px 5px 0 var(--ink);
}

/* instructed-mode markdown result */
.md { font-family: 'Space Mono', monospace; font-size: 13px; line-height: 1.55; overflow-x: auto; }
.md h2, .md h3, .md h4 { font-family: 'Bangers', cursive; letter-spacing: 1px; font-weight: normal; margin: 12px 0 4px; }
.md h2 { font-size: 22px; } .md h3 { font-size: 18px; } .md h4 { font-size: 16px; }
.md table { border-collapse: collapse; margin: 10px 0; width: 100%; font-size: 10px; }
.md th, .md td { border: 2px solid var(--ink); padding: 4px 6px; text-align: left; }
.md th { background: var(--yellow); font-family: 'Bangers', cursive; font-weight: normal; letter-spacing: 1px; font-size: 12px; }
.md p { margin: 6px 0; }
.md ul { margin: 6px 0; padding-left: 20px; }

/* --- LOG view --- */
.robot-bubble {
  background: var(--blue);
  border: 4px solid var(--ink);
  border-radius: 18px;
  padding: 13px 15px;
  box-shadow: 5px 5px 0 var(--ink);
}
.robot-bubble .rhead { display: flex; align-items: center; gap: 8px; }
.robot-bubble .rface {
  width: 34px; height: 34px;
  background: var(--yellow);
  border: 3px solid var(--ink);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.robot-bubble .rtitle { font-family: 'Bangers', cursive; font-size: 20px; letter-spacing: 1px; color: #fff; }
.robot-bubble .rbody { font-family: 'Space Mono', monospace; font-size: 14px; color: #eaf1ff; line-height: 1.55; margin-top: 9px; }
.robot-bubble .rbody h2, .robot-bubble .rbody h3 {
  font-family: 'Bangers', cursive; font-weight: normal; letter-spacing: 1px;
  color: var(--yellow); font-size: 18px; margin: 10px 0 2px;
}
.robot-bubble .rbody ul { margin: 3px 0; padding-left: 18px; }
.robot-bubble .rbody strong, .robot-bubble .rbody b { color: var(--yellow); }
.robot-bubble .rfoot { font-family: 'Space Mono', monospace; font-size: 12px; color: #cfe0ff; margin-top: 9px; }
.robot-bubble .rfoot button {
  background: none; border: none; color: inherit;
  font-family: inherit; font-size: inherit;
  text-decoration: underline; padding: 0;
}

.nudge {
  background: var(--red);
  border: 4px solid var(--ink);
  border-radius: 14px;
  padding: 9px 13px;
  box-shadow: 4px 4px 0 var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
}
.nudge .txt { font-family: 'Space Mono', monospace; font-size: 12px; color: #fff; line-height: 1.4; flex: 1; }
.nudge .go {
  font-family: 'Bangers', cursive;
  font-size: 15px;
  color: var(--ink);
  background: var(--yellow);
  border: 2px solid var(--ink);
  padding: 2px 9px;
  border-radius: 10px;
}

.review-item {
  background: #fff;
  border: 4px solid var(--ink);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 5px 5px 0 var(--ink);
}
.review-item img { width: 100%; max-height: 240px; object-fit: contain; border: 3px solid var(--ink); border-radius: 8px; }
.review-item .rn { font-family: 'Bangers', cursive; font-size: 18px; letter-spacing: .5px; margin-top: 8px; text-transform: uppercase; }
.review-item .rr { font-family: 'Space Mono', monospace; font-size: 13px; color: var(--grey-dark); margin: 4px 0 10px; }

.log-row {
  display: flex;
  align-items: center;
  gap: 11px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 9px 12px;
  box-shadow: 4px 4px 0 var(--ink);
}
.log-row .e { font-size: 30px; flex-shrink: 0; }
.log-row .info { flex: 1; min-width: 0; }
.log-row .n {
  font-family: 'Bangers', cursive;
  font-size: 18px;
  letter-spacing: .5px;
  line-height: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.log-row .d { font-family: 'Space Mono', monospace; font-size: 13px; color: var(--grey-dark); margin-top: 3px; }
.log-row .tag {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  background: var(--yellow);
  border: 2px solid var(--ink);
  padding: 1px 5px;
  flex-shrink: 0;
}
.log-row .edit-btn {
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  padding: 3px 6px;
  flex-shrink: 0;
}

/* inline editor revealed by tapping a log row */
.log-edit {
  border: 3px dashed var(--ink);
  border-top: none;
  border-radius: 0 0 14px 14px;
  margin: -6px 6px 0;
  padding: 14px 10px 10px;
  background: rgba(255, 253, 245, 0.95);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.log-edit .verdicts button { opacity: 0.6; }
.log-edit .verdicts button.cur {
  opacity: 1;
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}
.log-edit .note-edit { font-size: 16px; border-width: 2px; border-radius: 10px; padding: 7px 9px; }
.log-edit-actions { display: flex; gap: 10px; justify-content: space-between; }
.log-edit-actions .btn { font-size: 14px; box-shadow: 3px 3px 0 var(--ink); }
.log-edit-actions .trash { background: #fff; }

/* --- log search --- */
#log-search {
  width: 100%;
  padding: 10px 12px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  font-family: 'Space Mono', monospace;
  font-size: 16px;
  outline: none;
  -webkit-appearance: none;
}
#log-search:focus { box-shadow: 3px 3px 0 var(--ink); }

/* --- tap a log row → label photo --- */
.log-photo {
  border: 3px dashed var(--ink);
  border-top: none;
  border-radius: 0 0 14px 14px;
  margin: -6px 6px 0;
  padding: 14px 10px 10px;
  background: rgba(255, 253, 245, 0.95);
  text-align: center;
}
.log-photo img {
  max-width: 100%;
  max-height: 340px;
  object-fit: contain;
  border: 3px solid var(--ink);
  border-radius: 10px;
}

/* --- settings overlay --- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 16, 0.55);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.admin-card { width: 100%; max-width: 340px; box-shadow: 8px 8px 0 var(--ink); }
.admin-label {
  font-family: 'Bangers', cursive;
  font-size: 15px;
  letter-spacing: 1px;
  margin: 16px 0 8px;
}
.size-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.size-row button {
  font-family: 'Bangers', cursive;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 8px 0;
}
.size-row button:nth-child(1) { font-size: 16px; }
.size-row button:nth-child(2) { font-size: 20px; }
.size-row button:nth-child(3) { font-size: 25px; }
.size-row button:nth-child(4) { font-size: 30px; }
.size-row button.sel {
  background: var(--yellow);
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}

.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 3px solid rgba(20,18,16,0.25);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -3px;
}
.spinner.light { border-color: rgba(255,255,255,0.35); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes wobble { 0%,100%{transform:rotate(-3deg)} 50%{transform:rotate(3deg)} }
