﻿/* =========================================
   koro.css  窶・shared styles for koro.*
   ========================================= */

/* --- Reset & Variables --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #fefcfb;
  --surface:   #f3efec;
  --border:    #e6ddd8;
  --text:      #1c1715;
  --muted:     #9e8e88;
  --accent:    #c45c8a;
  --accent-fg: #ffffff;
  --accent-h:  #a8406f;   /* hover */
  --shadow:    0 2px 12px rgba(0,0,0,0.07);
  --radius:    10px;
  --hh:        54px;      /* header height */
  --ch:        72px;      /* compose bar min height */
  --max-w:     520px;
}

[data-theme="dark"] {
  --bg:        #1a1614;
  --surface:   #261f1c;
  --border:    #3a2f2b;
  --text:      #f0e8e4;
  --muted:     #7a6d68;
  --accent:    #d97aab;
  --accent-h:  #e693be;
  --shadow:    0 2px 12px rgba(0,0,0,0.30);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-y: scroll;
  transition: background 0.2s, color 0.2s;
}

a { color: inherit; text-decoration: none; }

/* ==============================
   Header
   ============================== */
.site-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--hh);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
  z-index: 200;
  gap: 8px;
  transition: background 0.2s, border-color 0.2s;
}

.logo {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--accent);
  flex-shrink: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==============================
   Icon button (theme toggle, etc.)
   ============================== */
.icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn svg   { display: block; }

/* ==============================
   Account dropdown
   ============================== */
.account-wrap {
  position: relative;
  display: inline-block;
}

.account-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  flex-shrink: 0;
  transition: border-color 0.15s;
}
.account-btn:hover { border-color: var(--accent); }
.account-btn img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  min-width: 168px;
  display: none;
  z-index: 500;
  overflow: hidden;
}
.account-dropdown.open { display: block; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 16px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  width: 100%;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.1s;
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover      { background: var(--surface); }
.dropdown-item.danger     { color: #d44; }

/* ==============================
   Buttons
   ============================== */
.btn {
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  padding: 7px 18px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn:hover    { background: var(--accent-h); }
.btn:disabled { opacity: 0.35; cursor: default; }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--muted); background: transparent; }

/* ==============================
   Feed (home, reverse-chrono)
   ============================== */
.feed-wrap {
  padding-top: var(--hh);
  padding-bottom: 200px;
  min-height: 100dvh;
  max-width: var(--max-w);
  margin: 0 auto;
}

#feed {
  display: flex;
  flex-direction: column-reverse;
}

.load-more-msg {
  text-align: center;
  padding: 18px 0;
  color: var(--muted);
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

/* ==============================
   Post item
   ============================== */
.post-item {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.post-item:hover { background: var(--surface); }

.post-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.post-row-content { flex: 1; min-width: 0; }
.post-avatar-sm {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-decoration: none;
}
.post-avatar-sm img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.post-meta {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 5px;
}
.post-name   { font-weight: 700; font-size: 14px; }
.post-handle { color: var(--muted); font-size: 13px; }
.post-time   { color: var(--muted); font-size: 12px; margin-left: auto; }
.post-body   { font-size: 15px; line-height: 1.65; word-break: break-word; white-space: pre-wrap; }

.post-image {
  margin-top: 10px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}
.post-image img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: cover;
}

/* ==============================
   Compose bar (fixed bottom)
   ============================== */
.compose-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  max-height: 52dvh;
  overflow-y: auto;
  z-index: 200;
  transition: background 0.2s, border-color 0.2s;
}

.compose-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compose-bar textarea {
  flex: 1;
  min-height: 44px;
  max-height: 140px;
  resize: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  line-height: 1.5;
}
.compose-bar textarea:focus {
  border-color: var(--accent);
  background: var(--bg);
}
.compose-bar textarea::placeholder { color: var(--muted); }

.compose-tools {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* image icon in compose (hidden real input) */
.compose-img-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.compose-img-label:hover { background: var(--surface); color: var(--accent); }
.compose-img-label input { display: none; }
.compose-img-label svg   { display: block; }

.selected-file {
  font-size: 12px;
  color: var(--muted);
  max-width: 50vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.tiny-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 14px;
  padding: 3px 9px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.1s, border-color 0.1s;
}
.tiny-btn:hover { color: var(--text); border-color: var(--muted); }

/* Guest bar */
.guest-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--ch);
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 14px;
  color: var(--muted);
  z-index: 200;
}

/* ==============================
   Setup / form
   ============================== */
.setup-wrap {
  max-width: 380px;
  margin: calc(var(--hh) + 48px) auto 0;
  padding: 0 20px;
}

.form-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 22px;
  background: var(--bg);
  box-shadow: var(--shadow);
}

.form-card h2 { font-size: 17px; font-weight: 800; margin-bottom: 4px; }
.form-card p  { color: var(--muted); font-size: 13px; margin-bottom: 22px; }

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}

.field {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 14px;
}
.field:focus { border-color: var(--accent); background: var(--bg); }
.field:last-of-type { margin-bottom: 18px; }

/* ==============================
   Profile page
   ============================== */
.profile-wrap {
  max-width: var(--max-w);
  margin: calc(var(--hh) + 16px) auto 48px;
  padding: 0 16px;
}

.profile-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 16px;
  background: var(--bg);
  box-shadow: var(--shadow);
}

.profile-banner {
  height: 150px;
  min-height: 150px;
  max-height: 150px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--border) 100%);
  overflow: hidden;
  flex-shrink: 0;
}
.profile-banner-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

.profile-body { padding: 12px 18px 18px; }

.profile-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800;
  margin-top: -34px;
  border: 3px solid var(--bg);
  user-select: none;
  overflow: hidden;
  flex-shrink: 0;
}
.profile-avatar-img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.profile-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.profile-info { flex: 1; }

.profile-name   { font-size: 17px; font-weight: 800; margin-top: 10px; }
.profile-handle { font-size: 13px; color: var(--muted); margin-top: 2px; }
.profile-bio    { font-size: 14px; color: var(--text); opacity: 0.8; line-height: 1.6; margin-top: 10px; }

.profile-stats { display: flex; gap: 20px; margin-top: 12px; }
.profile-stat  { font-size: 13px; color: var(--muted); }
.profile-stat b { color: var(--text); font-weight: 700; }

/* profile edit button (pencil) */
.profile-edit-btn {
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--muted);
  margin-top: 10px;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.profile-edit-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--surface); }

/* profile edit panel */
.profile-edit-panel {
  border-top: 1px solid var(--border);
  padding: 16px 18px;
  display: none;
  background: var(--surface);
}
.profile-edit-panel.open { display: block; }

.profile-edit-panel .field-label { margin-top: 10px; }
.profile-edit-panel .field { margin-bottom: 10px; }

.edit-img-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}

.edit-img-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-family: inherit;
  color: var(--muted);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.edit-img-label:hover { border-color: var(--accent); color: var(--accent); }
.edit-img-label input { display: none; }

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.5;
}

/* ==============================
   Posts list (profile page)
   ============================== */
.posts-list {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg);
  box-shadow: var(--shadow);
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

/* ==============================
   Not found
   ============================== */
.not-found {
  text-align: center;
  padding: 80px 20px 0;
  color: var(--muted);
}
.not-found h2 { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.not-found p  { font-size: 14px; margin-bottom: 22px; }

/* ==============================
   Utility
   ============================== */
.text-muted  { color: var(--muted); }
.text-center { text-align: center; }
.pad-18      { padding: 18px; }

/* ==============================
   Post actions (like / delete)
   ============================== */
.post-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  padding: 4px 8px;
  border-radius: 20px;
  transition: background 0.15s, color 0.15s;
}
.action-btn:hover { background: var(--surface); color: var(--text); }
.action-btn svg   { display: block; flex-shrink: 0; }

.like-btn { color: var(--muted); }
.like-btn:hover { background: rgba(224,64,112,0.10); color: #e04070; }
.like-btn.liked { color: #e04070; }
.like-btn.liked svg { animation: like-pop 0.28s cubic-bezier(.36,.07,.19,.97); }

@keyframes like-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.4); }
  70%  { transform: scale(0.85); }
  100% { transform: scale(1); }
}

.like-count { min-width: 14px; }

.delete-btn { margin-left: auto; }
.delete-btn:hover { background: rgba(220,68,68,0.12); color: #d44; }

/* ==============================
   Char counter
   ============================== */
.char-counter {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
  flex-shrink: 0;
  transition: color 0.15s;
}
.char-counter.warn { color: #e6a817; }
.char-counter.over { color: #d44; font-weight: 700; }

/* ==============================
   Follow button
   ============================== */
.follow-btn {
  background: var(--text);
  color: var(--bg);
  border: none;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-top: 10px;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.follow-btn:hover { opacity: 0.85; }

.follow-btn.following {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.follow-btn.following .ftxt-h { display: none; }
.follow-btn.following:hover .ftxt   { display: none; }
.follow-btn.following:hover .ftxt-h { display: inline; color: #d44; }
.follow-btn.following:hover { border-color: #d44; }

/* ==============================
   Auto-link
   ============================== */
a.auto-link {
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}
a.auto-link:hover { text-decoration: underline; }

/* ==============================
   Scrollbar
   ============================== */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

::selection { background: var(--accent); color: var(--accent-fg); }

/* ==============================
   Reply / Thread styles
   ============================== */
.reply-btn { color: var(--muted); text-decoration: none; }
.reply-btn:hover { background: rgba(29,155,240,0.10); color: #1d9bf0; }
.reply-count { min-width: 14px; }

.repost-btn { color: var(--muted); }
.repost-btn:hover { background: rgba(0,186,124,0.10); color: #00ba7c; }
.repost-btn.reposted { color: #00ba7c; }

/* Repost quote block */
.repost-quote {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
  background: var(--surface);
  font-size: 14px;
}
.repost-quote-meta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}
.repost-quote-body {
  word-break: break-word;
  white-space: pre-wrap;
  line-height: 1.5;
}

/* Repost modal overlay */
.repost-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 800;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 0;
}
.repost-modal {
  background: var(--bg);
  border-radius: 18px 18px 0 0;
  padding: 20px 18px 32px;
  width: 100%;
  max-width: var(--max-w);
  animation: slide-up 0.22s ease;
}
@keyframes slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.repost-modal h3 { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.repost-modal textarea {
  width: 100%; resize: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
  outline: none;
  min-height: 72px;
  transition: border-color 0.15s;
}
.repost-modal textarea:focus { border-color: var(--accent); }
.repost-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

/* Post page (thread view) */
.thread-wrap {
  max-width: var(--max-w);
  margin: calc(var(--hh) + 0px) auto 200px;
}
.thread-root {
  border-bottom: 1px solid var(--border);
  padding: 16px 18px;
  background: var(--bg);
}
.thread-root .post-meta { margin-bottom: 8px; }
.thread-root .post-body { font-size: 17px; line-height: 1.7; }
.thread-root .post-time {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 12px;
  margin-left: 0;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.thread-root-av {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  text-decoration: none;
}
.thread-root-av img { width:100%; height:100%; object-fit:cover; border-radius:50%; }

/* Reply connector line */
.reply-item {
  padding: 12px 18px 12px 18px;
  border-bottom: 1px solid var(--border);
  position: relative;
  transition: background 0.1s;
}
.reply-item:hover { background: var(--surface); }
.reply-item.nested {
  padding-left: 52px;
  background: color-mix(in srgb, var(--surface) 40%, var(--bg));
}
.reply-item.nested::before {
  content: '';
  position: absolute;
  left: 34px; top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}

.thread-reply-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.expand-replies-btn {
  all: unset;
  cursor: pointer;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  padding: 6px 18px 8px 52px;
  display: block;
  border-bottom: 1px solid var(--border);
  width: 100%;
  transition: background 0.1s;
}
.expand-replies-btn:hover { background: var(--surface); }

/* Inline reply compose (on thread page) */
.inline-reply-bar {
  border-bottom: 1px solid var(--border);
  padding: 12px 18px;
  background: var(--surface);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.inline-reply-bar textarea {
  flex: 1;
  resize: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 8px 11px;
  outline: none;
  min-height: 40px;
  transition: border-color 0.15s;
}
.inline-reply-bar textarea:focus { border-color: var(--accent); }
.inline-reply-av {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
}
.inline-reply-av img { width:100%;height:100%;object-fit:cover;border-radius:50%; }
.reply-to-tag {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

/* ── リコロラベル ── */
.recoro-label {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #00ba7c;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px 2px;
}

/* ── 認証バッジ ── */
.verify-badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 2px;
  flex-shrink: 0;
  fill: #1d9bf0;
  filter: drop-shadow(0 0 1px rgba(29,155,240,0.3));
  pointer-events: none;
}
.recoro-label svg { fill: #00ba7c; }
.post-item[onclick] { cursor: pointer; }
.post-item[onclick]:hover { background: var(--hover, rgba(0,0,0,.03)); }
[data-theme="dark"] .post-item[onclick]:hover { background: rgba(255,255,255,.04); }

/* ── トースト通知 ── */
#koro-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #333;
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
  max-width: 90vw;
}
#koro-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
#koro-toast.error { background: #d93025; }
#koro-toast.success { background: #1d9bf0; }
