/* The Takeaway Rankings: a retro diner. Teal and cherry, a striped awning, a letter-board leaderboard
   and a till receipt for each spot. */

:root {
  --teal: #1E8C8C;
  --teal-deep: #156B6B;
  --cherry: #D7263D;
  --cream: #FFF3E0;
  --paper: #FFFBF4;
  --brown: #3B2416;
  --butter: #F2B33D;
  --orange: #E9803A;
  --muted: #7A5C48;
  --line: 3px solid var(--brown);
  --pop: 5px 5px 0 var(--brown);
  --round: "Fredoka", "Nunito", system-ui, sans-serif;
  --till: "Courier Prime", "Courier New", monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--brown);
  font: 400 1.04rem/1.5 var(--round);
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
a { color: inherit; }

:focus-visible { outline: 3px solid var(--brown); outline-offset: 3px; box-shadow: 0 0 0 6px var(--butter); }

/* ---------- hero: the diner front ---------- */

.hero {
  position: relative;
  z-index: 1;
  background: var(--teal);
  color: var(--cream);
  padding: 0 16px 64px;
  overflow-x: clip;
}

/* Striped awning hanging off the bottom, one scallop per stripe. */
.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 34px;
  background: repeating-linear-gradient(90deg, var(--cherry) 0 40px, var(--paper) 40px 80px);
  -webkit-mask: linear-gradient(#000 0 0) top / 100% 14px no-repeat,
    radial-gradient(circle at 50% 14px, #000 19.5px, transparent 20px) 0 0 / 40px 34px repeat-x;
  mask: linear-gradient(#000 0 0) top / 100% 14px no-repeat,
    radial-gradient(circle at 50% 14px, #000 19.5px, transparent 20px) 0 0 / 40px 34px repeat-x;
  filter: drop-shadow(0 3px 0 rgba(59, 36, 22, 0.25));
}

.topbar {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 0;
}

.home-link {
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  white-space: nowrap;
}
.home-link:hover { text-decoration: underline; text-underline-offset: 4px; }

.account { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.hero-inner {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 24px;
}

.sign {
  margin: 0;
  font: 700 clamp(3.6rem, 13vw, 9rem)/0.88 var(--round);
  letter-spacing: -0.02em;
  color: var(--cream);
  text-shadow: 0.05em 0.05em 0 var(--cherry);
}
.sign span { display: block; animation: slam 0.55s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
.sign span:nth-child(1) { font-size: 0.5em; line-height: 1; color: var(--butter); text-shadow: 0.06em 0.06em 0 var(--brown); }
.sign span:nth-child(2) { animation-delay: 0.08s; }
.sign span:nth-child(3) { animation-delay: 0.16s; padding-left: 0.45em; }

@keyframes slam {
  from { opacity: 0; transform: translateY(-30%) rotate(-5deg) scale(1.12); }
}

.hero-sub {
  max-width: 34ch;
  margin: 26px 0 0;
  font-size: clamp(1.1rem, 2.4vw, 1.35rem);
  font-weight: 500;
}

/* The current number one, as a cherry sticker slapped on the window. */
.champ {
  position: absolute;
  right: 0;
  bottom: -30px;
  z-index: 2;
  width: 230px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 4px solid var(--brown);
  background: var(--cherry);
  color: var(--cream);
  box-shadow: 6px 6px 0 var(--brown);
  display: grid;
  place-content: center;
  text-align: center;
  padding: 24px;
  transform: rotate(9deg);
  animation: stick 0.6s 0.35s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
.champ[hidden] { display: none; }
.champ:hover { transform: rotate(3deg); }
.champ-label { font-weight: 600; font-size: 0.9rem; }
.champ-score { font: 700 3.8rem/1 var(--round); margin: 2px 0; color: var(--butter); }
.champ-name { font-weight: 600; font-size: 1rem; line-height: 1.2; }

@keyframes stick {
  from { opacity: 0; transform: rotate(-40deg) scale(0.4); }
}

@media (max-width: 860px) {
  .champ {
    position: relative;
    margin-top: 30px;
    width: 180px;
    right: auto;
    bottom: auto;
    float: right;
  }
  .champ-score { font-size: 3rem; }
  .hero-inner::after { content: ""; display: block; clear: both; }
}

/* ---------- buttons ---------- */

.btn {
  border: var(--line);
  border-radius: 999px;
  background: var(--paper);
  padding: 8px 18px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}
.btn:active { transform: translate(2px, 2px); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn-add { background: var(--cherry); color: var(--cream); box-shadow: 4px 4px 0 var(--brown); }
.btn-add:active { box-shadow: 2px 2px 0 var(--brown); }
.btn-danger { background: var(--paper); color: var(--cherry); border-color: var(--cherry); }
.topbar .btn-ghost { background: transparent; border-color: var(--cream); color: var(--cream); }
.topbar .btn-ghost:hover { background: var(--cream); color: var(--teal-deep); }

/* ---------- main ---------- */

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 72px 16px 64px;
}

.views { display: flex; gap: 10px; margin-bottom: 26px; }
.views [role="tab"] {
  border: var(--line);
  border-radius: 999px;
  background: var(--paper);
  padding: 9px 22px;
  font: 600 1.2rem/1.2 var(--round);
}
.views [aria-selected="true"] { background: var(--teal); color: var(--cream); }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.search {
  flex: 1 1 260px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: var(--line);
  border-radius: 999px;
  background: var(--paper);
  padding: 0 18px;
}
.search:focus-within { box-shadow: 0 0 0 4px var(--butter); }
.search svg { width: 20px; height: 20px; fill: none; stroke: var(--brown); stroke-width: 2.6; stroke-linecap: round; flex: none; }
.search input { border: 0; outline: 0; background: none; padding: 10px 0; width: 100%; }
.search input::placeholder { color: var(--muted); }

.sort { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.sort select {
  border: var(--line);
  border-radius: 999px;
  padding: 9px 40px 9px 16px;
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%233B2416' stroke-width='2.4'/%3E%3C/svg%3E") no-repeat right 16px center / 12px;
  appearance: none;
}

.brands { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 2px solid var(--brown);
  border-radius: 999px;
  background: var(--paper);
  padding: 5px 14px;
  font-weight: 600;
  font-size: 0.98rem;
}
.chip i { width: 12px; height: 12px; border-radius: 50%; background: var(--dot); border: 2px solid var(--brown); }
.chip span { font-weight: 400; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--brown); color: var(--cream); }
.chip[aria-pressed="true"] span { color: var(--butter); }

/* ---------- cards ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
  gap: 28px;
  margin-top: 28px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: var(--line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: var(--pop);
  overflow: hidden;
  text-decoration: none;
}

.card-top {
  aspect-ratio: 16 / 10;
  background: var(--brand);
  border-bottom: var(--line);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.card-top img { width: 100%; height: 100%; object-fit: cover; }
/* Brand name bottom-left so the score sticker (top-right) never covers it. */
.card-top:not(.has-photo) { place-items: end start; padding: 0 0 8% 5%; }

/* No photo yet: the brand name, big, like printed packaging. */
.card-top, .photos-none { container-type: inline-size; }
.plate {
  font: 700 min(4.6rem, calc(125cqi / var(--len, 8)))/0.9 var(--round);
  color: var(--brand-ink);
  transform: rotate(-7deg);
  text-align: center;
  padding: 0 12px;
  white-space: nowrap;
}
.card-top .plate { font-size: min(3.6rem, calc(105cqi / var(--len, 8))); transform-origin: 0 100%; padding: 0; }

.card-body { padding: 14px 20px 22px; }
.card-brand { margin: 0; font-weight: 500; color: var(--muted); }
.card h3 { margin: 0; font: 700 1.65rem/1.05 var(--round); }
.card-desc {
  margin: 8px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.stamp {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 78px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: var(--line);
  display: grid;
  place-content: center;
  text-align: center;
  transform: rotate(-10deg);
  transition: transform 0.2s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.card:hover .stamp { transform: rotate(4deg) scale(1.06); }
.stamp b { font: 700 1.75rem/1 var(--round); }
.stamp small { font-weight: 600; font-size: 0.75rem; }

.tier-great { background: var(--teal); color: var(--cream); }
.tier-good { background: var(--butter); color: var(--brown); }
.tier-meh { background: var(--orange); color: var(--brown); }
.tier-bad { background: var(--cherry); color: var(--cream); }

.empty {
  grid-column: 1 / -1;
  border: 3px dashed var(--brown);
  border-radius: 24px;
  padding: 48px 24px;
  text-align: center;
}
.empty h2 { margin: 0; font: 700 2.1rem/1.1 var(--round); }
.empty p { margin: 10px 0 22px; }

/* ---------- the board: a diner letter board ---------- */

.menuboard {
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 9px),
    #241812;
  border: 12px solid #7A4B2A;
  outline: 3px solid var(--brown);
  border-radius: 22px;
  box-shadow: inset 0 0 0 3px #5A341C, var(--pop);
  padding: clamp(14px, 3vw, 34px);
  color: var(--cream);
}
.menuboard ol { list-style: none; margin: 0; padding: 0; }
.menuboard li + li { margin-top: 4px; }
.menuboard a {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  text-decoration: none;
}
.menuboard a:hover { background: rgba(255, 243, 224, 0.06); }
.rank { font: 700 1.6rem/1 var(--round); color: var(--butter); min-width: 2.2ch; }
.name { font-weight: 500; font-size: clamp(1.1rem, 2.4vw, 1.4rem); letter-spacing: 0.01em; }
.leader { flex: 1; min-width: 20px; border-bottom: 3px dotted rgba(255, 243, 224, 0.35); transform: translateY(-5px); }
.score { font: 700 clamp(1.7rem, 4vw, 2.4rem)/1 var(--round); color: var(--cream); }
.menuboard .first a { background: var(--cherry); padding-block: 18px; }
.menuboard .first .rank, .menuboard .first .score { color: var(--butter); }
.menuboard .first .name { font-size: clamp(1.25rem, 3vw, 1.75rem); font-weight: 600; }
.menuboard .first .leader { border-color: rgba(255, 243, 224, 0.5); }
.board-empty { padding: 30px 14px; color: #CDB8A6; text-align: center; }

/* ---------- dialogs ---------- */

dialog {
  border: 4px solid var(--brown);
  border-radius: 28px;
  padding: 0;
  background: var(--paper);
  color: var(--brown);
  box-shadow: 8px 8px 0 var(--brown);
  max-width: min(1040px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  width: 100%;
}
dialog[open] { animation: open 0.22s cubic-bezier(0.2, 1.3, 0.4, 1); }
dialog::backdrop { background: rgba(36, 24, 18, 0.6); }
@keyframes open { from { opacity: 0; transform: translateY(14px) scale(0.97); } }

.detail-close, .rk-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: var(--line);
  background: var(--paper);
  padding: 0;
  font-size: 0; /* the × is drawn below so it sits exactly in the middle */
}
.detail-close::before, .detail-close::after, .rk-close::before, .rk-close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: var(--brown);
  transform: translate(-50%, -50%) rotate(45deg);
}
.detail-close::after, .rk-close::after { transform: translate(-50%, -50%) rotate(-45deg); }

/* Detail: write-up on the left, receipt on a teal tray on the right. */
.detail-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr);
}
.detail-main { padding: 26px 28px 30px; min-width: 0; }

.photos {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  margin: 0 0 22px;
  padding-right: 60px;
}
.photos img {
  flex: 0 0 88%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: var(--line);
  border-radius: 18px;
  scroll-snap-align: start;
}
.photos img:only-child { flex-basis: 100%; }
.photos-none {
  height: 150px;
  border: var(--line);
  border-radius: 18px;
  background: var(--brand);
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 0;
}

.detail-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
/* On phones the receipt is further down, so the score also sits beside the name. */
.detail-title .stamp { position: static; flex: none; display: none; }
.detail-brand { margin: 0; font-weight: 500; color: var(--muted); font-size: 1.1rem; }
.detail h2 { margin: 0; font: 700 clamp(2.1rem, 5vw, 3.1rem)/1 var(--round); }
.verdict { margin-top: 18px; max-width: 62ch; font-size: 1.12rem; line-height: 1.6; }
.verdict p { margin: 0 0 0.9em; }

.history { margin-top: 22px; color: var(--muted); }
.history-one { margin: 0; }
.history summary { cursor: pointer; font-weight: 600; color: var(--brown); }
.history ol { list-style: none; margin: 12px 0 0; padding: 0 0 0 14px; border-left: 3px solid var(--teal); }
.history li { margin: 0 0 10px; }
.history li b { color: var(--brown); margin-right: 6px; font-weight: 600; }
.history li small { display: block; }

.detail-actions { grid-column: 1; padding: 0 28px 28px; margin-top: -8px; }

.receipt {
  grid-row: 1 / span 2;
  grid-column: 2;
  background: var(--teal);
  border-left: var(--line);
  padding: 46px 26px 40px;
  filter: drop-shadow(5px 6px 0 rgba(36, 24, 18, 0.25));
}

/* The paper itself, slightly askew, with a torn zigzag bottom. */
.paper {
  --z: 9px;
  max-width: 340px;
  margin: 0 auto;
  padding: 24px 22px calc(22px + var(--z));
  background: #FFFFFF;
  color: #2A2A2A;
  font: 400 0.98rem/1.45 var(--till);
  transform: rotate(1.2deg);
  -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - var(--z)) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(2 * var(--z)) var(--z) repeat-x;
  mask: linear-gradient(#000 0 0) top / 100% calc(100% - var(--z)) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(2 * var(--z)) var(--z) repeat-x;
}
.paper > p, .paper > ul { margin: 0; padding: 10px 0; }
.paper > :first-child { padding-top: 0; }

.r-head { text-align: center; font-weight: 700; letter-spacing: 0.06em; }
.r-center { text-align: center; }
.r-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.85rem;
  border-top: 2px dashed #2A2A2A;
}
.r-lines { list-style: none; border-top: 2px dashed #2A2A2A; }
.r-lines li { display: grid; grid-template-columns: 1fr 5ch 9ch; gap: 6px; }
.r-lines li > :last-child { text-align: right; }
.r-lines .w { color: #6A6A6A; text-align: right; }
.r-lines .unrated { color: #9A9A9A; }
.r-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 2px dashed #2A2A2A;
  font-weight: 700;
  font-size: 1.15rem;
}
.r-total b { font-size: 2.1rem; }
.r-foot { text-align: center; font-size: 0.82rem; border-top: 2px dashed #2A2A2A; }

@media (max-width: 760px) {
  .detail-inner { grid-template-columns: 1fr; }
  .detail-main { padding: 22px 18px 24px; }
  .receipt { grid-row: auto; grid-column: 1; border-left: 0; border-top: var(--line); padding: 30px 16px 34px; }
  .detail-actions { grid-column: 1; grid-row: 2; padding: 0 18px 24px; margin: 0; }
  .photos { padding-right: 52px; }
  .detail-title .stamp { display: grid; }
}

/* ---------- editor ---------- */

.editor { max-width: min(780px, calc(100vw - 32px)); }
.editor-inner { position: relative; padding: 28px clamp(18px, 4vw, 34px) 0; }
.editor h2 { margin: 0 56px 22px 0; font: 700 clamp(1.8rem, 4vw, 2.4rem)/1.05 var(--round); }

.field { display: grid; gap: 6px; margin-bottom: 18px; }
.field > span { font-weight: 600; }
.field input, .field textarea {
  width: 100%;
  border: var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  background: #FFFFFF;
}
.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus { outline: 0; box-shadow: 0 0 0 4px var(--butter); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.editor-sub { margin: 8px 0 2px; font: 700 1.45rem/1.2 var(--round); }
.editor-hint { margin: 0 0 14px; color: var(--muted); }

.rates { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.rate {
  margin: 0;
  border: var(--line);
  border-radius: 18px;
  padding: 10px 14px 14px;
  min-width: 0;
  background: #FFFFFF;
}
.rate legend {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px;
  font-weight: 600;
  font-size: 1.1rem;
}
.rate legend svg { width: 28px; height: 28px; fill: none; stroke: var(--brown); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.rate-start {
  width: 100%;
  border: 3px dashed var(--brown);
  border-radius: 14px;
  background: none;
  padding: 22px 12px;
  font-weight: 600;
}
.rate-start:hover { background: var(--cream); }
.rate-body { display: none; }
.rate.on .rate-start { display: none; }
.rate.on .rate-body { display: block; }

.rate-score { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 4px 0 8px; }
.rate-score output {
  min-width: 3.4ch;
  text-align: center;
  font: 700 2.3rem/1 var(--round);
  border: var(--line);
  border-radius: 14px;
  padding: 4px 10px;
}
.step {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: var(--line);
  background: var(--paper);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1;
}

.rate input[type="range"] {
  --fill: 50%;
  width: 100%;
  height: 34px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: none;
}
.rate input[type="range"]::-webkit-slider-runnable-track {
  height: 14px;
  border: 2px solid var(--brown);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal) var(--fill), var(--cream) var(--fill));
}
.rate input[type="range"]::-moz-range-track {
  height: 10px;
  border: 2px solid var(--brown);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal) var(--fill), var(--cream) var(--fill));
}
.rate input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  margin-top: -10px;
  border-radius: 50%;
  border: 3px solid var(--brown);
  background: var(--cherry);
}
.rate input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 3px solid var(--brown);
  background: var(--cherry);
}
.rate input[type="range"]:focus-visible { box-shadow: none; outline-offset: 2px; border-radius: 999px; }

.weights {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 2px solid var(--brown);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 8px;
}
.weights button {
  border: 0;
  background: var(--paper);
  padding: 7px 2px;
  font-weight: 600;
  font-size: 0.92rem;
}
.weights button + button { border-left: 2px solid var(--brown); }
.weights [aria-checked="true"] { background: var(--teal); color: var(--cream); }

.rate-clear {
  display: block;
  margin: 10px auto 0;
  border: 0;
  background: none;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 0.92rem;
}

/* Overall score, pinned just above the Save bar while you adjust the ratings. */
.live-total {
  position: sticky;
  bottom: 88px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 22px;
  padding: 12px 14px 12px 20px;
  background: var(--brown);
  color: var(--cream);
  border-radius: 18px;
}
.live-total span { font: 700 1.4rem/1 var(--round); }
.live-total small { display: block; color: #E3CDB8; margin-top: 4px; font-size: 0.92rem; }
.live-score {
  min-width: 3.4ch;
  text-align: center;
  font: 700 2.3rem/1 var(--round);
  border-radius: 12px;
  padding: 4px 12px;
}
.live-score:not([class*="tier-"]) { background: #5A3D2B; }

.photo-edit { display: flex; flex-wrap: wrap; gap: 10px; }
.thumbs { display: contents; }
.thumbs figure {
  position: relative;
  margin: 0;
  width: 92px;
  height: 92px;
  border: var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.thumbs button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--brown);
  background: var(--paper);
  line-height: 1;
  font-size: 1.1rem;
}
.thumbs .uploading { display: grid; place-items: center; background: var(--cream); font-size: 0.8rem; font-weight: 600; }
.add-photo {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  text-align: center;
  border: 3px dashed var(--brown);
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  padding: 6px;
}
.add-photo:hover { background: var(--cream); }
.add-photo:focus-within { box-shadow: 0 0 0 4px var(--butter); }

.form-error, .rk-error {
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 2px solid var(--cherry);
  border-radius: 12px;
  background: #FDE4E7;
  color: #8E1424;
  font-weight: 500;
}

.editor-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 calc(-1 * clamp(18px, 4vw, 34px));
  padding: 16px clamp(18px, 4vw, 34px);
  background: var(--paper);
  border-top: var(--line);
}
.editor-actions span { flex: 1; }

@media (max-width: 640px) {
  .field-row, .rates { grid-template-columns: 1fr; }
  .topbar .btn { padding: 6px 13px; font-size: 0.95rem; }
  /* Keep the Save bar on one row; the × closes the editor too. */
  .editor-actions { flex-wrap: nowrap; }
  .editor-actions [data-cancel] { display: none; }
}

/* ---------- login, devices, confirm ---------- */

.rk-dialog { max-width: min(460px, calc(100vw - 32px)); }
.rk-panel { position: relative; padding: 28px 26px 26px; }
.rk-panel h2 { margin: 0 52px 14px 0; font: 700 1.9rem/1.05 var(--round); }
.rk-panel p { margin: 0 0 14px; }
.rk-block { border-top: 2px solid #EFE0D0; padding-top: 16px; margin-top: 16px; }
.rk-block:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.rk-block h3, .rk-group h3 { margin: 0 0 4px; font: 700 1.2rem/1.2 var(--round); }
.rk-block p { margin: 0 0 10px; color: var(--muted); }
.rk-pair { display: flex; gap: 8px; }
.rk-pair .rk-input { flex: 1; min-width: 0; }
.rk-sent { background: #E3F3F1; border: 2px solid var(--teal); border-radius: 12px; padding: 10px 14px; color: var(--brown) !important; margin-top: 10px !important; }
.rk-btn {
  border: var(--line);
  border-radius: 999px;
  background: var(--paper);
  padding: 10px 18px;
  font-weight: 600;
}
.rk-btn:disabled { opacity: 0.55; cursor: progress; }
.rk-primary { background: var(--cherry); color: var(--cream); box-shadow: 4px 4px 0 var(--brown); }
.rk-danger { background: var(--cherry); color: var(--cream); }
.rk-link { border: 0; background: none; padding: 4px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; justify-self: start; }
.rk-input {
  width: 100%;
  border: var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  background: #FFFFFF;
}
.rk-input:focus { outline: 0; box-shadow: 0 0 0 4px var(--butter); }
.rk-code { font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.rk-code::placeholder { text-transform: none; letter-spacing: 0.08em; }
.rk-devcode { background: var(--cream); border: 2px solid var(--brown); border-radius: 12px; padding: 10px 14px; margin-top: 10px !important; color: var(--brown) !important; }
.rk-check { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; }
.rk-check input { width: 20px; height: 20px; accent-color: var(--teal); }
.rk-row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.rk-requests { max-width: min(620px, calc(100vw - 32px)); }
.rk-group { margin-top: 18px; }
.rk-send { background: var(--cream); border: 3px solid var(--teal); border-radius: 18px; padding: 16px 18px; margin: 4px 0 8px; }
.rk-send h3 { margin: 0 0 6px; font: 700 1.15rem/1.2 var(--round); }
.rk-send p { margin: 0 0 10px; color: var(--muted); }
.rk-send .rk-actions { justify-content: flex-start; }
.rk-send a.rk-btn { text-decoration: none; display: inline-block; }
.rk-code-show { font: 700 1.9rem/1.1 var(--round); letter-spacing: 0.08em; color: var(--brown) !important; user-select: all; }
.rk-none { color: var(--muted); margin: 0; }
.rk-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.rk-actions .rk-btn { padding: 7px 14px; font-size: 0.95rem; }
.rk-quiet { color: var(--cherry); border-color: var(--cherry); }
.rk-list { list-style: none; margin: 0 0 16px; padding: 0; }
.rk-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 2px solid #EFE0D0;
}
.rk-list small { display: block; color: var(--muted); }
.topbar .count { display: inline-grid; place-items: center; min-width: 1.5em; height: 1.5em; margin-left: 4px; border-radius: 999px; background: var(--cherry); color: var(--cream); font-size: 0.85em; }
@media (max-width: 560px) { .rk-list li { flex-direction: column; align-items: flex-start; } .rk-actions { justify-content: flex-start; } }
.rk-tag { background: var(--butter); border: 2px solid var(--brown); border-radius: 999px; padding: 0 8px; font-size: 0.8rem; font-weight: 600; }

/* ---------- footer ---------- */

.foot {
  border-top: var(--line);
  padding: 22px 16px 30px;
  text-align: center;
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
