/* Burg-It hub. Light "order pad" look: mint graph paper, sticker cards with ink outlines and
   lopsided corners, chunky press-down buttons, bouncy little animations. Game font Exo 2.
   Point badges reuse the item tier colors from the GDD (T1 light blue, T2 blue-violet, T3 orange). */
@font-face {
  font-family: "Exo 2";
  src: url("/assets/Exo2-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f3faef;
  --grid: #e2f1db;
  --panel: #ffffff;
  --panel2: #eef7ea;
  --edge: #cfe5c6;        /* soft green outline of panels */
  --line: #e1eedc;        /* hairlines inside panels */
  --ink: #23362a;         /* text and sticker outlines */
  --text: #23362a;
  --muted: #6c826f;
  --green: #45c262;
  --green-deep: #2f9a4a;
  --green-soft: #dcf5d4;
  --bun: #ffc83d;
  --bun-deep: #dfa416;
  --bun-soft: #fff4cc;
  --ketchup: #f2594f;
  --ketchup-deep: #c93d35;
  --slime: #7bd858;
  --violet: #9d8cff;
  --t1: #36b5ee;
  --t2: #7a63f0;
  --t3: #ff9a1f;
  --paper: #fffef9;
  --ink-muted: #7c8a7e;
  --blob: 22px 8px 22px 8px;      /* lopsided corners: panels */
  --blob-s: 14px 5px 14px 5px;    /* small things */
  --tilt: -.7deg;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Exo 2", system-ui, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1.5px, transparent 1.5px),
    linear-gradient(90deg, var(--grid) 1.5px, transparent 1.5px);
  background-size: 30px 30px;
  min-height: 100vh;
  line-height: 1.45;
}
a { color: var(--green-deep); font-weight: 700; text-decoration-thickness: 2px; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
[hidden] { display: none !important; }
::selection { background: var(--bun); }

/* ---------- header */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px 22px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(6px);
  border-bottom: 3px solid var(--edge);
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo img { width: 44px; height: 44px; transition: transform .2s; }
.logo:hover img { animation: wiggle .5s ease; }
.brand {
  font-weight: 900; font-style: italic; letter-spacing: .04em; margin: 0; font-size: 24px;
  color: var(--green-deep); text-shadow: 2px 2px 0 var(--bun);
}
.brand-sub { font-size: 12px; color: var(--muted); margin-top: -3px; font-weight: 600; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a {
  padding: 7px 14px; border-radius: var(--blob-s); text-decoration: none; color: var(--muted); font-weight: 800;
  border: 2px solid transparent; transition: transform .12s, background .12s;
}
.tabs a:hover { color: var(--ink); background: var(--panel2); transform: rotate(-2deg); }
.tabs a.on {
  color: #fff; background: var(--green); border-color: var(--green-deep);
  box-shadow: 0 4px 0 var(--green-deep); transform: translateY(-2px);
}
.me-chip {
  margin-left: auto; display: flex; align-items: center; gap: 10px;
  padding: 5px 6px 5px 14px; border-radius: var(--blob-s); background: #fff;
  border: 2px solid var(--edge); box-shadow: 0 4px 0 var(--edge);
  cursor: pointer; font-weight: 700; transition: transform .1s, box-shadow .1s;
}
.me-chip:hover { transform: translateY(-1px); }
.me-chip:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge); }
.me-chip .pts { color: var(--bun-deep); font-weight: 900; }
.fire { color: var(--t3); font-weight: 900; white-space: nowrap; display: inline-block; }
/* Only the flame moves, a slow steady sway; the number next to it stays still. */
.flame { display: inline-block; font-style: normal; transform-origin: 50% 85%; animation: flame 3.6s ease-in-out infinite; }
.fire.off .flame { animation: none; }
.fire.off { color: var(--muted); font-weight: 600; filter: grayscale(1); opacity: .7; }

.banner {
  margin: 16px 22px 0; padding: 12px 16px; border-radius: var(--blob-s);
  background: #fff0ee; border: 2px solid #f6b8b2; border-bottom-width: 5px; color: var(--ketchup-deep); font-weight: 700;
}

/* ---------- layout */
main.view { padding: 24px 22px 40px; max-width: 1500px; margin: 0 auto; }
.grid { display: grid; gap: 22px; }
.kitchen { grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); }
@media (max-width: 980px) { .kitchen { grid-template-columns: 1fr; } }
.panel {
  background: var(--panel); border: 2px solid var(--edge); border-bottom-width: 6px; border-radius: var(--blob);
  padding: 18px 20px;
}
.panel h2 { margin: 0 0 14px; font-size: 19px; font-weight: 900; letter-spacing: .01em; }
.panel h2:first-child { /* highlighter stroke behind the title text */
  display: table;
  background: linear-gradient(transparent 58%, var(--bun-soft) 58%, var(--bun-soft) 92%, transparent 92%);
  padding: 0 4px; margin-left: -4px;
}
.panel h2 .muted { font-weight: 600; font-size: 13px; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; align-content: start; min-width: 0; }
.stack > *, .grid > * { min-width: 0; } /* long one-line titles must shrink, not push the column wider */

/* ---------- hero */
.hero {
  display: grid; grid-template-columns: auto 1fr; gap: 14px 18px; align-items: center;
  background: var(--green-soft); border-color: #a9dd98;
  background-image: radial-gradient(circle at 92% 18%, rgba(255, 255, 255, .7) 0 38px, transparent 39px),
                    radial-gradient(circle at 80% 85%, rgba(255, 255, 255, .5) 0 22px, transparent 23px);
}
.mascot { width: 84px; height: 84px; animation: bob 3s ease-in-out infinite; cursor: pointer; }
.mascot:hover { animation: wiggle .5s ease; }
.hero h1 { margin: 0; font-size: 32px; font-weight: 900; line-height: 1.1; color: var(--green-deep); }
.hero p { margin: 6px 0 0; color: #47634c; font-weight: 600; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; grid-column: 1 / -1; }
.stat {
  border: 2px solid; border-bottom-width: 5px; border-radius: var(--blob-s); padding: 8px 14px; min-width: 104px;
  transform: rotate(var(--r, 0deg)); transition: transform .15s;
}
.stat:hover { transform: rotate(0) scale(1.06); }
.stat b { display: block; font-size: 28px; font-weight: 900; line-height: 1.1; }
.stat span { font-size: 12px; font-weight: 700; opacity: .8; }
.stat.gold { --r: -2deg; background: var(--bun-soft); border-color: #f2cf63; color: #8a6206; }
.stat.fire { --r: 1.5deg; background: #ffead2; border-color: #ffbe73; color: #a35400; }
.stat.green { --r: -1deg; background: #fff; border-color: #a9dd98; color: var(--green-deep); }
@media (max-width: 760px) { .mascot { width: 60px; height: 60px; } }

/* ---------- tickets (task cards): order slips pinned to the board */
.ticket {
  position: relative; background: var(--paper); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 4px 16px 4px 16px;
  padding: 16px 14px 12px; cursor: pointer; box-shadow: 4px 4px 0 var(--ink);
  transform: rotate(var(--tilt)); transition: transform .14s ease, box-shadow .14s ease;
}
.col-body .ticket:nth-child(even) { --tilt: .8deg; }
.col-body .ticket:nth-child(3n) { --tilt: -.3deg; }
.ticket::before { /* pushpin, colored by point tier */
  content: ""; position: absolute; top: -9px; left: 50%; width: 16px; height: 16px; margin-left: -8px;
  border-radius: 50%; background: var(--pin, var(--green)); border: 2px solid var(--ink);
  box-shadow: inset -3px -3px 0 rgba(0, 0, 0, .18);
}
.ticket.pin-t1 { --pin: var(--t1); }
.ticket.pin-t2 { --pin: var(--t2); }
.ticket.pin-t3 { --pin: var(--t3); }
.ticket.pin-none { --pin: #c9d3c9; }
.ticket:hover { transform: rotate(0) translate(-2px, -3px); box-shadow: 7px 7px 0 var(--ink); }
.ticket:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.ticket .row { display: flex; align-items: center; gap: 8px; }
.ticket .num { font-weight: 900; color: var(--ink-muted); font-size: 13px; }
.ticket h3 { margin: 6px 0 10px; font-size: 15px; font-weight: 800; line-height: 1.3; }
.ticket .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding-top: 9px; border-top: 2px dashed #dfe6dc; }
.ticket .takers { margin-left: auto; display: flex; padding-left: 6px; }
.ticket.mine { background: #f2fdea; }
.ticket.mine::after {
  content: attr(data-mine); position: absolute; top: -11px; right: 10px; padding: 0 8px; font-size: 11px; font-weight: 900;
  background: var(--green); color: #fff; border: 2px solid var(--ink); border-radius: 8px 3px 8px 3px; transform: rotate(4deg);
}

.pts-badge {
  margin-left: auto; font-weight: 900; font-size: 13px; padding: 1px 9px; border-radius: 10px 4px 10px 4px;
  color: #fff; background: #9fae9f; white-space: nowrap; border-bottom: 3px solid rgba(0, 0, 0, .2);
}
.pts-badge.t1 { background: var(--t1); }
.pts-badge.t2 { background: var(--t2); }
.pts-badge.t3 { background: var(--t3); }
.pts-badge.none { background: #b8c4b8; }
.pts-num { color: var(--bun-deep); font-size: 20px; font-weight: 900; }

.tag {
  display: inline-block; font-size: 12px; font-weight: 800; padding: 1px 9px; border-radius: 9px 3px 9px 3px;
  background: var(--panel2); color: #4b6650; border: 2px solid var(--edge);
}
.dark .tag, .tag.dark { background: #fff; }

.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 12px; font-weight: 900; color: var(--ink); background: var(--slime); border: 2px solid var(--ink);
  margin-left: -7px;
}
.avatar.big { width: 42px; height: 42px; font-size: 17px; margin: 0; box-shadow: 2px 2px 0 var(--ink); }

/* ---------- board */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 22px; }
.chip {
  padding: 5px 13px; border-radius: var(--blob-s); border: 2px solid var(--edge); background: #fff;
  color: #4b6650; cursor: pointer; font-weight: 800; font-size: 13px;
  box-shadow: 0 3px 0 var(--edge); transition: transform .08s, box-shadow .08s;
}
.chip:hover { transform: translateY(-1px); color: var(--ink); }
.chip:active { transform: translateY(3px); box-shadow: 0 0 0 var(--edge); }
.chip.on { background: var(--bun); color: var(--ink); border-color: var(--bun-deep); box-shadow: 0 3px 0 var(--bun-deep); }
.chip.slime.on { background: var(--green); color: #fff; border-color: var(--green-deep); box-shadow: 0 3px 0 var(--green-deep); }
.search {
  margin-left: auto; padding: 8px 14px; border-radius: var(--blob-s); border: 2px solid var(--edge); background: #fff; min-width: 220px;
}
.board { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 18px; align-items: start; overflow-x: auto; padding: 4px 4px 12px; }
.col {
  background: rgba(255, 255, 255, .55); border: 2px dashed #b9d9ad; border-radius: var(--blob);
  padding: 12px 12px 18px; min-height: 220px;
}
.col-head { display: flex; align-items: center; gap: 8px; margin: 2px 4px 10px; font-weight: 900; font-size: 16px; }
.col-head .dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); }
.col-head .count {
  margin-left: auto; background: var(--ink); color: #fff; border-radius: 8px 3px 8px 3px; padding: 0 9px; font-size: 13px; font-weight: 900;
}
.col-body { display: grid; gap: 20px; padding-top: 8px; }
.col .empty { color: var(--muted); font-size: 13px; font-weight: 700; text-align: center; padding: 26px 6px; }
.col .empty::before { content: "🍽️"; display: block; font-size: 26px; margin-bottom: 4px; opacity: .6; }
.rail { /* the order rail the slips hang from */
  height: 8px; border-radius: 4px; margin: 0 0 6px; background: linear-gradient(#e7ede6, #bfcabd); border: 2px solid #9fb09c;
}

/* ---------- lists */
.list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.mini {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--blob-s);
  background: #fff; border: 2px solid var(--edge); border-bottom-width: 4px; cursor: pointer;
  transition: transform .1s, border-color .1s;
}
.mini:hover { border-color: var(--green); transform: translateX(3px); }
.mini:active { transform: translateY(2px); border-bottom-width: 2px; }
.mini .t { flex: 1; min-width: 0; }
.mini .t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini > .muted:last-child { font-size: 22px; font-weight: 900; color: var(--green); }

.feed { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.feed-item { display: flex; gap: 12px; padding: 8px 6px; border-bottom: 2px dotted var(--line); align-items: flex-start; }
.feed-item:last-child { border: 0; }
.feed-item .ico {
  width: 32px; height: 32px; flex: none; display: grid; place-items: center; font-size: 16px;
  background: var(--panel2); border: 2px solid var(--edge); border-radius: 10px 4px 10px 4px;
}
.feed-item:nth-child(3n+1) .ico { transform: rotate(-6deg); }
.feed-item:nth-child(3n+2) .ico { transform: rotate(5deg); }
.feed-item .txt { flex: 1; min-width: 0; padding-top: 4px; }
.feed-item .when { color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; padding-top: 6px; }
.feed-item a.link, a.link { color: var(--green-deep); text-decoration: none; cursor: pointer; font-weight: 800; }
a.link:hover { text-decoration: underline wavy var(--green); }

.member { display: flex; align-items: center; gap: 12px; padding: 8px 4px; }
.member + .member { border-top: 2px dotted var(--line); }
.member .t { flex: 1; min-width: 0; }
.member .t b { display: block; }
.weeks { display: flex; gap: 4px; margin-top: 4px; }
.weeks i { width: 12px; height: 12px; border-radius: 4px 2px 4px 2px; background: #e3ebe1; }
.weeks i.on { background: var(--t3); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15); }

/* Duolingo-style progress bar: thick, rounded, with a light shine on top. */
.stage { margin-bottom: 14px; }
.stage .head { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 700; }
.bar { height: 16px; border-radius: 99px; background: #e5eee2; overflow: hidden; margin-top: 5px; }
.bar i {
  position: relative; display: block; height: 100%; min-width: 16px; border-radius: 99px;
  background: var(--green); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .12);
}
.bar i::after { content: ""; position: absolute; left: 8px; right: 8px; top: 3px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .45); }
.bar i[style^="width:0%"] { visibility: hidden; }
.group-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; margin: 6px 0 10px; }

.build { display: grid; gap: 6px; background: var(--bun-soft); border-color: #f2cf63; }
.build .big { font-size: 22px; font-weight: 900; }
.build pre { margin: 0; white-space: pre-wrap; font: inherit; color: var(--muted); font-size: 13px; }

/* ---------- tables, forms */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 2px dotted var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; border-bottom: 2px solid var(--edge); }
td.num, th.num { text-align: right; }
.form { display: grid; gap: 12px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 700px) { .form .two { grid-template-columns: 1fr; } }
label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 700; }
input, select, textarea {
  background: #fbfdfa; border: 2px solid var(--edge); border-radius: 12px 5px 12px 5px; padding: 9px 12px; color: var(--text); font-weight: 600;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
input[readonly] { background: var(--panel2); color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; cursor: pointer; }
label.check input { accent-color: var(--green); width: 18px; height: 18px; }

/* Chunky press-down buttons. */
.btn {
  border-radius: 14px 6px 14px 6px; padding: 9px 18px; font-weight: 900; cursor: pointer; letter-spacing: .02em;
  background: #fff; color: var(--ink); border: 2px solid var(--edge); border-bottom-width: 5px;
  transition: transform .08s, border-bottom-width .08s, filter .1s;
}
.btn:hover { filter: brightness(1.04); transform: translateY(-1px); }
.btn:active { transform: translateY(3px); border-bottom-width: 2px; }
.btn.primary { background: var(--green); color: #fff; border-color: var(--green-deep); }
.btn.slime { background: var(--bun); color: var(--ink); border-color: var(--bun-deep); }
.btn.danger { background: #fff; color: var(--ketchup-deep); border-color: #f6b8b2; }
.btn.small { padding: 4px 11px; font-size: 13px; border-bottom-width: 4px; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.error { color: var(--ketchup-deep); margin: 0; font-weight: 700; }

/* ---------- modal */
.modal-back {
  position: fixed; inset: 0; background: rgba(35, 54, 42, .35); backdrop-filter: blur(2px);
  display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .15s ease;
}
.modal {
  position: relative; width: min(720px, 100%); max-height: 90vh; overflow: auto; background: #fff;
  border: 2px solid var(--ink); border-radius: 26px 8px 26px 8px; box-shadow: 8px 8px 0 var(--ink); padding: 24px;
  animation: pop .28s cubic-bezier(.3, 1.6, .5, 1);
}
.modal h2 { margin: 6px 0 8px; font-size: 24px; font-weight: 900; }
.modal .close {
  float: right; width: 36px; height: 36px; background: var(--panel2); border: 2px solid var(--edge); border-radius: 50%;
  font-size: 20px; font-weight: 900; color: var(--muted); cursor: pointer; line-height: 1;
}
.modal .close:hover { transform: rotate(90deg); transition: transform .2s; }
.modal .panel { background: var(--panel2); }
.md { background: var(--paper); border: 2px dashed var(--edge); border-radius: 14px 5px 14px 5px; padding: 12px 16px; margin: 12px 0; overflow-wrap: anywhere; }
.md p { margin: 0 0 8px; }
.md ul { margin: 0 0 8px; padding-left: 20px; }
.md code { background: var(--panel2); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
.md pre { background: var(--panel2); padding: 10px; border-radius: 8px; overflow: auto; }
.status-pill { display: inline-block; padding: 1px 10px; border-radius: 10px 4px 10px 4px; font-weight: 900; font-size: 13px; color: var(--ink); border: 2px solid var(--ink); }

.toast {
  position: fixed; bottom: 24px; left: 50%; z-index: 60; transform: translateX(-50%);
  background: var(--green); color: #fff; font-weight: 900; border: 2px solid var(--green-deep); border-bottom-width: 5px;
  padding: 10px 20px; border-radius: 16px 6px 16px 6px; animation: toast .4s cubic-bezier(.3, 1.6, .5, 1);
}

/* ---------- map, links */
.map-frame { width: 100%; height: calc(100vh - 110px); border: 2px solid var(--edge); border-radius: var(--blob); background: #fff; }
main.view.full { max-width: none; padding: 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.link-card {
  display: block; text-decoration: none; color: var(--text); font-weight: 400; background: #fff;
  border: 2px solid var(--edge); border-bottom-width: 6px; border-radius: var(--blob); padding: 18px;
  transition: transform .14s;
}
.link-card:nth-child(odd) { transform: rotate(-.8deg); }
.link-card:nth-child(even) { transform: rotate(.7deg); }
.link-card:hover { transform: rotate(0) translateY(-4px); border-color: var(--green); }
.link-card .em { font-size: 32px; display: inline-block; }
.link-card:hover .em { animation: wiggle .5s ease; }
.link-card b { display: block; font-size: 17px; font-weight: 900; margin: 6px 0 2px; }

/* ---------- login */
.login-page { display: grid; place-items: center; padding: 20px; }
.login-card {
  width: min(390px, 100%); background: #fff; border: 2px solid var(--ink); border-radius: 28px 8px 28px 8px;
  padding: 28px; text-align: center; box-shadow: 8px 8px 0 var(--ink); animation: pop .4s cubic-bezier(.3, 1.6, .5, 1);
}
.login-card form { display: grid; gap: 12px; text-align: left; margin-top: 16px; }
.login-card .btn { margin-top: 4px; padding: 12px; font-size: 16px; }
.login-logo { width: 104px; height: 104px; animation: bob 3s ease-in-out infinite; }
.login-card .brand { font-size: 36px; }

/* ---------- motion */
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(2deg); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-10deg); } 50% { transform: rotate(8deg); } 75% { transform: rotate(-4deg); } }
@keyframes flame {
  0%, 100% { transform: rotate(-2.5deg) scale(1, 1); }
  25% { transform: rotate(0deg) scale(1.03, 1.07); }
  50% { transform: rotate(2.5deg) scale(1, 1); }
  75% { transform: rotate(0deg) scale(1.02, 1.05); }
}
@keyframes pop { 0% { opacity: 0; transform: scale(.9) translateY(8px); } 100% { opacity: 1; transform: none; } }
@keyframes popTilt { 0% { opacity: 0; transform: scale(.85) rotate(-4deg); } 100% { opacity: 1; transform: rotate(var(--tilt)); } }
@keyframes fade { from { opacity: 0; } }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 30px) scale(.8); } }

/* Entrance only right after switching tabs (app.js adds .enter for a moment). */
.view.enter .panel, .view.enter .col, .view.enter .link-card { animation: pop .35s cubic-bezier(.3, 1.5, .5, 1) backwards; }
.view.enter .ticket { animation: popTilt .4s cubic-bezier(.3, 1.6, .5, 1) backwards; }
.view.enter .stack > :nth-child(2), .view.enter .board > :nth-child(2) { animation-delay: .05s; }
.view.enter .stack > :nth-child(3), .view.enter .board > :nth-child(3) { animation-delay: .1s; }
.view.enter .stack > :nth-child(4), .view.enter .board > :nth-child(4) { animation-delay: .15s; }
.view.enter .ticket:nth-child(2) { animation-delay: .08s; }
.view.enter .ticket:nth-child(3) { animation-delay: .14s; }
.view.enter .ticket:nth-child(n+4) { animation-delay: .2s; }

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

/* ---------- language switch (RU | DE) */
.lang { display: flex; border: 2px solid var(--edge); border-radius: 12px 4px 12px 4px; overflow: hidden; background: #fff; flex: none; }
.lang button { border: 0; background: none; padding: 6px 10px; font-weight: 900; font-size: 13px; color: var(--muted); cursor: pointer; }
.lang button + button { border-left: 2px solid var(--edge); }
.lang button.on { background: var(--green); color: #fff; }
.login-lang { position: fixed; top: 16px; right: 16px; }
.weeks.days { gap: 3px; }
.weeks.days i { width: 9px; height: 12px; }

/* OWL facts in the kitchen feed: stickers that pop up once, when first scrolled to.
   .pop = the one-time pop animation, .seen = already shown (after a redraw), still and visible. */
.owl-fact {
  display: flex; gap: 12px; align-items: flex-start; margin: 8px 4px; padding: 10px 14px;
  background: #fff6d6; border: 2px solid var(--bun); border-bottom-width: 5px; border-radius: 18px 6px 18px 6px;
  --fact-tilt: -1deg; opacity: 0; transform: scale(.6) rotate(-4deg);
}
.feed .owl-fact:nth-child(10n+5) { --fact-tilt: 1deg; }
.owl-fact.seen { opacity: 1; transform: rotate(var(--fact-tilt)); }
.owl-fact.pop { animation: factPop .5s cubic-bezier(.3, 1.6, .5, 1) forwards; }
.owl-fact .owl { font-size: 26px; line-height: 1; }
.owl-fact b { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #b8860b; }
.owl-fact p { margin: 2px 0 0; font-weight: 600; }
@keyframes factPop {
  0% { opacity: 0; transform: scale(.6) rotate(-4deg); }
  100% { opacity: 1; transform: rotate(var(--fact-tilt)); }
}
@media (prefers-reduced-motion: reduce) { .owl-fact, .owl-fact.pop { animation: none; opacity: 1; transform: none; } }

/* ---------- phone: one compact header that scrolls away, tabs in a sideways strip, tighter panels */
.kao { white-space: nowrap; display: inline-block; }
@media (max-width: 640px) {
  .top {
    position: static; display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "logo lang me" "tabs tabs tabs"; gap: 8px 8px; padding: 8px 12px 0;
  }
  .logo { grid-area: logo; min-width: 0; gap: 8px; }
  .logo > div { flex: 1; min-width: 0; } /* take all the free width, so the subtitle measures against it */
  .logo img { width: 34px; height: 34px; }
  .brand { font-size: 19px; }
  .brand-sub { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .lang { grid-area: lang; }
  .lang button { padding: 4px 7px; font-size: 12px; }
  .me-chip { grid-area: me; margin: 0; gap: 6px; padding: 3px 3px 3px 9px; box-shadow: 0 3px 0 var(--edge); }
  .me-chip > span:first-child, .me-chip .pts { display: none; } /* name and points are in the hero anyway */
  .me-chip .avatar.big { width: 32px; height: 32px; font-size: 14px; }
  .tabs {
    grid-area: tabs; position: relative; flex-wrap: nowrap; overflow-x: auto; gap: 4px;
    margin: 0 -12px; padding: 4px 12px 10px; scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { flex: none; padding: 5px 11px; font-size: 14px; }
  .banner { margin: 10px 12px 0; }
  main.view { padding: 14px 12px 28px; }
  .grid, .stack { gap: 14px; }
  .panel { padding: 14px; border-bottom-width: 5px; }
  .panel h2 { font-size: 17px; margin-bottom: 10px; }
  .hero { gap: 10px 12px; }
  .mascot { width: 50px; height: 50px; }
  .hero h1 { font-size: 22px; }
  .hero p { font-size: 14px; }
  .stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stat { min-width: 0; padding: 6px 8px; }
  .stat b { font-size: 20px; }
  .stat span { font-size: 11px; display: block; line-height: 1.2; }
  .mini { padding: 8px 10px; gap: 10px; }
  .mini .t b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}

/* ---------- "show more", points list (table on wide screens, cards on phones), board column tabs */
.btn.more { margin-top: 12px; justify-self: start; }
.all-orders { display: inline-block; margin-top: 12px; }
.ledger { display: grid; container-type: inline-size; }
.led-row {
  display: grid; grid-template-columns: 96px 100px 70px minmax(0, 1fr) 100px minmax(170px, 230px);
  gap: 10px; padding: 9px 4px; border-bottom: 2px dotted var(--line); align-items: start;
}
.led-head { color: var(--muted); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; border-bottom: 2px solid var(--edge); }
.led-row .num { text-align: right; }
.led-row.cancelled .led-pts, .led-row.cancelled .led-what { text-decoration: line-through; opacity: .55; }
.led-state.warn { color: var(--t3); font-weight: 700; }
.led-state.bad { color: var(--ketchup-deep); font-weight: 700; }
.led-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.led-until .btn { margin-left: 4px; }
.ph-only { display: none; }
.col-tabs { display: none; }

@media (max-width: 980px) {
  /* Kitchen in one column (phone, tablet): the order that matters; the endless feed goes last. */
  .kitchen { display: flex; flex-direction: column; }
  .kitchen > .stack { display: contents; }
  .kitchen > .stack > * { order: 6; }
  .k-hero { order: 1 !important; } .k-stove { order: 2 !important; } .k-forme { order: 3 !important; }
  .k-board { order: 4 !important; } .k-progress { order: 5 !important; } .k-team { order: 7 !important; } .k-feed { order: 9 !important; }
}
@media (max-width: 640px) {
  .k-forme .mini:nth-child(n+4) { display: none; } /* three here, the rest on the board */


  /* Orders: one column at a time, picked with tabs. */
  .filters { gap: 6px; margin-bottom: 12px; }
  .filters .search { flex: 1 1 100%; }
  .col-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -12px 12px; padding: 2px 12px 8px; scrollbar-width: none; }
  .col-tabs::-webkit-scrollbar { display: none; }
  .col-tabs button {
    flex: none; display: flex; align-items: center; gap: 6px; padding: 6px 11px; font: inherit; font-weight: 800; font-size: 13px;
    border: 2px solid var(--edge); border-radius: var(--blob-s); background: #fff; color: var(--muted); box-shadow: 0 3px 0 var(--edge);
  }
  .col-tabs button.on { color: var(--ink); border-color: var(--green); box-shadow: 0 3px 0 var(--green-deep); }
  .col-tabs .dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink); }
  .board { grid-template-columns: minmax(0, 1fr); overflow: visible; padding: 0; }
  .board > .col:not(.on) { display: none; }
  .col-head, .col > .rail { display: none; }
  .col-body { gap: 14px; }
  .ticket { padding: 12px 12px 10px; box-shadow: 3px 3px 0 var(--ink); }
  .ticket h3 { font-size: 16px; }

  /* Code map: nearly the whole screen. */
  main.view.full { padding: 8px; }
  .map-frame { height: calc(100dvh - 16px); }
}

/* Points list: cards whenever the list itself is narrow (phone, or the left column of a smaller screen). */
@container (max-width: 700px) {
  .led-head { display: none; }
  .led-row {
    grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 12px 2px;
    grid-template-areas: "who pts" "what what" "date by" "until until";
  }
  .led-who { grid-area: who; } .led-pts { grid-area: pts; } .led-what { grid-area: what; }
  .led-date { grid-area: date; font-size: 13px; } .led-by { grid-area: by; font-size: 13px; text-align: right; }
  .led-until { grid-area: until; margin-top: 6px; font-size: 13px; }
  .ph-only { display: inline; }
}

/* Points page: summary on top, the endless ledger below it, full width. */
.points-top { margin-bottom: 22px; }
.ledger-panel { min-width: 0; }
@media (max-width: 640px) { .points-top { margin-bottom: 14px; } }

/* Uploaded profile pictures (profile window → "Поставить фото"). */
.avatar.pic { background: #fff; overflow: hidden; }
.avatar.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.huge { width: 84px; height: 84px; font-size: 34px; margin: 0; box-shadow: 3px 3px 0 var(--ink); }
.profile-head { display: flex; gap: 16px; align-items: center; margin-bottom: 8px; }
.profile-head h2 { margin: 0; }
.profile-head p { margin: 2px 0 8px; }
.profile-head .actions { margin: 0; gap: 8px; }
.profile-head label.btn { cursor: pointer; }

/* Photo framing before an avatar is saved. */
.crop-back { z-index: 60; }
.crop-box {
  position: relative; width: min(300px, 100%); aspect-ratio: 1; margin: 12px auto; overflow: hidden;
  border-radius: 14px; background: #20301f; touch-action: none; cursor: grab; user-select: none;
}
.crop-box:active { cursor: grabbing; }
.crop-box img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; pointer-events: none; }
.crop-ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 9999px rgba(20, 30, 20, .55); border: 3px solid #fff; pointer-events: none; }
.crop-zoom { display: flex; align-items: center; gap: 10px; justify-content: center; margin: 4px 0 12px; font-size: 13px; }
.crop-zoom input { flex: 1; max-width: 230px; accent-color: var(--green); }

/* ---- Tabs: icons only on the phone bottom bar; a badge for news on the board. */
.tabs a { position: relative; }
.tabs .ti, .tabs .short { display: none; }
.tabs .ti { font-style: normal; }
.badge {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--ketchup); color: #fff; font-size: 11px; font-weight: 900; line-height: 18px; text-align: center;
  border: 2px solid #fff;
}
.stat b.long { font-size: 17px; }

@media (max-width: 640px) {
  /* no backdrop blur here: it would make the fixed tab bar stick to the header instead of the screen */
  .top { grid-template-areas: "logo lang me"; padding-bottom: 6px; backdrop-filter: none; -webkit-backdrop-filter: none; }
  body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; margin: 0; overflow: visible;
    display: flex; gap: 2px; padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
    background: #fff; border-top: 2px solid var(--edge); box-shadow: 0 -4px 14px rgba(35, 54, 42, .08);
  }
  .tabs a {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 4px 0 3px; font-size: 10.5px; line-height: 1.1; border-radius: 12px;
  }
  .tabs a[hidden] { display: none; }
  .tabs a:hover { transform: none; }
  .tabs a.on { transform: none; box-shadow: 0 3px 0 var(--green-deep); }
  .tabs .ti { display: block; font-size: 20px; line-height: 1; }
  .tabs .full { display: none; }
  .tabs .short { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .badge { top: -2px; right: calc(50% - 22px); }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .map-frame { height: calc(100dvh - 16px - 66px - env(safe-area-inset-bottom)); }
  .stat b.long { font-size: 13px; }
}

/* ---- The board: stickers. */
.board { columns: 280px; column-gap: 18px; }
.board > p { column-span: all; }
.note {
  --paper: #fff3a8; --paper-edge: #e6cf55;
  break-inside: avoid; margin: 0 0 18px; padding: 14px 14px 10px; position: relative;
  background: var(--paper); border: 2px solid var(--paper-edge); border-radius: 4px 4px 18px 4px;
  box-shadow: 3px 5px 0 rgba(35, 54, 42, .12); transform: rotate(var(--tilt, 0deg));
  display: grid; gap: 8px;
}
.note::before { /* a strip of tape */
  content: ""; position: absolute; top: -10px; left: calc(50% - 34px); width: 68px; height: 18px;
  background: rgba(255, 255, 255, .6); border: 1px solid rgba(0, 0, 0, .06); transform: rotate(-3deg);
}
.note.pinned::before { content: "📍"; background: none; border: 0; width: auto; height: auto; left: calc(50% - 10px); top: -14px; font-size: 22px; transform: none; }
.note.for-me { outline: 3px dashed var(--ketchup); outline-offset: 3px; }
.c-yellow { --paper: #fff3a8; --paper-edge: #e6cf55; }
.c-pink { --paper: #ffd6e3; --paper-edge: #eaa3bb; }
.c-green { --paper: #d7f5c8; --paper-edge: #9fd58a; }
.c-blue { --paper: #d3ecff; --paper-edge: #95c6ec; }
.c-orange { --paper: #ffe0bf; --paper-edge: #efb279; }
.c-purple { --paper: #e8dcff; --paper-edge: #b9a2ec; }
.note-head { display: flex; align-items: center; gap: 8px; }
.note-head .avatar, .reply .avatar { margin: 0; flex: none; }
.note-tools { margin-left: auto; display: flex; gap: 2px; }
.note .x {
  border: 0; background: none; cursor: pointer; font-size: 15px; padding: 2px 5px; border-radius: 8px; color: var(--ink); line-height: 1;
}
.note .x:hover { background: rgba(0, 0, 0, .07); }
.note-to { font-size: 13px; color: var(--ketchup-deep); font-weight: 700; }
.note-text { font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.note-img { width: 100%; max-height: 360px; object-fit: cover; border-radius: 8px; border: 2px solid rgba(0, 0, 0, .08); cursor: zoom-in; display: block; }
.note-img.small { max-height: 180px; margin-top: 4px; }
.replies { display: grid; gap: 8px; border-top: 2px dashed rgba(0, 0, 0, .12); padding-top: 8px; }
.reply { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; font-size: 14px; overflow-wrap: anywhere; }
.reply > div { position: relative; }
.reply .x { position: absolute; top: -2px; right: 0; }
.reply-form { display: flex; gap: 4px; align-items: flex-end; }
.reply-form textarea {
  flex: 1; min-width: 0; resize: vertical; min-height: 34px; padding: 6px 10px; font: inherit; font-size: 14px;
  border: 2px solid rgba(0, 0, 0, .12); border-radius: 10px; background: rgba(255, 255, 255, .65);
}
.reply-form label.x { padding: 6px 4px; }
.pic-preview { position: relative; width: max-content; max-width: 100%; }
.pic-preview img { max-height: 140px; max-width: 100%; border-radius: 8px; border: 2px solid var(--edge); display: block; }
.pic-preview .x, .board-compose .pic-preview .x {
  position: absolute; top: 4px; right: 4px; background: #fff; border: 2px solid var(--edge); border-radius: 50%;
  width: 26px; height: 26px; cursor: pointer; font-weight: 900;
}
.board-compose { margin-bottom: 26px; display: grid; gap: 10px; }
.board-compose h2 { margin-bottom: 0; }
.board-compose textarea {
  width: 100%; font: inherit; padding: 10px 12px; border: 2px solid var(--edge); border-radius: 12px 5px 12px 5px; resize: vertical; background: #fbfdfa;
}
.compose-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.compose-row .btn.primary { margin-left: auto; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--paper-edge); background: var(--paper); cursor: pointer; }
.swatch.on { outline: 3px solid var(--ink); outline-offset: 1px; }
.mini-board { columns: 1; }
.mini-board .note { margin-bottom: 12px; }
.lightbox { cursor: zoom-out; }
.lightbox img { max-width: 96vw; max-height: 90vh; border-radius: 10px; box-shadow: 0 10px 40px rgba(0, 0, 0, .4); }

/* ---- Order comments. */
.cmt-title { margin: 16px 0 8px; font-size: 16px; }
.comments { display: grid; gap: 10px; margin-bottom: 12px; max-height: 340px; overflow-y: auto; }
.cmt { background: var(--panel2); border-radius: 12px 4px 12px 4px; padding: 8px 12px; }
.cmt-body { margin: 4px 0 0; padding: 0; border: 0; background: none; }
.cmt-body p { margin: 4px 0; }
.md-img { max-width: 100%; max-height: 260px; border-radius: 8px; display: block; margin: 6px 0; }
.file-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.file-chips .chip b { cursor: pointer; margin-left: 4px; }

@media (max-width: 640px) {
  .board { columns: 1; }
  .note { transform: none; }

}
