:root {
  --bg: #fff7ed; --card: #ffffff; --ink: #1c1917; --soft: #78716c; --line: #e7e5e4;
  --accent: #c2410c; --accent-ink: #ffffff; --ok: #15803d; --warn: #b45309; --bad: #be123c;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1917; --card: #292524; --ink: #f5f5f4; --soft: #a8a29e; --line: #44403c;
    --accent: #fb923c; --accent-ink: #1c1917; --ok: #4ade80; --warn: #fbbf24; --bad: #fb7185;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
a { color: var(--accent); }
main { max-width: 640px; margin: 0 auto; padding: 0 16px 24px; }
h1 { font-size: 1.5rem; margin: 12px 0; }
h2 { font-size: 1.15rem; margin: 28px 0 8px; color: var(--soft); }

.top {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 640px; margin: 0 auto; padding: calc(10px + env(safe-area-inset-top)) 16px 4px;
}
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--ink); }
.me, .owner { --c: var(--accent); }
.me {
  background: var(--c); color: #fff; border-radius: 999px; padding: 2px 12px; font-size: .9rem; font-weight: 600;
}

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabs a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-size: .72rem; color: var(--soft); text-decoration: none; padding: 2px 0;
}
.tabs a span { font-size: 1.25rem; line-height: 1.3; }
.tabs a.on { color: var(--accent); font-weight: 600; }
.tabs a.add span {
  background: var(--accent); color: var(--accent-ink); border-radius: 50%; width: 34px; height: 34px;
  display: grid; place-items: center; font-size: 1.3rem;
}

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.chip {
  --c: var(--soft); flex: none; padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--c);
  color: var(--ink); text-decoration: none; font-size: .95rem; background: var(--card);
}
.chip.on { background: var(--c); color: #fff; }
.chips .chip:first-child.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  display: grid; grid-template-columns: 84px 1fr; gap: 12px; padding: 12px; margin-bottom: 12px;
}
.card.taken, .card.muted { opacity: .55; }
.card.done { border-color: var(--ok); }
.thumb {
  width: 84px; height: 84px; border-radius: 10px; overflow: hidden; background: var(--bg);
  display: grid; place-items: center; font-size: 2rem;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.body { min-width: 0; }
.title { font-weight: 600; overflow-wrap: anywhere; }
.title a { color: var(--ink); text-decoration: none; }
.title a::after { content: " ↗"; color: var(--soft); font-weight: 400; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .85rem; color: var(--soft); margin-top: 2px; }
.pri { font-size: .7rem; letter-spacing: -1px; }
.price { color: var(--ink); font-weight: 600; }
.note { font-size: .9rem; color: var(--soft); margin-top: 4px; overflow-wrap: anywhere; }
.foot {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px;
}
.foot form { margin: 0; }
.owner { margin-right: auto; color: var(--c); font-weight: 600; font-size: .9rem; }

.btn {
  display: inline-block; border: 0; border-radius: 10px; padding: 9px 16px; font: inherit; font-weight: 600;
  background: var(--accent); color: var(--accent-ink); text-decoration: none; cursor: pointer;
  white-space: nowrap;
}
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { color: var(--bad); }
.btn.big { width: 100%; padding: 14px; font-size: 1.05rem; margin-top: 8px; }
.bookmarklet { cursor: grab; }
.tag { font-size: .85rem; padding: 4px 10px; border-radius: 999px; background: var(--bg); }
.tag.mine { color: var(--ok); }
.tag.taken { color: var(--soft); }
.tag.warn { color: var(--warn); }

.flash { padding: 10px 14px; border-radius: 10px; margin: 8px 0; background: var(--card); border-left: 4px solid var(--accent); }
.flash-success { border-color: var(--ok); }
.flash-warning { border-color: var(--warn); }
.empty { text-align: center; color: var(--soft); padding: 32px 0; }
.hint { color: var(--soft); font-size: .9rem; }

.wishform .field { margin-bottom: 14px; }
.wishform label { display: block; font-weight: 600; margin-bottom: 4px; }
input[type=text], input[type=url], input[type=file], textarea, .codeform input {
  width: 100%; font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink);
}
.radios div, .radios ul { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.radios label { font-weight: 400; display: inline-flex; gap: 6px; align-items: center;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; background: var(--card); }
.radios > label { border: 0; padding: 0; background: none; font-weight: 600; }
.preview-img { display: block; max-width: 100%; max-height: 220px; margin: 0 auto 14px; border-radius: 12px; }
.err { color: var(--bad); font-size: .9rem; margin-top: 4px; }

.welcome { text-align: center; padding-top: 24px; }
.welcome ol { text-align: left; }
.codeform { display: flex; flex-direction: column; gap: 10px; max-width: 280px; margin: 16px auto; }
.codeform input { text-align: center; font-size: 1.6rem; letter-spacing: .3em; }
.qr { display: grid; place-items: center; background: #fff; border-radius: 16px; padding: 12px; width: fit-content; margin: 0 auto; }
.code { text-align: center; font-size: 2.2rem; font-weight: 700; letter-spacing: .15em; margin: 8px 0; }

.devices { list-style: none; padding: 0; }
.devices li { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; }
.devices small { color: var(--soft); }
details { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px; }
summary { font-weight: 600; cursor: pointer; }
code { background: var(--bg); padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; }
