:root {
  --bg: #eef3f2;
  --surface: #ffffff;
  --surface-muted: #f7faf9;
  --ink: #17201d;
  --muted: #5b6863;
  --line: #d6dfdc;
  --accent: #0f6b52;
  --accent-strong: #094a39;
  --accent-blue: #255a9b;
  --warning: #9a5a10;
  --shadow: 0 14px 36px rgba(17, 31, 27, 0.16);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  letter-spacing: 0;
}

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

button {
  letter-spacing: 0;
}

a {
  color: var(--accent-blue);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.15rem;
  font-size: 1.35rem;
  line-height: 1.2;
}

h2 {
  margin-bottom: 0;
  font-size: 0.95rem;
  line-height: 1.35;
}

h3 {
  margin-bottom: 0.35rem;
  font-size: 1rem;
  line-height: 1.35;
}

p {
  line-height: 1.7;
}

noscript {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 1400;
  padding: 0.8rem 1rem;
  border: 1px solid #e7c781;
  border-radius: var(--radius);
  background: #fff8e6;
  color: #593b08;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.brand {
  min-width: 0;
  flex: 0 0 auto;
}

.topbar-search {
  width: min(360px, 28vw);
  min-width: 220px;
}

.topbar-search input {
  width: 100%;
  min-height: 2.55rem;
  padding: 0.62rem 0.75rem;
  border: 1px solid #cdd8d4;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  outline: none;
}

.topbar-search input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37, 90, 155, 0.14);
}

.eyebrow {
  margin-bottom: 0.15rem;
  color: var(--accent);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0;
}

#siteDescription {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.topbar__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-left: auto;
}

.button,
.danger-button,
.mode-button,
.photo-delete-button,
.text-button,
.icon-button,
.color-swatch,
.tag-filter,
.pin-card {
  appearance: none;
  border: 0;
  cursor: pointer;
}

.button {
  min-height: 2.55rem;
  padding: 0.58rem 0.85rem;
  border-radius: var(--radius);
  color: #fff;
  background: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}

.button:hover,
.button:focus-visible {
  background: var(--accent-strong);
}

.button--secondary {
  color: var(--ink);
  background: #e6eeeb;
}

.button--secondary:hover,
.button--secondary:focus-visible {
  color: #fff;
  background: var(--accent-blue);
}

.button--danger {
  color: #fff;
  background: #a33a2b;
}

.button--danger:hover,
.button--danger:focus-visible {
  background: #7f2d24;
}

.button--full {
  width: 100%;
}

.button.is-active,
.button[aria-pressed="true"] {
  background: var(--warning);
}

.button:disabled {
  cursor: not-allowed;
  color: #eef3f2;
  background: #9aa7a2;
}

.mode-switch {
  min-height: 2.55rem;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid #cdd8d4;
  border-radius: var(--radius);
  background: #edf3f1;
}

.mode-button {
  min-width: 5.5rem;
  min-height: 2.45rem;
  padding: 0.5rem 0.75rem;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
  white-space: nowrap;
}

.mode-button + .mode-button {
  border-left: 1px solid #cdd8d4;
}

.mode-button:hover,
.mode-button:focus-visible {
  color: var(--accent-strong);
  background: #fff;
}

.mode-button.is-active,
.mode-button[aria-pressed="true"] {
  color: #fff;
  background: var(--accent);
}

.danger-button {
  width: 100%;
  min-height: 2.45rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  color: #fff;
  background: #a33a2b;
  font-weight: 800;
}

.danger-button:hover,
.danger-button:focus-visible {
  background: #80271c;
}

.role-badge {
  min-height: 2.55rem;
  display: none !important;
  align-items: center;
  justify-content: center;
  padding: 0.42rem 0.7rem;
  border: 1px solid #cdd8d4;
  border-radius: var(--radius);
  color: var(--accent-strong);
  background: #f4faf7;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

.storage-badge {
  min-height: 2.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.42rem 0.7rem;
  border: 1px solid #cdd8d4;
  border-radius: var(--radius);
  color: #173e68;
  background: #f2f7fd;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

.storage-badge.is-warning {
  border-color: #e7c781;
  color: #593b08;
  background: #fff8e6;
}

.text-button {
  padding: 0.25rem 0.35rem;
  color: var(--accent-blue);
  background: transparent;
  font-size: 0.82rem;
  font-weight: 700;
}

.text-button:hover,
.text-button:focus-visible {
  text-decoration: underline;
}

.icon-button {
  width: 2.35rem;
  height: 2.35rem;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: #fff;
  background: rgba(23, 32, 29, 0.82);
  font-size: 1.35rem;
  line-height: 1;
}

.icon-button:hover,
.icon-button:focus-visible {
  background: #000;
}

.layout {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.home-view,
.auth-view,
.dashboard-view,
.public-view {
  position: absolute;
  inset: 0;
  z-index: 850;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(238, 243, 242, 0.94);
}

.home-view {
  place-items: center start;
  padding: clamp(1.1rem, 4vw, 4rem);
  background: rgba(238, 243, 242, 0.78);
}

.home-content {
  width: min(680px, 100%);
}

.home-kicker {
  margin-bottom: 0.55rem;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
}

.home-content h2 {
  max-width: 12em;
  margin-bottom: 0.85rem;
  font-size: clamp(2.1rem, 5vw, 4.3rem);
  line-height: 1.08;
}

.home-content > p {
  max-width: 46rem;
  margin-bottom: 1rem;
  color: #2f3d39;
  font-size: 1.05rem;
}

.home-login-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
  width: min(560px, 100%);
  margin-bottom: 0.55rem;
}

.home-login-form input {
  width: 100%;
  min-height: 2.7rem;
  padding: 0.62rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 1rem 0;
}

.home-feature-list {
  display: grid;
  gap: 0.35rem;
  max-width: 52rem;
  margin: 1rem 0 0;
  padding-left: 1.1rem;
  color: #354541;
}

.home-feature-list li {
  line-height: 1.55;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  max-width: 56rem;
  margin-top: 1rem;
}

.pricing-card,
.pricing-plan {
  display: grid;
  gap: 0.35rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.pricing-card h3,
.pricing-plan h4 {
  margin: 0;
}

.pricing-card p,
.pricing-plan p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.pricing-card__price,
.pricing-plan__price {
  color: var(--ink) !important;
  font-size: 1.05rem !important;
  font-weight: 900;
}

.home-view[hidden],
.auth-view[hidden],
.dashboard-view[hidden],
.public-view[hidden] {
  display: none;
}

.auth-panel,
.dashboard-panel {
  width: min(720px, 100%);
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.auth-panel {
  width: min(430px, 100%);
}

.auth-panel p,
.dashboard-panel p {
  color: var(--muted);
}

.dashboard-panel__header,
.dashboard-map-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.dashboard-panel__header {
  margin-bottom: 1rem;
}

.public-map-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.public-map-tools input {
  width: 100%;
  min-height: 2.55rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.dashboard-panel__header p {
  margin-bottom: 0;
  font-size: 0.86rem;
}

.dashboard-map-list {
  display: grid;
  gap: 0.65rem;
}

.billing-panel {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.billing-panel h3 {
  margin-bottom: 0.15rem;
}

.billing-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.billing-panel__limits {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.billing-panel__limits span {
  padding: 0.28rem 0.5rem;
  border: 1px solid #cdd8d4;
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.pricing-plan-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.pricing-plan.is-active {
  border-color: #b8ddce;
  background: #eff9f4;
}

.dashboard-map-item {
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.dashboard-map-item h3,
.dashboard-map-item p {
  margin-bottom: 0;
}

.dashboard-map-item__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.dashboard-map-item__actions a,
.dashboard-map-item__actions button {
  text-decoration: none;
}

.sidebar {
  position: absolute;
  left: 1rem;
  top: 1rem;
  z-index: 700;
  width: min(360px, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  overflow: auto;
  padding: 0;
  border: 0;
  background: transparent;
  overscroll-behavior: contain;
  pointer-events: auto;
}

body.is-home-screen .sidebar,
body.is-home-screen .detail-drawer,
body.is-home-screen .leaflet-control-container {
  display: none;
}

body.is-home-screen .topbar-search,
body.is-auth-screen .topbar-search {
  display: none;
}

.panel,
.list-panel {
  margin-bottom: 0.9rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.search-panel {
  padding: 0.58rem;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 26px rgba(17, 31, 27, 0.14);
  backdrop-filter: blur(10px);
}

.panel__header,
.list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.panel__status {
  color: var(--muted);
  font-size: 0.76rem;
}

.edit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.field-label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

input[type="search"],
input[type="text"],
input[type="email"],
input[type="date"],
input[type="file"],
select,
textarea {
  width: 100%;
  border: 1px solid #cdd8d4;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  outline: none;
}

input[type="search"] {
  min-height: 2.55rem;
  padding: 0.62rem 0.75rem;
}

input[type="text"],
input[type="email"],
input[type="date"] {
  min-height: 2.45rem;
  padding: 0.55rem 0.68rem;
}

select {
  min-height: 2.45rem;
  padding: 0.55rem 0.68rem;
}

input[type="file"] {
  min-height: 2.55rem;
  padding: 0.5rem;
  color: var(--muted);
  font-size: 0.84rem;
}

input[type="search"]:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="date"]:focus,
input[type="file"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37, 90, 155, 0.14);
}

textarea {
  min-height: 11rem;
  padding: 0.75rem;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 0.82rem;
  line-height: 1.55;
}

.pin-edit-fields {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.map-edit-fields {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.2rem;
}

.color-swatch {
  width: 2.15rem;
  height: 2.15rem;
  display: inline-grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--swatch-color);
  box-shadow:
    0 0 0 1px rgba(23, 32, 29, 0.22),
    0 5px 12px rgba(17, 31, 27, 0.16);
}

.color-swatch:hover,
.color-swatch:focus-visible {
  box-shadow:
    0 0 0 3px rgba(37, 90, 155, 0.2),
    0 5px 12px rgba(17, 31, 27, 0.16);
}

.color-swatch.is-active::after {
  content: "";
  width: 0.52rem;
  height: 0.52rem;
  border: 2px solid #fff;
  border-radius: 999px;
  background: rgba(23, 32, 29, 0.46);
}

#pinDescriptionInput {
  min-height: 5.2rem;
  font-family: inherit;
  font-size: 0.86rem;
}

#mapDescriptionInput {
  min-height: 4.2rem;
  font-family: inherit;
  font-size: 0.86rem;
}

.tag-filter-block {
  margin-top: 0.85rem;
}

.upload-box {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.editor-photos {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.editor-photo-list {
  display: grid;
  gap: 0.48rem;
}

.editor-photo-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 0.55rem;
  align-items: center;
}

.editor-photo-item__body {
  min-width: 0;
  display: grid;
  gap: 0.12rem;
}

.editor-photo-item__title,
.editor-photo-item__path {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-photo-item__title {
  color: var(--ink);
  font-size: 0.83rem;
  font-weight: 800;
}

.editor-photo-item__path {
  color: var(--muted);
  font-size: 0.74rem;
}

.upload-status {
  min-height: 1.2rem;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.upload-status.is-error {
  color: #9a2d20;
}

.upload-status.is-success {
  color: var(--accent);
}

.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
}

.tag-filter {
  min-height: 2rem;
  padding: 0.34rem 0.62rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

.tag-filter:hover,
.tag-filter:focus-visible,
.tag-filter.is-active {
  border-color: rgba(15, 107, 82, 0.55);
  color: #fff;
  background: var(--accent);
}

.badge {
  min-width: 2rem;
  display: inline-flex;
  justify-content: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  color: #fff;
  background: var(--accent-blue);
  font-size: 0.8rem;
  font-weight: 800;
}

.pin-list {
  display: grid;
  gap: 0.55rem;
}

.pin-card {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 0.68rem;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.pin-card:hover,
.pin-card:focus-visible,
.pin-card.is-active {
  border-color: rgba(15, 107, 82, 0.56);
  background: #eef7f4;
}

.pin-card__content {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 0.12rem;
}

.pin-card__title,
.pin-card__meta,
.pin-card__desc {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pin-card__title {
  color: var(--ink);
  font-size: 0.93rem;
  font-weight: 800;
  line-height: 1.35;
}

.pin-card__meta,
.pin-card__desc {
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.45;
}

.pin-card__desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.map-shell {
  position: absolute;
  inset: 0;
  min-width: 0;
  min-height: 0;
}

#map {
  width: 100%;
  height: 100%;
  background: #d9e2de;
}

#map.is-add-mode {
  cursor: crosshair;
}

.photo-marker {
  position: relative;
  background: transparent;
  border: 0;
}

.map-pin {
  position: relative;
  z-index: 1;
  width: 32px;
  height: 44px;
  display: block;
  filter: drop-shadow(0 7px 12px rgba(9, 24, 20, 0.28));
  transform-origin: 50% 95%;
  transition:
    filter 160ms ease,
    transform 160ms ease;
}

.map-pin__svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.map-pin__shape {
  fill: var(--pin-color, #0f6b52);
  stroke: #fff;
  stroke-width: 2.4;
  stroke-linejoin: round;
  transition:
    stroke 160ms ease,
    stroke-width 160ms ease;
}

.map-pin__dot {
  fill: #fff;
}

.photo-marker.is-active .map-pin {
  transform: translateY(-2px) scale(1.1);
  filter: drop-shadow(0 10px 16px rgba(9, 24, 20, 0.34));
}

.photo-marker.is-edit-selected,
.photo-marker--draft {
  z-index: 1100 !important;
}

.photo-marker.is-edit-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
}

.photo-marker.is-edit-selected::after,
.photo-marker--draft::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 18px;
  z-index: 0;
  width: 46px;
  height: 46px;
  border: 3px solid rgba(255, 228, 92, 0.95);
  border-radius: 999px;
  background: rgba(255, 248, 189, 0.22);
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.82),
    0 8px 18px rgba(9, 24, 20, 0.24);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.photo-marker.is-edit-selected .map-pin,
.photo-marker--draft .map-pin {
  transform: translateY(-4px) scale(1.24);
  filter: drop-shadow(0 12px 18px rgba(9, 24, 20, 0.38));
}

.photo-marker.is-edit-selected .map-pin__shape,
.photo-marker--draft .map-pin__shape {
  stroke: #ffe45c;
  stroke-width: 4;
}

.leaflet-popup-content {
  margin: 0 !important;
}

.photo-tooltip,
.photo-popup .leaflet-popup-content-wrapper {
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.photo-tooltip {
  padding: 0;
  background: transparent;
}

.photo-tooltip::before {
  display: none;
}

.pin-info {
  overflow: hidden;
  border-radius: var(--radius);
  background: #fff;
}

.pin-info--tooltip {
  width: 250px;
}

.pin-info--popup {
  width: min(310px, calc(100vw - 72px));
}

.pin-info--drawer {
  width: 100%;
}

.pin-info__body {
  padding: 0.78rem;
}

.pin-info__body p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.48rem;
}

.tag,
.date-pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.38rem;
  border-radius: 999px;
  padding: 0.12rem 0.48rem;
  font-size: 0.72rem;
  font-weight: 800;
}

.tag {
  color: #184c3d;
  background: #e3f2ed;
}

.date-pill {
  color: #173e68;
  background: #e6f0fb;
}

.photo-frame {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid #d3ddd9;
  border-radius: var(--radius);
  background: #e7ecea;
  color: var(--muted);
}

.photo-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.photo-frame__message {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0.6rem;
  background: repeating-linear-gradient(
    135deg,
    #eef2f1,
    #eef2f1 8px,
    #e3e9e7 8px,
    #e3e9e7 16px
  );
  color: #5f6d68;
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.photo-frame.is-empty .photo-frame__message,
.photo-frame.is-broken .photo-frame__message {
  display: flex;
}

.photo-frame--thumb {
  width: 74px;
  height: 74px;
}

.photo-frame--tooltip {
  height: 150px;
}

.photo-frame--tooltip-primary {
  height: 132px;
}

.photo-frame--tooltip-thumb {
  height: 58px;
}

.photo-frame--popup {
  height: 190px;
}

.photo-frame--popup-primary {
  height: 178px;
}

.photo-frame--popup-thumb {
  height: 74px;
}

.photo-frame--drawer {
  height: 235px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.photo-frame--drawer-primary {
  height: 235px;
}

.photo-frame--drawer-thumb {
  height: 92px;
}

.photo-frame--editor {
  height: 56px;
}

.photo-gallery {
  display: grid;
  gap: 0.38rem;
  padding: 0.38rem;
}

.photo-gallery__thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  gap: 0.38rem;
}

.photo-gallery__item {
  position: relative;
  min-width: 0;
}

.photo-gallery__count {
  position: absolute;
  right: 0.35rem;
  bottom: 0.35rem;
  z-index: 2;
  min-width: 2rem;
  padding: 0.14rem 0.4rem;
  border-radius: 999px;
  color: #fff;
  background: rgba(23, 32, 29, 0.78);
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
}

.photo-delete-button {
  position: absolute;
  left: 0.35rem;
  bottom: 0.35rem;
  z-index: 3;
  min-height: 1.85rem;
  padding: 0.22rem 0.5rem;
  border-radius: var(--radius);
  color: #fff;
  background: #a33a2b;
  font-size: 0.72rem;
  font-weight: 900;
}

.photo-delete-button:hover,
.photo-delete-button:focus-visible {
  background: #80271c;
}

.image-action {
  width: 100%;
  padding: 0;
  border: 0;
  cursor: zoom-in;
}

.image-action:focus-visible {
  outline: 3px solid rgba(37, 90, 155, 0.32);
  outline-offset: -3px;
}

.coords {
  margin-top: 0.8rem;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 0.76rem;
}

.pin-actions {
  display: grid;
  gap: 0.48rem;
  margin-top: 0.85rem;
}

.pin-action-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.55;
}

.pin-action-note--success {
  margin-top: 0.75rem;
  padding: 0.58rem 0.65rem;
  border: 1px solid #b8ddce;
  border-radius: var(--radius);
  color: var(--accent-strong);
  background: #eff9f4;
  font-weight: 700;
}

.detail-drawer {
  position: fixed;
  right: 1rem;
  top: 88px;
  z-index: 900;
  width: min(390px, calc(100vw - 2rem));
  max-height: calc(100dvh - 108px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.drawer-close,
.modal-close {
  position: absolute;
  right: 0.55rem;
  top: 0.55rem;
  z-index: 2;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: center;
  gap: 0.8rem;
  padding: 2.6rem 1rem 1.2rem;
  background: rgba(9, 14, 13, 0.9);
}

.photo-manager {
  position: fixed;
  inset: 0;
  z-index: 1150;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(9, 14, 13, 0.56);
}

.share-dialog {
  position: fixed;
  inset: 0;
  z-index: 1160;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(9, 14, 13, 0.56);
}

.share-dialog__panel {
  width: min(880px, 100%);
  max-height: min(780px, calc(100dvh - 2rem));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 0.85rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.share-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem 0;
}

.share-dialog__header h2 {
  margin-bottom: 0.2rem;
  font-size: 1.18rem;
}

.share-dialog__summary,
.share-dialog__note {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.share-dialog__sections {
  display: grid;
  align-content: start;
  gap: 0.65rem;
  overflow: auto;
  padding: 0 1rem;
}

.share-dialog__section {
  display: grid;
  gap: 0.65rem;
  padding: 0.78rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.share-dialog__section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.share-dialog__section-head h3 {
  margin: 0;
}

.share-dialog__fields {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.48rem 0.7rem;
  align-items: center;
}

.share-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.switch-control {
  min-height: 2.35rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid #cdd8d4;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
}

.switch-control input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--accent);
}

.share-output {
  display: grid;
  gap: 0.38rem;
  padding: 0 1rem;
}

.share-output textarea {
  min-height: 5.2rem;
  max-height: 8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 0.78rem;
}

.share-dialog__panel > .upload-status {
  margin: 0;
  padding: 0 1rem 1rem;
}

.photo-manager__panel {
  width: min(960px, 100%);
  max-height: min(760px, calc(100dvh - 2rem));
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 0.8rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.photo-manager__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem 0;
}

.photo-manager__header h2 {
  margin-bottom: 0.2rem;
  font-size: 1.18rem;
}

.photo-manager__usage {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.photo-manager__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 1rem;
}

.photo-manager__panel > .upload-status {
  margin: 0;
  padding: 0 1rem;
}

.photo-manager__list {
  display: grid;
  align-content: start;
  gap: 0.55rem;
  overflow: auto;
  padding: 0 1rem 1rem;
}

.photo-manager__row {
  display: grid;
  grid-template-columns: auto 88px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.photo-manager__check {
  width: 1.15rem;
  height: 1.15rem;
}

.photo-manager__thumb {
  width: 88px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius);
  background: #dfe8e5;
}

.photo-manager__thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.photo-manager__body {
  min-width: 0;
  display: grid;
  gap: 0.28rem;
}

.photo-manager__title,
.photo-manager__meta,
.photo-manager__key {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-manager__title {
  font-weight: 800;
}

.photo-manager__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.photo-manager__key {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 0.74rem;
}

.photo-manager__link-state {
  color: var(--accent-strong);
  font-weight: 800;
}

.photo-manager__link-state.is-unused {
  color: #7b3a1d;
}

.image-modal[hidden],
.detail-drawer[hidden],
.share-dialog[hidden],
.photo-manager[hidden],
.mode-switch[hidden],
.list-panel[hidden],
.add-panel[hidden] {
  display: none;
}

.image-modal img {
  max-width: min(1080px, 96vw);
  max-height: 82dvh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: #111;
}

.image-modal p {
  margin: 0;
  color: #fff;
  text-align: center;
}

.empty-state,
.empty-inline {
  color: var(--muted);
  font-size: 0.86rem;
}

.empty-state {
  margin: 0;
  padding: 0.9rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.is-embed {
  grid-template-rows: minmax(0, 1fr);
}

body.is-embed .topbar,
body.is-embed .sidebar,
body.is-embed .detail-drawer {
  display: none !important;
}

@media (max-width: 920px) {
  .home-login-form,
  .public-map-tools,
  .pricing-grid,
  .pricing-plan-list {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar__actions {
    width: 100%;
    justify-content: flex-start;
  }

  .layout {
    min-height: 0;
  }

  .map-shell {
    inset: 0;
  }

  .sidebar {
    left: 0.65rem;
    top: 0.65rem;
    width: min(360px, calc(100% - 1.3rem));
    max-height: calc(100% - 1.3rem);
  }

  .detail-drawer {
    top: auto;
    right: 0.75rem;
    bottom: 0.75rem;
    width: calc(100vw - 1.5rem);
    max-height: 58dvh;
  }

  .photo-manager__panel {
    max-height: calc(100dvh - 1.3rem);
  }

  .share-dialog__panel {
    max-height: calc(100dvh - 1.3rem);
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 1.15rem;
  }

  #siteDescription {
    font-size: 0.8rem;
  }

  .topbar__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .button,
  .mode-switch {
    width: 100%;
    min-width: 0;
  }

  .mode-switch {
    grid-column: 1 / -1;
  }

  .button,
  .mode-button {
    min-width: 0;
    padding-right: 0.55rem;
    padding-left: 0.55rem;
    white-space: normal;
  }

  .sidebar {
    padding: 0;
  }

  .panel,
  .list-panel {
    padding: 0.72rem;
    margin-bottom: 0.65rem;
  }

  .pin-card {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .photo-frame--thumb {
    width: 64px;
    height: 64px;
  }

  .photo-manager {
    padding: 0.65rem;
  }

  .photo-manager__row {
    grid-template-columns: auto 72px minmax(0, 1fr);
    gap: 0.55rem;
  }

  .photo-manager__thumb {
    width: 72px;
  }

  .photo-manager__actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .share-dialog {
    padding: 0.65rem;
  }

  .share-dialog__section-head,
  .share-dialog__actions {
    align-items: stretch;
    flex-direction: column;
  }

  .share-dialog__fields {
    grid-template-columns: 1fr;
  }

}
