:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #23272f;
  --muted: #6b7280;
  --line: #e2e5ea;
  --accent: #2f7d5b;
  --accent-ink: #ffffff;
  --danger: #b3261e;
  --danger-bg: #fceceb;
  --ok: #1f6f43;
  --ok-bg: #e8f5ee;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  line-height: 1.6;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 26px 24px;
  box-shadow: 0 6px 24px rgba(20, 24, 31, 0.06);
}

.logo {
  margin: 4px 0 20px;
  text-align: center;
}
.logo img {
  height: 60px;
  width: auto;
  display: block;
  margin: 0 auto;
}

.tagline {
  margin: 0 0 20px;
  text-align: center;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}

h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

form { display: flex; flex-direction: column; gap: 12px; }

label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  color: var(--muted);
}

input {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  color: var(--ink);
  background: #fff;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 125, 91, 0.15);
}

button {
  margin-top: 4px;
  padding: 11px 14px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

button:hover { filter: brightness(1.05); }
button:disabled { opacity: 0.6; cursor: default; }

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

.links {
  margin: 16px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.links a { color: var(--accent); text-decoration: none; }
.links a:hover { text-decoration: underline; }

.muted { color: var(--muted); font-size: 13px; }
.greeting { font-size: 15px; font-weight: 600; }

.flash {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}
.flash.error { background: var(--danger-bg); color: var(--danger); }
.flash.ok    { background: var(--ok-bg);     color: var(--ok); }

.footer { font-size: 12px; color: var(--muted); }

/* ============ ログイン後: 地図アプリ ============ */

/* ログイン後は中央寄せレイアウトを解除してフル幅にする */
body.app-mode {
  display: block;
  padding: 0;
  background: var(--bg);
}
body.app-mode #auth-card { display: none; }

.btn-primary, .btn-ghost {
  border: none; border-radius: 8px; cursor: pointer;
  font-size: 14px; font-weight: 600; padding: 9px 14px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: #eef0f3; color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; border: none; border-radius: 8px;
  padding: 9px 14px; font-weight: 600; cursor: pointer; }

/* トップバー */
.topbar {
  position: sticky; top: 0; z-index: 500;
  background: #fff; border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1000px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px;
}
.brand { height: 26px; width: auto; cursor: pointer; display: block; }
.search { flex: 1; margin: 0; }
.search input {
  width: 100%; max-width: 320px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 20px; font-size: 14px;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user { font-size: 13px; color: var(--muted); }

.app-main { max-width: 1000px; margin: 0 auto; padding: 20px 16px 60px; }
.app-view h2 { margin: 0 0 14px; font-size: 20px; }
.app-flash { max-width: 1000px; margin: 12px auto 0; }

/* 一覧カード */
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.pcard {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: #fff; cursor: pointer; transition: box-shadow .15s, transform .15s;
  display: flex; flex-direction: column;
}
.pcard:hover { box-shadow: 0 6px 18px rgba(20,24,31,.10); transform: translateY(-2px); }
.pcard .thumb {
  aspect-ratio: 1 / 1; background: #eef0f3;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.pcard .thumb img { width: 100%; height: 100%; object-fit: cover; }
.pcard .thumb .pin { width: 34px; height: 34px; border-radius: 50%; }
.pcard .meta { padding: 8px 10px; border-top: 4px solid transparent; }
.pcard .meta .title { font-size: 13px; font-weight: 600; margin: 0 0 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .meta .date { font-size: 11px; color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 48px 0; }

/* 色ドット / ピン色 */
.dot { display: inline-block; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid rgba(0,0,0,.15); vertical-align: middle; }
.dot.pink { background: #e9698f; }
.dot.yellow { background: #edc23a; }
.dot.blue { background: #3f7fd0; }
.dot.green { background: #4aa564; }
.pin.pink { background: #e9698f; } .pin.yellow { background: #edc23a; }
.pin.blue { background: #3f7fd0; } .pin.green { background: #4aa564; }
.card-pink { border-top-color: #e9698f !important; }
.card-yellow { border-top-color: #edc23a !important; }
.card-blue { border-top-color: #3f7fd0 !important; }
.card-green { border-top-color: #4aa564 !important; }

/* フォーム（アプリ内） */
.app-form { display: flex; flex-direction: column; gap: 12px; max-width: 560px; }
.app-form label { display: flex; flex-direction: column; gap: 5px;
  font-size: 13px; color: var(--muted); }
.app-form input[type=text], .app-form textarea, .app-form input[type=file] {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 15px; color: var(--ink); background: #fff; font-family: inherit; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; color: var(--muted); }
.colors { display: flex; gap: 14px; }
.color-opt { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.hint { font-size: 12px; color: var(--muted); margin: 8px 0 4px; }

/* 地図 */
.map { width: 100%; height: 320px; border-radius: 12px; border: 1px solid var(--line);
  z-index: 1; }

/* 詳細 */
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.detail-title { font-size: 22px; margin: 0; }
.detail-date { color: var(--muted); font-size: 13px; margin: 2px 0 14px; }
.detail-memo { white-space: pre-wrap; margin: 0 0 16px; line-height: 1.7; }
.detail-photos { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }
.detail-photos img { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.back-link { display: inline-block; margin-bottom: 12px; color: var(--accent);
  text-decoration: none; font-size: 14px; cursor: pointer; }

/* アカウント画面 */
.user-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 4px;
  font-weight: 400;
}
.user-btn:hover { color: var(--ink); text-decoration: underline; }

#account-email { margin: 0 0 24px; }

.danger-zone {
  border: 1px solid var(--danger);
  border-radius: 12px;
  padding: 18px 20px;
  max-width: 560px;
  background: var(--danger-bg);
}
.danger-zone h3 { margin: 0 0 8px; font-size: 16px; color: var(--danger); }
.danger-zone p { margin: 0 0 14px; font-size: 13px; color: var(--ink); line-height: 1.7; }
