/*
 * 公開ページ(箱・回答)共通。アプリ(Flutter)の theme/tokens.dart と同じ値を使う。
 * Xのアプリ内ブラウザで即表示できるよう、外部フォント・画像・ライブラリは使わない。
 * ライトモードを基準にする(ダークモードは後で対応)。
 */
:root {
  --brand: #3355ff;
  --brand-soft: #ebefff;
  --bg: #ffffff;
  --surface: #f5f6f8;
  --surface-strong: #eceef1;
  --text: #15171a;
  --text-sub: #6b7280;
  --text-hint: #a0a6b0;
  --danger: #e5484d;
  --success: #12a150;
  --card: #ffffff;
  --line: #eceef1;
  --shadow: rgba(21, 23, 26, .12);
  --flash-error-bg: #fdecec;
  --flash-error-text: #b42318;
  --doc-text: #374151;
  color-scheme: light dark;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

/* ダークモード(端末の設定に合わせる)。色は変数だけで切り替える */
@media (prefers-color-scheme: dark) {
  :root {
  --brand: #6680ff;
  --brand-dark: #4d68f0;
  --brand-soft: #1e2546;
  --bg: #111316;
  --surface: #1c1f23;
  --surface-strong: #2a2e34;
  --text: #ecedef;
  --text-sub: #a0a6b0;
  --text-hint: #6b717b;
  --danger: #ff6b6f;
  --success: #3dd68c;
  --card: #24282d;
  --line: #2a2e34;
  --shadow: rgba(0, 0, 0, .45);
    --flash-error-bg: #3a1d1f;
    --flash-error-text: #ff9a9c;
    --doc-text: #c9ccd1;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}
a { color: var(--brand); }
.page { max-width: 520px; margin: 0 auto; padding: 20px 20px 40px; min-height: 100vh; display: flex; flex-direction: column; }
.brand { display: inline-flex; align-items: center; gap: 6px; color: var(--text-sub); font-size: 13px; font-weight: 700; text-decoration: none; }
.brand .logo-mark { width: 22px; height: 22px; }

/* 箱の見出し */
.box-head { margin: 28px 0 20px; }
.box-owner { margin: 0 0 4px; font-size: 14px; font-weight: 700; color: var(--brand); word-break: break-all; }
.box-name { margin: 0; font-size: 26px; line-height: 1.35; font-weight: 800; word-break: break-word; }
.box-desc { margin: 10px 0 0; color: var(--text-sub); word-break: break-word; }
.box-meta { margin: 8px 0 0; font-size: 13px; color: var(--text-sub); }

/* フォーム */
.post-form textarea {
  display: block; width: 100%; min-height: 168px; padding: 16px; border: 0; border-radius: var(--radius-md);
  background: var(--surface); color: var(--text); font: inherit; font-size: 17px; line-height: 1.7; resize: vertical;
  outline: none; transition: box-shadow .15s ease, transform .35s cubic-bezier(.5,0,.8,.3), opacity .35s ease;
}
.post-form textarea:focus { box-shadow: 0 0 0 2px var(--brand); }
.post-form textarea::placeholder { color: var(--text-hint); }
.count { margin: 6px 2px 16px; text-align: right; font-size: 12px; color: var(--text-hint); }
.button {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 56px; border: 0;
  border-radius: var(--radius-md); background: var(--brand); color: #fff; font: inherit; font-size: 16px; font-weight: 700;
  letter-spacing: .03em; text-decoration: none; cursor: pointer; transition: transform .1s ease, opacity .15s ease;
}
.button:active { transform: scale(.98); }
.button:disabled { opacity: .5; cursor: default; }
.button.secondary { background: var(--surface); color: var(--text); }
.notes { margin: 16px 2px 0; padding: 0; list-style: none; }
.notes li { font-size: 12px; color: var(--text-hint); line-height: 1.7; }
.cf-turnstile { margin: 0 0 12px; }

/* お知らせ */
.flash { margin: 0 0 16px; padding: 12px 14px; border-radius: var(--radius-md); font-size: 14px; }
.flash.error { background: var(--flash-error-bg); color: var(--flash-error-text); }
.closed { padding: 28px 16px; border-radius: var(--radius-lg); background: var(--surface); text-align: center; color: var(--text-sub); }
.closed strong { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }

/* 投函の演出: 書いた紙が小さくなって箱へ入る(約0.4秒) */
.post-form.is-posting textarea { transform: translateY(40px) scale(.2); opacity: 0; }
.post-form.is-posting .button { opacity: .6; }

/* 投函しました */
.done { margin-top: 36px; text-align: center; }
.done-art { width: 120px; height: 120px; margin: 0 auto 8px; }
.done-art .letter { animation: drop .55s cubic-bezier(.5,0,.75,0) both; transform-origin: center; }
.done-art .lid { animation: bump .25s ease-out .5s both; transform-origin: 60px 64px; }
.done h1 { margin: 8px 0 6px; font-size: 24px; font-weight: 800; animation: rise .35s ease-out .45s both; }
.done p { margin: 0 0 28px; color: var(--text-sub); animation: rise .35s ease-out .55s both; }
@keyframes drop { 0% { transform: translateY(-46px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(14px); opacity: 0; } }
@keyframes bump { 0% { transform: scaleY(1); } 50% { transform: scaleY(.9); } 100% { transform: scaleY(1); } }
@keyframes rise { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* 返事ページ: 1通のメッセージと、それへの返事(会話ではない) */
.qa { margin: 4px 0 28px; }
.qa-card { padding: 22px 20px; border-radius: var(--radius-lg); background: var(--surface); }
.qa-label { margin: 0 0 8px; font-size: 12px; font-weight: 700; color: var(--text-sub); letter-spacing: .04em; }
.qa-message { font-size: 18px; line-height: 1.75; font-weight: 600; word-break: break-word; }
.qa-reply { margin-top: 22px; padding: 2px 0 2px 16px; border-left: 3px solid var(--brand); }
.qa-reply .qa-label { color: var(--brand); }
.qa-reply-body { font-size: 17px; line-height: 1.8; word-break: break-word; }

.foot { margin-top: auto; padding-top: 40px; text-align: center; font-size: 12px; color: var(--text-hint); }
.foot a { color: var(--text-sub); font-weight: 700; text-decoration: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* 利用規約・プライバシーポリシー */
.doc { line-height: 1.85; }
.doc h1 { margin: 28px 0 12px; font-size: 24px; font-weight: 800; }
.doc h2 { margin: 32px 0 8px; font-size: 17px; font-weight: 800; }
.doc h3 { margin: 18px 0 6px; font-size: 15px; font-weight: 700; }
.doc p, .doc li { font-size: 14.5px; color: var(--doc-text); }
.doc ol, .doc ul { padding-left: 1.4em; }
.doc li { margin: 4px 0; }
.doc-date { margin-top: 28px; font-size: 13px; color: var(--text-sub); }
.legal { display: flex; justify-content: center; gap: 16px; padding-top: 12px; font-size: 12px; }
.legal a { color: var(--text-hint); text-decoration: none; }
.legal a:hover { text-decoration: underline; }

/* 通報フォーム */
.report-form fieldset { margin: 16px 0; padding: 0; border: 0; display: grid; gap: 8px; }
.choice { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: var(--radius-md); background: var(--surface); font-size: 15px; cursor: pointer; }
.choice input { accent-color: var(--brand); width: 18px; height: 18px; }
.report-form textarea { display: block; width: 100%; min-height: 96px; margin: 0 0 16px; padding: 14px 16px; border: 0; border-radius: var(--radius-md); background: var(--surface); font: inherit; font-size: 15px; }
.report-link { display: inline-block; margin-top: 18px; font-size: 12px; color: var(--text-hint); text-decoration: none; }
.report-link:hover { text-decoration: underline; }
