:root {
  --sand: #F5EFE4;
  --paper: #FFFDF8;
  --ink: #1E2733;
  --ink-2: #3A4553;
  --muted: #5A6472;
  --line: #E4DACA;
  --line-strong: #C9BCA7;
  --sea: #1F5F7A;
  --sea-dark: #174A60;
  --sea-soft: #DCE8EC;
  --coral: #B8472F;
  --coral-soft: #F6E3DD;
  --coral-ink: #8E3522;
  --photo-bg: #CDB08A;
  --serif: 'Zen Old Mincho', serif;
  --sans: 'Zen Kaku Gothic New', system-ui, sans-serif;
  --tabbar-h: calc(62px + env(safe-area-inset-bottom));
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--sand);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--sea); }
a:hover { color: var(--sea-dark); }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--sea); outline-offset: 2px; }

/* ---------- 画面の枠 ---------- */
.screen {
  max-width: 440px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 16px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.screen--tabbed { padding-bottom: calc(var(--tabbar-h) + 24px); }
.screen--center { align-items: center; text-align: center; padding-top: 96px; }
.screen--onboarding { align-items: center; padding-top: 64px; gap: 24px; }
.loading { min-height: 100dvh; display: grid; place-items: center; color: var(--muted); }

.stack { display: flex; flex-direction: column; gap: 16px; }
.stack--s { gap: 10px; }
.stack--xs { gap: 4px; }
.spacer { flex-grow: 1; }
.center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }

/* ---------- 文字 ---------- */
.logo { font-family: var(--serif); font-size: 20px; font-weight: 700; letter-spacing: .08em; margin: 0; }
.logo--large { font-size: 36px; letter-spacing: .12em; }
.title { margin: 0; font-family: var(--serif); font-size: 22px; font-weight: 700; line-height: 1.5; }
.title--l { font-size: 22px; }
#received-title { font-size: 20px; }
.lead { margin: 0; font-size: 15px; line-height: 1.9; text-align: center; color: var(--ink-2); }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.6; }
.strong { font-weight: 700; }
.sea-text { color: var(--sea-dark); }
.eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .1em; color: var(--muted); }
.eyebrow--left { color: var(--ink-2); }
.fineprint { margin: 0; font-size: 12px; line-height: 1.7; color: var(--muted); text-align: center; }
.drift { font-family: var(--serif); font-weight: 700; color: var(--sea); }
.drift--l { font-size: 40px; line-height: 1.2; }
.drift--m { font-size: 22px; }
.drift--s { font-size: 17px; }

/* ---------- ヘッダー ---------- */
.topbar { min-height: 56px; display: flex; align-items: center; justify-content: space-between; }
.topbar--back { justify-content: flex-start; gap: 8px; }
.topbar--back .icon-btn { margin-left: -10px; }
.topbar__title { margin: 0; font-size: 17px; font-weight: 700; }

/* ---------- ボタン ---------- */
.btn {
  min-height: 56px; width: 100%;
  padding: 0 20px;
  border: none; border-radius: 28px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 16px; font-weight: 700; text-decoration: none;
}
.btn--primary { background: var(--sea); color: #fff; }
.btn--primary:hover { background: var(--sea-dark); color: #fff; }
.btn--danger { background: var(--coral); color: #fff; min-height: 52px; }
.btn--outline { background: transparent; border: 1px solid var(--line-strong); color: var(--ink); font-weight: 400; }
.btn--text { background: transparent; color: var(--ink-2); font-weight: 400; min-height: 44px; }
.btn--small { min-height: 44px; width: auto; align-self: center; font-size: 14px; }
.btn--m { min-height: 48px; font-size: 15px; }
.icon-btn {
  width: 44px; height: 44px; border: none; border-radius: 22px;
  background: transparent; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn--float { position: absolute; top: 10px; right: 10px; background: var(--paper); }

/* ---------- カード・行 ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; }
.row {
  padding: 12px 14px; display: flex; align-items: center; gap: 14px;
  text-decoration: none; color: var(--ink); list-style: none;
}
.row--sea { background: var(--sea-soft); border-radius: 16px; }
.thumb { width: 56px; height: 56px; flex-shrink: 0; border-radius: 12px; object-fit: cover; background: var(--photo-bg); }
.thumb--s { width: 48px; height: 48px; border-radius: 10px; }
.thumb--l { width: 64px; height: 64px; }
.chip {
  align-self: flex-start;
  padding: 4px 12px; border-radius: 14px;
  background: var(--coral-soft); color: var(--coral-ink);
  font-size: 12px; font-weight: 700;
}
.empty { margin: 0; padding: 28px 16px; text-align: center; line-height: 1.8; color: var(--ink-2); }

/* ---------- 浜辺 ---------- */
.sea { height: 240px; border-radius: 24px; background: var(--sea-soft); overflow: hidden; display: flex; align-items: flex-end; }
.sea svg { width: 100%; height: 100%; }
.dish-card { padding: 0; overflow: hidden; text-align: left; width: 100%; }
.dish-card__img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--photo-bg); }
.dish-card__body { padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dish-card .chip { align-self: center; }

/* ---------- 初回説明 ---------- */
.onboarding__art { width: 220px; height: 160px; }
.steps { margin: 0; padding: 20px; list-style: none; width: 100%; display: flex; flex-direction: column; gap: 14px; font-size: 14px; }
.steps li { display: flex; align-items: center; gap: 12px; }
.steps__num {
  width: 28px; height: 28px; flex-shrink: 0; border-radius: 14px;
  background: var(--sea); color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- 写真 ---------- */
.photo-wrap { position: relative; }
.photo { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 20px; background: var(--photo-bg); }
.checklist { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.checklist__title { margin: 0; font-size: 14px; font-weight: 700; }
.checklist p { margin: 0; display: flex; gap: 10px; font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.checklist svg { flex-shrink: 0; margin-top: 2px; }

/* ---------- 判定中 ---------- */
.screen--drifting {
  max-width: none; background: var(--sea); color: #fff;
  align-items: center; justify-content: center; gap: 28px; text-align: center;
}
.drifting__art { width: min(326px, 100%); }
.drifting__title { margin: 0; font-family: var(--serif); font-size: 26px; letter-spacing: .08em; }
.drifting__text { margin: 0; font-size: 14px; line-height: 1.7; color: var(--sea-soft); }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }
.bob { animation: bob 2.4s ease-in-out infinite; transform-origin: 170px 150px; }
@media (prefers-reduced-motion: reduce) { .bob { animation: none; } }

/* ---------- 漂着・スタンプ ---------- */
.stamps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stamp {
  min-height: 44px; border: 1px solid var(--line-strong); border-radius: 22px;
  background: var(--paper); font-size: 14px;
}
.stamp[aria-pressed="true"] { background: var(--coral); border-color: var(--coral); color: #fff; font-weight: 700; opacity: 1; }
.reject-mark {
  width: 64px; height: 64px; border-radius: 32px;
  border: 2px solid var(--coral); color: var(--coral); background: var(--paper);
  display: flex; align-items: center; justify-content: center;
}

/* ---------- 記録 ---------- */
.segmented {
  padding: 4px; min-height: 44px; border-radius: 22px; background: #E9E0D1;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px;
}
.segmented button { border: none; border-radius: 18px; background: transparent; color: #4A5563; font-size: 14px; }
.segmented button[aria-selected="true"] { background: var(--paper); color: var(--ink); font-weight: 700; }
.banner { padding: 14px 16px; border-radius: 16px; background: var(--sea); color: #fff; display: flex; flex-direction: column; gap: 10px; }
.banner p { margin: 0; font-size: 13px; line-height: 1.7; }
.banner__btn {
  align-self: flex-start; padding: 8px 16px; border-radius: 18px;
  background: var(--paper); color: var(--sea-dark); font-size: 13px; font-weight: 700; text-decoration: none;
}
.list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.grid { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile { width: 100%; padding: 0; overflow: hidden; text-align: left; display: flex; flex-direction: column; }
.tile__img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--photo-bg); }
.tile__body { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }

/* ---------- 設定 ---------- */
.card.stack { padding: 18px; }
.menu { display: flex; flex-direction: column; overflow: hidden; }
.menu a { min-height: 52px; padding: 0 18px; display: flex; align-items: center; color: var(--ink); text-decoration: none; border-bottom: 1px solid #EFE7DA; }
.menu a:last-child { border-bottom: none; }

/* ---------- タブバー ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: var(--tabbar-h); padding-bottom: env(safe-area-inset-bottom);
  background: var(--paper); border-top: 1px solid var(--line);
  display: flex; justify-content: center;
}
.tabbar a {
  flex: 1; max-width: 220px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: #6B7482; font-size: 11px;
}
.tabbar a[aria-current="page"] { color: var(--sea); font-weight: 700; }

/* ---------- 報告シート ---------- */
.sheet {
  width: 100%; max-width: 440px; margin: auto auto 0;
  padding: 12px 24px calc(28px + env(safe-area-inset-bottom));
  border: none; border-radius: 24px 24px 0 0; background: var(--paper); color: var(--ink);
}
.sheet::backdrop { background: rgba(20, 26, 34, .55); }
.sheet form { display: flex; flex-direction: column; gap: 14px; }
.sheet__handle { align-self: center; width: 40px; height: 4px; border-radius: 2px; background: #D6CBB8; }
.sheet__title { margin: 0; font-size: 18px; }
.reasons { margin: 0; padding: 0; border: none; display: flex; flex-direction: column; gap: 8px; }
.reasons label {
  min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px;
  display: flex; align-items: center; gap: 12px; font-size: 14px;
}
.reasons label:has(input:checked) { border: 2px solid var(--coral); }
.reasons input { width: 18px; height: 18px; margin: 0; accent-color: var(--coral); }

/* ---------- トースト ---------- */
.toast {
  position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top)); transform: translateX(-50%);
  box-shadow: 0 4px 16px rgba(20, 26, 34, .18);
  width: max-content; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px;
  background: var(--ink); color: #fff; font-size: 14px; z-index: 10;
}

/* ---------- 規約・ポリシーなどの文書ページ ---------- */
.doc { max-width: 680px; margin: 0 auto; padding: 16px 24px 64px; line-height: 1.9; font-size: 15px; }
.doc__back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; margin-left: -8px; padding: 0 8px; color: var(--ink); text-decoration: none; font-size: 14px; }
.doc h1 { margin: 8px 0 4px; font-family: var(--serif); font-size: 26px; line-height: 1.5; }
.doc h2 { margin: 32px 0 8px; font-size: 17px; }
.doc h3 { margin: 20px 0 4px; font-size: 15px; }
.doc p, .doc ul, .doc ol { margin: 8px 0; }
.doc ul, .doc ol { padding-left: 1.4em; }
.doc li + li { margin-top: 4px; }
.doc .muted { font-size: 13px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0; }
.doc th, .doc td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.doc th { font-weight: 700; white-space: nowrap; }
.doc__footer { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.doc .license { margin: 8px 0; padding: 12px 14px; overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; font-size: 12px; line-height: 1.6; white-space: pre-wrap; }
.doc .btn { margin: 16px 0; }

/* ---------- ログイン導線 ---------- */
.btn--login { margin-top: -8px; font-size: 14px; }
.underline { text-decoration: underline; text-underline-offset: 3px; color: var(--sea); font-weight: 700; }
