/* Wanted: old West wanted posters nailed to a wooden wall. Palette matches RecipeRoper. */
@font-face { font-family: "Rye"; src: url(/rye.woff2) format("woff2"); font-display: swap; }

:root {
  --wood: #3a2213;
  --wood-2: #54311a;
  --wood-3: #6f4220;
  --paper: #f6ead2;
  --paper-2: #ead3a6;
  --paper-edge: #c9a46b;
  --ink: #2a1a0e;
  --ink-2: #6f4220;
  --muted: #7a6a55;
  --line: #d9bf8e;
  --sunset: #bf3a04;
  --sunset-2: #e84d08;
  --stamp: #b3261e;
  --deal: #2f6b2f;
  --display: "Rye", "Rockwell", Georgia, serif;
  --hh: clamp(150px, 44vw, 240px);   /* banner height */
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 17px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background-color: var(--wood);
  /* Plank wall */
  background-image:
    repeating-linear-gradient(180deg, rgba(0,0,0,.28) 0 2px, transparent 2px 64px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.025) 0 3px, rgba(0,0,0,.04) 3px 7px),
    linear-gradient(180deg, #4a2c17, #2e1a0d);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
  min-height: 100vh;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: var(--ink); }
svg { fill: currentColor; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.error { color: var(--stamp); font-size: 15px; margin: 6px 0 0; }
.kicker {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-2);
}
.wanted { font-family: var(--display); font-weight: 400; margin: 0; line-height: 1; color: var(--ink); letter-spacing: .02em; }

/* A parchment poster */
.poster {
  position: relative;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255,250,236,.9), rgba(255,250,236,0) 70%),
    radial-gradient(ellipse at 50% 50%, var(--paper) 55%, var(--paper-2) 100%);
  border: 1px solid var(--paper-edge);
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, 0 8px 18px rgba(0,0,0,.45), 0 2px 4px rgba(0,0,0,.3);
}
.poster::before {   /* the nail */
  content: ""; position: absolute; top: 7px; left: 50%; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #b9a58a, #4b3a28 70%); box-shadow: 0 1px 2px rgba(0,0,0,.5);
}

/* Header: the banner art, then a parchment strip with the live count */
.top { max-width: 640px; margin: 0 auto; }
.hero {
  position: relative;
  height: calc(var(--hh) + var(--safe-t));
  background: url(/hero.jpg) left bottom / auto var(--hh) no-repeat, var(--wood);
}
.hero-strip {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 9px 16px 8px;
  background: radial-gradient(ellipse at 50% 50%, var(--paper) 55%, var(--paper-2) 100%);
  border-top: 3px solid #241409; border-bottom: 3px solid #241409;
  box-shadow: 0 6px 14px rgba(0,0,0,.4);
}
.strip-title { margin: 0; font-family: var(--display); font-weight: 400; font-size: 22px; line-height: 1; color: var(--ink); }
.strip-title span {
  display: block; margin-top: 3px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap;
}
.summary { margin: 0; font-size: 13px; font-weight: 700; color: var(--sunset); text-transform: uppercase; letter-spacing: .05em; text-align: right; white-space: nowrap; }
.hero-tools { position: absolute; top: calc(8px + var(--safe-t)); right: 8px; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 42px; height: 42px; border: 0; border-radius: 21px;
  background: rgba(36, 20, 9, .62); color: var(--paper); display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.icon-btn:active { background: rgba(36, 20, 9, .85); }
.sync { width: 11px; height: 11px; border-radius: 6px; background: #6fd18a; border: 2px solid rgba(36,20,9,.6); transition: background .2s; }
.sync.pending { background: #f2b84b; }
.sync.offline { background: #9a8b78; }

.banner {
  max-width: 616px; margin: 12px auto 0; padding: 10px 12px; border-radius: 6px;
  background: var(--paper-2); color: var(--ink); font-size: 15px; box-shadow: 0 4px 10px rgba(0,0,0,.35);
}

/* List */
.list { padding: 6px 12px calc(100px + var(--safe-b)); max-width: 640px; margin: 0 auto; }
.store { margin: 18px 2px; padding: 20px 0 4px; }
.store:nth-child(odd) { transform: rotate(-.35deg); }
.store:nth-child(even) { transform: rotate(.3deg); }
.store-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 8px;
  padding: 4px 14px 10px; border-bottom: 5px double var(--ink); margin: 0 10px;
}
.store-title { min-width: 0; }
.store-head h2 { margin: 2px 0 0; font-family: var(--display); font-weight: 400; font-size: 26px; line-height: 1.05; color: var(--ink); word-break: break-word; }
.store-head .count {
  flex: none; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--sunset);
  padding-bottom: 3px;
}
.store-head .count.clear { color: var(--deal); }
.link-btn {
  flex: none; border: 1.5px solid var(--sunset); border-radius: 14px; background: none; color: var(--sunset);
  font-size: 13px; font-weight: 700; padding: 3px 10px; margin-bottom: 1px;
}

.item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-height: 54px; padding: 7px 6px 7px 14px; margin: 0 6px;
  border-top: 1px dashed var(--line);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  cursor: pointer;
}
.store-head + .item { border-top: 0; margin-top: 4px; }
.item:active { background: rgba(201, 164, 107, .25); }
.check {
  flex: none; width: 28px; height: 28px; border-radius: 14px;
  border: 2px solid var(--ink-2); display: grid; place-items: center; background: rgba(255,255,255,.35);
  transition: background .15s, border-color .15s;
}
.check svg { width: 17px; height: 17px; fill: var(--paper); opacity: 0; }
.item.done .check { background: var(--ink-2); }
.item.done .check svg { opacity: 1; }
.item-main { flex: 1; min-width: 0; }
.item-name { word-break: break-word; font-weight: 600; }
.item.done .item-name { color: #a8977d; text-decoration: line-through; font-weight: 500; }
.item-meta { font-size: 13px; color: var(--muted); margin-top: 1px; }
.item-price { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.item-price .here { font-weight: 700; color: var(--ink-2); }
.item-price .here + .best::before { content: " · "; color: var(--muted); font-weight: 400; }
.item-price .best { color: var(--deal); font-weight: 600; }
.item-price.pending { font-style: italic; opacity: .8; }
.qty {
  display: inline-block; font-size: 13px; font-weight: 700; color: var(--ink-2);
  background: rgba(201, 164, 107, .35); border-radius: 8px; padding: 1px 7px; margin-left: 6px; vertical-align: 1px;
}
.edit-btn {
  flex: none; width: 40px; height: 40px; border: 0; border-radius: 20px; background: none;
  color: var(--muted); display: grid; place-items: center;
}
.edit-btn:active { background: rgba(201, 164, 107, .35); }
.stamp {
  position: absolute; right: 50px; top: 50%; transform: translateY(-50%) rotate(-11deg);
  font-family: var(--display); font-size: 14px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--stamp); border: 2px solid var(--stamp); border-radius: 4px; padding: 1px 7px 0;
  opacity: .78; pointer-events: none;
}

.empty {
  text-align: center; color: var(--muted); padding: 40px 24px 32px; margin: 22px 8px;
  background: radial-gradient(ellipse at 50% 50%, var(--paper) 55%, var(--paper-2) 100%);
  border: 1px solid var(--paper-edge); box-shadow: 0 8px 18px rgba(0,0,0,.45); transform: rotate(-.4deg);
}
.empty .big { font-family: var(--display); font-size: 26px; color: var(--ink); margin-bottom: 8px; }

/* Add bar: a plank along the bottom */
.add-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; gap: 8px; align-items: center;
  padding: 10px max(12px, calc((100vw - 640px) / 2 + 12px)) calc(10px + var(--safe-b));
  background: linear-gradient(180deg, #6f4220, #4a2c17);
  border-top: 2px solid #241409; box-shadow: 0 -6px 18px rgba(0,0,0,.4);
}
.store-chip {
  flex: none; max-width: 38%; display: flex; align-items: center; gap: 4px;
  height: 44px; padding: 0 10px 0 12px; border: 0; border-radius: 22px;
  background: var(--paper-2); font-size: 15px; font-weight: 700; color: var(--ink);
}
.store-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#add-input {
  flex: 1; min-width: 0; height: 44px; padding: 0 14px;
  border: 2px solid transparent; border-radius: 22px; background: var(--paper);
  font-size: 17px; outline: none;
}
#add-input:focus { border-color: var(--sunset-2); }
#add-input::placeholder { color: #9a876c; }
.add-btn {
  flex: none; width: 44px; height: 44px; border: 0; border-radius: 22px;
  background: var(--sunset-2); color: #fff; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.add-btn:active { background: var(--sunset); }

/* Install card, like RecipeRoper's */
.install-card {
  position: fixed; z-index: 7; left: 12px; right: 12px; bottom: calc(76px + var(--safe-b));
  max-width: 420px; margin: 0 auto; padding: 14px 16px 12px;
  background: radial-gradient(ellipse at 50% 50%, var(--paper) 55%, var(--paper-2) 100%);
  border: 1px solid var(--paper-edge); border-radius: 8px; box-shadow: 0 12px 30px rgba(0,0,0,.5);
  animation: up .25s ease-out;
}
.install-title { margin: 0; font-family: var(--display); font-size: 19px; color: var(--ink); }
.install-text { margin: 4px 0 0; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.install-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.install-actions .btn { height: 40px; font-size: 15px; }

/* Buttons and forms */
.btn {
  height: 46px; padding: 0 18px; border-radius: 23px; border: 1.5px solid var(--paper-edge);
  background: rgba(255,255,255,.4); font-weight: 700;
}
.btn.primary { background: var(--sunset); border-color: var(--sunset); color: #fff; }
.btn.primary:active { background: #962d08; }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.danger { color: var(--stamp); border-color: rgba(179, 38, 30, .5); }
.btn.wide { width: 100%; margin-top: 10px; }
label { display: block; font-size: 14px; font-weight: 600; color: var(--ink-2); margin: 12px 0 0; }
label input, label select {
  display: block; width: 100%; height: 46px; margin-top: 4px; padding: 0 12px;
  border: 1.5px solid var(--paper-edge); border-radius: 10px; background: #fffaf0; font-size: 17px; font-weight: 400; outline: none;
}
label input:focus, label select:focus { border-color: var(--sunset-2); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Sign in: one big poster */
.login { min-height: 100vh; display: grid; place-items: center; padding: calc(24px + var(--safe-t)) 16px 24px; }
.login-card { width: 100%; max-width: 400px; padding: 30px 20px 22px; text-align: center; transform: rotate(-.6deg); }
.login-card .kicker { margin-top: 6px; }
.login-card .wanted { font-size: 54px; line-height: .95; margin: 8px 0 14px; }
.login-art { display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; border: 2px solid var(--ink); border-radius: 2px; filter: sepia(.15); }
.poster-line { margin: 12px 0 4px; font-family: var(--display); font-size: 18px; color: var(--ink-2); }
.login-card form { text-align: left; }
.login-card .btn { margin-top: 18px; }

/* Sheets */
.scrim { position: fixed; inset: 0; background: rgba(20, 10, 4, .55); z-index: 10; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11;
  max-height: 85vh; overflow-y: auto; max-width: 640px; margin: 0 auto;
  background: radial-gradient(ellipse at 50% 30%, #fbf2df 50%, var(--paper) 100%);
  border-radius: 16px 16px 0 0; border-top: 1px solid var(--paper-edge);
  padding: 8px 18px calc(18px + var(--safe-b));
  animation: up .18s ease-out;
}
@keyframes up { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-grab { width: 40px; height: 5px; border-radius: 3px; background: var(--paper-edge); margin: 4px auto 12px; }
.sheet h2 { margin: 0 0 8px; font-family: var(--display); font-weight: 400; font-size: 22px; color: var(--ink); }
.sheet p { margin: 8px 0; }
.sheet-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }
.sheet-actions .btn { flex: 1; }
.edit-prices { font-size: 14px; color: var(--deal); line-height: 1.45; }

.store-options { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; }
.store-opt {
  height: 42px; padding: 0 16px; border-radius: 21px; border: 1.5px solid var(--paper-edge);
  background: rgba(255,255,255,.45); font-weight: 700;
}
.store-opt.on { background: var(--ink-2); border-color: var(--ink-2); color: var(--paper); }
.inline-form { display: flex; gap: 8px; }
.inline-form input {
  flex: 1; min-width: 0; height: 46px; padding: 0 12px; border: 1.5px solid var(--paper-edge);
  border-radius: 10px; background: #fffaf0; font-size: 17px; outline: none;
}

.menu-item {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 14px 4px; border-top: 1px dashed var(--line); font-size: 17px;
}
.menu-item:first-of-type { border-top: 0; font-weight: 700; color: var(--sunset); }
.menu-item.muted-item { color: var(--muted); }

.install-guide { margin: 6px 0 4px; }
.guide-device { font-weight: 700; color: var(--ink-2); margin: 10px 0 4px !important; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.steps li { display: flex; gap: 10px; font-size: 15px; line-height: 1.45; }
.step-n {
  flex: none; width: 26px; height: 26px; border-radius: 13px; background: var(--sunset-2); color: #fff;
  display: grid; place-items: center; font-family: var(--display); font-size: 13px;
}
.inline-icon { width: 18px; height: 18px; vertical-align: -3px; fill: none; color: #1a73e8; }
.steps svg[fill="currentColor"] { fill: currentColor; color: var(--ink); }
.code-line {
  font: 600 15px/1.4 ui-monospace, Menlo, Consolas, monospace; background: #fffaf0; border: 1.5px solid var(--paper-edge);
  border-radius: 8px; padding: 10px 12px; word-break: break-all; user-select: all; -webkit-user-select: all;
}

.manage-list { margin: 8px 0; }
.manage-row { display: flex; align-items: center; gap: 6px; padding: 8px 0; border-top: 1px dashed var(--line); }
.manage-row:first-child { border-top: 0; }
.manage-row .name { flex: 1; font-weight: 700; }
.manage-row .mini {
  width: 38px; height: 38px; border-radius: 10px; border: 1.5px solid var(--paper-edge); background: rgba(255,255,255,.45);
  display: grid; place-items: center;
}
.manage-row .mini:disabled { opacity: .35; }
.manage-row .mini.del { color: var(--stamp); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(84px + var(--safe-b)); z-index: 20;
  background: #241409; color: var(--paper); padding: 10px 16px; border-radius: 12px; font-size: 15px;
  box-shadow: 0 6px 20px rgba(0,0,0,.4); display: flex; gap: 14px; align-items: center; max-width: 92vw;
}
.toast button { border: 0; background: none; color: #ffb887; font-weight: 700; padding: 0; }

/* Text pages (privacy, terms) */
.doc-page { padding: calc(24px + var(--safe-t)) 14px 40px; }
.doc { max-width: 680px; margin: 0 auto; padding: 34px 24px 26px; line-height: 1.55; }
.doc .wanted { font-size: 40px; margin: 6px 0 8px; }
.doc h2 { font-family: var(--display); font-weight: 400; font-size: 21px; margin: 26px 0 6px; color: var(--ink); }
.doc p { margin: 0 0 10px; font-size: 16px; }
.doc a { color: var(--sunset); font-weight: 600; }
.doc-meta { color: var(--muted); font-size: 14px !important; border-bottom: 5px double var(--ink); padding-bottom: 14px; }
.doc-back { margin-top: 26px !important; text-align: center; }
.login-links { margin: 16px 0 0; text-align: center; font-size: 13px; }
.login-links a { color: var(--muted); }

/* Accounts, lists and keys */
.list-chip {
  display: flex; align-items: center; gap: 6px; border: 0; background: none; padding: 2px 0; text-align: left; color: var(--ink);
  min-width: 0; max-width: 62%;
}
.list-chip svg { flex: none; fill: var(--ink-2); }
.list-chip .strip-title { min-width: 0; }
.list-chip .strip-title span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.google-btn { display: grid; place-items: center; text-decoration: none; }
.login-gate { margin: 10px 0 0; line-height: 1.4; }
.invite-note { margin: 12px 0 0; padding: 8px 10px; border: 1.5px dashed var(--paper-edge); border-radius: 8px; font-size: 15px; color: var(--ink-2); }
.passcode-box { margin-top: 16px; text-align: left; }
.passcode-box summary { font-size: 14px; color: var(--muted); text-align: center; cursor: pointer; }
.passcode-box .btn { margin-top: 12px; }
.banner.note { background: var(--paper-2); color: var(--ink); }
.banner .link-btn { margin-left: 6px; }
.list-options { display: grid; gap: 8px; margin: 6px 0 14px; }
.list-opt {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; min-height: 46px; padding: 0 14px;
  border-radius: 12px; border: 1.5px solid var(--paper-edge); background: rgba(255,255,255,.45); font-weight: 700; font-size: 17px;
}
.list-opt.on { background: var(--ink-2); border-color: var(--ink-2); color: var(--paper); }
.list-opt .meta { margin-left: auto; font-size: 12px; font-weight: 600; opacity: .75; white-space: nowrap; }
.list-actions { margin: 14px 0 0; }
.list-actions .menu-item:first-of-type { border-top: 1px dashed var(--line); font-weight: 400; color: var(--ink); }
.manage-row .sub { display: block; font-size: 13px; font-weight: 400; color: var(--muted); word-break: break-all; }
.manage-row .mini.txt { width: auto; padding: 0 12px; font-size: 14px; font-weight: 700; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin: 4px 0 8px; }
.check-grid label { display: flex; align-items: center; gap: 8px; margin: 0; padding: 8px 0; font-weight: 600; }
.check-grid input { width: 20px; height: 20px; }
#share-form, #new-list-form { margin-top: 10px; }
