/* base */
html,
body {
  height: 100%;
  margin: 0;
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Hiragino Sans",
    "Hiragino Kaku Gothic ProN",
    "Noto Sans JP",
    "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

.map-message {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  background: #f7f9fb;
  color: #222;
  font-size: 16px;
  line-height: 1.7;
  text-align: center;
  white-space: pre-wrap;
}

.map-message[hidden] {
  display: none;
}

/* dock / panel */
.share-dock {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 1100;
  width: min(420px, calc(100% - 16px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.panel-open {
  pointer-events: auto;
  border: 0;
  border-radius: 999px;
  width: 56px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #222;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
}

.panel-open-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.panel-open-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
}

.panel-open[hidden] {
  display: none;
}

.share-panel {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 12px 12px;
  overflow: visible;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 18px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  pointer-events: auto;
  transform: translateY(0);
  opacity: 1;
  transition: transform 0.26s ease, opacity 0.2s ease;
}

.share-dock.is-collapsed .share-panel {
  display: none;
}

.share-panel.is-dragging {
  transition: none;
}

.share-panel.is-closing,
.share-panel.is-opening {
  transform: translateY(40px);
  opacity: 0;
  pointer-events: none;
}

.panel-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0;
  padding: 10px 0 4px;
  border: 0;
  background: transparent;
  cursor: grab;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.panel-handle:active {
  cursor: grabbing;
}

.panel-handle-bar {
  display: block;
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: #d1d5db;
}

/* status */
.status-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.status-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 500;
  color: #222;
  cursor: pointer;
  background: #fff;
}

.status-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.status-option:has(input:checked) {
  border-color: #222;
  background: #f3f4f6;
}

/* note */
.note-field {
  margin-top: 8px;
  text-align: left;
}

.note-label {
  display: block;
  margin-bottom: 4px;
  color: #6b7280;
  font-size: 12px;
}

.note-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  color: #222;
  outline: none;
  background: #fff;
}

.note-input:focus {
  border-color: #222;
}

/* share button */
.share-btn {
  position: relative;
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  background: #3a3a3a;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  overflow: hidden;
  font-family: inherit;
}

.share-btn-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  background: #222;
  transition: width 0.35s linear;
  pointer-events: none;
}

.share-btn-label {
  position: relative;
  z-index: 1;
}

.share-btn.is-sharing .share-btn-fill {
  background: #222;
}

.share-btn:disabled {
  background: #9aa0a6;
  cursor: wait;
}

.share-btn:disabled .share-btn-fill {
  background: #8a9096;
}

/* top-right menu */
.drawer-btn {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 1260;
  width: 44px;
  height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s ease;
}

.map-provider-toggle {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  z-index: 1260;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
  color: #222;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.map-provider-icon {
  display: block;
}

.map-provider-toggle:disabled {
  opacity: 0.55;
  cursor: wait;
}

.place-search-wrap {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: calc(max(12px, env(safe-area-inset-right)) + 44px + 8px);
  left: auto;
  transform: none;
  z-index: 1260;
  width: 44px;
  box-sizing: border-box;
  transition: width 0.22s ease;
}

.place-search-wrap.is-open {
  width: min(340px, calc(100vw - 168px));
}

.place-search {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  height: 44px;
  box-sizing: border-box;
  padding: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
  overflow: hidden;
}

.place-search-input {
  flex: 1;
  min-width: 0;
  width: 0;
  opacity: 0;
  border: 0;
  border-radius: 999px;
  padding: 0;
  margin: 0;
  background: transparent;
  color: #222;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  pointer-events: none;
  transition: opacity 0.18s ease, padding 0.18s ease;
}

.place-search-wrap.is-open .place-search-input {
  opacity: 1;
  padding: 8px 4px 8px 14px;
  pointer-events: auto;
}

.place-search-input::placeholder {
  color: #9ca3af;
}

.place-search-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  color: #222;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.place-search-wrap.is-open .place-search-btn {
  background: #222;
  color: #fff;
}

.place-search-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.place-search-icon {
  display: block;
}

.place-search-results {
  list-style: none;
  margin: 8px 0 0;
  padding: 6px;
  max-height: min(280px, 45vh);
  overflow-y: auto;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.place-search-results[hidden] {
  display: none;
}

.place-search-result {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  background: transparent;
  color: #222;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  text-align: left;
  line-height: 1.35;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.place-search-result:hover,
.place-search-result:focus {
  background: #f3f4f6;
  outline: none;
}

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

@media (max-width: 520px) {
  .place-search-wrap.is-open {
    width: calc(100vw - 120px);
  }
}

.drawer-btn-line {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: #222;
  transition: transform 0.22s ease, opacity 0.18s ease;
}

.drawer-btn.is-open .drawer-btn-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.drawer-btn.is-open .drawer-btn-line:nth-child(2) {
  opacity: 0;
}

.drawer-btn.is-open .drawer-btn-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.drawer[hidden] {
  display: none;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 1250;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.18);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.drawer.is-open .drawer-backdrop {
  opacity: 1;
}

.drawer-panel {
  position: absolute;
  top: calc(max(12px, env(safe-area-inset-top)) + 52px);
  right: max(12px, env(safe-area-inset-right));
  width: min(220px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  transform-origin: top right;
  transition:
    opacity 0.2s ease,
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.drawer.is-open .drawer-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.drawer-item {
  width: 100%;
  border: 0;
  border-radius: 11px;
  padding: 12px 14px;
  background: transparent;
  color: #222;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  opacity: 0;
  transform: translateY(6px);
  transition: background 0.15s ease, opacity 0.22s ease, transform 0.22s ease;
}

.drawer.is-open .drawer-item {
  opacity: 1;
  transform: translateY(0);
}

.drawer.is-open .drawer-item:nth-child(1) {
  transition-delay: 0.03s;
}

.drawer.is-open .drawer-item:nth-child(2) {
  transition-delay: 0.06s;
}

.drawer.is-open .drawer-item:nth-child(3) {
  transition-delay: 0.09s;
}

.drawer.is-open .drawer-item:nth-child(4) {
  transition-delay: 0.12s;
}

.drawer.is-open .drawer-item:nth-child(5) {
  transition-delay: 0.15s;
}

.drawer.is-open .drawer-item:nth-child(6) {
  transition-delay: 0.18s;
}

.drawer.is-open .drawer-item:nth-child(7) {
  transition-delay: 0.21s;
}

.drawer.is-open .drawer-item:nth-child(8) {
  transition-delay: 0.24s;
}

.drawer-item:hover,
.drawer-item:active {
  background: #f3f4f6;
}

.drawer-btn:disabled,
.drawer-item:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* role modal */
.role-modal[hidden] {
  display: none;
}

.role-modal {
  position: fixed;
  inset: 0;
  z-index: 1350;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.role-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.role-modal-sheet {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 24px 20px 20px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
}

.role-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
}

.role-modal-actions {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.role-modal-btn {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 14px 18px;
  background: #fff;
  color: #222;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.role-modal-btn-primary {
  border-color: #222;
  background: #222;
  color: #fff;
}

body.is-viewer .share-dock,
body.is-role-pending .share-dock {
  display: none;
}

body.is-viewer #profile-open-btn,
body.is-viewer #unshare-btn,
body.is-viewer #stats-open-btn {
  display: none;
}

body.is-viewer #join-driver-btn {
  display: block;
}

#join-driver-btn[hidden],
#switch-viewer-btn[hidden] {
  display: none;
}

body.is-driver #switch-viewer-btn {
  display: block;
}

/* legal modal */
.legal-modal[hidden] {
  display: none;
}

.legal-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.legal-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.legal-modal-sheet {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(520px, 100%);
  max-height: min(88vh, 720px);
  background: #fff;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

@media (min-width: 640px) {
  .legal-modal {
    align-items: center;
    padding: 24px;
  }

  .legal-modal-sheet {
    border-radius: 18px;
    max-height: min(80vh, 720px);
  }
}

.legal-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding: 14px 14px 12px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.legal-modal-title {
  flex: 1;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}

.legal-modal-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.legal-modal-close:hover {
  background: #e5e7eb;
  color: #111827;
}

.legal-modal-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 16px 28px;
}

.legal-loading {
  margin: 24px 0;
  text-align: center;
  color: #6b7280;
  font-size: 13px;
}

.legal-updated {
  margin: 0 0 14px;
  color: #6b7280;
  font-size: 12px;
}

.legal-section {
  margin-bottom: 22px;
}

.legal-section:last-child {
  margin-bottom: 0;
}

.legal-section h2,
.legal-section h3 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
}

.legal-section h3 {
  margin: 16px 0 6px;
  font-size: 14px;
}

.legal-section p,
.legal-section li {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.7;
  color: #374151;
}

.legal-section ul {
  margin: 0 0 8px;
  padding-left: 1.2em;
}

/* legal standalone page */
.legal-page {
  min-height: 100%;
  margin: 0;
  background: #f7f9fb;
  color: #111827;
}

.legal-page-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.legal-page-back {
  flex-shrink: 0;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.legal-page-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.legal-page-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  box-sizing: border-box;
}

.legal-document {
  background: #fff;
  border-radius: 14px;
  padding: 20px 18px 28px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.legal-page .legal-section h2 {
  font-size: 18px;
}

.legal-page .legal-section h3 {
  font-size: 15px;
}

.legal-page .legal-section p,
.legal-page .legal-section li {
  font-size: 14px;
}

/* stats modal */
.stats-modal-sheet {
  max-height: min(78vh, 560px);
}

.stats-modal-body {
  padding-bottom: 24px;
}

.stats-filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.stats-filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stats-filter-label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
}

.stats-filter-select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: #222;
}

.stats-filter-select:focus {
  outline: none;
  border-color: #222;
}

.stats-match-btn {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 11px 12px;
  background: #fff;
  color: #222;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.stats-match-btn:active {
  background: #f3f4f6;
}

.stats-chart-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.stats-chart {
  width: 180px;
  height: 180px;
}

.stats-chart svg {
  display: block;
  width: 100%;
  height: 100%;
}

.stats-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stats-legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f9fafb;
  font-size: 14px;
  font-weight: 600;
  color: #222;
}

.stats-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stats-legend-label {
  flex: 1;
  min-width: 0;
}

.stats-legend-value {
  color: #4b5563;
  font-variant-numeric: tabular-nums;
}

.stats-empty {
  margin: 24px 0 8px;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
}

.stats-total {
  margin: 14px 0 0;
  text-align: center;
  color: #6b7280;
  font-size: 12px;
}

/* profile modal */
.profile-modal-sheet {
  max-height: min(86vh, 720px);
}

.profile-help {
  margin: 0 0 16px;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.6;
}

.profile-avatar-field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.profile-avatar-field .profile-label {
  text-align: left;
  width: 100%;
}

.profile-avatar-wrap {
  position: relative;
  width: 88px;
  height: 88px;
  margin: 4px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-avatar-btn {
  width: 72px;
  height: 72px;
  border: 2px dashed #d1d5db;
  border-radius: 50%;
  padding: 0;
  background: #f9fafb;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-avatar-btn.has-image {
  border-style: solid;
  border-color: transparent;
}

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

.profile-avatar-img[hidden] {
  display: none;
}

.profile-avatar-placeholder {
  font-size: 28px;
  font-weight: 500;
  color: #9ca3af;
  line-height: 1;
}

.profile-avatar-placeholder[hidden] {
  display: none;
}

/* 丸の外側・右上。写真に被らない位置 */
.profile-avatar-clear {
  position: absolute;
  top: 0;
  right: 0;
  width: 26px;
  height: 26px;
  border: 2px solid #fff;
  border-radius: 50%;
  padding: 0;
  background: #fff;
  color: #111;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

.profile-avatar-clear[hidden] {
  display: none;
}

.profile-avatar-input {
  display: none;
}

.avatar-edit-sheet {
  max-height: min(88vh, 640px);
}

.avatar-edit-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 22px;
}

.avatar-edit-stage {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

.avatar-edit-canvas {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: #e5e7eb;
  touch-action: none;
  cursor: grab;
  box-shadow: inset 0 0 0 2px #fff, 0 0 0 1px #d1d5db;
}

.avatar-edit-canvas:active {
  cursor: grabbing;
}

.avatar-edit-hint {
  margin: 0;
  text-align: center;
  color: #9ca3af;
  font-size: 12px;
}

.avatar-edit-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.avatar-edit-control-label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
}

.avatar-edit-zoom {
  width: 100%;
  accent-color: #222;
}

.avatar-edit-rotate-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.avatar-edit-rotate-btn {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 11px 10px;
  background: #fff;
  color: #222;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.avatar-edit-apply-btn {
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 13px 14px;
  margin-top: 4px;
  background: #222;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.profile-field {
  margin-bottom: 16px;
  text-align: left;
}

.profile-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
}

.profile-char-count {
  font-weight: 500;
  color: #9ca3af;
}

.profile-textarea,
.profile-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  color: #222;
  background: #fff;
  font-family: inherit;
  outline: none;
}

.profile-textarea {
  resize: vertical;
  min-height: 84px;
  line-height: 1.5;
}

.profile-textarea:focus,
.profile-input:focus {
  border-color: #222;
}

.profile-links {
  display: grid;
  gap: 8px;
}

.profile-select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  color: #222;
  background: #fff;
  font-family: inherit;
  outline: none;
}

.profile-select:focus {
  border-color: #222;
}

.profile-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.profile-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 10px;
  font-size: 14px;
  font-weight: 500;
  color: #222;
  cursor: pointer;
  background: #fff;
}

.profile-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.profile-option:has(input:checked) {
  border-color: #222;
  background: #f3f4f6;
}

.profile-save-btn {
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  background: #222;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.profile-save-btn:disabled {
  background: #9aa0a6;
  cursor: wait;
}

.profile-save-msg {
  margin: 10px 0 0;
  min-height: 1.2em;
  text-align: center;
  color: #6b7280;
  font-size: 12px;
}

.save-toast {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.save-toast[hidden] {
  display: none;
}

.save-toast-card {
  min-width: 160px;
  padding: 16px 22px;
  border-radius: 14px;
  background: #111827;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  animation: save-toast-in 0.18s ease-out;
}

@keyframes save-toast-in {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* pin profile (view only) */
.pin-profile-modal-sheet {
  max-height: min(70vh, 480px);
}

.pin-profile-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 8px;
}

.pin-profile-avatar-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  margin: 0 0 14px;
}

.pin-profile-avatar-btn {
  width: 96px;
  height: 96px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  display: block;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.pin-profile-avatar-btn[hidden] {
  display: none;
}

.pin-profile-avatar,
.pin-profile-avatar-fallback {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: block;
}

.pin-profile-avatar {
  object-fit: cover;
  background: #e5e7eb;
}

.pin-profile-avatar-fallback {
  overflow: hidden;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.pin-profile-avatar-fallback[hidden] {
  display: none;
}

.pin-profile-avatar-person {
  display: block;
  width: 96px;
  height: 96px;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 1450;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.image-viewer[hidden] {
  display: none;
}

.image-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
}

.image-viewer-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 1;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.image-viewer-img {
  position: relative;
  z-index: 1;
  width: min(92vw, 78vh, 768px);
  height: min(92vw, 78vh, 768px);
  max-width: 768px;
  max-height: 768px;
  border-radius: 50%;
  object-fit: cover;
  background: #111;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  animation: image-viewer-in 0.18s ease-out;
}

@keyframes image-viewer-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.pin-profile-nickname {
  margin: 0 0 8px;
  color: #111827;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  word-break: break-word;
}

.pin-profile-nickname[hidden] {
  display: none;
}

.pin-profile-note {
  margin: 8px 0 0;
  max-width: 100%;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
}

.pin-profile-note[hidden] {
  display: none;
}

.pin-profile-section {
  width: 100%;
  margin: 18px 0 0;
  text-align: left;
}

.pin-profile-section + .pin-profile-section {
  margin-top: 22px;
}

.pin-profile-section[hidden] {
  display: none;
}

.pin-profile-section-label {
  display: block;
  margin-bottom: 6px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
}

.pin-profile-bio {
  margin: 0;
  width: 100%;
  color: #374151;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
}

.pin-profile-links {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: grid;
  gap: 8px;
}

.pin-profile-link {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f3f4f6;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  text-align: left;
  word-break: break-all;
}

.pin-profile-link:hover {
  background: #e5e7eb;
}

.pin-profile-meta {
  width: 100%;
  margin: 20px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.pin-profile-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f9fafb;
  text-align: left;
}

.pin-profile-meta-row dt {
  margin: 0;
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
}

.pin-profile-meta-row dd {
  margin: 0;
  color: #111827;
  font-size: 14px;
  font-weight: 600;
}

/* Mapbox: 必須クレジットは残す。ただし白丸や強い装飾は付けない */
.mapboxgl-ctrl-logo {
  opacity: 0.22;
  transform: scale(0.75);
  transform-origin: left bottom;
  pointer-events: none;
  cursor: default;
  filter: grayscale(1) contrast(0.85);
}

.mapboxgl-ctrl-attrib {
  margin: 0 !important;
  padding: 0 4px !important;
  border: 0 !important;
  border-radius: 4px !important;
  background: rgba(255, 255, 255, 0.55) !important;
  box-shadow: none !important;
  opacity: 0.7;
  font-size: 10px !important;
  line-height: 1.3;
}

/* compact の白い大きな丸背景だけ消す */
.mapboxgl-ctrl-attrib.mapboxgl-compact:not(.mapboxgl-compact-show) {
  min-height: 18px !important;
  min-width: 18px !important;
  padding: 0 !important;
  background: transparent !important;
}

.mapboxgl-ctrl-attrib.mapboxgl-compact:not(.mapboxgl-compact-show)::before,
.mapboxgl-ctrl-attrib.mapboxgl-compact:not(.mapboxgl-compact-show)::after {
  display: none !important;
  content: none !important;
  width: 0 !important;
  height: 0 !important;
  background: none !important;
  box-shadow: none !important;
}

.mapboxgl-ctrl-attrib-button {
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background-color: transparent !important;
  box-shadow: none !important;
  opacity: 0.65;
}

.mapboxgl-ctrl-attrib-button:focus,
.mapboxgl-ctrl-attrib-button:focus-visible,
.mapboxgl-ctrl-attrib:focus,
.mapboxgl-ctrl-attrib:focus-visible,
.mapboxgl-ctrl-attrib a:focus,
.mapboxgl-ctrl-attrib a:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

.mapboxgl-ctrl-attrib.mapboxgl-compact-show {
  padding: 2px 6px !important;
  background: rgba(255, 255, 255, 0.8) !important;
}

.mapboxgl-ctrl-bottom-left,
.mapboxgl-ctrl-bottom-right {
  margin: 0 4px 4px;
  z-index: 1;
}

/* Google Maps: 必須の Google 表示は残し、報告リンクなど余白を抑える */
.gm-style-cc {
  opacity: 0.45 !important;
  font-size: 10px !important;
  line-height: 1.2 !important;
}

.gm-style .gm-style-cc a[href*="report"],
.gm-style .gm-style-cc a[href*="Report"],
.gm-style a[title*="Report"],
.gm-style a[title*="report"],
.gm-style a[title*="誤り"],
.gm-style a[aria-label*="Report"],
.gm-style a[aria-label*="誤り"],
.gm-style a[aria-label*="報告"] {
  display: none !important;
}

/* キーボードショートカットの案内ボタン */
.gm-style button[title*="Keyboard"],
.gm-style button[aria-label*="Keyboard"],
.gm-style button[aria-label*="キーボード"] {
  display: none !important;
}

/* Google ロゴは残すが控えめに */
.gm-style a[href^="https://maps.google.com/maps"] img,
.gm-style a[href^="https://www.google.com/maps"] img {
  opacity: 0.55;
  transform: scale(0.85);
  transform-origin: left bottom;
}
