:root {
    --bg: #0b0d12;
    --bg-elevated: #14171f;
    --text: #e8eaf0;
    --text-muted: #9aa1b2;
    --accent: #5b8cff;
    --accent-hover: #7ba1ff;
    --border: #262b38;
    --badge-bg: #1d3a2a;
    --badge-text: #4ade80;
    --star: #ffb020;
    --danger: #ef4444;
}

:root[data-theme="light"] {
    --bg: #f7f8fa;
    --bg-elevated: #ffffff;
    --text: #1a1d24;
    --text-muted: #5a6272;
    --accent: #3b6fe0;
    --accent-hover: #2d5bc4;
    --border: #e3e6ec;
    --badge-bg: #e3f7ea;
    --badge-text: #16803c;
    --star: #d98c00;
    --danger: #dc2626;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    background-image: radial-gradient(var(--border) 1px, transparent 1px);
    background-size: 24px 24px;
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ---------- Nav ---------- */
.site-header {
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
    position: sticky;
    top: 0;
    z-index: 10;
}
.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.nav-left { display: flex; align-items: center; gap: 20px; flex-shrink: 0; }
.nav-back {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.88rem;
    padding: 6px 10px;
    border-radius: 8px;
}
.nav-back:hover { color: var(--accent); background: var(--bg); }
.nav-divider { color: var(--border); font-weight: 300; }
.nav-brand { font-weight: 700; font-size: 1.05rem; color: var(--text); letter-spacing: -0.01em; }
.nav-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.nav-user { color: var(--text-muted); font-size: 0.88rem; white-space: nowrap; }
.nav-auth-link {
    font-size: 0.88rem;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    white-space: nowrap;
    line-height: 1;
}
.nav-auth-link--primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.nav-auth-link--primary:hover { background: var(--accent-hover); color: #fff; }
#theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 36px; height: 36px;
    flex-shrink: 0;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
}
#theme-toggle:hover { border-color: var(--accent); }

@media (max-width: 560px) {
    .nav-inner { height: auto; padding: 12px 16px; flex-wrap: wrap; row-gap: 10px; }
    .nav-user { display: none; }
}

/* ---------- Layout ---------- */
main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}
.site-footer {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 24px 48px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ---------- Hero ---------- */
.hero { margin-bottom: 32px; }
.hero h1 { font-size: 2rem; margin: 0 0 12px; }
.hero-sub { color: var(--text-muted); font-size: 1.02rem; max-width: 640px; }

h2 { font-size: 1.3rem; margin: 32px 0 12px; }
p { color: var(--text-muted); }
.back-link { display: inline-block; margin-bottom: 16px; color: var(--text-muted); font-size: 0.9rem; }
.back-link:hover { color: var(--accent); }
.empty-state { font-style: italic; color: var(--text-muted); }

.intro-copy {
    max-width: 680px;
    margin: 24px 0 8px;
    padding: 22px 24px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.intro-copy p { color: var(--text); font-size: 0.98rem; margin: 0 0 14px; }
.intro-copy p:last-child { margin-bottom: 0; }

/* ---------- Two-column tool cards ---------- */
.tool-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    align-items: stretch;
}
.tool-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px 26px;
    min-height: 280px;
    transition: border-color 0.15s ease, transform 0.1s ease;
}
.tool-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.tool-card-main { flex: 1; }
.tool-card h2 { margin: 0 0 8px; font-size: 1.25rem; color: var(--text); }
.tool-card-main p { margin: 0 0 12px; }
.tool-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.tool-card-cta { margin-left: auto; color: var(--accent); font-size: 0.9rem; font-weight: 600; }
.review-count { color: var(--text-muted); font-size: 0.9rem; }

@media (max-width: 700px) {
    .tool-list { grid-template-columns: 1fr; }
    .tool-card { min-height: 0; }
}

.rating { color: var(--star); font-weight: 600; }
.rating--large { color: var(--star); font-weight: 700; font-size: 1.05rem; }
.rating--empty { color: var(--text-muted); font-weight: 400; }

.feature-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 0;
}
.feature-list li {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.feature-list--compact li { padding: 4px 12px; font-size: 0.78rem; }

/* ---------- Tool detail page ---------- */
.videos {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 16px 0 32px;
}
.video-embed {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-elevated);
}
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

#review-form, .signin-prompt {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}
#review-form { display: flex; flex-direction: column; gap: 12px; }
#review-form label { font-size: 0.9rem; color: var(--text-muted); }
#review-form select, #review-form textarea {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 10px 12px;
    font-family: inherit;
    font-size: 0.95rem;
}
#review-form textarea { min-height: 90px; resize: vertical; }
#review-form button {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-weight: 600;
    cursor: pointer;
    align-self: flex-start;
}
#review-form button:hover { background: var(--accent-hover); }
.moderation-note { font-size: 0.8rem; margin: 0; }
.signin-prompt p { margin: 0; color: var(--text); }
.signin-prompt a { font-weight: 600; }

.review {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    background: var(--bg-elevated);
}
.review p { color: var(--text); margin: 8px 0; }
.badge {
    display: inline-block;
    background: var(--badge-bg);
    color: var(--badge-text);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
    margin-left: 8px;
}
.admin-reply {
    background: var(--bg);
    border-left: 3px solid var(--accent);
    padding: 8px 12px;
    margin-top: 10px;
    font-size: 0.9rem;
}
.vote-helpful {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.8rem;
    cursor: pointer;
}
.vote-helpful:hover { border-color: var(--accent); color: var(--accent); }
.vote-helpful--static { cursor: default; }
.vote-helpful--static:hover { border-color: var(--border); color: var(--text-muted); }
