:root {
  --green: #2f5d50;
  --light-green: #e9f1ee;
  --border: #b9c5c0;
  --text: #1d2925;
  --muted: #68736f;
  --bg: #f5f7f6;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  padding-bottom: calc(74px + env(safe-area-inset-bottom));
}
button, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; cursor: pointer; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--green);
  color: white;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-header h1 { margin: 0; font-size: 20px; }
.status { font-size: 12px; opacity: .9; }

main { max-width: 760px; margin: 0 auto; padding: 18px 14px 30px; }
.screen { display: none; }
.screen.active { display: block; }

.home-buttons { display: grid; gap: 14px; margin-top: 20px; }
.main-button, .complete-button, .secondary-button {
  border-radius: 10px;
  min-height: 52px;
  border: 1px solid var(--border);
  padding: 10px 16px;
}
.main-button {
  background: white;
  color: var(--green);
  border: 2px solid var(--green);
  font-weight: 700;
  font-size: 18px;
}
.complete-button {
  width: 100%;
  margin-top: 18px;
  background: var(--green);
  color: white;
  border-color: var(--green);
  font-weight: 700;
}
.storage-note { color: var(--muted); font-size: 13px; margin-top: 24px; }

.toolbar { margin-bottom: 18px; }
.toolbar h2 { margin: 0; font-size: 21px; }

fieldset {
  border: 1px solid var(--border);
  background: white;
  border-radius: 12px;
  padding: 12px;
  margin: 0 0 16px;
}
legend { padding: 0 6px; font-weight: 700; }

.choice-list { display: grid; gap: 8px; }
.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  min-height: 46px;
  background: white;
  cursor: pointer;
  text-align: left;
}
.choice.selected { background: var(--light-green); border-color: var(--green); }
.square {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border: 2px solid #77827e;
  border-radius: 3px;
  display: grid;
  place-items: center;
  background: white;
}
.choice.selected .square { border-color: var(--green); background: var(--green); }
.square::after {
  content: "✓";
  color: white;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  opacity: 0;
}
.choice.selected .square::after { opacity: 1; }

.memo-label { display: block; font-weight: 700; margin: 8px 0; }
textarea {
  display: block;
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: white;
}

.location-box {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  padding: 11px 12px;
  font-size: 13px;
}
.location-title { font-weight: 700; margin-bottom: 3px; }
#locationStatus { color: var(--muted); }

.hidden { display: none !important; }
.after-save {
  margin-top: 18px;
  padding: 14px;
  background: var(--light-green);
  border-radius: 12px;
}
.after-save p { margin-top: 0; }
.two-buttons { display: grid; gap: 10px; }

.view-tabs {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}
.view-tab {
  flex: 0 0 auto;
  min-height: 44px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 9px;
  padding: 8px 14px;
}
.view-tab.active { background: var(--green); color: white; border-color: var(--green); }

.memo-list { display: grid; gap: 10px; }
.memo-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 14px;
}
.memo-meta { font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.memo-category { font-weight: 700; color: var(--green); }
.memo-text { white-space: pre-wrap; word-break: break-word; }
.memo-location {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid #e2e7e5;
  font-size: 12px;
  color: var(--muted);
}
.empty {
  background: white;
  border: 1px dashed var(--border);
  border-radius: 11px;
  padding: 24px 14px;
  text-align: center;
  color: var(--muted);
}

/* 画面最下部に常時表示する共通ナビ */
.bottom-nav {
  position: fixed;
  z-index: 20;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(245,247,246,.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.bottom-nav button {
  min-height: 48px;
  border: 1px solid var(--green);
  border-radius: 9px;
  background: white;
  color: var(--green);
  font-weight: 700;
}

@media (min-width: 600px) {
  .home-buttons { grid-template-columns: repeat(2, 1fr); }
  .two-buttons { grid-template-columns: 1fr; }
}
