/* 入口ページ群（架空SNS「ひびログ」・メッセージアプリ「トークル」・資料）の共通スタイル
 * 前作の「ひだまり日記」とちがい、最初から少し冷たく、色が抜けている */
:root {
  --bg: #e4e2e9;
  --paper: #f4f3f6;
  --ink: #34313b;
  --sub: #8a8594;
  --accent: #7c6f9c;
  --line: #d6d2de;
  --red: #b3121b;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  line-height: 1.8; overflow-x: hidden; min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
body::after {
  /* うっすら暗い四隅 */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 40;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(20, 10, 30, .28) 100%);
}
a { color: var(--accent); }
button { font: inherit; }
canvas { max-width: 100%; }

/* ---- 上のバー ---- */
.topbar {
  position: sticky; top: 0; z-index: 30; background: rgba(244, 243, 246, .94); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top, 0px));
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.topbar .logo { font-weight: 800; letter-spacing: .06em; color: var(--accent); text-decoration: none; font-size: 18px; white-space: nowrap; }
.topbar .logo i { font-style: normal; display: inline-block; width: 18px; height: 18px; border-radius: 5px; background: var(--accent); margin-right: 6px; vertical-align: -3px; }
.topbar nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.topbar nav a { font-size: 13px; text-decoration: none; color: var(--ink); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; white-space: nowrap; }
.topbar nav a.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.topbar nav a.locked { opacity: .35; pointer-events: none; }

.wrap { max-width: 640px; margin: 0 auto; padding: 0 12px 30px; position: relative; z-index: 2; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 14px 0; }
.small { font-size: 12px; color: var(--sub); }
.redtext { color: var(--red); }
.hidden { display: none !important; }
.center { text-align: center; }

/* ---- プロフィール ---- */
.cover { height: 120px; border-radius: 14px 14px 0 0; margin: 12px -16px -16px; position: relative; overflow: hidden; background: #222; }
.cover canvas { width: 100%; height: 100%; display: block; }
.prof { position: relative; padding-top: 0; }
.prof .ava { width: 84px; height: 84px; border-radius: 50%; border: 4px solid var(--paper); margin-top: -40px; position: relative; z-index: 2; background: #ddd; overflow: hidden; }
.prof .ava canvas { width: 100%; height: 100%; display: block; }
.prof h1 { margin: 6px 0 0; font-size: 21px; }
.prof .id { color: var(--sub); font-size: 13px; }
.prof .bio { margin: 8px 0; font-size: 14px; }
.prof .stats { display: flex; gap: 16px; font-size: 13px; color: var(--sub); flex-wrap: wrap; }
.prof .stats b { color: var(--ink); }
.banner { background: #2b2633; color: #d9d3e6; font-size: 13px; padding: 10px 14px; border-radius: 10px; margin: 14px 0 0; letter-spacing: .04em; }
.banner b { color: #ff8a8a; }

/* ---- タブ ---- */
.tabs { display: flex; border-bottom: 1px solid var(--line); margin: 16px 0 0; gap: 2px; }
.tabs button { flex: 1; background: none; border: 0; padding: 10px 4px; font-size: 14px; color: var(--sub); cursor: pointer; border-bottom: 3px solid transparent; min-height: 44px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 700; }
.tabs .cnt { display: inline-block; min-width: 1.6em; padding: 0 5px; margin-left: 4px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; line-height: 1.6; }

/* ---- 投稿 ---- */
.post { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 12px 0; position: relative; }
.post .head { display: flex; align-items: center; gap: 10px; }
.post .mini { width: 38px; height: 38px; border-radius: 50%; overflow: hidden; background: #ccc; flex: none; }
.post .mini canvas { width: 100%; height: 100%; display: block; }
.post .nm { font-weight: 700; font-size: 14px; line-height: 1.3; }
.post .tm { font-size: 12px; color: var(--sub); }
.post .body { margin: 8px 0 4px; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.post .pic { display: block; width: 100%; border-radius: 10px; margin: 8px 0 4px; cursor: zoom-in; background: #111; aspect-ratio: 4 / 3; }
.post .acts { display: flex; gap: 18px; font-size: 13px; color: var(--sub); align-items: center; flex-wrap: wrap; }
.post .acts button { background: none; border: 0; color: inherit; cursor: pointer; padding: 6px 4px; min-height: 36px; }
.post .acts .liked { color: var(--red); }
.post.draft { background: #2a2530; color: #cfc6dc; border-color: #3d3446; }
.post.draft .nm { color: #e7d9f2; }
.post.draft .tm { color: #8d7f9c; }
.post.draft a { color: #ff9a9a; }
.post.draft.new { animation: newDraft 2.2s ease; }
@keyframes newDraft { 0% { box-shadow: 0 0 0 0 #b3121b; } 30% { box-shadow: 0 0 0 4px #b3121b88; } 100% { box-shadow: 0 0 0 0 transparent; } }
.dlabel { font-size: 11px; letter-spacing: .2em; background: #b3121b; color: #fff; border-radius: 4px; padding: 0 6px; margin-left: auto; }
.empty-note { text-align: center; color: var(--sub); font-size: 13px; padding: 20px 0; }

/* ---- 写真の拡大 ---- */
.viewer { position: fixed; inset: 0; z-index: 60; background: rgba(8, 6, 10, .95); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; gap: 10px; }
.viewer canvas { width: min(720px, 94vw); max-height: 70vh; object-fit: contain; aspect-ratio: 4 / 3; height: auto; background: #000; }
.viewer .cap { color: #bbb; font-size: 14px; text-align: center; max-width: 640px; }
.viewer .x { position: absolute; top: calc(8px + env(safe-area-inset-top, 0px)); right: 10px; background: none; border: 0; color: #aaa; font-size: 30px; padding: 6px 12px; cursor: pointer; }

/* ---- トースト ---- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(60px + env(safe-area-inset-bottom, 0px)); z-index: 70;
  background: rgba(30, 26, 36, .95); color: #eee; padding: 10px 16px; border-radius: 12px; font-size: 13px;
  max-width: min(92vw, 420px); box-shadow: 0 6px 24px rgba(0, 0, 0, .35); animation: toastIn .3s ease both; text-align: center;
}
.toast b { color: #ff9a9a; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } }

.btn2 { display: inline-block; font-size: 14px; padding: 10px 18px; border-radius: 999px; border: 0; background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; min-height: 40px; }
.btn2.red { background: #8a1018; }
.btn2.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.input2 { font: inherit; font-size: 16px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); min-width: 0; }

/* ---- RTA ---- */
.rta-card h3 { margin: 0 0 8px; font-size: 15px; }
.rta-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.rta-num { font-family: "Courier New", monospace; font-variant-numeric: tabular-nums; }
.rta-list { margin: 6px 0 0; padding: 0; list-style: none; }
.rta-list li { display: flex; gap: 10px; padding: 5px 2px; border-bottom: 1px dashed var(--line); font-size: 14px; align-items: baseline; }
.rta-list li.me { background: #f3e6ff; }
.rta-rank { width: 3em; color: var(--sub); flex: none; }
.rta-who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rta-form { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 0; }
.rta-form .input2 { flex: 1; min-width: 140px; }

/* ---- 不気味な状態 ---- */
/* body に filter をかけると position:fixed の基準がずれるので、中身にだけかける */
body.cold .wrap, body.cold .topbar { filter: saturate(.6); }
body.red-tint { background: #2a1015; }
body.red-tint .post, body.red-tint .card { background: #f3e9ea; }
.blinky { animation: blinky 4s infinite; }
@keyframes blinky { 0%, 96%, 100% { opacity: 1; } 97% { opacity: .1; } 98% { opacity: 1; } 99% { opacity: .3; } }

.foot { text-align: center; font-size: 12px; color: var(--sub); padding: 18px 8px; position: relative; z-index: 2; }

@media (max-width: 480px) {
  .topbar { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .topbar .logo { font-size: 15px; }
  .topbar .logo i { width: 14px; height: 14px; margin-right: 4px; }
  .topbar nav { gap: 3px; }
  .topbar nav a { font-size: 12px; padding: 3px 7px; }
}
