:root {
    --bg: #1a1b26;
    --bg-card: #24283b;
    --bg-card-hover: #292e42;
    --text: #e0e3e7;
    --text-muted: #565f89;
    --text-heading: #e0e3e7;
    --border: #292e42;
    --accent: #7aa2f7;
    --accent-hover: #89b4fa;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,.3);
    --shadow-hover: 0 4px 16px rgba(0,0,0,.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 16px;
    line-height: 1.6;
}

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

h1, h2, h3 {
    color: var(--text-heading);
    line-height: 1.3;
}

h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }

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

p { margin-bottom: 1rem; }

/* Cards grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    height: 400px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow .2s, background .2s;
}
.card:hover {
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-hover);
    text-decoration: none;
}

.card-title {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-heading);
    line-height: 1.3;
    flex-shrink: 0;
    margin-bottom: 0.5rem;
}

/* Snippet */
.snippet { font-size: 0.9rem; color: var(--text); line-height: 1.5; flex: 1; overflow: hidden; }
.snippet p { margin-bottom: 0.5rem; }
.snippet hr { border: none; border-top: 1px solid var(--border); margin: 0.75rem 0; }
.snippet ul { margin: 0.5rem 0 0 1.2rem; padding: 0; list-style: disc; }
.snippet li { margin-bottom: 0.3rem; font-size: 0.8rem; }

/* Tags */
.tags { margin-top: 0.75rem; display: flex; flex-wrap: wrap; gap: 0.4rem; flex-shrink: 0; }
.tag {
    display: inline-block;
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
    text-decoration: none;
    transition: color .2s, border-color .2s;
}
.tag:hover {
    color: var(--accent);
    border-color: var(--accent);
    text-decoration: none;
}

/* Footer */
.card footer {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Article page */
.article-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 2rem;
}
.article-meta a { color: var(--accent); }

.article { line-height: 1.8; }
article { line-height: 1.8; }
article h1, article h2, article h3, .article h1, .article h2, .article h3 { margin: 1.5rem 0 0.75rem; }
article ul, article ol, .article ul, .article ol { margin-bottom: 1rem; padding-left: 1.5rem; }
article ul, .article ul { list-style: disc; }
article ol, .article ol { list-style: decimal; }
article li, .article li { margin-bottom: 0.4rem; }
.article p { margin-bottom: 1rem; }
.article ul, .article ol { margin-bottom: 1rem; padding-left: 1.5rem; }
.article ul { list-style: disc; }
.article ol { list-style: decimal; }
.article li { margin-bottom: 0.4rem; }
.article code {
    background: var(--bg-card);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
}
.article pre {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}
.article pre code { background: none; padding: 0; }

.disclaimer {
    margin-top: 2rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Form */
input[type="url"], input[type="text"], input[type="email"] {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color .2s;
}
input[type="url"]:focus, input[type="text"]:focus, input[type="email"]:focus {
    border-color: var(--accent);
}

label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.url-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.url-row input { flex: 1; }
.url-row button { margin-top: 0; white-space: nowrap; }

button, [type="submit"] {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background .2s;
}
button:hover, [type="submit"]:hover { background: var(--accent-hover); }
button:disabled { opacity: .5; cursor: not-allowed; }

/* Status messages */
.status { text-align: center; padding: 1rem; color: var(--text-muted); }
.error { color: #f7768e; }

#content { color: var(--text); }

/* Tags list page */
.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}
.tag-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: inherit;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 1rem;
    transition: background .2s, box-shadow .2s;
}
.tag-card:hover {
    background: var(--bg-card-hover);
    box-shadow: var(--shadow);
    text-decoration: none;
}
.tag-name { color: var(--text); font-size: 0.95rem; }
.tag-count {
    color: var(--text-muted);
    font-size: 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
}
.pagination-link {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    color: var(--accent);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: background .2s, border-color .2s;
}
.pagination-link:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    text-decoration: none;
}
.pagination-info {
    color: var(--text-muted);
    font-size: 0.9rem;
}
