/* ---- リセット & 変数 ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #101010;
  --surface:  #1c1c1c;
  --surface2: #252525;
  --border:   #2e2e2e;
  --text:     #f0f0f0;
  --muted:    #888;
  --accent:   #5c6ef8;
  --danger:   #e05555;
  --success:  #4caf50;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

/* ---- Header ---- */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.2rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
}

header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ---- Buttons ---- */
.btn {
  padding: 0.45rem 1rem;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.8; }
.btn:active { opacity: 0.6; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-danger  { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.78rem; }

/* ---- Toast ---- */
.toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: #1a361a;
  border: 1px solid var(--success);
  color: var(--success);
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 999;
  white-space: nowrap;
  transition: opacity 0.4s;
}
.toast.hidden { display: none; }

/* ---- Main ---- */
main {
  max-width: 660px;
  margin: 0 auto;
  padding: 1rem 1rem 4rem;
}

/* ---- 手動追加フォーム ---- */
.add-section {
  margin-bottom: 1.4rem;
}

.add-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  width: 100%;
  color: var(--muted);
  font-size: 0.9rem;
  transition: border-color 0.15s;
}
.add-toggle:hover { border-color: var(--accent); color: var(--text); }
.add-toggle svg { flex-shrink: 0; }

.add-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.add-form.hidden { display: none; }

.add-form input,
.add-form textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  padding: 0.6rem 0.8rem;
  width: 100%;
  resize: vertical;
}
.add-form input:focus,
.add-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.add-form input::placeholder,
.add-form textarea::placeholder { color: var(--muted); }

/* ---- 件数バー ---- */
.count-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.2rem;
  margin-bottom: 0.8rem;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ---- 投稿カード ---- */
.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.9rem;
}

.post-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.post-date {
  font-size: 0.75rem;
  color: var(--muted);
}

.post-url {
  display: block;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.82rem;
  word-break: break-all;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}
.post-url:hover { text-decoration: underline; }

.post-text {
  font-size: 0.93rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 0.7rem;
  color: var(--text);
}

.post-note-wrap { margin-top: 0.5rem; }

.post-note {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.83rem;
  font-family: inherit;
  padding: 0.5rem 0.7rem;
  resize: vertical;
  min-height: 50px;
}
.post-note:focus { outline: none; border-color: var(--accent); }
.post-note::placeholder { color: var(--muted); }

/* ---- 空状態 ---- */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.empty-state p { margin: 0.3rem 0; font-size: 0.9rem; }
.empty-state .muted { font-size: 0.82rem; color: var(--muted); margin-top: 0.5rem; line-height: 1.6; }
.empty-state.hidden { display: none; }

/* ---- Utilities ---- */
.hidden { display: none !important; }

/* ---- モバイル調整 ---- */
@media (max-width: 480px) {
  main { padding: 0.8rem 0.8rem 4rem; }
  header { padding: 0.75rem 1rem; }
  .btn { padding: 0.4rem 0.8rem; }
}
