:root {
  color-scheme: light;
  --ink: #101417;
  --muted: #68716e;
  --paper: #fbfbf7;
  --mist: #eef3ee;
  --line: #d9ded8;
  --coal: #222626;
  --night: #111616;
  --teal: #0a8f8a;
  --cedar: #2d6a4f;
  --coral: #d85a3a;
  --gold: #bb8d23;
  --water: #2473a6;
  --shadow: 0 14px 34px rgb(16 20 23 / 0.12);
  --nav-height: 74px;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  height: 100%;
  min-height: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgb(10 143 138 / 0.18), transparent 320px),
    linear-gradient(135deg, #f7faf6 0%, #e6efea 46%, #f7efe1 100%);
  font-family:
    "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo",
    system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgb(10 143 138 / 0.35);
  outline-offset: 2px;
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 100vh;
  height: 100vh;
  height: 100dvh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  color: white;
  background: rgb(16 20 23 / 0.92);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgb(255 255 255 / 0.12);
}

.topbar h1,
.section-title h2,
.dialog-head h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.12;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.topbar .eyebrow {
  color: rgb(255 255 255 / 0.66);
}

.icon-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  color: inherit;
  background: rgb(255 255 255 / 0.1);
  border-radius: 8px;
}

.icon-lines,
.icon-close,
.nav-icon,
.search-box > span {
  position: relative;
  display: inline-block;
  width: 22px;
  height: 22px;
}

.icon-lines::before,
.icon-lines::after,
.icon-close::before,
.icon-close::after {
  position: absolute;
  inset-inline: 3px;
  content: "";
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.icon-lines::before {
  top: 7px;
  box-shadow: 0 7px 0 currentColor;
}

.icon-lines::after {
  top: 21px;
  width: 10px;
}

.icon-close::before,
.icon-close::after {
  top: 10px;
}

.icon-close::before {
  rotate: 45deg;
}

.icon-close::after {
  rotate: -45deg;
}

.main {
  width: min(100%, 1120px);
  min-height: 0;
  margin: 0 auto;
  padding: 14px 14px 16px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.install-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto 36px;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 0.96), rgb(238 247 244 / 0.95)),
    white;
  border: 1px solid rgb(10 143 138 / 0.18);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgb(16 20 23 / 0.08);
}

.install-card[hidden] {
  display: none;
}

.install-card img {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 0;
  box-shadow: none;
}

.install-card div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.install-card strong {
  font-size: 14px;
  line-height: 1.24;
  overflow-wrap: anywhere;
}

.install-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
}

.install-button {
  min-width: 58px;
  min-height: 40px;
  padding: 0 12px;
  color: white;
  background: var(--teal);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.install-dismiss {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #4b5854;
  background: rgb(16 20 23 / 0.06);
  border-radius: 8px;
}

.install-dismiss .icon-close {
  width: 18px;
  height: 18px;
}

.summary-band {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 238px;
  margin: 0 0 14px;
  padding: 18px;
  color: white;
  background:
    linear-gradient(180deg, rgb(16 20 23 / 0.18), rgb(16 20 23 / 0.74)),
    linear-gradient(90deg, rgb(16 20 23 / 0.82), rgb(16 20 23 / 0.12) 64%),
    url("./assets/sauna-hero.png") center / cover no-repeat,
    linear-gradient(135deg, #101417, #2a3330 58%, #3d3023);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.summary-band::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(180deg, transparent 68%, rgb(16 20 23 / 0.72)),
    radial-gradient(circle at 88% 18%, rgb(10 143 138 / 0.36), transparent 30%);
  pointer-events: none;
}

.summary-band > * {
  position: relative;
  z-index: 1;
}

.summary-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
  align-self: end;
}

.summary-label {
  color: rgb(255 255 255 / 0.72);
  font-size: 13px;
  font-weight: 800;
}

.summary-copy strong {
  font-size: 44px;
  line-height: 0.98;
}

.summary-copy span:last-child {
  color: rgb(255 255 255 / 0.78);
  font-size: 13px;
  line-height: 1.35;
}

#collectionScope {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  color: rgb(255 255 255 / 0.86);
  background: rgb(255 255 255 / 0.12);
  border: 1px solid rgb(255 255 255 / 0.18);
  border-radius: 8px;
  backdrop-filter: blur(12px);
}

.progress-ring {
  align-self: start;
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  background:
    radial-gradient(circle, #101417 54%, transparent 55%),
    conic-gradient(var(--teal) var(--progress, 0%), rgb(255 255 255 / 0.2) 0);
  border-radius: 50%;
}

.hero-metrics {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  align-self: end;
}

.hero-metrics div {
  display: grid;
  align-content: center;
  min-height: 58px;
  padding: 10px;
  background: rgb(255 255 255 / 0.12);
  border: 1px solid rgb(255 255 255 / 0.16);
  border-radius: 8px;
  backdrop-filter: blur(14px);
}

.hero-metrics strong {
  font-size: 22px;
  line-height: 1;
}

.hero-metrics span {
  margin-top: 4px;
  color: rgb(255 255 255 / 0.72);
  font-size: 11px;
  font-weight: 900;
}

.progress-ring span {
  font-size: 15px;
  font-weight: 900;
}

.view {
  display: none;
  animation: fade-in 180ms ease;
}

.view-active {
  display: block;
}

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

.tool-band {
  position: sticky;
  top: 0;
  z-index: 12;
  display: grid;
  gap: 10px;
  padding: 10px 0 12px;
  background: linear-gradient(180deg, rgb(251 251 247 / 0.96), rgb(251 251 247 / 0.88));
  backdrop-filter: blur(16px);
}

.search-box {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 6px 0 14px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.search-box > span::before {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  content: "";
  border: 2px solid var(--muted);
  border-radius: 50%;
}

.search-box > span::after {
  position: absolute;
  top: 16px;
  left: 15px;
  width: 8px;
  height: 2px;
  content: "";
  background: var(--muted);
  border-radius: 2px;
  rotate: 45deg;
}

.search-box input {
  min-width: 0;
  height: 44px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.search-clear-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #52605b;
  background: #eef3ee;
  border-radius: 8px;
}

.search-clear-button[hidden] {
  display: none;
}

.search-clear-button .icon-close {
  width: 16px;
  height: 16px;
}

.segment {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  background: #dde6df;
  border-radius: 8px;
}

.segment button {
  min-width: 0;
  height: 38px;
  color: #52605b;
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.segment .segment-active {
  color: var(--ink);
  background: white;
  box-shadow: 0 4px 12px rgb(16 20 23 / 0.08);
}

.pref-strip {
  display: flex;
  gap: 8px;
  margin: 0 -14px 10px;
  padding: 0 14px 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.pref-strip::-webkit-scrollbar {
  display: none;
}

.pref-chip {
  flex: 0 0 auto;
  min-width: 62px;
  min-height: 40px;
  padding: 0 12px;
  color: #39423f;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.pref-chip-active {
  color: white;
  background: var(--teal);
  border-color: var(--teal);
}

.source-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.source-row::-webkit-scrollbar {
  display: none;
}

.source-row a {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  color: #28403b;
  background: rgb(10 143 138 / 0.1);
  border: 1px solid rgb(10 143 138 / 0.2);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.feature-filter-panel {
  margin: 0 0 12px;
  background: rgb(255 255 255 / 0.78);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.feature-filter-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  color: #33413d;
  font-size: 13px;
  font-weight: 900;
  list-style: none;
  cursor: pointer;
}

.feature-filter-panel summary::-webkit-details-marker {
  display: none;
}

.feature-filter-panel summary strong {
  color: var(--teal);
  font-size: 12px;
  white-space: nowrap;
}

.feature-filter-grid,
.feature-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.feature-group {
  display: contents;
}

.feature-filter-grid {
  padding: 0 12px 12px;
}

.feature-chip,
.feature-option {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  min-width: 0;
  padding: 0 10px;
  color: #2f403c;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
  white-space: nowrap;
}

.feature-chip {
  cursor: pointer;
}

.feature-chip.is-active,
.feature-option:has(input:checked) {
  color: white;
  background: var(--teal);
  border-color: var(--teal);
  box-shadow: 0 8px 18px rgb(10 143 138 / 0.18);
}

.feature-option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.feature-option span {
  pointer-events: none;
}

.spotlight {
  margin-bottom: 12px;
}

.spotlight:empty {
  display: none;
}

.spotlight-card {
  display: grid;
  grid-template-columns: 1fr 78px;
  gap: 12px;
  padding: 14px;
  color: white;
  background:
    linear-gradient(135deg, rgb(16 20 23 / 0.94), rgb(30 58 54 / 0.95)),
    linear-gradient(135deg, var(--night), var(--cedar));
  border: 1px solid rgb(255 255 255 / 0.12);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.spotlight-card .stamp-art {
  width: 78px;
}

.spotlight-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  color: #ffe1b7;
  background: rgb(216 90 58 / 0.24);
  border: 1px solid rgb(216 90 58 / 0.28);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 900;
}

.spotlight-card h3 {
  margin: 8px 0 4px;
  font-size: 18px;
  line-height: 1.25;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.spotlight-card p {
  margin: 0;
  color: rgb(255 255 255 / 0.68);
  font-size: 12px;
  line-height: 1.45;
}

.spotlight-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.facility-list {
  display: grid;
  gap: 10px;
}

.load-more-button {
  grid-column: 1 / -1;
  min-height: 48px;
  color: white;
  background: linear-gradient(135deg, var(--night), var(--teal));
  border-radius: 8px;
  font-weight: 900;
  box-shadow: 0 10px 22px rgb(10 143 138 / 0.18);
}

.facility-card {
  position: relative;
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 12px;
  padding: 12px;
  background:
    linear-gradient(90deg, rgb(10 143 138 / 0.045), transparent 56%),
    white;
  border: 1px solid rgb(16 20 23 / 0.08);
  border-radius: 8px;
  box-shadow: 0 6px 16px rgb(16 20 23 / 0.06);
}

.facility-card::before {
  position: absolute;
  inset: 10px auto 10px 0;
  width: 3px;
  content: "";
  background: var(--teal);
  border-radius: 0 3px 3px 0;
  opacity: 0.72;
}

.stamp-art {
  --stamp-color: var(--coral);
  --stamp-bg: #fff6ef;
  position: relative;
  display: grid;
  place-items: center;
  align-self: start;
  width: 82px;
  aspect-ratio: 1;
  color: var(--stamp-color);
  background:
    radial-gradient(circle at center, transparent 56%, var(--stamp-color) 58%, var(--stamp-color) 61%, transparent 63%),
    linear-gradient(145deg, var(--stamp-bg), white);
  border: 3px solid var(--stamp-color);
  border-radius: 50%;
  rotate: -5deg;
  overflow: hidden;
}

.stamp-art::before {
  position: absolute;
  inset: 9px;
  content: "";
  border: 2px dashed currentColor;
  border-radius: 50%;
  opacity: 0.6;
}

.stamp-art::after {
  position: absolute;
  inset: 16px;
  content: "";
  background:
    linear-gradient(currentColor, currentColor) center / 34px 3px no-repeat,
    radial-gradient(circle at 50% 35%, currentColor 0 10px, transparent 11px);
  opacity: 0.12;
}

.stamp-kanji {
  position: relative;
  z-index: 1;
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
}

.stamp-art.locked {
  color: #96a19d;
  background: #f1f3f1;
  border-color: #bdc6c2;
  filter: grayscale(0.8);
}

.card-body {
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.facility-name {
  flex: 1 1 160px;
  margin: 0;
  min-width: 0;
  font-size: 16px;
  line-height: 1.28;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.visited-badge,
.source-badge,
.status-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  color: white;
  background: var(--coal);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.source-badge {
  color: #2a3531;
  background: var(--mist);
  text-decoration: none;
}

.status-badge {
  color: #fff7df;
  background: #7d4b22;
}

.facility-meta {
  margin: 5px 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  color: #41504b;
  background: #eef3ee;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.card-actions-visited {
  grid-template-columns: 1.15fr 0.85fr;
}

.primary-button,
.secondary-button,
.undo-button,
.facility-share-button,
.ghost-button,
.danger-button,
.import-box {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 900;
  text-align: center;
}

.primary-button {
  color: white;
  background: var(--teal);
  box-shadow: 0 8px 18px rgb(10 143 138 / 0.22);
}

.primary-button:disabled {
  color: #4c5955;
  background: #d7e0dc;
  box-shadow: none;
  cursor: default;
}

.secondary-button {
  color: var(--ink);
  background: #f2eee6;
  border: 1px solid #e4d8c7;
}

.secondary-button.is-active {
  color: white;
  background: var(--coral);
  border-color: var(--coral);
}

.complete-button:disabled {
  color: #f7faf6;
  background: #46524e;
}

.undo-button {
  color: #87322a;
  background: #fff5ef;
  border: 1px solid #f0c7b8;
}

.share-button {
  min-height: 40px;
  padding: 0 12px;
  color: white;
  background: #101417;
  border-radius: 8px;
  font-weight: 900;
}

.facility-share-button {
  width: 100%;
  margin-top: 8px;
  color: white;
  background: #101417;
  border: 1px solid rgb(255 255 255 / 0.06);
  box-shadow: 0 8px 16px rgb(16 20 23 / 0.12);
}

.spotlight-actions .facility-share-button {
  grid-column: 1 / -1;
  margin-top: 0;
}

.memo-panel {
  margin-top: 10px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  border-top: 1px solid var(--line);
}

.memo-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  color: #34413d;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.memo-panel summary::-webkit-details-marker {
  display: none;
}

.memo-panel summary strong {
  color: var(--teal);
  font-size: 11px;
}

.memo-body {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  padding-bottom: 2px;
}

.memo-panel:not([open]) > .memo-body {
  display: none;
}

.memo-body > * {
  min-width: 0;
}

.memo-text {
  margin: 0;
  padding: 9px 10px;
  color: #2f3a36;
  background: #f5f7f3;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.memo-date {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.memo-panel textarea {
  width: 100%;
  min-height: 78px;
  padding: 10px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
}

.memo-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.memo-actions button {
  min-width: 0;
  padding-inline: 8px;
}

.ghost-button {
  color: #24413d;
  background: white;
  border: 1px solid var(--line);
}

.full-button {
  width: 100%;
  margin-bottom: 12px;
}

.danger-button {
  width: 100%;
  color: white;
  background: #9d302a;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 14px;
}

.passport-scope-strip {
  display: flex;
  gap: 8px;
  margin: 0 -14px 12px;
  padding: 0 14px 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.passport-scope-strip::-webkit-scrollbar {
  display: none;
}

.pref-chip-mastered {
  border-color: rgb(187 141 35 / 0.45);
  box-shadow: inset 0 -3px 0 rgb(187 141 35 / 0.28);
}

.title-progress-panel {
  margin-bottom: 12px;
}

.title-card {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  color: white;
  background:
    linear-gradient(135deg, rgb(16 20 23 / 0.93), rgb(36 64 59 / 0.94)),
    var(--night);
  border: 1px solid rgb(255 255 255 / 0.12);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.title-card img {
  display: block;
  width: 116px;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  object-position: center;
  border-radius: 8px;
  background: #fff8e9;
}

.title-card-body {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.title-kicker {
  color: rgb(255 255 255 / 0.66);
  font-size: 11px;
  font-weight: 900;
}

.title-card strong {
  font-size: 18px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.title-card p,
.title-card em {
  margin: 0;
  color: rgb(255 255 255 / 0.72);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.35;
}

.title-progress {
  height: 8px;
  margin: 2px 0;
  background: rgb(255 255 255 / 0.16);
  border-radius: 999px;
  overflow: hidden;
}

.title-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  border-radius: inherit;
}

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

.stamp-tile {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 174px;
  padding: 14px 10px;
  background: white;
  border: 1px solid rgb(16 20 23 / 0.08);
  border-radius: 8px;
}

.stamp-tile .stamp-art {
  width: 96px;
}

.stamp-title {
  width: 100%;
  margin: 0;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.32;
  text-align: center;
  overflow-wrap: anywhere;
}

.stamp-date {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  text-align: center;
}

.stamp-note {
  width: 100%;
  margin: 0;
  padding: 8px;
  color: #34413d;
  background: #f5f7f3;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.4;
  text-align: left;
  overflow-wrap: anywhere;
}

.tiny-undo-button {
  min-height: 32px;
  padding: 0 10px;
  color: #87322a;
  background: #fff5ef;
  border: 1px solid #f0c7b8;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 900;
}

.tiny-share-button {
  min-height: 32px;
  padding: 0 10px;
  color: white;
  background: #101417;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 900;
}

.empty-add-button {
  margin-top: 12px;
}

.empty-state {
  display: grid;
  grid-column: 1 / -1;
  place-items: center;
  min-height: 240px;
  padding: 32px 18px;
  color: var(--muted);
  background: rgb(255 255 255 / 0.72);
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.stat-box {
  min-height: 104px;
  padding: 14px;
  color: white;
  background: var(--coal);
  border-radius: 8px;
}

.stat-box:nth-child(2) {
  background: var(--cedar);
}

.stat-box:nth-child(3) {
  background: var(--water);
}

.stat-box:nth-child(4) {
  background: var(--coral);
}

.stat-box span {
  display: block;
  margin-bottom: 8px;
  color: rgb(255 255 255 / 0.72);
  font-size: 12px;
  font-weight: 800;
}

.stat-box strong {
  display: block;
  font-size: 30px;
  line-height: 1;
  overflow-wrap: anywhere;
}

.pref-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.pref-progress {
  display: grid;
  align-content: center;
  gap: 4px;
  min-height: 66px;
  padding: 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.pref-progress-master {
  color: white;
  background: linear-gradient(135deg, var(--night), var(--gold));
  border-color: rgb(187 141 35 / 0.4);
}

.pref-progress-master span {
  color: rgb(255 255 255 / 0.76);
}

.pref-progress strong {
  font-size: 13px;
}

.pref-progress span {
  color: var(--muted);
  font-size: 11px;
}

.import-box {
  display: grid;
  place-items: center;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  cursor: pointer;
}

.import-box input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.add-form {
  display: grid;
  gap: 12px;
  padding-bottom: 10px;
}

.add-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.feature-picker {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 12px;
  color: var(--muted);
  background: rgb(255 255 255 / 0.68);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.feature-picker legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.form-hint {
  margin: -2px 0 0;
  color: #52605b;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.add-form input,
.add-form select,
.add-form textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.add-form .feature-option input {
  min-height: 100%;
  padding: 0;
  border: 0;
}

.add-form textarea {
  min-height: 104px;
  resize: vertical;
}

.bottom-nav {
  position: relative;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: rgb(16 20 23 / 0.94);
  backdrop-filter: blur(18px);
  border-top: 1px solid rgb(255 255 255 / 0.1);
}

.bottom-nav button {
  display: grid;
  place-items: center;
  gap: 3px;
  min-width: 0;
  color: rgb(255 255 255 / 0.62);
  background: transparent;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 900;
}

.bottom-nav .nav-active {
  color: white;
  background: rgb(255 255 255 / 0.11);
}

.nav-search::before {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 11px;
  height: 11px;
  content: "";
  border: 2px solid currentColor;
  border-radius: 50%;
}

.nav-search::after {
  position: absolute;
  top: 15px;
  left: 15px;
  width: 7px;
  height: 2px;
  content: "";
  background: currentColor;
  rotate: 45deg;
}

.nav-stamp {
  border: 2px solid currentColor;
  border-radius: 50%;
}

.nav-stamp::before {
  position: absolute;
  inset: 5px;
  content: "";
  border: 1px dashed currentColor;
  border-radius: 50%;
}

.nav-chart::before,
.nav-chart::after {
  position: absolute;
  bottom: 3px;
  content: "";
  width: 4px;
  background: currentColor;
  border-radius: 2px;
}

.nav-chart::before {
  left: 4px;
  height: 10px;
  box-shadow: 7px -5px 0 currentColor, 14px -1px 0 currentColor;
}

.nav-plus::before,
.nav-plus::after {
  position: absolute;
  inset: 10px 3px auto;
  content: "";
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.nav-plus::after {
  rotate: 90deg;
}

.settings-dialog {
  width: min(calc(100% - 28px), 420px);
  padding: 16px;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.settings-dialog::backdrop {
  background: rgb(16 20 23 / 0.58);
  backdrop-filter: blur(3px);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.dialog-head .icon-button {
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 54px;
  margin-bottom: 12px;
  padding: 0 12px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.toggle-row input {
  width: 24px;
  height: 24px;
  accent-color: var(--teal);
}

.install-steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0 0 0 22px;
  color: #34413d;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.5;
}

.achievement-dialog {
  width: min(calc(100% - 28px), 440px);
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
}

.achievement-dialog::backdrop {
  background:
    radial-gradient(circle at 50% 30%, rgb(187 141 35 / 0.3), transparent 32%),
    rgb(16 20 23 / 0.68);
  backdrop-filter: blur(4px);
}

.achievement-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 14px;
  text-align: center;
  background:
    linear-gradient(180deg, #fffaf0, #f4fbf6),
    white;
  border: 1px solid rgb(16 20 23 / 0.08);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgb(16 20 23 / 0.28);
  animation: achievement-pop 320ms cubic-bezier(0.2, 0.9, 0.2, 1.15);
  overflow: hidden;
}

.achievement-card::before,
.achievement-card::after {
  position: absolute;
  top: 18px;
  content: "〰";
  color: rgb(10 143 138 / 0.35);
  font-size: 30px;
  font-weight: 900;
  animation: steam-rise 1500ms ease-in-out infinite;
}

.achievement-card::before {
  left: 22px;
}

.achievement-card::after {
  right: 26px;
  animation-delay: 240ms;
}

.achievement-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #44514d;
  background: rgb(16 20 23 / 0.06);
  border-radius: 8px;
}

.achievement-close .icon-close {
  width: 16px;
  height: 16px;
}

.achievement-card img {
  justify-self: center;
  width: min(100%, 330px);
  aspect-ratio: 3 / 2;
  object-fit: cover;
  object-position: center;
  border-radius: 8px;
  background: #fff8e9;
}

.achievement-card h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.achievement-card p {
  margin: 0;
  color: #52605b;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.achievement-card .primary-button {
  width: 100%;
  margin-top: 4px;
}

@keyframes achievement-pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.94);
  }
}

@keyframes steam-rise {
  50% {
    transform: translateY(-7px);
    opacity: 0.58;
  }
}

.toast {
  position: fixed;
  z-index: 40;
  right: 14px;
  bottom: calc(var(--nav-height) + 12px + env(safe-area-inset-bottom));
  left: 14px;
  min-height: 46px;
  padding: 13px 14px;
  color: white;
  background: rgb(16 20 23 / 0.96);
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (min-width: 720px) {
  .main {
    padding: 18px 24px 0;
  }

  .topbar {
    padding-inline: 24px;
  }

  .tool-band {
    grid-template-columns: 1fr minmax(320px, 420px);
    align-items: center;
  }

  .facility-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .facility-card {
    min-height: 186px;
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 420px) {
  .main {
    padding: 12px 12px 14px;
  }

  .install-card {
    grid-template-columns: 52px minmax(0, 1fr) auto 34px;
    gap: 8px;
    padding: 9px;
  }

  .install-card img {
    width: 52px;
    height: 52px;
  }

  .install-card strong {
    font-size: 13px;
  }

  .install-card span {
    font-size: 11px;
  }

  .install-button {
    min-width: 52px;
    min-height: 38px;
    padding-inline: 10px;
  }

  .install-dismiss {
    width: 34px;
    height: 34px;
  }

  .summary-band {
    min-height: 206px;
    margin-bottom: 12px;
    padding: 14px;
  }

  .summary-copy strong {
    font-size: 38px;
  }

  .summary-copy span:last-child {
    font-size: 12px;
  }

  .progress-ring {
    width: 68px;
    height: 68px;
  }

  .hero-metrics {
    gap: 6px;
  }

  .hero-metrics div {
    min-height: 50px;
    padding: 8px;
  }

  .tool-band {
    gap: 8px;
    padding: 8px 0 10px;
  }

  .pref-strip {
    margin-bottom: 8px;
  }

  .source-row {
    margin-bottom: 10px;
  }

  .passport-scope-strip {
    margin-inline: -12px;
    padding-inline: 12px;
  }

  .title-card {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .title-card img {
    width: 92px;
  }

  .title-card strong {
    font-size: 16px;
  }

  .title-card p,
  .title-card em {
    font-size: 11px;
  }

  .feature-filter-grid,
  .feature-picker-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .feature-chip,
  .feature-option {
    min-height: 38px;
    padding-inline: 8px;
    font-size: 11px;
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: normal;
    text-align: center;
  }

  .facility-card {
    grid-template-columns: 74px 1fr;
    gap: 10px;
    padding: 10px;
  }

  .facility-card .stamp-art {
    width: 74px;
  }

  .facility-name {
    font-size: 15px;
  }

  .primary-button,
  .secondary-button,
  .undo-button,
  .facility-share-button,
  .ghost-button,
  .danger-button,
  .import-box {
    min-height: 42px;
    padding-inline: 10px;
  }

  .achievement-card {
    padding: 12px;
  }

  .achievement-card img {
    width: min(100%, 300px);
  }

  .achievement-card h2 {
    font-size: 20px;
  }
}

@media (max-width: 899px) {
  .add-form {
    padding-bottom: calc(var(--nav-height) + 28px + env(safe-area-inset-bottom));
  }
}

@media (min-width: 900px) {
  :root {
    --nav-height: 74px;
    --rail-width: 88px;
  }

  .app-shell {
    grid-template-columns: var(--rail-width) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .topbar {
    grid-column: 1 / -1;
    padding-left: 24px;
  }

  .main {
    grid-column: 2;
    grid-row: 2;
    padding-bottom: 32px;
  }

  .bottom-nav {
    grid-column: 1;
    grid-row: 2;
    align-self: start;
    justify-self: center;
    grid-template-columns: 1fr;
    width: 62px;
    height: auto;
    min-height: 330px;
    margin-top: 18px;
    padding: 8px;
    translate: none;
    border: 1px solid rgb(255 255 255 / 0.12);
    border-radius: 8px;
  }

  .bottom-nav button {
    min-height: 74px;
  }

  .toast {
    right: auto;
    bottom: 18px;
    left: calc(var(--rail-width) + 18px);
    width: min(420px, calc(100% - var(--rail-width) - 36px));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
