* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    "Noto Sans JP",
    sans-serif;
  background: #f6f7f8;
  color: #111;
}
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #111;
  color: #fff;
}
.bar h1 {
  font-size: 16px;
  margin: 0;
}
.bar button {
  padding: 6px 12px;
  font-size: 14px;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
}

.wrap {
  display: grid;
  max-width: 1400px;
  margin: 0 auto;
  grid-template-columns: 5.5fr 4.5fr; /* 地図 : フォーム = 6 : 4 */
  gap: 16px;
  padding: 24px;
}
@media (max-width: 980px) {
  .wrap {
    grid-template-columns: 1fr;
  }

  .wrap > .panel:first-child {
    position: static !important;
    top: auto !important;
  }
}

.panel {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
}

.wrap > .panel:first-child {
  position: sticky;
  top: 16px;
  align-self: start;
}

label {
  display: block;
  margin-top: 8px;
  margin-bottom: 4px;
  font-size: 13px;
  color: #444;
}
input,
textarea {
  width: 100%;
  padding: 6px 8px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 7px;
}

/* Normalize placeholder appearance */
input::placeholder,
textarea::placeholder {
  color: #999;
  font-weight: 400;
  opacity: 1; /* prevent browser default lighter rendering */
  font-size: 13px;
}
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  align-items: end;
  margin-bottom: 35px;
}

/* Better width balance for spot form */
.row.rowPins {
  grid-template-columns: 1fr 1fr;
}

.row.rowPins input[type="file"] {
  grid-column: 1 / span 3;
}

.row.rowPins .photoPreview {
  grid-column: 4;
  justify-self: end;
}
.row > div {
  display: flex;
  flex-direction: column;
}
.row button {
  padding: 6px 12px;
  font-size: 14px;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.map {
  height: 520px;
  border-radius: 12px;
  overflow: hidden;
  background: #eee;
}

/* Read-only display style for center lat/lng + zoom fields under the map */
.wrap > .panel:first-child .map + .row {
  margin-top: 14px;
  margin-bottom: 12px;
  grid-template-columns: 1fr 1fr 0.6fr;
}

.wrap > .panel:first-child .map + .row input {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
  color: #111;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.4;
  pointer-events: none;
  outline: none;
  text-align: center;
}

.wrap > .panel:first-child .map + .row input:focus {
  outline: none;
  box-shadow: none;
}

.wrap > .panel:first-child .map + .row label {
  margin-bottom: 6px;
  font-size: 12px;
  color: #666;
  text-align: center;
}

@media (max-width: 640px) {
  .wrap > .panel:first-child .map + .row input {
    font-size: 20px;
  }
}

/* Address search row */
.searchRow {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.searchRow input {
  flex: 1;
}

.searchRow button {
  white-space: nowrap;
  padding: 6px 12px;
}

.list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}
.pinRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border: 1px solid #eee;
  border-radius: 7px;
  margin-top: 8px;
}
.pinRow .sub {
  font-size: 11px;
  color: #666;
  line-height: 1.5;
}
.btnDel {
  border: 0;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
}

.hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: #4f6f8f;
  border-radius: 6px;
  padding: 6px 8px 6px 26px;
  position: relative;
}

.hint::before {
  content: "💡";
  position: absolute;
  left: 6px;
  top: 4px;
  font-size: 14px;
  opacity: 0.8;
}
.mini {
  margin: 8px 0 0;
  font-size: 12px;
  color: #666;
}

.share {
  margin-top: 12px;
}
.ok {
  padding: 10px;
  background: #e8fff1;
  border: 1px solid #bfe9cc;
  border-radius: 7px;
}
.links {
  margin-top: 8px;
  font-size: 13px;
}
code {
  display: block;
  padding: 8px;
  background: #f1f1f1;
  border-radius: 7px;
  overflow: auto;
}
.photoPreview {
  border: 1px dashed #ccc;
  border-radius: 6px;
  width: 96px;
  height: 96px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  overflow: hidden;
}

.photoPreview img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 6px;
}

.photoPreview .ph {
  font-size: 12px;
  color: #777;
}

.btnAddPin {
  margin-top: 12px;
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid #cfcfcf;
  border-radius: 12px;
  background: #e9ecef;
  color: #222;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition:
    background 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.05s ease;
  transform: translateY(0);
}

.btnAddPin:hover {
  background: #e1e5e9;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.14);
  transform: translateY(-1px);
}

.btnAddPin:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* Optional options accordion layout */
.pinOptions {
  grid-column: 1 / -1; /* make it full width inside grid */
  margin-top: 4px;
  font-size: 12px;
}

.pinOptions summary {
  cursor: pointer;
  font-size: 12px;
  color: #666;
  padding: 2px 0;
}

.pinOptionsInner {
  margin-top: 6px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.pinOptionsInner input {
  font-size: 13px;
  padding: 6px 8px;
}

.pinCoordDisplay {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 0;
  padding: 0;
}

.pinCoordLabel {
  font-size: 13px;
  color: #888;
  white-space: nowrap;
  font-weight: 500;
}

.pinCoordDisplay input {
  width: 9.5ch;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
  color: #888;
  font-size: 13px;
  font-weight: 400;
  pointer-events: none;
  outline: none;
}

.pinCoordDisplay input:focus {
  outline: none;
  box-shadow: none;
}
.btnSaveBottom {
  margin-top: 14px;
  width: 100%;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  background: #555;
  color: #fff;
  border-radius: 12px;
  border: 0;
  cursor: pointer;
}
.spotCard {
  margin-top: 14px;
  padding: 16px;
  border-radius: 12px;
  background: #fbfbfb;
  border: 1px solid #e6e6e6;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.pinSelectedCoord {
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
}

.pinSelectedCoordLabel {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #666;
}

.pinSelectedCoordValues {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.pinCoordDisplay input {
  font-variant-numeric: tabular-nums;
}

.tempMarkerIcon {
  filter: grayscale(1) saturate(0.2) brightness(0.95);
  opacity: 0.75;
}

/* tighten spacing inside the spot card */
.spotCard label:first-of-type {
  margin-top: 0;
}
.spotCard .hint {
  margin-top: 8px;
}

/* Spot card: sticky bottom action (wrap button + hint in .spotCardFooter) */
.spotCard {
  position: relative;
}

.spotCardFooter {
  position: sticky;
  bottom: 0;
  margin-top: 10px;
  padding-top: 10px;
  padding-bottom: 2px;
  background: linear-gradient(to bottom, rgba(251, 251, 251, 0), rgba(251, 251, 251, 0.92) 35%, rgba(251, 251, 251, 1));
}

.spotCardFooter .btnAddPin {
  margin-top: 0;
  width: 100%;
}

.spotCardFooter .hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: #666;
}

.footer {
  margin-top: 40px;
  padding: 20px 20px;
  text-align: center;
  font-size: 14px;
  color: #777;
  border-top: 1px solid #eee;
}

/* Shared popup card styles (view.php / embed.php) */
.leaflet-popup-content-wrapper {
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.leaflet-popup-content {
  margin: 12px;
  min-width: 250px;
}

.embedPopup {
  font-family:
    system-ui,
    -apple-system,
    "Noto Sans JP",
    sans-serif;
  color: #333;
}

.embedPopup .thumb {
  width: 100%;
  height: 120px;
  border-radius: 10px;
  overflow: hidden;
  background: #f2f2f2;
  margin-bottom: 10px;
}

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

.embedPopup .title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  margin: 0 0 6px;
}
.embedPopup .memo {
  margin: 4px 0 8px;
  font-size: 11px;
  line-height: 1.5;
  color: #666;
}

.embedPopup .meta {
  display: flex;
  align-items: flex-start; /* ← これがポイント */
  gap: 6px;
  font-size: 12px;
  line-height: 1.6;
  color: #444;
  margin: 0;
}

.embedPopup .ico {
  width: 16px;
  display: inline-flex;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 4px; /* 微調整 */
}

.embedPopup .actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.embedPopup .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid #cfcfcf;
  border-radius: 8px;
  background: #f5f5f5;
  color: #333;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  box-sizing: border-box;
}

.embedPopup .btn:hover {
  background: #ededed;
}
.pinRow .pinActions {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.pinRow .pinActions a,
.pinRow .pinActions button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  height: 36px;
  padding: 0 10px;
  white-space: nowrap !important;
  word-break: keep-all;
  line-break: strict;
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
  box-sizing: border-box;
}

/* Make copy buttons consistent height */
.copyRow {
  align-items: center;
}

.copyRowEmbed .copyBtn {
  height: 40px !important;
  min-height: 40px !important;
  align-self: center;
}

/* Embed size selector */
.embedSizeRow {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.embedSizeBtn {
  height: 34px;
  padding: 0 12px;
  border: 1px solid #d5d5d5;
  border-radius: 999px;
  background: #fff;
  color: #333;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.embedSizeBtn.is-active {
  background: #555;
  border-color: #555;
  color: #fff;
}

.copyStatus {
  display: none;
}
/* Copy success toast */
.copyToast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(34, 34, 34, 0.92);
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.copyToast.is-show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 640px) {
  .copyToast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    text-align: center;
  }
}

@media (max-width: 980px) {
  .wrap > .panel:first-child {
    position: static !important;
    top: auto !important;
    align-self: auto !important;
  }
}

.photoUploadRow {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start;
  gap: 16px;
  margin-top: 10px;
}

.photoUploadControl {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 8px;
  min-width: 0;
  flex-wrap: nowrap;
}

.photoUploadLabel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 6px;
  border: 1px solid #dcdcdc;
  border-radius: 8px;
  background: #f3f3f3;
  color: #333;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.15s ease,
    box-shadow 0.15s ease;
  white-space: nowrap;
}

.photoUploadLabel:hover {
  background: #f7f7f7;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

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

.photoUploadHint {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  color: #666;
  width: 100%;
  white-space: nowrap;
  text-align: center;
}

#pinList li {
  transition:
    background-color 0.25s ease,
    box-shadow 0.25s ease;
}

#pinList li.pin-added {
  background: #f5fbf8;
  box-shadow: 0 0 0 1px rgba(36, 136, 121, 0.18) inset;
  border-radius: 12px;
}
.spot-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.spot-count {
  background: #f3f3f3;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
}

/* ===== SP ===== */
@media (max-width: 768px) {
  .wrap {
    padding: 12px;
    gap: 12px;
  }

  .panel {
    padding: 12px;
  }

  .row {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 20px;
  }

  .row.rowPins {
    grid-template-columns: 1fr;
  }

  .wrap > .panel:first-child .map + .row {
    grid-template-columns: 1fr;
  }

  .pinOptionsInner {
    grid-template-columns: 1fr;
  }

  .photoUploadRow {
    flex-wrap: wrap !important;
    align-items: flex-start !important;
  }

  .photoUploadControl {
    width: 100%;
    min-width: 0;
  }

  .photoUploadHint {
    white-space: normal;
    text-align: left;
  }

  .pinRow {
    flex-wrap: wrap;
    gap: 10px;
  }

  .pinRow > div:first-child {
    min-width: 0;
    width: 100%;
  }

  .pinRow .pinActions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap !important;
  }

  .spot-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .spot-count {
    font-size: 13px;
    opacity: 0.8;
  }
}

@media (max-width: 640px) {
  html,
  body {
    overflow-x: hidden;
  }

  .pinCoordDisplay {
    flex-wrap: wrap;
  }

  .pinCoordDisplay input {
    width: 100%;
    min-width: 0;
  }

  .embedSizeRow {
    flex-direction: column;
  }

  .embedSizeBtn {
    width: 100%;
  }
}
