:root {
  --ink: #2e2015;
  --ink-soft: #5c4a38;
  --paper: #faf6ee;
  --paper-deep: #f1e9d8;
  --ochre: #c8862a;
  --ochre-deep: #a05e12;
  --moss: #4a7a3a;
  --vermillion: #b23a2a;
  --line: #d9cdb4;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Karla", "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  overscroll-behavior: none;
}

main, #map { position: absolute; inset: 0; }

/* ---------- top bar ---------- */

.topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: calc(env(safe-area-inset-top) + 0.55rem) 0.9rem 0.55rem;
  background: var(--paper);
  background-image: var(--grain);
  border-bottom: 2px solid var(--ink);
  box-shadow: 0 1px 0 var(--ochre), 0 6px 18px rgb(46 32 21 / 0.12);
}

.logo {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: -0.01em;
  line-height: 1;
}

.logo-dot { color: var(--ochre); }

.logo-kana {
  display: block;
  font-family: var(--sans);
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.42em;
  color: var(--ink-soft);
  margin-top: 0.2rem;
}

.city-switch {
  display: flex;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  background: var(--paper-deep);
}

.city-btn {
  appearance: none;
  border: 0;
  background: transparent;
  font: 600 0.85rem var(--sans);
  color: var(--ink-soft);
  padding: 0.45rem 0.95rem;
  cursor: pointer;
  transition: background 200ms var(--ease-out), color 200ms var(--ease-out);
}

.city-btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- bottom sheet ---------- */

.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  max-height: 72vh;
  overflow-y: auto;
  background: var(--paper);
  background-image: var(--grain);
  border-top: 2px solid var(--ink);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -2px 0 var(--ochre), 0 -14px 40px rgb(46 32 21 / 0.25);
  padding: 1rem 1.1rem calc(env(safe-area-inset-bottom) + 1.1rem);
  animation: sheet-up 420ms var(--ease-out);
}

@keyframes sheet-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.sheet-close {
  position: absolute;
  top: 0.55rem; right: 0.7rem;
  appearance: none;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  width: 2rem; height: 2rem;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.sheet-body {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

/* the medallion — the thing people screenshot */
.medallion {
  flex: 0 0 auto;
  width: 5.4rem;
  height: 5.4rem;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fffdf6, var(--paper-deep));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  box-shadow: inset 0 0 0 4px var(--paper), inset 0 0 0 5.5px var(--ochre);
  animation: medal-in 500ms var(--ease-out);
}

@keyframes medal-in {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.score {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--ochre-deep);
  font-variant-numeric: oldstyle-nums;
}

.score.unrated { color: var(--line); }

.logs-count {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.sheet-info { min-width: 0; }

.sheet-info h2 {
  margin: 0.1rem 0 0.15rem;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1.25;
}

.address {
  margin: 0 0 0.5rem;
  font-size: 0.76rem;
  color: var(--ink-soft);
}

.chips {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chips li {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.22rem 0.55rem;
  border: 1.5px solid var(--ink-soft);
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--paper);
  animation: chip-in 350ms var(--ease-out) backwards;
}

.chips li:nth-child(2) { animation-delay: 40ms; }
.chips li:nth-child(3) { animation-delay: 80ms; }
.chips li:nth-child(4) { animation-delay: 120ms; }
.chips li:nth-child(5) { animation-delay: 160ms; }

@keyframes chip-in {
  from { transform: translateY(6px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.chips li.good  { border-color: var(--moss); color: var(--moss); }
.chips li.bad   { border-color: var(--vermillion); color: var(--vermillion); }
.chips li.gold  { border-color: var(--ochre-deep); color: var(--ochre-deep); background: #fdf3df; }

.hours {
  margin: 0.55rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.provenance {
  margin: 0.45rem 0 0;
  font-size: 0.68rem;
  color: var(--ink-soft);
  opacity: 0.75;
}

/* ---------- rating flow ---------- */

.action-row {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.action-row .log-btn, .action-row .dir-btn { margin-top: 0; flex: 1; }

.dir-btn {
  display: block;
  padding: 0.7rem;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font: 700 0.95rem var(--sans);
  letter-spacing: 0.02em;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 3px 0 var(--ink);
  transition: transform 120ms var(--ease-out), box-shadow 120ms var(--ease-out);
}

.dir-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

.log-btn {
  appearance: none;
  display: block;
  width: 100%;
  margin-top: 0.9rem;
  padding: 0.7rem;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--ochre);
  color: var(--ink);
  font: 700 0.95rem var(--sans);
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
  transition: transform 120ms var(--ease-out), box-shadow 120ms var(--ease-out);
}

.log-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.log-btn:disabled { opacity: 0.55; cursor: default; }

.rate-panel { margin-top: 0.9rem; }

.stars {
  border: 0;
  margin: 0 0 0.6rem;
  padding: 0;
}

.stars legend {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 0;
  margin-bottom: 0.15rem;
}

.star-row { display: flex; gap: 0.15rem; }

.star-row label {
  font-size: 1.6rem;
  color: var(--line);
  cursor: pointer;
  transition: transform 120ms var(--ease-out);
}

.star-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.star-row label.lit { color: var(--ochre); }
.star-row label:active { transform: scale(1.2); }
.star-row input:focus-visible + span { outline: 2px solid var(--ochre-deep); outline-offset: 2px; border-radius: 4px; }

.comment-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.comment-label textarea {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.55rem;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fffdf6;
  font: 400 0.9rem var(--sans);
  color: var(--ink);
  resize: vertical;
}

.comment-label textarea:focus-visible { outline: 2px solid var(--ochre); }

.rate-error {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--vermillion);
}

/* ---------- comments ---------- */

.comments-wrap { margin-top: 1.1rem; }

.comments-title {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.comments {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.comments li {
  border: 1.5px solid var(--line);
  border-left: 4px solid var(--ochre);
  border-radius: 10px;
  background: #fffdf6;
  padding: 0.55rem 0.7rem;
}

.comment-meta {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.comment-meta .report-btn {
  margin-left: auto;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--line);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0 0.15rem;
}

.comment-meta .report-btn:hover,
.comment-meta .report-btn:focus-visible { color: var(--vermillion); }
.comment-meta .report-btn:disabled { color: var(--vermillion); cursor: default; }

.comment-text {
  margin: 0.3rem 0 0;
  font-size: 0.86rem;
  line-height: 1.45;
}

/* ---------- map furniture ---------- */

.maplibregl-ctrl-top-right { top: calc(env(safe-area-inset-top) + 4.4rem); }

button:focus-visible, .sheet-close:focus-visible {
  outline: 2.5px solid var(--ochre-deep);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .sheet, .medallion, .chips li { animation: none; }
  * { transition-duration: 0.01ms !important; }
}
