@font-face { font-family: Bagel; src: url(font/bagel.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: Courier; src: url(font/courier-400.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: Courier; font-weight: 700; src: url(font/courier-700.woff2) format("woff2"); font-display: swap; }

:root {
  --paper: #f3e6cf;
  --ticket: #fbf4e6;
  --ink: #2b1d16;
  --soft: #7a5d4a;
  --line: #d9c4a3;
  --bark: #6b3a24;
  --ember: #e8692c;
  --pink: #e98f8a;
  --done: #4f7a3a;
  --on-ember: #2b1d16;
  --grain-op: .09;
  --bagel: Bagel, "Arial Rounded MT Bold", system-ui, sans-serif;
  --read: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  --type: Courier, "Courier New", ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #211a15;
    --ticket: #2e241e;
    --ink: #f3e6cf;
    --soft: #b59a83;
    --line: #4a3a2f;
    --bark: #c98a5e;
    --done: #8fbf6a;
    --grain-op: .16;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.4 var(--type);
  -webkit-tap-highlight-color: transparent;
}
/* paper grain */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  opacity: var(--grain-op);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .17 0 0 0 0 .11 0 0 0 0 .08 0 0 0 1.4 -.35'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 50;
}
button { font: inherit; color: inherit; }
h1, h2 { font-family: var(--bagel); font-weight: 400; margin: 0; line-height: 1; }
h2 { font-size: 24px; }
p { margin: 0; }
[hidden] { display: none !important; }

/* ---------- header ---------- */
.top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: max(18px, env(safe-area-inset-top)) 18px 6px;
  max-width: 560px; margin: 0 auto;
}
.mark {
  font-size: 30px; letter-spacing: .5px; line-height: .86;
  color: var(--ember);
  -webkit-text-stroke: 1.5px var(--ink);
  paint-order: stroke fill;
  transform: rotate(-3deg);
  margin-top: 4px;
}
.netpill {
  display: inline-flex; align-items: center; gap: 8px;
  max-width: 60%;
  border: 2px solid var(--ink); border-radius: 999px;
  background: var(--ticket);
  padding: 6px 12px 6px 9px;
  font-weight: 700; font-size: 14px;
  cursor: pointer;
}
.netpill #netname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.netpill.hotspot { background: var(--ember); color: var(--on-ember); }

/* flame signal bars */
.flames { display: inline-flex; align-items: flex-end; gap: 1px; flex: none; }
.flames svg { display: block; }
.flames path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.flames .on path { fill: var(--ember); stroke: var(--ink); }
.netpill.hotspot .flames .on path { fill: var(--ticket); }

main { max-width: 560px; margin: 0 auto; padding: 4px 16px 40px; }

/* ---------- buttons ---------- */
.btn {
  appearance: none;
  border: 2px solid var(--ink); border-radius: 12px;
  background: var(--ember); color: var(--on-ember);
  font-family: var(--bagel); font-size: 19px; letter-spacing: .3px;
  padding: 10px 22px 11px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.btn:disabled { opacity: .55; }
.link {
  appearance: none; background: none; border: 0; padding: 4px 2px;
  font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px;
  text-underline-offset: 3px; text-decoration-color: var(--ember);
  cursor: pointer;
}
.row { display: flex; align-items: center; gap: 16px; margin-top: 16px; }

/* ---------- setup banner ---------- */
.setup {
  display: flex; align-items: center; gap: 14px;
  margin: 14px 0 6px;
  padding: 14px 16px 16px 8px;
  border: 2px dashed var(--ink); border-radius: 16px;
}
.setup-art { width: 92px; flex: none; transform: rotate(-6deg); }
.setup h2 { font-size: 22px; margin-bottom: 4px; }
.setup p { font-size: 14px; margin-bottom: 10px; }

/* ---------- probe tickets ---------- */
.ticket {
  position: relative;
  margin: 58px 0 18px;
  background: var(--ticket);
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 18px 16px 14px;
  /* notched sides like a torn deli ticket */
  -webkit-mask: radial-gradient(circle 10px at 0 112px, #0000 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 10px at 100% 112px, #0000 98%, #000) right / 51% 100% no-repeat;
          mask: radial-gradient(circle 10px at 0 112px, #0000 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 10px at 100% 112px, #0000 98%, #000) right / 51% 100% no-repeat;
}
.ticket-wrap { position: relative; }
.sticker {
  position: absolute; z-index: 2;
  right: 4px; top: -56px;
  width: 128px; height: 128px; object-fit: contain;
  transform: rotate(5deg);
  pointer-events: none;
  filter: drop-shadow(0 2px 0 rgba(43, 29, 22, .18));
}
.ticket-wrap:nth-child(even) .sticker { transform: rotate(-5deg); }
.sticker.pop { animation: pop .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { from { transform: scale(.6) rotate(-12deg); } }

.stub {
  display: flex; gap: 10px; align-items: baseline;
  font-size: 13px; text-transform: uppercase; letter-spacing: 1px; font-weight: 700;
  color: var(--soft);
  padding-right: 120px;
}
.stub .name {
  color: var(--ink); font-size: 15px; letter-spacing: .5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.edit { margin-left: auto; color: var(--ink); font-size: 13px; text-transform: none; letter-spacing: 0; }

.reading { display: flex; align-items: flex-end; gap: 10px; margin: 6px 0 2px; min-height: 92px; }
.temp {
  font-family: var(--bagel); font-size: 88px; line-height: .9; letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}
.temp sup { font-size: 34px; vertical-align: top; position: relative; top: 8px; margin-left: 2px; }
.temp.none { font: 700 46px/1 var(--type); color: var(--soft); padding-bottom: 14px; letter-spacing: 4px; }
.goal { padding-bottom: 10px; font-size: 14px; font-weight: 700; line-height: 1.25; }
.goal b { display: block; font-family: var(--bagel); font-weight: 400; font-size: 22px; }

/* perforation between the reading and the notes */
.perf { border-top: 2px dashed var(--line); margin: 14px -16px 12px; }

/* doneness bar */
.bar { position: relative; height: 22px; margin: 6px 0 4px; }
.bar .track {
  position: absolute; inset: 5px 0;
  border: 2px solid var(--ink); border-radius: 999px;
  background: repeating-linear-gradient(90deg, transparent 0 9.6%, var(--line) 9.6% 10%);
  overflow: hidden;
}
.bar .fill {
  height: 100%; width: 0;
  background: var(--pink);
  border-right: 2px solid var(--ink);
}
.bar .fill.hot { background: var(--ember); }
.bar .fill.done { background: var(--done); }
.ticks { display: flex; margin-top: -2px; justify-content: space-between; font-size: 11px; color: var(--soft); font-weight: 700; }
.note { font-size: 15px; font-weight: 700; min-height: 21px; }
.note .dim { color: var(--soft); font-weight: 400; }
.stamp {
  display: none;
  position: absolute; right: 12px; bottom: 14px;
  font-family: var(--bagel); font-size: 22px; letter-spacing: .5px; text-transform: uppercase;
  color: var(--done); border: 3px solid var(--done); border-radius: 8px;
  padding: 2px 10px 4px; transform: rotate(-10deg); opacity: .9;
}
.ticket.done .stamp { display: block; animation: pop .35s cubic-bezier(.3, 1.6, .5, 1); }
.ticket.done .note { color: var(--done); padding-right: 118px; }
.unplugged .note { color: var(--soft); font-weight: 400; }

/* ---------- cook chart ---------- */
.cook { margin-top: 26px; }
.cook-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.cook-head h2 { font-size: 20px; }
.cook-len { font-size: 13px; color: var(--soft); font-weight: 700; }
#chart {
  display: block; width: 100%; height: 160px;
  border-bottom: 2px solid var(--ink);
  overflow: visible;
}
#chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
#chart .gl { fill: var(--soft); font: 700 10px var(--type); }
#chart .series { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
#chart .target { stroke-width: 1.5; stroke-dasharray: 6 5; vector-effect: non-scaling-stroke; }
.legend { display: flex; gap: 18px; margin-top: 8px; font-size: 13px; font-weight: 700; }
.legend i { display: inline-block; width: 18px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }

.foot { display: flex; justify-content: center; gap: 10px; margin-top: 34px; color: var(--soft); }
.foot .link { color: var(--ink); }

/* ---------- sheets ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(33, 26, 21, .55);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-card {
  position: relative;
  width: 100%; max-width: 560px; max-height: 92vh; overflow: auto;
  background: var(--paper);
  border: 2px solid var(--ink); border-bottom: 0;
  border-radius: 20px 20px 0 0;
  padding: 22px 18px max(26px, env(safe-area-inset-bottom));
  animation: up .25s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 600px) {
  .sheet { align-items: center; }
  .sheet-card { border-bottom: 2px solid var(--ink); border-radius: 20px; }
}
.x {
  position: absolute; right: 12px; top: 10px;
  width: 38px; height: 38px;
  border: 0; background: none; font-size: 30px; line-height: 1; cursor: pointer;
}
.sheet-hero { display: flex; align-items: center; gap: 12px; margin: 0 30px 14px 0; }
.sheet-hero img { width: 84px; height: 84px; object-fit: contain; flex: none; transform: rotate(-5deg); }
.sheet-hero h2 { font-size: 24px; margin-bottom: 4px; }
.sub { font-size: 14px; color: var(--soft); }

.listhead {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--soft);
  margin: 6px 0;
}
.listhead .link { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--ink); }
.nets {
  list-style: none; margin: 0; padding: 0;
  background: var(--ticket); border: 2px solid var(--ink); border-radius: 12px;
  overflow: hidden;
}
.nets li + li { border-top: 2px dashed var(--line); }
.nets button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: 0; text-align: left;
  padding: 13px 14px; font-weight: 700; font-size: 16px; cursor: pointer;
}
.nets button:active { background: var(--line); }
.nets .ssid { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nets .tag {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  border: 1.5px solid currentColor; border-radius: 4px; padding: 1px 5px;
  color: var(--bark); transform: rotate(-3deg);
}
.nets .lock { width: 14px; height: 16px; flex: none; }
.nets .lock path, .nets .lock rect { fill: none; stroke: currentColor; stroke-width: 2; }
.nets .empty { padding: 16px 14px; color: var(--soft); font-weight: 400; }
.nets.slim li { display: flex; align-items: center; padding: 8px 8px 8px 14px; gap: 8px; }
.nets.slim .ssid { font-weight: 700; }
.nets.slim .link { font-size: 14px; width: auto; flex: none; padding: 4px 6px; }
.other { margin-top: 10px; font-size: 14px; }
.saved { margin-top: 18px; }

.scanning { padding: 18px 14px; display: flex; gap: 10px; align-items: center; color: var(--soft); }
.dots::after { content: ""; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.field { display: block; margin: 12px 0; }
.field > span { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; color: var(--soft); }
.field > span b { color: var(--ink); }
.field input {
  width: 100%;
  font: 700 18px var(--type);
  color: var(--ink);
  background: var(--ticket);
  border: 2px solid var(--ink); border-radius: 10px;
  padding: 11px 12px;
  outline: none;
}
.field input:focus { box-shadow: 0 0 0 3px var(--ember); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ember); }
.check.big { font-size: 15px; font-weight: 700; margin: 8px 0 14px; }

.result { padding: 4px 0 4px; }
.result p { font-size: 16px; line-height: 1.5; }
.result p b { font-family: var(--bagel); font-weight: 400; }
.result .addr {
  display: inline-block; margin-top: 6px; padding: 2px 8px;
  border: 2px solid var(--ink); border-radius: 6px; background: var(--ticket);
  font-weight: 700; user-select: all;
}

/* two meats / both in one */
.seg {
  display: grid; grid-template-columns: 1fr 1fr;
  border: 2px solid var(--ink); border-radius: 12px; overflow: hidden;
  margin: 14px 0 4px;
}
.seg button {
  border: 0; background: var(--ticket); padding: 10px 6px;
  font-family: var(--bagel); font-size: 16px; cursor: pointer;
}
.seg button + button { border-left: 2px solid var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ember); color: var(--on-ember); }
.spotrow { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.spotrow .jack {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--ink); display: grid; place-items: center; font-size: 13px;
}
.spotrow input { min-width: 0; }
.spotrow input[name^="n"] { flex: 1; }
.spotrow input[name^="t"] { width: 78px; flex: none; font-family: var(--bagel); font-weight: 400; font-size: 20px; padding: 8px 10px; }
.spotrow .unit { font-family: var(--bagel); font-weight: 400; font-size: 18px; }
.spotrow input {
  font: 700 16px var(--type); color: var(--ink); background: var(--ticket);
  border: 2px solid var(--ink); border-radius: 10px; padding: 10px; outline: none;
}
.spotrow input:focus { box-shadow: 0 0 0 3px var(--ember); }
.tip { font-size: 13px; color: var(--soft); line-height: 1.45; margin-top: 4px; }

/* paired ticket: a compact row per spot */
.reading-wrap.compact { padding: 4px 0 2px; }
.reading-wrap.compact + .reading-wrap.compact { border-top: 2px dashed var(--line); margin-top: 10px; padding-top: 12px; }
.reading-wrap.compact .reading { min-height: 0; margin: 0; }
.reading-wrap.compact .temp { font-size: 58px; }
.reading-wrap.compact .temp sup { font-size: 24px; top: 4px; }
.reading-wrap.compact .temp.none { font-size: 34px; padding-bottom: 8px; }
.reading-wrap.compact .goal { padding-bottom: 6px; }
.reading-wrap.compact .goal b { font-size: 19px; }
.spot { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.spot-check {
  display: none; font-size: 11px; color: var(--done);
  border: 1.5px solid var(--done); border-radius: 4px; padding: 0 5px; transform: rotate(-3deg);
}
.reading-wrap.is-done .spot-check { display: inline-block; }
.ticket.paired { padding-top: 16px; }
.ticket.paired .stub { margin-bottom: 8px; }

/* meat picker */
.meats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.meats button {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--ticket);
  padding: 6px 1px 5px; font-size: 11px; font-weight: 700; cursor: pointer; line-height: 1.1;
}
.meats img { width: 46px; height: 46px; object-fit: contain; }
.meats button[aria-pressed="true"] { border-color: var(--ink); background: var(--pink); color: #2b1d16; }
.target { display: flex; align-items: center; gap: 8px; }
.target input { width: 120px; font-family: var(--bagel); font-weight: 400; font-size: 26px; padding: 6px 12px; }
.target .unit { font-family: var(--bagel); font-weight: 400; font-size: 24px; }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; margin: 0; }
.facts dt { color: var(--soft); font-weight: 700; }
.facts dd { margin: 0; word-break: break-all; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- cloud: plan, coach, past cooks, alerts ---------- */
.card {
  margin: 26px 0 0;
  background: var(--ticket);
  border: 2px solid var(--ink); border-radius: 14px;
  padding: 16px;
}
.card-hero { display: flex; gap: 12px; align-items: center; }
.card-hero img { width: 96px; flex: none; transform: rotate(-5deg); }
.card-hero h2 { font-size: 21px; margin-bottom: 4px; }
.card-hero p { font-size: 14px; margin-bottom: 10px; }
.card-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.card-head img { width: 54px; height: 54px; object-fit: contain; flex: none; transform: rotate(-6deg); }
.card-head h2 { font-size: 21px; margin-bottom: 2px; }

.ontrack { font-weight: 700; font-size: 14px; padding: 8px 10px; border-radius: 8px; margin: 0 0 10px; border: 2px solid currentColor; }
.ontrack.ok { color: var(--done); }
.ontrack.late { color: var(--ember); }
.ontrack .link { color: var(--ink); font-size: 14px; }
.plan-sum { font-size: 14px; margin-bottom: 12px; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { border-top: 2px dashed var(--line); }
.steps summary {
  display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: baseline;
  padding: 10px 0; cursor: pointer; list-style: none;
}
.steps summary::-webkit-details-marker { display: none; }
.steps .when { font-weight: 700; font-size: 13px; color: var(--soft); }
.steps b { font-size: 15px; }
.steps details p { margin: -4px 0 12px 106px; }
.steps li.past { opacity: .45; }
.steps li.past b { text-decoration: line-through; text-decoration-thickness: 2px; }
.steps li.next { background: var(--paper); margin: 0 -8px; padding: 0 8px; border-radius: 8px; border-top-color: transparent; }
.steps li.next .when { color: var(--ember); }
.donesteps { font-size: 13px; margin-bottom: 4px; }
@media (max-width: 380px) {
  .steps summary { grid-template-columns: 1fr; gap: 2px; }
  .steps details p { margin-left: 0; }
}
.tips { margin-top: 10px; font-size: 14px; }
.tips summary { font-weight: 700; cursor: pointer; }
.tips ul { padding-left: 18px; margin: 8px 0 0; }
.tips li + li { margin-top: 6px; }

.chat { max-height: 360px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.msg p { font-size: 15px; line-height: 1.45; padding: 9px 12px; border-radius: 12px; max-width: 88%; }
.msg.user { align-self: flex-end; }
.msg.user p { background: var(--ember); color: var(--on-ember); border-bottom-right-radius: 3px; font-weight: 700; margin-left: auto; }
.msg.coach p { background: var(--paper); border: 2px solid var(--line); border-bottom-left-radius: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chips button {
  border: 2px solid var(--ink); background: var(--paper); border-radius: 999px;
  padding: 6px 11px; font-size: 13px; font-weight: 700; cursor: pointer; text-align: left;
}
.chips button:disabled { opacity: .5; }
.askform { display: flex; gap: 8px; }
.askform input {
  flex: 1; min-width: 0;
  font: 700 16px var(--type); color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink); border-radius: 10px; padding: 10px; outline: none;
}
.askform input:focus { box-shadow: 0 0 0 3px var(--ember); }
.btn.small { font-size: 16px; padding: 8px 16px 9px; }

.finish { margin-top: 10px; font-size: 14px; }
.pair2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pair2 .target input { width: 100%; }
.seg3 { grid-template-columns: 1fr 1fr 1fr; margin: 0; }
.field input[type="datetime-local"] { font-size: 16px; }
.bad { color: #b3402a; font-weight: 700; font-size: 14px; margin-top: 10px; }
.thinking { margin-top: 10px; }
.howto { padding-left: 20px; line-height: 1.6; }

.pastcook { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 14px 0; border-top: 2px dashed var(--line); }
.pastcook:first-child { border-top: 0; }
.pastcook img { width: 56px; height: 56px; object-fit: contain; }
.pastcook h3 { margin: 0 0 2px; font-family: var(--bagel); font-weight: 400; font-size: 18px; }
.pastcook p { font-size: 14px; margin-top: 4px; }
.pastcook ul { margin: 4px 0 0; padding-left: 18px; font-size: 14px; }
#cooklist { margin-top: 10px; }

/* long-form text reads better in a plain sans */
.plan-sum, .steps details p, .tips, .msg p, .pastcook p, .pastcook ul, .card-hero p, .result p, .setup p {
  font-family: var(--read); letter-spacing: 0;
}
.steps details p { font-size: 14.5px; line-height: 1.5; color: var(--ink); opacity: .85; }
.plan-sum { font-size: 15px; line-height: 1.5; }
.foot { flex-wrap: wrap; row-gap: 4px; }
.foot .link { white-space: nowrap; }
