/* static/thanks/user.css
   利用者画面（送る・受け取った・ログイン）の見た目。スマホ縦画面が基本、PCでは中央に置く。
   「感謝と和」の輪がモチーフ。3つの行動規範に1色ずつ（朱・若竹・山吹）で、輪・印・カードの縁だけに使う。
   明るく温かい雰囲気にするため、背景は生成りに朝日のようなにじみを置く。 */

:root {
  --bg: #fff8ef;
  --surface: #ffffff;
  --ink: #3a2e28;
  --sub: #8a7b70;
  --line: #f0e2d2;
  --accent: #e2553a;
  --accent-dark: #c8442b;
  --accent-soft: #fde8e1;
  --n1: #d9543b;  --n1-soft: #fceae5;
  --n2: #1f9e74;  --n2-soft: #e3f4ed;
  --n3: #c99300;  --n3-soft: #fbf1d8;
  --ok: #1f7a5a;
  --shadow: 0 6px 24px rgba(160, 110, 70, .10), 0 1px 3px rgba(160, 110, 70, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(120% 60% at 50% -12%, #ffe1c4 0%, rgba(255, 225, 196, 0) 62%),
    radial-gradient(60% 40% at 100% 0%, #fdeae0 0%, rgba(253, 234, 224, 0) 70%),
    var(--bg);
  background-attachment: fixed;
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "BIZ UDPGothic", "Yu Gothic UI", "Meiryo", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  min-height: 100vh;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }

/* ── 輪のマーク：3本の弧（各88）＋すき間。閉じる動きでは弧が伸びてつながる ── */
.ring { display: block; transform: rotate(-90deg); flex: none; }
.ring .arc { fill: none; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 88 212; }
.ring .arc1 { stroke: var(--n1); stroke-dashoffset: 0; }
.ring .arc2 { stroke: var(--n2); stroke-dashoffset: -100; }
.ring .arc3 { stroke: var(--n3); stroke-dashoffset: -200; }
.ring-closing .arc { animation: ring-close 1.2s .3s cubic-bezier(.3, .7, .3, 1) forwards; }
@keyframes ring-close { to { stroke-dasharray: 100.5 199.5; stroke-linecap: butt; } }
@media (prefers-reduced-motion: reduce) {
  .ring-closing .arc { animation: none; stroke-dasharray: 100.5 199.5; }
}

/* ── ヘッダー ── */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: rgba(255, 250, 244, .86);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid rgba(240, 226, 210, .8);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 700; font-size: 17px; letter-spacing: .04em; margin-right: auto; }
.topnav { display: none; gap: 4px; }
.topnav a { position: relative; padding: 6px 14px; border-radius: 999px; text-decoration: none; color: var(--sub); font-weight: 700; font-size: 15px; }
.topnav a.on { background: var(--accent-soft); color: var(--accent-dark); }
.topnav .to-console { border: 1px solid var(--line); font-weight: 500; }
.me { position: relative; }
.me summary {
  list-style: none; cursor: pointer; font-size: 14px; color: var(--sub);
  max-width: 9em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
}
.me summary::-webkit-details-marker { display: none; }
.me-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 170px; padding: 6px;
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--line);
}
.me-menu a, .me-menu button {
  display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none;
  border-radius: 8px; text-decoration: none; font-size: 14px; cursor: pointer;
}
.me-menu a:hover, .me-menu button:hover { background: var(--bg); }
.anon { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.anon-tag { padding: 3px 10px; border-radius: 999px; background: var(--n3-soft); color: #7a5a00; font-weight: 700; }
.anon a { color: var(--sub); }

.page { max-width: 560px; margin: 0 auto; padding: 8px 16px 32px; }

/* ── 見出し ── */
.hero { text-align: center; padding: 26px 0 18px; }
.hero h1 { margin: 0; font-size: 23px; letter-spacing: .06em; }
.hero p { margin: 6px 0 0; color: var(--sub); }
.hero-small { padding: 18px 0 12px; }
.hero-small h1 { font-size: 20px; }

/* ── 入力のまとまり（白い紙） ── */
.sheet {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 8px 18px 22px;
}
.step { padding: 18px 0 6px; border-bottom: 1px dashed var(--line); }
.step:last-of-type { border-bottom: 0; }
.step h2 { display: flex; align-items: center; gap: 10px; font-size: 16px; margin: 0 0 12px; letter-spacing: .04em; }
.num {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--accent); color: var(--accent); font-size: 13px; font-weight: 700;
}
label.field { display: block; font-weight: 700; margin: 18px 0 8px; font-size: 15px; }
.hint { font-weight: 400; font-size: 12px; color: var(--sub); margin-left: 4px; }
.input, textarea, select {
  width: 100%; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  background: #fffdfa; font-size: 16px; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 150px; line-height: 1.7; }
.input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.errorlist { list-style: none; padding: 0; margin: 8px 0 0; color: var(--accent-dark); font-size: 14px; font-weight: 700; }
.counter { text-align: right; font-size: 12px; color: var(--sub); margin-top: 4px; }

/* ── 相手の検索 ── */
.search-row { display: grid; grid-template-columns: minmax(0, 40%) 1fr; gap: 8px; }
.results { list-style: none; padding: 0; margin: 10px 0 0; max-height: 320px; overflow: auto; border-radius: 12px; }
.results:empty { display: none; }
.finder-hint { margin: 8px 2px 0; font-size: 13px; color: var(--sub); }
.input:disabled { background: #f7f2ec; color: var(--sub); }
.results li button {
  width: 100%; text-align: left; padding: 11px 14px; background: #fffdfa; border: 0;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.results li button:hover { background: var(--accent-soft); }
.results .nm { font-weight: 700; }
.results .meta { display: block; color: var(--sub); font-size: 12px; }
.picked {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
  background: var(--accent-soft);
}
.avatar {
  flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); color: var(--accent-dark); font-weight: 700; font-size: 18px;
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--accent);
}
.who-text { flex: 1; min-width: 0; }
.who-text .nm { font-weight: 700; font-size: 17px; }
.who-text .meta { display: block; color: var(--sub); font-size: 12px; }
.linkish { background: none; border: 0; color: var(--accent-dark); text-decoration: underline; cursor: pointer; font-size: 14px; flex: none; }

/* ── 行動規範（3色の輪の印つき） ── */
.norms { display: grid; gap: 10px; }
.norm {
  position: relative; display: flex; gap: 12px; align-items: center; padding: 14px 14px; border-radius: 14px;
  background: #fffdfa; border: 1.5px solid var(--line); cursor: pointer; font-weight: 700; line-height: 1.55;
  transition: background .15s, border-color .15s;
}
.norm input { position: absolute; opacity: 0; pointer-events: none; }
.norm-mark { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 5px solid var(--mark, var(--n1)); background: var(--surface); }
.norm-1 { --mark: var(--n1); --mark-soft: var(--n1-soft); }
.norm-2 { --mark: var(--n2); --mark-soft: var(--n2-soft); }
.norm-3 { --mark: var(--n3); --mark-soft: var(--n3-soft); }
.norm:has(input:checked) { background: var(--mark-soft); border-color: var(--mark); }
.norm:has(input:checked) .norm-mark { background: var(--mark); box-shadow: inset 0 0 0 3px #fff; }
.norm:has(input:focus-visible) { box-shadow: 0 0 0 4px var(--accent-soft); }

.choices { display: grid; gap: 8px; }
.choice { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.choice input { margin-top: 6px; accent-color: var(--accent); width: 18px; height: 18px; }

/* ── ボタン ── */
.btn {
  display: block; width: 100%; padding: 15px; margin-top: 20px; border: 0; border-radius: 999px;
  background: linear-gradient(180deg, #ec6a4f, var(--accent));
  color: #fff; font-weight: 700; font-size: 17px; letter-spacing: .08em;
  text-align: center; text-decoration: none; cursor: pointer;
  box-shadow: 0 6px 16px rgba(226, 85, 58, .28);
  transition: transform .1s, box-shadow .1s;
}
.btn:active { transform: translateY(1px); box-shadow: 0 3px 8px rgba(226, 85, 58, .28); }
.btn:disabled { opacity: .6; }
.btn-ghost { background: var(--surface); color: var(--ink); box-shadow: none; border: 1.5px solid var(--line); }
.btn-row { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; }

/* ── カード（手紙） ── */
.letter {
  position: relative; display: block; background: var(--surface); border-radius: var(--radius);
  box-shadow: inset 0 6px 0 var(--mark, var(--n1)), var(--shadow); padding: 24px 20px 18px; text-decoration: none;
}
.letter-ring { position: absolute; right: 16px; top: 16px; opacity: .9; }
.letter .to { font-size: 19px; font-weight: 700; padding-right: 54px; }
.to-sub { display: block; font-size: 12px; color: var(--sub); font-weight: 400; }
.letter-norm { display: flex; align-items: center; gap: 8px; margin: 14px 0 0; color: var(--sub); font-size: 14px; font-weight: 700; }
.letter-norm .norm-mark { width: 16px; height: 16px; border-width: 4px; }
.letter-norm.small { margin-top: 6px; font-size: 13px; }
.letter-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 12px 0 0; font-size: 16px; line-height: 1.9; }
.letter .from { margin-top: 18px; text-align: right; font-weight: 700; }
.letter .date { display: block; font-size: 12px; color: var(--sub); font-weight: 400; }
.letters { display: grid; gap: 14px; }
.letter-link { padding: 18px 18px 16px; transition: transform .12s; }
.letter-link:hover { transform: translateY(-2px); }
.letter-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.letter-head .from-top { font-weight: 700; }
.letter-head .date { font-size: 12px; color: var(--sub); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 6px; font-size: 15px; }
.letter.unread .from-top::after {
  content: "NEW"; margin-left: 8px; font-size: 10px; letter-spacing: .08em; padding: 2px 7px;
  border-radius: 999px; background: var(--accent); color: #fff; vertical-align: 2px;
}
.note { text-align: center; color: var(--sub); font-size: 13px; margin: 12px 0 0; }
.back { display: inline-block; margin: 14px 0 12px; color: var(--sub); text-decoration: none; font-size: 14px; }
.share-box { margin-top: 18px; padding: 16px 18px; border-radius: var(--radius); background: rgba(255, 255, 255, .6); border: 1.5px dashed var(--line); }
.share-box h2 { margin: 0 0 6px; font-size: 15px; }
.share-box p { margin: 0; font-size: 14px; color: var(--sub); }
.share-box .ok { color: var(--ok); font-weight: 700; margin-top: 8px; }

/* ── 完了・空 ── */
.done { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 48px 0 12px; }
.done h1 { margin: 22px 0 4px; font-size: 24px; letter-spacing: .1em; }
.done p { margin: 0; color: var(--sub); }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; color: var(--sub); padding: 40px 0; }
.empty .ring { opacity: .6; margin-bottom: 10px; }
.empty .btn { max-width: 320px; }

/* ── メッセージ ── */
.flash { list-style: none; padding: 0; margin: 12px 0; }
.flash li { padding: 11px 14px; border-radius: 12px; background: var(--n2-soft); color: var(--ok); margin-bottom: 6px; font-size: 14px; font-weight: 700; }
.flash .flash-warning, .flash .flash-error { background: var(--n3-soft); color: #7a5a00; }

/* ── 下のタブ（スマホ） ── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: 1fr 1fr;
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 4px 10px; text-decoration: none; font-size: 12px; font-weight: 700; color: var(--sub);
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.tabbar a.on { color: var(--accent); }
.dot-badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px;
  border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; line-height: 1;
}
.tabbar .dot-badge { position: absolute; top: 4px; left: calc(50% + 8px); margin: 0; }

/* ── ログイン ── */
.login-body { padding-bottom: 0; }
.login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; max-width: 400px; margin: 0 auto; padding: 24px 0; }
.login-mark { display: flex; justify-content: center; }
.login h1 { text-align: center; font-size: 24px; letter-spacing: .1em; margin: 18px 0 0; }
.login-lead { text-align: center; color: var(--sub); margin: 4px 0 20px; }
.login .sheet { padding-top: 4px; }

/* ── PC：ナビをヘッダーへ、下のタブは消す ── */
@media (min-width: 860px) {
  body { padding-bottom: 32px; }
  .tabbar { display: none; }
  .topnav { display: flex; }
  .top { padding: 12px 28px; }
  .page { padding-top: 16px; }
  .hero { padding-top: 40px; }
  .hero h1 { font-size: 27px; }
  .sheet { padding: 10px 28px 28px; }
}
