:root {
  --bg: #fafaf8;
  --card: #ffffff;
  --text: #1c1c1a;
  --muted: #76766f;
  --line: #e7e6e1;
  --accent: #1c1c1a;
  --star: #e0a400;
  --danger: #b3261e;
  --radius: 14px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 40px 16px 80px; }

header { margin-bottom: 28px; }
h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); letter-spacing: -0.02em; margin: 0 0 6px; font-weight: 700; }
.sub { color: var(--muted); margin: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: opacity .2s, filter .2s;
}
.card .img { aspect-ratio: 4 / 3; background: #f1f0ec center / contain no-repeat; border-bottom: 1px solid var(--line); }
.card .img.empty { display: grid; place-items: center; color: #c9c8c2; font-size: 2.4rem; }
.card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h2 { font-size: 1.02rem; margin: 0; font-weight: 600; }
.card .price { font-weight: 600; }
.card .note { color: var(--muted); font-size: .9rem; margin: 0; }
.card .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 10px; }
.card a.link { color: var(--muted); font-size: .9rem; }
.star { color: var(--star); }

.card.taken { opacity: .5; filter: grayscale(1); }
.tag { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.mine { background: none; border: 0; padding: 0; color: var(--muted); font-size: .82rem; text-decoration: underline; cursor: pointer; }
.taken-box { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.card a.link { white-space: nowrap; }

button.btn {
  font: inherit; font-weight: 600; font-size: .92rem;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  border-radius: 999px; padding: 8px 18px; cursor: pointer;
}
button.btn.ghost { background: transparent; color: var(--accent); }
button.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
button.btn:disabled { opacity: .5; cursor: default; }

.empty-state { color: var(--muted); text-align: center; padding: 60px 0; }

dialog {
  border: 0; border-radius: var(--radius); padding: 24px; width: min(420px, calc(100vw - 32px));
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
}
dialog::backdrop { background: rgba(20,20,18,.35); }
dialog h3 { margin: 0 0 6px; }
dialog p { margin: 0 0 14px; color: var(--muted); font-size: .92rem; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.error { color: var(--danger); font-size: .9rem; min-height: 1.2em; margin-top: 8px; }

label { display: block; font-size: .85rem; font-weight: 600; margin: 12px 0 4px; }
input[type=text], input[type=url], input[type=number], textarea {
  font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; min-height: 60px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }

/* admin */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 24px; }
.share { display: flex; gap: 8px; }
.share input { flex: 1; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.li { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.li .thumb { width: 52px; height: 52px; border-radius: 8px; background: #f1f0ec center / cover no-repeat; flex: none; }
.li .info { flex: 1; min-width: 0; }
.li .info b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .info span { color: var(--muted); font-size: .88rem; }
.li .tools { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.icon { font: inherit; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.icon.del { color: var(--danger); }

@media (max-width: 520px) {
  .wrap { padding-top: 28px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card .body { padding: 10px 12px 12px; }
  .card .row { flex-direction: column; align-items: stretch; }
  .taken-box { align-items: flex-start; }
  .two { grid-template-columns: 1fr; }
  .li { flex-wrap: wrap; }
  .li .tools { width: 100%; justify-content: flex-start; }
}
