:root {
    --bg: #0A0A0C;
    --surface: #121215;
    --surface-hover: #1A1A1F;
    --border: #27272A;
    --text-main: #FFFFFF;
    --text-muted: #A1A1AA;
    --accent: #6366F1;
    --accent-hover: #4F46E5;
    --danger: #EF4444;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text-main); min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, h3 { font-family: 'Outfit', sans-serif; font-weight: 800; }

.auth-screen { position: fixed; inset: 0; background: var(--bg); display: flex; justify-content: center; align-items: center; z-index: 500; }
.auth-box { background: var(--surface); border: 1px solid var(--border); padding: 30px; border-radius: 16px; width: 100%; max-width: 360px; text-align: center; }
.auth-box h2 { margin-bottom: 20px; font-size: 1.5rem; }
.auth-box .field { margin-bottom: 15px; }
.w-100 { width: 100%; }
.mt-10 { margin-top: 10px; }
.error-text { color: var(--danger); font-size: 0.85rem; margin-top: 15px; min-height: 20px; }

.header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 20px; position: sticky; top: 0; z-index: 10; }
.header-content { max-width: 1100px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.header h1 { font-size: 1.6rem; }
.header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

#search-input, .tag-filter { background: var(--bg); border: 1px solid var(--border); color: var(--text-main); padding: 10px 16px; border-radius: 8px; font-family: 'Inter', sans-serif; font-size: 0.9rem; outline: none; transition: border-color 0.2s; }
#search-input:focus, .tag-filter:focus { border-color: var(--accent); }
#search-input { width: 220px; }

.container { max-width: 1100px; margin: 30px auto; padding: 0 20px; flex: 1; width: 100%; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; cursor: pointer; transition: all 0.2s ease; display: flex; flex-direction: column; gap: 10px; }
.card:hover { background: var(--surface-hover); border-color: var(--accent); transform: translateY(-2px); }
.card-title { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 1.1rem; word-break: break-word; }
.card-date { color: var(--text-muted); font-size: 0.85rem; }
.card-preview { color: var(--text-muted); font-size: 0.9rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.tags-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.tag-pill { background: rgba(99, 102, 241, 0.15); color: var(--accent); font-size: 0.75rem; padding: 2px 8px; border-radius: 4px; font-weight: 600; }

.empty { text-align: center; padding: 60px 20px; color: var(--text-muted); font-size: 1rem; }

.btn { font-family: 'Inter', sans-serif; font-weight: 600; font-size: 0.9rem; padding: 10px 18px; border-radius: 8px; border: none; cursor: pointer; transition: all 0.2s ease; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text-main); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-hover); }
.btn-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }

.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(4px); display: none; justify-content: center; align-items: center; z-index: 100; padding: 20px; }
.modal-overlay.active { display: flex; }
.modal-content { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; width: 100%; max-width: 640px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { font-size: 1.3rem; }
.btn-close { background: transparent; border: none; color: var(--text-muted); font-size: 26px; cursor: pointer; line-height: 1; }
.btn-close:hover { color: var(--text-main); }

.modal-body { padding: 20px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.field input, .field textarea { background: var(--bg); border: 1px solid var(--border); color: var(--text-main); padding: 10px 14px; border-radius: 8px; font-family: 'Inter', sans-serif; font-size: 0.95rem; outline: none; transition: border-color 0.2s; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--accent); }

.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }

.section { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; }
.section-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.section-value { line-height: 1.5; color: var(--text-main); }
.section-value ul { padding-left: 20px; margin: 5px 0; }
.section-value li { margin-bottom: 4px; }
.section-value p { margin-bottom: 8px; }
.section-value input[type="checkbox"] { margin-right: 8px; cursor: pointer; transform: scale(1.2); vertical-align: middle; }

.guide-body p { margin-bottom: 15px; color: var(--text-muted); }
.guide-table { width: 100%; border-collapse: collapse; }
.guide-table td { padding: 10px; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.guide-table td code { background: var(--bg); padding: 4px 8px; border-radius: 4px; color: var(--accent); font-weight: 600; }
.guide-table td:last-child { text-align: right; color: var(--text-muted); }

#toast-container { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { background: var(--surface); border: 1px solid var(--accent); color: var(--text-main); padding: 12px 20px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); font-weight: 600; animation: slideInRight 0.3s ease forwards; }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOutRight { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

@media (max-width: 600px) {
    .header-actions { width: 100%; flex-direction: column; }
    #search-input, .tag-filter { width: 100%; }
    .header-actions .btn { width: 100%; }
    .field-row { flex-direction: column; }
}