:root {
  color-scheme: dark;
  --ink: #171716;
  --panel: #211f1c;
  --panel-soft: #2a2723;
  --paper: #f3eddf;
  --muted: #aaa296;
  --line: rgba(243, 237, 223, 0.14);
  --hot: #ff465f;
  --rating-3: #ff0098;
  --rating-2: #e96f15;
  --rating-1: #89d32d;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { color: var(--paper); background: var(--ink); }
button, a { font: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.app-shell {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  grid-template-rows: 84px minmax(0, 1fr);
  width: 100%;
  height: 100dvh;
  background: var(--ink);
}

.topbar {
  grid-column: 1 / -1;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(23, 23, 22, 0.97);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 70, 95, 0.65);
  border-radius: 50%;
  color: var(--paper);
  font-family: "Noto Sans JP", sans-serif;
  font-size: 1.25rem;
  background: #34201f;
}
.brand h1 { margin: 0; font-size: 1.1rem; letter-spacing: 0.08em; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: 0.8rem; }
.legend { display: flex; gap: 18px; color: #d3ccbf; font-size: 0.8rem; }
.legend span { display: flex; align-items: center; gap: 7px; }
.dot { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(255,255,255,.07); }
.dot-3 { background: var(--rating-3); }
.dot-2 { background: var(--rating-2); }
.dot-1 { background: var(--rating-1); }

.detail-panel {
  position: relative;
  z-index: 900;
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  padding: 30px 28px;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 12px 0 34px rgba(0, 0, 0, 0.18);
}
.sheet-handle, .close-button { display: none; }
.empty-state { display: grid; min-height: 100%; place-content: center; text-align: center; }
.empty-state img { width: min(260px, 100%); margin: 0 auto 24px; border-radius: 18px; opacity: .92; }
.empty-state p { margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.8; }
.shop-detail { padding-top: 12px; }
.eyebrow { margin: 0 0 9px; color: var(--hot); font-size: .78rem; font-weight: 700; letter-spacing: .12em; }
.shop-detail h2 { margin: 0; font-family: "Noto Sans JP", sans-serif; font-size: clamp(1.6rem, 3vw, 2.25rem); font-weight: 700; line-height: 1.35; letter-spacing: .02em; }
.rating-badge { display: inline-flex; align-items: center; gap: 8px; margin-top: 20px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; color: #eee8dc; font-size: .85rem; }
.rating-badge::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--rating-color); box-shadow: 0 0 14px var(--rating-color); }
.shop-address, .shop-comment { margin: 24px 0 0; color: #c7c0b5; font-size: .94rem; line-height: 1.75; }
.shop-comment { padding: 16px; border-left: 2px solid var(--hot); background: var(--panel-soft); }
.link-row { display: grid; gap: 10px; margin-top: 30px; }
.link-row a { display: flex; min-height: 50px; align-items: center; justify-content: space-between; padding: 0 17px; border-radius: 10px; color: inherit; font-size: .92rem; font-weight: 700; text-decoration: none; transition: transform .16s ease, background .16s ease; }
.link-row a:hover { transform: translateY(-1px); }
.primary-link { background: var(--hot); }
.primary-link:hover { background: #ff5b71; }
.secondary-link { border: 1px solid var(--line); background: var(--panel-soft); }

.map-wrap { position: relative; grid-column: 2; grid-row: 2; min-width: 0; min-height: 0; }
#map { width: 100%; height: 100%; background: #d6d2c7; }
.leaflet-tile-pane { filter: saturate(.72) contrast(1.03); }
.leaflet-control-attribution { background: rgba(255,255,255,.84) !important; font-size: 10px !important; }
.leaflet-control-zoom { border: 0 !important; box-shadow: 0 4px 18px rgba(0,0,0,.18) !important; }
.leaflet-control-zoom a { color: #222 !important; border: 0 !important; }
.ramen-marker { display: grid; place-items: center; border: 3px solid #fff; border-radius: 50% 50% 50% 10%; color: #fff; font-size: 12px; font-weight: 900; line-height: 1; transform: rotate(-45deg); box-shadow: 0 5px 14px rgba(0,0,0,.38); }
.ramen-marker span { transform: rotate(45deg); }
.ramen-marker.is-selected { width: 38px !important; height: 38px !important; margin: -4px 0 0 -4px; box-shadow: 0 0 0 5px rgba(255,255,255,.34), 0 7px 18px rgba(0,0,0,.4); }
.map-actions { position: absolute; z-index: 800; right: 16px; bottom: 30px; display: grid; gap: 8px; }
.map-actions button { display: grid; width: 58px; min-height: 58px; place-items: center; padding: 7px 4px 6px; border: 0; border-radius: 12px; color: #292725; background: rgba(248,244,235,.96); box-shadow: 0 4px 18px rgba(0,0,0,.22); cursor: pointer; }
.map-actions svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.map-actions span { font-size: .67rem; font-weight: 700; }
.map-actions button:hover { background: #fff; }
.map-status { position: absolute; z-index: 850; left: 50%; top: 18px; max-width: calc(100% - 36px); padding: 10px 15px; transform: translateX(-50%); border-radius: 999px; color: var(--paper); background: rgba(23,23,22,.9); box-shadow: 0 5px 22px rgba(0,0,0,.2); font-size: .8rem; pointer-events: none; transition: opacity .2s; }
.map-status.is-hidden { opacity: 0; }
.user-location { border-radius: 50%; background: #287be8; border: 3px solid #fff; box-shadow: 0 0 0 12px rgba(40,123,232,.2), 0 3px 12px rgba(0,0,0,.35); }

@media (max-width: 760px) {
  .app-shell { display: block; position: relative; height: 100dvh; }
  .topbar { position: absolute; top: calc(10px + var(--safe-top)); left: 10px; right: 10px; min-height: 62px; padding: 8px 12px; border: 1px solid rgba(255,255,255,.13); border-radius: 15px; box-shadow: 0 5px 26px rgba(0,0,0,.25); }
  .brand-mark { width: 38px; height: 38px; font-size: 1.05rem; }
  .brand h1 { font-size: .95rem; }
  .brand p { font-size: .72rem; }
  .legend { display: none; }
  .map-wrap { position: absolute; inset: 0; }
  .leaflet-control-zoom { margin-top: calc(90px + var(--safe-top)) !important; }
  .map-actions { right: 12px; bottom: calc(20px + var(--safe-bottom)); }
  .map-actions button { width: 54px; min-height: 54px; }
  .detail-panel {
    position: absolute;
    z-index: 1100;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    height: 30dvh;
    min-height: 0;
    padding: 20px 16px calc(10px + var(--safe-bottom));
    border: 0;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -8px 32px rgba(0,0,0,.32);
  }
  .detail-panel.is-open { display: block; animation: sheet-in .22s ease-out; }
  .sheet-handle { position: absolute; top: 9px; left: 50%; display: block; width: 40px; height: 4px; transform: translateX(-50%); border-radius: 99px; background: #77716a; }
  .close-button { position: absolute; z-index: 2; top: 14px; right: 14px; display: grid; width: 34px; height: 34px; place-items: center; border: 0; border-radius: 50%; color: var(--paper); background: #38342f; font-size: 1.3rem; cursor: pointer; }
  .empty-state { display: none; }
  .shop-detail { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "area area" "name name" "rating address" "links links"; gap: 6px 10px; padding-top: 0; }
  .eyebrow { grid-area: area; margin: 0; font-size: .68rem; }
  .shop-detail h2 { grid-area: name; padding-right: 34px; font-size: 1.35rem; line-height: 1.2; }
  .rating-badge { grid-area: rating; align-self: center; margin: 0; padding: 4px 8px; font-size: .71rem; }
  .shop-address { grid-area: address; align-self: center; min-width: 0; margin: 0; overflow: hidden; color: #aaa49b; font-size: .7rem; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
  .shop-comment { display: none; }
  .link-row { grid-area: links; grid-template-columns: 1fr auto; gap: 8px; margin-top: 2px; }
  .link-row a { min-height: 40px; padding: 0 13px; font-size: .78rem; }
  .secondary-link span { display: none; }
  .map-status { top: calc(82px + var(--safe-top)); }
}

@keyframes sheet-in { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
