:root {
  --color-bg: #f7f7f5;
  --color-surface: #ffffff;
  --color-text: #1c1c1c;
  --color-text-muted: #6b6b6b;
  --color-border: #e2e2e0;
  --color-accent: #2f6f4f;
  --color-accent-contrast: #ffffff;
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic",
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
}

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

header.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

header.app-header h1 {
  font-size: 20px;
  margin: 0;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

header.app-header a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 14px;
}

#auth-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.auth-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-block;
  vertical-align: middle;
  border: 1px solid var(--color-border);
}

.auth-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  font-size: 13px;
  font-weight: 700;
}

button.auth-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 0;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.card h2 {
  margin-top: 0;
  font-size: 16px;
}

.card p.desc {
  color: var(--color-text-muted);
  font-size: 14px;
  margin-bottom: 8px;
}

.card a.theme-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.card a.theme-link:hover {
  opacity: 0.85;
}

.theme-icon,
.button-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.press-icon {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  object-fit: cover;
  margin-bottom: 8px;
}

.post-thumb {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  vertical-align: middle;
  margin-left: 6px;
}

label {
  display: block;
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
  margin-top: 12px;
}

input[type="text"],
input[type="color"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 15px;
  background: var(--color-surface);
  color: var(--color-text);
}

textarea {
  resize: vertical;
  min-height: 64px;
}

button,
.button-like {
  display: inline-block;
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  text-align: center;
  text-decoration: none;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

.secondary {
  background: transparent;
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
}

.btn-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.button-edit-form-container {
  width: 100%;
}

.btn-row button {
  flex: 1;
  padding: 8px 16px;
  font-size: 13px;
}

button.btn-danger {
  color: #c0392b;
  border-color: #c0392b;
}

.big-count {
  font-size: 40px;
  font-weight: 700;
  margin: 8px 0 0;
}

.count-label {
  font-size: 13px;
  color: var(--color-text-muted);
}

.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.qr-box canvas {
  border-radius: 8px;
}

.pin-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
}

.pin-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.pin-list li:last-child {
  border-bottom: none;
}

.map-container {
  height: 300px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.map-container .leaflet-popup-content {
  font-size: 13px;
}

/* map.html: 地図単体を大きく見せるための全画面レイアウト。 */
.page-full-map {
  padding-bottom: 16px;
}

.map-container-full {
  height: calc(100vh - 180px);
  min-height: 320px;
}

.status-message {
  text-align: center;
  padding: 40px 16px;
}

.status-message .icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.hint {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 24px;
}

.copy-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.copy-row input {
  flex: 1;
}

.share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.share-btn {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  color: #ffffff;
  white-space: nowrap;
}

.share-btn-native {
  background: var(--color-accent);
}

.share-btn-x {
  background: #000000;
}

.share-btn-line {
  background: #06c755;
}

.share-btn-copy {
  background: transparent;
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
}

.list-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.list-controls input[type="text"] {
  flex: 1;
  margin: 0;
}

.list-controls select {
  width: auto;
  flex-shrink: 0;
  margin: 0;
}

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.post-count-badge {
  display: inline-block;
  font-size: 12px;
  color: var(--color-text-muted);
  margin-left: 6px;
  white-space: nowrap;
}

/* b.html: 記録成功時の丸枠地図＋ピンドロップ演出 */
.round-map-wrap {
  position: relative;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  overflow: hidden;
  margin: 8px auto 20px;
  border: 5px solid var(--color-surface);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  background: var(--color-bg);
}

.round-map-wrap .leaflet-container {
  width: 100%;
  height: 100%;
  background: var(--color-bg);
}

/* 地図の外側の丸枠からはみ出す帰属表示・コントロールを隠す */
.round-map-wrap .leaflet-control-attribution {
  font-size: 8px;
  padding: 0 4px;
  opacity: 0.7;
}

/* 影はピンの先端が刺さる場所（コンテナの中心＝50%,50%）に、ずれなくちょうど重なるように
   配置している（幅・高さの半分だけ引くシンプルな中央寄せ。ピン側の先端も同じ中心座標に
   来るよう計算しているので、両者は必ず一致する）。 */
.pin-shadow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30px;
  height: 11px;
  margin-left: -15px;
  margin-top: -5.5px;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 50%;
  transform: scale(0.2);
  opacity: 0;
  animation: pinShadowGrow 0.5s ease-out 0.55s forwards;
  pointer-events: none;
  z-index: 401;
}

/* ピンは絵文字(📍)ではなく、CSSだけで描いた形状にしている。絵文字はOS/フォントによって
   グリフ内の「先端」の位置が微妙に違い、中央に正確に合わせられなかったため。
   .pin-drop（外側）は落下アニメーション用、.pin-shape（内側、正方形を45度回転して
   角を1つだけ丸めない形＝ティアドロップ）は先端の位置を数学的に計算して常に中央
   （＝上の.pin-shadowと同じ座標）に来るように固定している。 */
.pin-drop {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  margin-left: -23px;
  margin-top: -55.5px; /* -(幅/2 + 対角線の半分) : 回転後の先端がちょうど中央に来る位置 */
  opacity: 0;
  animation: pinDrop 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  animation-delay: 0.1s;
  pointer-events: none;
  z-index: 402;
}

.pin-shape {
  position: relative;
  width: 100%;
  height: 100%;
  background: #ffffff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 3px 3px rgba(0, 0, 0, 0.3);
}

.pin-shape::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34%;
  height: 34%;
  margin: -17% 0 0 -17%;
  background: var(--color-accent);
  border-radius: 50%;
}

@keyframes pinDrop {
  0% {
    transform: translateY(-160px) scale(0.7);
    opacity: 0;
  }
  60% {
    transform: translateY(4px) scale(1.08);
    opacity: 1;
  }
  80% {
    transform: translateY(-6px) scale(0.96);
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes pinShadowGrow {
  from {
    transform: scale(0.2);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.tag-chip-filter {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.tag-chip-filter.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-accent-contrast);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.tag-chip {
  display: inline-block;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
}

/* 全画面共通フッター（利用規約・プライバシーポリシー・お問い合わせ・ライセンス） */
.app-footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
}

.app-footer a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 12px;
}

.app-footer a:hover {
  text-decoration: underline;
}

/* 利用規約・プライバシーポリシー・お問い合わせ・ライセンスページ共通のレイアウト */
.legal-page h1 {
  font-size: 20px;
  margin-bottom: 4px;
}

.legal-page .updated-at {
  color: var(--color-text-muted);
  font-size: 12px;
  margin-top: 0;
  margin-bottom: 24px;
}

.legal-page h2 {
  font-size: 16px;
  margin-top: 28px;
  margin-bottom: 8px;
}

.legal-page p,
.legal-page li {
  font-size: 14px;
  color: var(--color-text);
}

.legal-page ul,
.legal-page ol {
  padding-left: 20px;
  margin: 8px 0;
}

.legal-page .back-link {
  display: inline-block;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--color-accent);
  text-decoration: none;
}

.license-item {
  margin-bottom: 20px;
}

.license-item h3 {
  font-size: 14px;
  margin-bottom: 4px;
}

.license-item .license-meta {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.license-item pre {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px;
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--color-text-muted);
}
