/* momo Web 版。スマホの縦画面を基本に、PC のブラウザでも読みやすい幅に収める。 */

:root {
  --bg: #fbf7f4;
  --surface: #ffffff;
  --text: #2b2624;
  --muted: #8a807b;
  --line: #ece4df;
  --accent: #e0736b;
  --accent-text: #ffffff;
  --focus: #3aa6c9;
  --error-bg: #fdecea;
  --error-text: #a3302a;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1a19;
    --surface: #262322;
    --text: #ece6e2;
    --muted: #a0958f;
    --line: #3a3533;
    --accent: #e8847c;
    --accent-text: #1c1a19;
    --focus: #5cc3e3;
    --error-bg: #3d2422;
    --error-text: #f3a39d;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 16px; /* 16px 未満だと iPhone が入力欄を拡大してしまう */
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

button,
.button {
  font: inherit;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 14px;
  min-height: 40px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:disabled,
.button.disabled {
  opacity: 0.45;
  cursor: default;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

button.danger {
  color: var(--error-text);
}

button.icon {
  padding: 4px 10px;
  min-height: 34px;
  font-size: 14px;
}

.app,
.setup {
  max-width: 720px;
  margin: 0 auto;
}

/* ---- ヘッダ ---- */

.header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.header h1 {
  margin: 0;
  font-size: 20px;
  color: var(--accent);
}

.status {
  flex: 1;
  color: var(--muted);
  font-size: 13px;
}

.settings {
  padding: 8px 16px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.settings p {
  margin: 4px 0;
}

/* ---- 投稿欄 ---- */

.composer {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.draft {
  display: block;
  width: 100%;
  min-height: 96px;
  resize: vertical;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

.draft:focus {
  outline: none;
  border-color: var(--focus);
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.actions input[type="file"] {
  display: none;
}

.post-status {
  flex: 1;
  color: var(--muted);
  font-size: 13px;
}

.photos {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  overflow-x: auto;
}

.photo {
  position: relative;
  flex: none;
}

.photo img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.photo .remove {
  position: absolute;
  top: -6px;
  right: -6px;
  min-height: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
}

.error {
  margin: 8px 0 0;
  color: var(--error-text);
  font-size: 14px;
}

.banner {
  margin: 0;
  padding: 8px 16px;
  font-size: 14px;
}

.banner.error {
  background: var(--error-bg);
}

/* ---- タイムライン（横幅いっぱいの 1 列。カードの間に線を 1 本） ---- */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.card {
  padding: 10px 16px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  overflow-wrap: anywhere;
}

.card:active {
  background: var(--surface);
}

.meta {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.pin {
  color: var(--accent);
  font-weight: 600;
}

.body .line {
  white-space: pre-wrap;
}

.more {
  color: var(--muted);
}

/* ---- 全文 ---- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 3;
  background: rgb(0 0 0 / 0.4);
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.sheet {
  width: 100%;
  max-width: 720px;
  max-height: calc(100% - env(safe-area-inset-top) - 24px);
  overflow-y: auto;
  background: var(--bg);
  border-radius: 14px 14px 0 0;
  padding: 0 16px calc(16px + env(safe-area-inset-bottom));
}

.sheet-header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
}

.full .text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0 0 12px;
}

.full .image {
  display: block;
  max-width: 100%;
  border-radius: 8px;
  margin: 0 0 12px;
}

.image-missing {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 12px;
}

/* ---- 設定 ---- */

.setup {
  padding: 24px 16px;
}

.setup h1 {
  color: var(--accent);
  margin-top: 0;
}

.hint {
  color: var(--muted);
  font-size: 14px;
}

.setup-input {
  display: block;
  width: 100%;
  min-height: 160px;
  font: 14px/1.5 ui-monospace, Menlo, monospace;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 12px;
}

.more-button {
  display: flex;
  width: calc(100% - 32px);
  margin: 12px 16px 24px;
}
