:root {
  --sand: #fbf8f3;
  --paper: #ffffff;
  --ink: #0f1f2a;
  --ink-2: #4a5b66;
  --ink-3: #8696a0;
  --line: #e9e3d8;
  --ocean: #0b7285;
  --ocean-deep: #08485a;
  --coral: #ff6b4a;
  --sun: #ffb547;
  --shadow: 0 1px 2px rgba(15, 31, 42, .06), 0 8px 24px rgba(15, 31, 42, .06);
  --shadow-lg: 0 20px 60px rgba(15, 31, 42, .22);
  --radius: 18px;
  --header-h: 60px;
  --font: "Zen Kaku Gothic New", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  --font-display: "Zen Maru Gothic", var(--font);
  --font-en: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--sand);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
img { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ───────── Hero ───────── */
.hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(120% 90% at 85% 10%, rgba(255, 199, 120, .95) 0%, rgba(255, 140, 90, .65) 28%, transparent 55%),
    linear-gradient(175deg, #ff9a6b 0%, #f2737a 22%, #7a5ba8 48%, #1e6f8c 72%, #0b4f63 100%);
  padding: 28px 16px 120px;
}
.hero-sun {
  position: absolute; right: 9%; top: 58px;
  width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle, #fff3c9 0%, #ffd27a 45%, rgba(255, 190, 110, 0) 70%);
  filter: blur(1px);
  animation: sun 9s ease-in-out infinite alternate;
}
@keyframes sun { to { transform: translateY(14px) scale(1.04); } }
.hero-palms {
  position: absolute; left: -10px; bottom: 60px; width: 220px; opacity: .9; pointer-events: none;
}
.hero-inner { position: relative; max-width: 1180px; margin: 0 auto; }
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-en); font-style: italic; font-weight: 600; font-size: 20px; letter-spacing: .02em;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .2); backdrop-filter: blur(6px); font-style: normal; font-size: 18px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 6vw, 56px);
  line-height: 1.25;
  margin: 46px 0 12px;
  font-weight: 900;
  letter-spacing: .02em;
  text-shadow: 0 2px 30px rgba(0, 0, 0, .15);
}
.hero h1 em { font-family: var(--font-en); font-weight: 600; font-style: italic; color: #fff3c9; }
.hero-lead { margin: 0; font-size: clamp(14px, 2.2vw, 17px); opacity: .95; max-width: 640px; }
.hero-stats { display: flex; gap: 22px; margin: 18px 0 26px; flex-wrap: wrap; }
.hero-stats div { font-size: 12px; opacity: .9; }
.hero-stats b { display: block; font-family: var(--font-en); font-size: 28px; line-height: 1.1; font-weight: 600; }

.search {
  position: relative; max-width: 680px;
}
.search input {
  width: 100%; border: 0; outline: 0;
  padding: 18px 52px 18px 54px;
  border-radius: 999px; font: inherit; font-size: 16px; color: var(--ink);
  background: #fff; box-shadow: 0 12px 40px rgba(8, 40, 55, .28);
}
.search input::placeholder { color: var(--ink-3); }
.search-icon { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; color: var(--ocean); }
.search-clear {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  border: 0; background: #f1ede6; width: 30px; height: 30px; border-radius: 50%; display: none;
}
.search.has-value .search-clear { display: block; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; max-width: 760px; }
.quick button {
  border: 1px solid rgba(255, 255, 255, .45); background: rgba(255, 255, 255, .14);
  color: #fff; padding: 6px 14px; border-radius: 999px; font-size: 13px; backdrop-filter: blur(6px);
  transition: background .15s;
}
.quick button:hover { background: rgba(255, 255, 255, .3); }
.hero-wave { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 90px; display: block; }

/* ───────── Tabs ───────── */
.tabs {
  position: sticky; top: 0; z-index: 900;
  background: rgba(251, 248, 243, .9); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.tabs-inner { max-width: 1180px; margin: 0 auto; display: flex; gap: 4px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
.tabs-inner::-webkit-scrollbar { display: none; }
.tab {
  border: 0; background: none; padding: 16px 14px 14px; font-weight: 700; font-size: 14px; color: var(--ink-2);
  border-bottom: 3px solid transparent; white-space: nowrap; display: flex; align-items: center; gap: 6px;
}
.tab[aria-selected="true"] { color: var(--ink); border-color: var(--coral); }
.tab .count { background: var(--coral); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; line-height: 18px; }
.tab .count:empty { display: none; }

main { max-width: 1180px; margin: 0 auto; padding: 18px 16px 80px; }
.view[hidden] { display: none !important; }

/* ───────── Filters ───────── */
.filters { display: grid; gap: 12px; margin-bottom: 14px; }
.filter-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.filter-label { font-size: 12px; font-weight: 700; color: var(--ink-3); width: 56px; flex: none; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; min-width: 0; flex: 1; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--paper);
  padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px; transition: all .15s;
}
.chip:hover { border-color: #d6cdbd; }
.chip .n { font-size: 11px; color: var(--ink-3); font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip[aria-pressed="true"] .n { color: rgba(255, 255, 255, .7); }
.chip.genre[aria-pressed="true"] { background: var(--c); border-color: var(--c); }

.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between;
  padding-top: 12px; border-top: 1px dashed var(--line);
}
.toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.toggle {
  border: 1px solid var(--line); background: var(--paper); border-radius: 10px;
  padding: 6px 11px; font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.toggle[aria-pressed="true"] { background: #fff4ef; border-color: var(--coral); color: #c2410c; }
.sort { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.sort select {
  font: inherit; font-weight: 600; border: 1px solid var(--line); border-radius: 10px; padding: 6px 30px 6px 10px; background: var(--paper);
  appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%234a5b66' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; color: var(--ink);
}
.result-meta { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; font-size: 13px; color: var(--ink-2); }
.result-meta b { font-family: var(--font-en); font-size: 20px; color: var(--ink); }
.link-btn { border: 0; background: none; color: var(--ocean); font-weight: 700; font-size: 13px; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

.course-banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 12px;
  border-radius: 14px; background: var(--paper); border: 2px solid var(--c, var(--ocean)); box-shadow: var(--shadow);
}
.course-banner .emoji { font-size: 24px; }
.course-banner b { display: block; }
.course-banner small { color: var(--ink-2); }
.course-banner .link-btn { margin-left: auto; white-space: nowrap; }

/* ───────── Explore layout ───────── */
.explore { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 20px; align-items: start; }
.list { display: grid; gap: 12px; min-width: 0; }
.map-wrap {
  position: sticky; top: calc(var(--header-h) + 14px);
  height: calc(100vh - var(--header-h) - 32px); min-height: 420px;
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line);
  background: #e8eef0;
}
#map { position: absolute; inset: 0; }

.card {
  position: relative; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px;
  background: var(--paper); border-radius: var(--radius); padding: 14px; border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(15, 31, 42, .04); cursor: pointer; text-align: left; width: 100%;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.card:hover, .card.is-hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #ddd3c3; }
.card.is-active { border-color: var(--c); box-shadow: 0 0 0 2px var(--c), var(--shadow); }
.card-icon {
  width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center; font-size: 30px;
  background: linear-gradient(140deg, color-mix(in srgb, var(--c) 16%, #fff), color-mix(in srgb, var(--c) 34%, #fff));
  position: relative;
}
.card-step {
  position: absolute; top: -6px; left: -6px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff;
}
.card-body { min-width: 0; }
.card-top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); flex-wrap: wrap; padding-right: 34px; }
.card-genre { color: var(--c); font-weight: 700; }
.card h3 { margin: 2px 0 0; font-size: 17px; line-height: 1.4; padding-right: 30px; font-family: var(--font-display); font-weight: 700; }
.card .en { font-family: var(--font-en); font-style: italic; font-size: 13px; color: var(--ink-3); margin: 0; line-height: 1.4; }
.card .quote {
  margin: 8px 0 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.65;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card .quote::before { content: "“"; font-family: var(--font-en); color: var(--coral); font-size: 20px; line-height: 0; margin-right: 2px; vertical-align: -6px; }
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag { font-size: 11.5px; padding: 2px 8px; border-radius: 6px; background: #f4efe7; color: var(--ink-2); font-weight: 600; }
.tag.warn { background: #fff1e6; color: #b45309; }
.tag.best { background: linear-gradient(90deg, #ffe7a3, #ffd0b5); color: #8a3b12; }
.fav {
  position: absolute; top: 10px; right: 10px; border: 0; background: none; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; color: #c9bfb0; transition: transform .15s, color .15s;
}
.fav:hover { transform: scale(1.1); }
.fav svg { width: 22px; height: 22px; }
.fav[aria-pressed="true"] { color: var(--coral); }
.fav[aria-pressed="true"] svg path { fill: currentColor; }
.empty { text-align: center; padding: 50px 20px; color: var(--ink-2); background: var(--paper); border-radius: var(--radius); border: 1px dashed var(--line); }
.empty .big { font-size: 40px; }

/* ───────── Map markers ───────── */
.pin {
  width: 36px; height: 36px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg);
  background: var(--c); border: 2.5px solid #fff; box-shadow: 0 4px 10px rgba(0, 0, 0, .28);
  display: grid; place-items: center; transition: transform .15s;
}
.pin span { transform: rotate(45deg); font-size: 16px; line-height: 1; }
.pin.best::after {
  content: "★"; position: absolute; top: -9px; right: -9px; transform: rotate(45deg);
  width: 17px; height: 17px; border-radius: 50%; background: #ffd24a; color: #8a3b12; font-size: 11px;
  display: grid; place-items: center; border: 2px solid #fff;
}
.pin.num span { font-family: var(--font-en); font-weight: 700; font-size: 15px; color: #fff; }
.pin.is-active { transform: rotate(-45deg) scale(1.3); z-index: 1000; }
.leaflet-marker-icon.is-front { z-index: 10000 !important; }
.leaflet-popup-content-wrapper { border-radius: 14px; box-shadow: var(--shadow-lg); }
.leaflet-popup-content { margin: 12px 14px; font-family: var(--font); line-height: 1.5; }
.pop b { display: block; font-size: 14px; }
.pop small { color: var(--ink-3); }
.pop button {
  margin-top: 8px; border: 0; background: var(--ink); color: #fff; padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 700;
}
.map-locate {
  position: absolute; z-index: 800; right: 12px; bottom: 24px; border: 0; width: 44px; height: 44px; border-radius: 12px;
  background: #fff; box-shadow: var(--shadow); display: grid; place-items: center; color: var(--ocean);
}
.map-legend {
  position: absolute; z-index: 800; left: 12px; bottom: 24px; background: rgba(255, 255, 255, .94);
  border-radius: 12px; padding: 8px 10px; font-size: 11px; box-shadow: var(--shadow); display: grid; gap: 2px;
}
.map-legend span { display: flex; align-items: center; gap: 6px; }
.map-legend i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }

.map-fab {
  display: none; position: fixed; z-index: 1100; left: 50%; bottom: 20px; transform: translateX(-50%);
  border: 0; background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 999px; font-weight: 700;
  box-shadow: var(--shadow-lg); align-items: center; gap: 8px;
}

/* ───────── Detail sheet ───────── */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 2000; background: rgba(8, 25, 35, .45); opacity: 0; pointer-events: none; transition: opacity .25s;
}
.sheet {
  position: fixed; z-index: 2001; top: 0; right: 0; bottom: 0; width: min(520px, 100%);
  background: var(--sand); overflow-y: auto; transform: translateX(100%); transition: transform .32s cubic-bezier(.2, .8, .2, 1);
  box-shadow: var(--shadow-lg); overscroll-behavior: contain;
}
body.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }
body.sheet-open .sheet { transform: none; }
body.sheet-open { overflow: hidden; }
.sheet-head {
  position: relative; color: #fff; padding: 22px 22px 26px;
  background: linear-gradient(140deg, var(--c), color-mix(in srgb, var(--c) 55%, #0b3140));
}
.sheet-head .big-icon { font-size: 44px; line-height: 1; }
.sheet-head h2 { margin: 12px 0 2px; font-family: var(--font-display); font-size: 25px; line-height: 1.35; }
.sheet-head .en { font-family: var(--font-en); font-style: italic; opacity: .85; margin: 0; }
.sheet-head .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.sheet-head .meta span { background: rgba(255, 255, 255, .2); padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.sheet-close, .sheet-fav {
  position: absolute; top: 14px; width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .22); color: #fff; display: grid; place-items: center; backdrop-filter: blur(6px);
}
.sheet-close { right: 14px; font-size: 20px; }
.sheet-fav { right: 62px; }
.sheet-fav svg { width: 20px; height: 20px; }
.sheet-fav[aria-pressed="true"] { background: #fff; color: var(--coral); }
.sheet-fav[aria-pressed="true"] svg path { fill: currentColor; }
.sheet-body { padding: 18px 18px 40px; display: grid; gap: 14px; }
.box { background: var(--paper); border-radius: var(--radius); padding: 16px 18px; border: 1px solid var(--line); }
.box h4 { margin: 0 0 8px; font-size: 12px; letter-spacing: .08em; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.box p { margin: 0; }
.owner { background: #fff9ec; border-color: #f6e3b8; position: relative; }
.owner p { font-size: 16px; line-height: 1.8; font-weight: 500; }
.owner h4 { color: #b45309; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.fact { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.fact small { display: block; font-size: 11px; color: var(--ink-3); font-weight: 700; }
.fact b { font-size: 14px; }
.tips { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.tips li { display: flex; gap: 10px; font-size: 14px; }
.tips li::before { content: "✓"; color: var(--ocean); font-weight: 900; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; border: 0;
  padding: 13px 14px; border-radius: 14px; font-weight: 700; font-size: 14px; background: var(--paper); border: 1px solid var(--line);
}
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); grid-column: 1 / -1; }
.btn svg { width: 18px; height: 18px; }
.mini-map { height: 180px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.nearby { display: grid; gap: 8px; }
.nearby button {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--paper); text-align: left; width: 100%;
}
.nearby .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 19px; flex: none; background: color-mix(in srgb, var(--c) 18%, #fff); }
.nearby b { display: block; font-size: 14px; line-height: 1.4; }
.nearby small { color: var(--ink-3); }
.note { font-size: 11.5px; color: var(--ink-3); margin: 0; }

/* ───────── Courses ───────── */
.section-head { margin: 8px 0 18px; }
.section-head h2 { font-family: var(--font-display); font-size: 26px; margin: 0; }
.section-head p { margin: 4px 0 0; color: var(--ink-2); }
.courses { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.course {
  background: var(--paper); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.course-head { padding: 18px 18px 16px; color: #fff; background: linear-gradient(140deg, var(--c), color-mix(in srgb, var(--c) 50%, #0b3140)); }
.course-head .emoji { font-size: 30px; }
.course-head h3 { margin: 6px 0 0; font-family: var(--font-display); font-size: 20px; }
.course-head small { opacity: .9; font-weight: 600; }
.course > p { margin: 14px 18px 4px; color: var(--ink-2); font-size: 14px; }
.timeline { list-style: none; margin: 8px 18px 14px; padding: 0; position: relative; flex: 1; }
.timeline::before { content: ""; position: absolute; left: 44px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.timeline li { display: grid; grid-template-columns: 38px 14px 1fr; gap: 10px; align-items: start; padding: 6px 0; }
.timeline time { font-family: var(--font-en); font-size: 13px; color: var(--ink-3); text-align: right; padding-top: 1px; }
.timeline .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--c); margin-top: 5px; position: relative; z-index: 1; }
.timeline button { border: 0; background: none; padding: 0; text-align: left; }
.timeline b { display: block; font-size: 14px; line-height: 1.45; }
.timeline button:hover b { color: var(--ocean); text-decoration: underline; }
.timeline small { color: var(--ink-2); font-size: 12.5px; }
.course .btn { margin: 0 18px 18px; }

/* ───────── Tips ───────── */
.tipsgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tipcard { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.tipcard .emoji { font-size: 28px; }
.tipcard h3 { margin: 6px 0 6px; font-size: 16px; font-family: var(--font-display); }
.tipcard p { margin: 0; font-size: 14px; color: var(--ink-2); }

footer { text-align: center; color: var(--ink-3); font-size: 12px; padding: 30px 16px 50px; border-top: 1px solid var(--line); }
footer p { margin: 4px 0; }

/* ───────── Responsive ───────── */
@media (max-width: 900px) {
  .explore { grid-template-columns: minmax(0, 1fr); }
  .map-wrap {
    position: fixed; inset: var(--header-h) 0 0 0; height: auto; min-height: 0; border-radius: 0; border: 0; z-index: 1000;
    visibility: hidden; opacity: 0; transition: opacity .2s;
  }
  body.map-mode .map-wrap { visibility: visible; opacity: 1; }
  body.map-mode { overflow: hidden; }
  body.on-explore .map-fab { display: flex; }
  .map-legend { bottom: 84px; }
  .map-locate { bottom: 84px; }
  .sheet { top: auto; width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; transform: translateY(100%); }
  .sheet-head { border-radius: 22px 22px 0 0; }
  .sheet-head::before { content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: rgba(255, 255, 255, .55); }
  .hero-palms { width: 150px; opacity: .55; }
  .hero-sun { width: 100px; height: 100px; top: 40px; right: 4%; }
}
@media (max-width: 560px) {
  .hero { padding-bottom: 100px; }
  .hero h1 { margin-top: 32px; }
  .filter-label { display: none; }
  .card { grid-template-columns: 52px minmax(0, 1fr); gap: 12px; padding: 12px; }
  .card-icon { width: 52px; height: 52px; font-size: 25px; border-radius: 14px; }
  .courses { grid-template-columns: minmax(0, 1fr); }
  .toolbar { align-items: stretch; }
  .map-legend { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
