:root {
  --bg: #faf6ef;
  --surface: #ffffff;
  --surface-muted: #f3eee5;
  --text: #2b2620;
  --muted: #7a7264;
  --border: #e3dccd;
  --accent: #b3543f;
  --accent-text: #ffffff;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
.site-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-size: 20px; font-weight: 700; color: var(--text); }
.brand-sub { color: var(--accent); font-size: 14px; margin-left: 4px; }
main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 48px; }
.site-footer { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; }
.btn {
  display: inline-block; background: var(--accent); color: var(--accent-text);
  border: 1px solid var(--accent); border-radius: 8px; padding: 8px 16px;
  font-size: 14px; cursor: pointer;
}
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn.danger { background: var(--surface); color: #b3261e; border-color: var(--border); }
.filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px;
}
.filters input[type="search"], .filters select {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); font-size: 14px; color: var(--text);
}
.filters input[type="search"] { flex: 1 1 220px; }
.count { color: var(--muted); font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; display: flex; flex-direction: column;
}
.card-media { background: var(--surface-muted); }
.thumb { position: relative; display: block; }
.thumb img { width: 100%; height: 300px; object-fit: cover; display: block; }
.play-badge {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 56px; height: 56px; border-radius: 50%; background: rgba(0,0,0,.55);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.embed-wrap { position: relative; width: 100%; padding-top: 125%; }
.embed-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-head { display: flex; justify-content: space-between; align-items: center; }
.author { font-weight: 700; color: var(--text); font-size: 16px; }
.fav-form { margin: 0; }
.fav { background: none; border: 0; font-size: 22px; cursor: pointer; color: #c9c0ae; padding: 0 2px; }
.fav.on { color: #e6a817; }
.meta-line { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 12px; }
.src { background: var(--surface-muted); border-radius: 999px; padding: 1px 8px; }
.metrics { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--muted); }
.metrics strong { color: var(--text); font-size: 16px; }
.metrics-at { color: var(--muted); font-size: 11px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  background: #f7e9e4; color: var(--accent); border-radius: 999px;
  padding: 2px 10px; font-size: 12px;
}
.note { margin: 0; font-size: 14px; }
.application {
  border-left: 3px solid var(--accent); background: var(--surface-muted);
  padding: 8px 12px; border-radius: 0 8px 8px 0; font-size: 13px;
}
.application-label { font-weight: 700; font-size: 12px; color: var(--accent); margin-bottom: 2px; }
.application p { margin: 0; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 6px; }
.inline-form { margin: 0; }
.empty { color: var(--muted); }
h1 { font-size: 22px; }
.notice { background: #fdf3e3; border: 1px solid #ecd9ae; border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.fetch-box, .edit-form {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px; margin-bottom: 18px; display: flex; flex-direction: column; gap: 12px;
}
.edit-form label, .fetch-box label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.edit-form input, .edit-form textarea, .edit-form select, .fetch-box input {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-weight: 400; color: var(--text); background: var(--surface); width: 100%;
}
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.metrics-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; }
.hint { color: var(--muted); font-size: 12px; margin: 0; }
.check { flex-direction: row !important; align-items: center; gap: 8px; }
.check input { width: auto; }
.form-actions { display: flex; gap: 10px; }
@media (max-width: 640px) {
  .two { grid-template-columns: 1fr; }
  .thumb img { height: 240px; }
}

/* --- login (PHP版で追加) --- */
.login-wrap { max-width: 380px; margin: 8vh auto 0; }
.login-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 24px; display: flex; flex-direction: column; gap: 12px;
}
.login-box h1 { font-size: 20px; margin: 0; }
.login-box label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.login-box input {
  padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-weight: 400; color: var(--text); background: var(--surface); width: 100%;
}
.error { background: #fbe9e7; border: 1px solid #e5b4ae; border-radius: 8px; padding: 10px 14px; font-size: 14px; color: #8c2b21; }
