@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500&display=swap');

:root {
  --bg:        #000000;
  --bg2:       #0d0d0d;
  --bg3:       #161616;
  --border:    #222222;
  --border-hi: #333333;
  --text:      #e0e0e0;
  --muted:     #555555;
  --accent:    #4caf72;
  --accent-dim:#2a5c3a;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-body: 'IBM Plex Sans', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 14px; line-height: 1.6; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── LAYOUT ───────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
/* homepage: slightly wider left */
.layout:not(.page-layout) {
  grid-template-columns: 260px 1fr;
}

/* ── LEFT COLUMN ──────────────────────────────────── */
.left-col {
  border-right: 1px solid var(--border);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.left-col-narrow { width: 220px; }

/* ── HEADER ───────────────────────────────────────── */
.site-header { margin-bottom: 20px; }
.site-name { font-family: var(--font-mono); font-size: 18px; font-weight: 500; color: var(--text); }
.site-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── NAV ──────────────────────────────────────────── */
.site-nav {
  display: flex; flex-direction: column; gap: 2px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}
.nav-link {
  font-family: var(--font-mono); font-size: 13px;
  color: var(--muted); padding: 5px 8px; border-radius: 4px;
  transition: color 0.1s, background 0.1s; text-decoration: none;
}
.nav-link:hover { color: var(--text); background: var(--bg3); text-decoration: none; }
.nav-link.active { color: var(--accent); background: var(--bg3); }

/* ── SECTIONS ─────────────────────────────────────── */
.section { margin-bottom: 20px; }
.section-label {
  font-family: var(--font-mono); font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 8px; padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.section-body { padding-top: 4px; }
.section-body p { color: var(--text); margin-bottom: 8px; font-size: 13px; }
.section-body p:last-child { margin-bottom: 0; }

/* ── NOW ──────────────────────────────────────────── */
.now-grid { display: flex; flex-direction: column; gap: 6px; }
.now-row { display: flex; flex-direction: column; gap: 1px; }
.now-label { font-size: 11px; color: var(--muted); font-family: var(--font-mono); }
.now-val { font-size: 13px; color: var(--text); }

/* ── STATS ────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-block { background: var(--bg2); border: 1px solid var(--border); border-radius: 4px; padding: 8px; }
.stat-val { font-family: var(--font-mono); font-size: 18px; font-weight: 500; color: var(--accent); line-height: 1.2; }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── CURRENT LIST ─────────────────────────────────── */
.current-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.current-row:last-child { border-bottom: none; }
.current-cover { width: 28px; height: 40px; object-fit: cover; border-radius: 2px; flex-shrink: 0; border: 1px solid var(--border); }
.current-info { min-width: 0; flex: 1; }
.current-title { font-size: 12px; color: var(--text); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.current-title:hover { color: var(--accent); text-decoration: none; }
.more-link { display: inline-block; font-family: var(--font-mono); font-size: 12px; color: var(--accent); margin-top: 10px; }

/* ── MISC UTILS ───────────────────────────────────── */
.inline-links { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.ext-link { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.ext-link:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.site-footer { margin-top: auto; padding-top: 20px; font-size: 11px; color: var(--muted); font-family: var(--font-mono); }

/* ── BUTTONS ──────────────────────────────────────── */
.btn {
  font-family: var(--font-mono); font-size: 13px;
  background: transparent; border: 1px solid var(--border-hi);
  color: var(--text); padding: 6px 14px; cursor: pointer;
  border-radius: 4px; transition: border-color 0.1s, color 0.1s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }

.filter-btn {
  display: block; width: 100%; font-family: var(--font-mono); font-size: 12px;
  background: transparent; border: none; border-left: 2px solid transparent;
  color: var(--muted); padding: 4px 8px; cursor: pointer;
  text-align: left; transition: color 0.1s, border-color 0.1s; margin-bottom: 2px;
}
.filter-btn:hover { color: var(--text); }
.filter-btn.active { color: var(--accent); border-left-color: var(--accent); }

/* ── FORMS ────────────────────────────────────────── */
.msg-input, .msg-textarea {
  display: block; width: 100%;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 4px;
  color: var(--text); font-family: var(--font-body); font-size: 13px;
  padding: 7px 10px; margin-bottom: 8px; outline: none; resize: vertical;
  transition: border-color 0.1s;
}
.msg-input:focus, .msg-textarea:focus { border-color: var(--accent-dim); }
.form-label {
  display: block; font-size: 11px; color: var(--muted);
  font-family: var(--font-mono); margin-bottom: 4px;
  text-transform: uppercase; letter-spacing: 1px;
}
.msg-status { font-family: var(--font-mono); font-size: 12px; margin-top: 6px; min-height: 16px; }
.msg-status.success { color: var(--accent); }
.msg-status.error { color: #e05555; }
.msg-status.info { color: var(--muted); }

/* ── RIGHT COLUMN ─────────────────────────────────── */
.right-col { display: flex; flex-direction: column; overflow-y: auto; }
.right-col-list { padding: 24px; overflow-y: auto; }
.right-col-form { padding: 24px; max-width: 600px; }

/* Homepage character panel — must be sticky + full height */
.char-right {
  padding: 24px;
  overflow-y: auto;
  position: sticky;
  top: 0;
  height: 100vh;
  align-self: start;
}
.char-right-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ── CHARACTER GRIDS ──────────────────────────────── */
.char-grid-home,
.char-grid-full {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.char-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 4px; overflow: hidden; cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.char-card:hover { border-color: var(--border-hi); transform: translateY(-1px); }
.char-card-img { aspect-ratio: 3/4; overflow: hidden; background: var(--bg3); }
.char-card-img img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform 0.2s; }
.char-card:hover .char-card-img img { transform: scale(1.03); }
.char-card-body { padding: 7px 8px; }
.char-card-name { font-size: 12px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 1px; }
.char-card-series { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.char-card-actions { display: flex; gap: 6px; margin-top: 6px; align-items: center; }

/* ── VOTE BUTTONS ─────────────────────────────────── */
.like-btn, .dislike-btn {
  background: transparent; border: none; cursor: pointer;
  color: var(--muted); display: flex; align-items: center; gap: 3px;
  font-family: var(--font-mono); font-size: 11px; padding: 2px;
  transition: color 0.1s;
}
.like-btn:hover { color: #e06a8c; }
.dislike-btn:hover { color: var(--text); }
.like-btn.on { color: #e06a8c; }
.dislike-btn.on { color: #888; }
.like-btn.big, .dislike-btn.big {
  padding: 4px 10px; border: 1px solid var(--border);
  border-radius: 4px; font-size: 13px; gap: 5px;
}
.media-vote-row { display: flex; gap: 6px; align-items: center; margin-top: 4px; }

/* ── CHARACTER OVERLAY ────────────────────────────── */
.char-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.char-overlay.hidden { display: none; }
.char-overlay-inner {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; display: flex; gap: 20px;
  max-width: 500px; width: 100%; padding: 20px; position: relative;
}
.overlay-close {
  position: absolute; top: 12px; right: 12px;
  background: transparent; border: none; color: var(--muted);
  cursor: pointer; font-size: 16px; padding: 4px;
}
.overlay-close:hover { color: var(--text); }
.overlay-img-wrap { width: 120px; flex-shrink: 0; }
.overlay-img-wrap img { width: 100%; aspect-ratio: 3/4; object-fit: cover; object-position: top; border-radius: 4px; }
.overlay-info { flex: 1; min-width: 0; }
.overlay-name { font-family: var(--font-mono); font-size: 18px; font-weight: 500; margin-bottom: 4px; }
.overlay-likes { margin-top: 14px; }
.overlay-like-row { display: flex; gap: 8px; }

/* ── ANIME GRID ───────────────────────────────────── */
.anime-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.anime-card {
  display: flex; flex-direction: column;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 4px; overflow: hidden;
  cursor: pointer;
  transition: border-color 0.1s;
}
.anime-card:hover { border-color: var(--border-hi); }
.anime-cover { aspect-ratio: 2/3; background-size: cover; background-position: center; background-color: var(--bg3); }
.anime-info { padding: 7px 8px; display: flex; flex-direction: column; flex: 1; }
.anime-title {
  font-size: 11px; font-weight: 500; color: var(--text);
  line-height: 1.4; margin-bottom: 2px;
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.anime-prog { font-family: var(--font-mono); font-size: 10px; color: var(--muted); margin-bottom: 4px; }
.anime-scores { margin-top: auto; display: flex; flex-direction: column; gap: 3px; }
.star-row { display: flex; gap: 1px; align-items: center; }

/* ── RECOMMENDATIONS ──────────────────────────────── */
.rec-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.rec-card {
  display: flex; flex-direction: column;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 4px; overflow: hidden;
  text-decoration: none; color: var(--text);
  transition: border-color 0.1s;
}
.rec-card:hover { border-color: var(--border-hi); text-decoration: none; }
.rec-cover { width: 100%; aspect-ratio: 2/3; object-fit: cover; object-position: top; background-color: var(--bg3); display: block; }
.rec-cover-placeholder {
  width: 100%; aspect-ratio: 2/3; background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; color: var(--muted);
}
.rec-card-body { padding: 10px; display: flex; flex-direction: column; flex: 1; }
.rec-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.rec-badge { font-family: var(--font-mono); font-size: 10px; padding: 1px 6px; border-radius: 3px; }
.rec-badge.anilist { background: #0a1f12; color: var(--accent); border: 1px solid var(--accent-dim); }
.rec-badge.spotify { background: #0a1a0a; color: #1db954; border: 1px solid #1a3a1a; }
.rec-title { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 3px; }
.rec-sub { margin-bottom: 4px; display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.rec-note { border-left: 2px solid var(--border); padding-left: 6px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.rec-admin-comment { margin-top: 6px; padding: 5px 7px; background: var(--bg3); border-radius: 3px; font-size: 12px; color: var(--text); }
.rec-admin-label { font-family: var(--font-mono); font-size: 10px; color: var(--accent); margin-right: 4px; }
.rec-hearts { font-family: var(--font-mono); font-size: 11px; color: var(--accent); display: flex; align-items: center; gap: 3px; }

/* ── CHAR SORT (characters page) ──────────────────── */
.char-side-entry-sort { display: flex; flex-direction: column; gap: 2px; }

/* ── RESPONSIVE ───────────────────────────────────── */
@media (max-width: 700px) {
  .layout,
  .layout:not(.page-layout) { grid-template-columns: 1fr; }
  .left-col { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .right-col,
  .char-right { height: auto; position: static; }
  .char-grid-home { grid-template-columns: repeat(3, 1fr); }
}
