/* 送り手の画面(ログイン・登録・マイページ・中身の編集)と「準備中」などのお知らせ画面の見た目。
   色は開封ページ(/s/style.css)と同じ。 */
:root {
  color-scheme: light;
  --bg: #f6efe6;
  --bg-deep: #efe3d4;
  --ink: #3d2f2a;
  --muted: #7d685d;
  --line: #e4d6c6;
  --paper: #fffaf3;
  --accent: #b5473f;
  --accent-ink: #fff;
  --ok: #3f6b4a;
  --warn: #9a5b12;
  --font-hand: "Klee One", "Hiragino Mincho ProN", serif;
  --font-ui: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body.ui {
  min-height: 100svh;
  background: radial-gradient(120% 80% at 50% 0%, #fbf6ef 0%, var(--bg) 55%, var(--bg-deep) 100%);
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 480px; margin: 0 auto; padding: 28px 16px 64px; }
.brand-top { margin: 0 0 18px; text-align: center; letter-spacing: .1em; font-size: 14px; color: var(--muted); }
.brand-top a { color: inherit; text-decoration: none; }
h1.title { font-family: var(--font-hand); font-weight: 600; font-size: 24px; line-height: 1.6; margin: 0 0 12px; text-align: center; }
h2.sub { font-size: 16px; margin: 0 0 10px; }
p { margin: 0 0 12px; }
.lead { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
a { color: var(--accent); }

.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px; margin: 16px 0; box-shadow: 0 6px 20px rgba(90, 60, 40, .06);
}

/* 入力 */
.field { margin: 0 0 18px; }
.field > label, .field > .label { display: block; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.field .hint { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.6; }
input[type="text"], input[type="email"], textarea {
  width: 100%; border: 1px solid #d9c7b3; border-radius: 10px; padding: 12px 14px;
  font: 17px/1.6 var(--font-ui); color: var(--ink); background: #fff;
}
textarea { resize: vertical; min-height: 9em; font-family: var(--font-hand); line-height: 1.9; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
input.code {
  font: 600 22px/1.4 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .12em; text-align: center; text-transform: uppercase;
}

/* ボタン */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 50px; padding: 12px 24px; border-radius: 999px; border: 0;
  background: var(--accent); color: var(--accent-ink); font: 700 16px var(--font-ui);
  text-decoration: none; cursor: pointer;
}
.btn.block { display: flex; width: 100%; }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid #d9c7b3; }
.btn.ghost { background: transparent; color: var(--accent); min-height: 40px; padding: 8px 12px; }
.btn.small { min-height: 40px; padding: 8px 16px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip {
  border: 1px solid #d9c7b3; background: #fff; color: var(--ink); border-radius: 999px;
  padding: 6px 12px; font: 14px var(--font-ui); cursor: pointer;
}

/* お知らせ */
.notice { border-radius: 10px; padding: 12px 14px; font-size: 15px; line-height: 1.7; margin: 12px 0; }
.notice.ok { background: #e8f0e7; color: #2c4a33; }
.notice.err { background: #f8e4e0; color: #7a2a22; }
.notice.info { background: #f3ead9; color: #5a4636; }
.dev-note { font-size: 12px; color: var(--muted); border: 1px dashed #cdb9a3; border-radius: 8px; padding: 8px 10px; margin-top: 18px; }

.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: #efe3d4; color: var(--muted); }
.pill.live { background: #e3eee1; color: var(--ok); }
.pill.draft { background: #f6e9d2; color: var(--warn); }
.pill.expired { background: #ece7e3; color: #7a706a; }

/* マイページ */
.top-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.set-title { display: flex; justify-content: space-between; align-items: baseline; margin: 28px 0 4px; font-size: 14px; color: var(--muted); }
.seal-item { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 10px 0; }
.seal-item-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.seal-dot { width: 26px; height: 26px; border-radius: 50%; flex: none; box-shadow: inset -3px -3px 6px rgba(0,0,0,.25), inset 2px 2px 4px rgba(255,255,255,.25); }
.seal-item-name { font-weight: 700; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.seal-item p { margin: 2px 0; font-size: 14px; }
.replies { margin: 10px 0 0; padding: 0; list-style: none; }
.replies li { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 8px; font-size: 15px; }
.replies time { display: block; font-size: 12px; color: var(--muted); }
.seal-item .btn { margin-top: 10px; }

/* 「準備中」「期限切れ」など(開封ページの中で使う) */
.message-page { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; text-align: center; padding: 40px 8px; }
.message-page .title { margin-bottom: 14px; }
.message-page .owner-link { margin-top: 48px; font-size: 13px; color: var(--muted); }
.message-page .owner-link a { color: var(--muted); }
.mini-seal { width: 64px; height: 64px; margin: 0 auto 18px; opacity: .9; }

/* ---------- 中身の登録・編集(/s/{id} を持ち主が開いたとき) ---------- */
.editor { padding: 24px 0 24px; font-size: 16px; line-height: 1.8; }
.editor .title { text-align: center; }
.editor-status {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 8px 0 4px;
}
.editor-status .status-text { flex: 1 1 100%; font-size: 14px; line-height: 1.7; }
.ed-section { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 18px 16px; margin: 14px 0; }
.ed-section .hint { font-size: 13px; color: var(--muted); margin: -4px 0 10px; }
.ed-section.ed-info { background: transparent; border-style: dashed; }
.ed-section.ed-info p { margin: 0 0 6px; }
.ed-lead { margin: 16px 4px 0; font-size: 15px; color: var(--muted); text-align: center; line-height: 1.7; }
h2.sub .sub-note { font-weight: 400; font-size: 13px; color: var(--muted); margin-left: 4px; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 0; background: none; padding: 2px; cursor: pointer; font: 12px var(--font-ui); color: var(--muted);
}
.swatch::before {
  content: ""; width: 40px; height: 40px; border-radius: 50%; background: var(--c);
  box-shadow: inset -4px -4px 8px rgba(0,0,0,.28), inset 3px 3px 5px rgba(255,255,255,.25);
  outline: 3px solid transparent; outline-offset: 2px;
}
.swatch[aria-checked="true"]::before { outline-color: var(--ink); }
.swatch[aria-checked="true"] { color: var(--ink); font-weight: 700; }

.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.photo-grid:empty { display: none; }
.thumb { position: relative; margin: 0; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #efe3d4; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.uploading { display: flex; align-items: center; padding: 0 10px; }
.thumb-del {
  position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: rgba(40, 30, 25, .7); color: #fff; font-size: 18px; line-height: 1; cursor: pointer;
}
.progress { width: 100%; height: 8px; border-radius: 99px; background: #e9dccb; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.media-box { margin-bottom: 10px; }
.media-box:empty { display: none; }
.media-box video { display: block; width: 100%; max-height: 60vh; border-radius: 8px; background: #2b211d; }
.media-box audio { display: block; width: 100%; }
.media-msg { font-size: 14px; border-radius: 8px; padding: 8px 10px; }
.media-msg.err { background: #f8e4e0; color: #7a2a22; }
.media-msg.info { background: #f3ead9; color: #5a4636; }
.rec-state { color: #b3261e; font-weight: 700; font-variant-numeric: tabular-nums; }
.btn.recording { background: #b3261e; color: #fff; border-color: transparent; }
.btn-row.inline > .btn { flex: 0 1 auto; }
label.btn { user-select: none; }

.action-bar {
  position: sticky; bottom: 0; z-index: 20;
  margin: 18px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(246, 239, 230, .96); border-top: 1px solid var(--line);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; flex-direction: column; gap: 8px;
}
.action-bar .dirty { margin: 0; font-size: 13px; color: var(--warn); text-align: center; }
.action-bar .btn.ghost { align-self: center; }
.editor.is-expired .ed-section { opacity: .6; }

/* プレビュー中の帯 */
.preview-bar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 16px; background: #3d2f2a; color: #fff; font: 700 13px var(--font-ui);
}
.preview-bar .btn { min-height: 36px; }

.loading { min-height: 100svh; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; letter-spacing: .1em; margin: 0; }
.field .chips + .hint { margin-top: 8px; }
