:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f4f2;
  --text: #1b1b1b;
  --muted: #6b6b6b;
  --border: #e3e3e0;
  --accent: #1b1b1b;
  --accent-contrast: #ffffff;
  --link: #1b1b1b;
  --danger: #c4321f;
  --warn: #fff4d6;
  --hot: #b4441c;
  --hot-bg: #fdf0e8;
  --star: #e8a317;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --surface: #1c1c1c;
    --surface-2: #232323;
    --text: #ededed;
    --muted: #9a9a9a;
    --border: #2e2e2e;
    --accent: #ededed;
    --accent-contrast: #141414;
    --link: #ededed;
    --danger: #f06a58;
    --warn: #3a3220;
    --hot: #f0a27c;
    --hot-bg: #3a2418;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text); font: 16px/1.5 var(--font);
}
main { flex: 1; }
main.container { padding-bottom: 56px; }
img { max-width: 100%; }
a { color: var(--link); text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.container { width: 100%; max-width: 1000px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
.site-header { border-bottom: 1px solid var(--border); }
.header-row { display: flex; align-items: center; gap: 8px 24px; flex-wrap: wrap; min-height: 60px; padding-top: 10px; padding-bottom: 10px; }
.brand { font-weight: 700; font-size: 1.05rem; color: var(--text); text-decoration: none; margin-right: auto; }
.nav, .langs { display: flex; align-items: center; gap: 18px; font-size: .95rem; }
.nav a, .link-btn { color: var(--muted); text-decoration: none; }
.nav a:hover, .link-btn:hover { color: var(--text); }
.nav a[aria-current] { color: var(--text); font-weight: 600; }
.langs { gap: 10px; font-size: .85rem; }
.langs a { color: var(--muted); text-decoration: none; }
.langs a:hover { color: var(--text); }
.langs a[aria-current] { color: var(--text); font-weight: 600; }
.inline-form { display: inline; margin: 0; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }

.site-footer { padding: 24px 0 32px; border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; }
.footer-row { display: flex; justify-content: space-between; gap: 16px; }
.site-footer a { color: var(--muted); }

/* controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 500;
  line-height: 1.2; cursor: pointer; text-decoration: none; transition: background .12s, border-color .12s;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { opacity: .88; border-color: var(--accent); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); background: transparent; }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: .875rem; }
.btn-block { width: 100%; }

input, textarea, select {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 11px;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { resize: vertical; min-height: 90px; }
label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: 6px; }
.form { display: grid; gap: 6px; }
.form .btn { margin-top: 12px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .75rem; background: var(--surface-2); color: var(--muted); }

.alert { padding: 10px 14px; border-radius: var(--radius); margin: 0 0 20px; background: var(--surface-2); }
.alert-error { background: color-mix(in srgb, var(--danger) 10%, var(--bg)); color: var(--danger); }

/* login */
.auth-card { max-width: 360px; margin: 64px auto 0; }
.auth-card h1 { font-size: 1.5rem; }
.code-input { font-size: 1.5rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.auth-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: .9rem; flex-wrap: wrap; }
.auth-actions a, .auth-actions .link-btn { color: var(--muted); text-decoration: underline; }

/* wishlist */
.page-head { padding: 40px 0 28px; }
.page-head h1 { font-size: 1.9rem; margin-bottom: 8px; }
.lead { margin: 0; max-width: 620px; color: var(--muted); }

.shelf { list-style: none; margin: 0; padding: 0; display: grid; gap: 40px 24px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); }
.tile { display: flex; flex-direction: column; gap: 6px; min-width: 0; scroll-margin-top: 20px; }
.tile:target .tile-photo { outline: 2px solid var(--text); outline-offset: 3px; }
.tile-photo {
  position: relative; aspect-ratio: 1; margin-bottom: 6px; border-radius: var(--radius); overflow: hidden;
  background: #fff; border: 1px solid var(--border);
}
.tile-photo img { width: 100%; height: 100%; object-fit: contain; padding: 8%; display: block; }
.tile-photo.is-empty { display: grid; place-items: center; background: var(--surface-2); border-color: transparent; }
.tile-icon { width: 36px; height: 36px; fill: none; stroke: var(--muted); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; opacity: .45; }
.tile.is-reserved .tile-photo img { opacity: .4; }
.chip {
  position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 999px;
  font-size: .75rem; background: rgba(255, 255, 255, .92); color: #444; border: 1px solid #e3e3e0;
}
.chip-hot { color: var(--hot); background: var(--hot-bg); border-color: transparent; }
.tile-title {
  margin: 0; font-size: .98rem; font-weight: 500; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.tile-title a { text-decoration: none; }
.tile-title a:hover { text-decoration: underline; }
.tile-note {
  margin: 0; font-size: .875rem; color: var(--muted); white-space: pre-line;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.tile-foot { display: flex; align-items: baseline; gap: 14px; margin-top: 2px; }
.tile-price { font-weight: 600; font-variant-numeric: tabular-nums; }
.tile-link { font-size: .875rem; color: var(--muted); }
.reserve { margin-top: 6px; }
.tile-reserved-by { margin: 6px 0 0; }
.reserve summary { list-style: none; }
.reserve summary::-webkit-details-marker { display: none; }
.reserve[open] summary { display: none; }
.reserve form { padding: 12px; border-radius: var(--radius); background: var(--surface-2); font-size: .875rem; }
.reserve form p { margin: 0 0 10px; color: var(--muted); }
.empty { padding: 48px 0; color: var(--muted); }

.received { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--border); }
.received h2 { font-size: 1rem; }
.received ul { margin: 0; padding-left: 20px; color: var(--muted); }
.received li { margin: 4px 0; }

@media (max-width: 560px) {
  .container { padding: 0 16px; }
  .brand { flex-basis: 100%; }
  .page-head { padding-top: 28px; }
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 14px; }
}

/* reservation */
.reserve form label { margin-top: 2px; color: var(--text); }
.reserve form input { margin-bottom: 8px; padding: 7px 10px; }
.reserve form p { font-size: .8rem; }
.reserve-item { display: flex; gap: 12px; align-items: center; margin: 0 0 20px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); }
.reserve-thumb { flex: none; width: 56px; height: 56px; border-radius: 6px; background: #fff; overflow: hidden; }
.reserve-thumb:empty { background: var(--surface-2); }
.reserve-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.reserve-name { margin: 0; font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.reserve-item .muted { margin: 2px 0 0; }
.reserve-page .auth-actions { justify-content: flex-start; }
