/* ============ RESET & BASE ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0f;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f5f5f7;
  --text-dim: #a1a1aa;
  --text-mute: #71717a;
  --accent: #a78bfa;
  --accent-2: #f472b6;
  --accent-3: #60a5fa;
  --success: #34d399;
  --danger: #f87171;
  --grad: linear-gradient(135deg, #a78bfa 0%, #f472b6 50%, #60a5fa 100%);
  --shadow-lg: 0 20px 60px -10px rgba(167, 139, 250, 0.25);
}

html, body {
  height: 100%;
  font-family: 'Google Sans', 'Google Sans Text', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .grad-text, .display {
  font-family: 'Google Sans Display', 'Google Sans', system-ui, sans-serif;
}

/* ============ ANIMATED BG ============ */
.bg-gradient {
  position: fixed; inset: 0; z-index: -3;
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(167, 139, 250, 0.18), transparent 60%),
    radial-gradient(ellipse 70% 50% at 80% 100%, rgba(244, 114, 182, 0.15), transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 30%, rgba(96, 165, 250, 0.12), transparent 60%),
    var(--bg);
}
.bg-grid {
  position: fixed; inset: 0; z-index: -2;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black, transparent 80%);
}
.orb {
  position: fixed; z-index: -1;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  pointer-events: none;
  animation: float 18s ease-in-out infinite;
}
.orb-1 { width: 500px; height: 500px; top: -150px; left: -150px;
  background: radial-gradient(circle, #a78bfa, transparent 70%); }
.orb-2 { width: 450px; height: 450px; bottom: -150px; right: -100px;
  background: radial-gradient(circle, #f472b6, transparent 70%);
  animation-delay: -6s; }
.orb-3 { width: 380px; height: 380px; top: 40%; right: 30%;
  background: radial-gradient(circle, #60a5fa, transparent 70%);
  animation-delay: -12s; opacity: 0.3; }

@keyframes float {
  0%, 100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.05); }
  66% { transform: translate(-30px, 40px) scale(0.95); }
}

/* ============ NAV ============ */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 32px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(10, 10, 15, 0.5);
  border-bottom: 1px solid var(--border);
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 18px; letter-spacing: -0.02em;
}
.logo-icon {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--grad);
  color: white;
}
.logo-icon svg { width: 18px; height: 18px; }

/* ============ BUTTONS ============ */
.btn-primary, .btn-ghost, .icon-btn, .tab, .btn-copy {
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-primary {
  padding: 12px 22px;
  border-radius: 12px;
  background: var(--grad);
  color: white;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  box-shadow: 0 8px 24px -8px rgba(167, 139, 250, 0.6);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px -8px rgba(167, 139, 250, 0.8);
}
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary svg { width: 16px; height: 16px; }

.btn-ghost {
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px; font-weight: 500;
  text-decoration: none;
}
.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.btn-ghost svg { width: 14px; height: 14px; }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  display: grid; place-items: center;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn svg { width: 16px; height: 16px; }

/* ============ HERO ============ */
.hero {
  text-align: center;
  padding: 80px 24px 50px;
  max-width: 800px;
  margin: 0 auto;
}
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 24px;
}
.badge .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
}
.hero h1 {
  font-size: clamp(38px, 6vw, 64px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 16px;
}
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p {
  font-size: 18px;
  color: var(--text-dim);
  max-width: 540px;
  margin: 0 auto;
}

/* ============ CONTAINER & TABS ============ */
.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 20px 24px 80px;
}
.tabs {
  display: flex;
  gap: 6px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 24px;
  width: fit-content;
}
.tab {
  padding: 10px 18px;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px; font-weight: 500;
}
.tab:hover { color: var(--text); }
.tab.active {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255,255,255,0.05) inset;
}
.tab svg { width: 14px; height: 14px; }

/* ============ PANELS & CARDS ============ */
.panel { display: none; animation: fadeUp 0.4s ease; }
.panel.active { display: block; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 12px;
  margin-bottom: 18px;
}
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
}
.input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  transition: all 0.2s;
  outline: none;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.15);
}
.input::placeholder { color: var(--text-mute); }
.input-sm { font-size: 14px; }

#post-title {
  font-size: 22px; font-weight: 700; letter-spacing: -0.02em;
  padding: 16px 18px;
}

/* Quill overrides */
#editor {
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  min-height: 300px;
  font-size: 16px;
}
.ql-toolbar.ql-snow, .ql-container.ql-snow {
  border: 1px solid var(--border) !important;
  background: rgba(0,0,0,0.2);
}
.ql-toolbar.ql-snow { border-radius: 12px 12px 0 0; padding: 10px; }
.ql-container.ql-snow { border-radius: 0 0 12px 12px; min-height: 280px; }
.ql-snow .ql-stroke { stroke: var(--text-dim); }
.ql-snow .ql-fill { fill: var(--text-dim); }
.ql-snow .ql-picker { color: var(--text-dim); }
.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: var(--accent); }
.ql-snow.ql-toolbar button:hover .ql-fill,
.ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--accent); }
.ql-editor { color: var(--text); font-family: 'Google Sans', sans-serif; }
.ql-editor.ql-blank::before { color: var(--text-mute); font-style: normal; }

/* ============ DROPZONE ============ */
.dropzone {
  display: block;
  border: 2px dashed var(--border-strong);
  border-radius: 16px;
  padding: 60px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: rgba(0,0,0,0.15);
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--accent);
  background: rgba(167, 139, 250, 0.05);
  transform: translateY(-2px);
}
.dropzone.has-file {
  border-color: var(--success);
  border-style: solid;
  background: rgba(52, 211, 153, 0.05);
}
.dropzone-icon {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  display: grid; place-items: center;
  background: var(--surface-2);
  border-radius: 16px;
  color: var(--accent);
}
.dropzone-icon svg { width: 28px; height: 28px; }
.dropzone-title {
  font-size: 18px; font-weight: 600;
  margin-bottom: 6px;
}
.dropzone-sub { font-size: 14px; color: var(--text-mute); }

/* ============ CARD FOOTER ============ */
.card-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 20px; gap: 16px; flex-wrap: wrap;
}
.hint {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  color: var(--text-mute);
}
.hint svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ============ DRAWER ============ */
.drawer-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 90;
  width: 400px; max-width: 92vw;
  background: rgba(15, 15, 22, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.drawer-head h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.drawer-body { flex: 1; overflow-y: auto; padding: 12px; }

.recent-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s;
  position: relative;
}
.recent-item:hover { background: var(--surface); }
.recent-item .ri-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--surface-2);
  display: grid; place-items: center;
  color: var(--accent);
  flex-shrink: 0;
}
.recent-item .ri-icon svg { width: 16px; height: 16px; }
.recent-item .ri-meta { flex: 1; min-width: 0; }
.recent-item .ri-title {
  font-size: 14px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.recent-item .ri-sub {
  font-size: 12px; color: var(--text-mute);
}
.recent-item .ri-del {
  opacity: 0; width: 28px; height: 28px;
  border-radius: 8px; display: grid; place-items: center;
  background: transparent; border: none; cursor: pointer;
  color: var(--danger);
  transition: all 0.15s;
}
.recent-item:hover .ri-del { opacity: 1; }
.recent-item .ri-del:hover { background: rgba(248, 113, 113, 0.15); }
.recent-item .ri-del svg { width: 14px; height: 14px; }
.empty {
  padding: 48px 20px; text-align: center;
  color: var(--text-mute); font-size: 14px;
}

/* ============ MODAL ============ */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  display: grid; place-items: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
  padding: 20px;
}
.modal.open { opacity: 1; pointer-events: auto; }
.modal-card {
  width: 100%; max-width: 480px;
  background: rgba(20, 20, 28, 0.9);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 28px 24px;
  text-align: center;
  transform: scale(0.95);
  transition: transform 0.25s;
  box-shadow: var(--shadow-lg);
}
.modal.open .modal-card { transform: scale(1); }
.success-icon {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--grad);
  display: grid; place-items: center;
  color: white;
  animation: pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.success-icon svg { width: 28px; height: 28px; }
@keyframes pop {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}
.modal-card h2 {
  font-size: 24px; font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.modal-card p {
  color: var(--text-dim);
  margin-bottom: 20px; font-size: 14px;
}
.link-box {
  display: flex; gap: 6px;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  margin-bottom: 20px;
}
.link-box input {
  flex: 1; min-width: 0;
  background: transparent; border: none; outline: none;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  padding: 8px 12px;
}
.btn-copy {
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 13px;
  border: none;
}
.btn-copy:hover { background: #9061f9; }
.btn-copy.copied { background: var(--success); }
.modal-actions {
  display: flex; justify-content: center; gap: 10px;
}

/* ============ TOAST ============ */
.toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translate(-50%, 20px);
  background: rgba(20, 20, 28, 0.95);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px; font-weight: 500;
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: all 0.3s;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast.error { border-color: rgba(248, 113, 113, 0.4); }
.toast.success { border-color: rgba(52, 211, 153, 0.4); }

/* ============ FOOTER ============ */
.footer {
  text-align: center;
  padding: 30px 20px;
  font-size: 13px;
  color: var(--text-mute);
}

/* ============ POST PAGE STYLES ============ */
.post-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 60px 24px 80px;
}
.post-meta {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 28px;
  font-size: 14px;
  color: var(--text-dim);
}
.post-author {
  display: flex; align-items: center; gap: 10px;
}
.author-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--grad);
  display: grid; place-items: center;
  color: white; font-weight: 700;
  font-size: 14px;
}
.post-title {
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 24px;
}
.post-content {
  font-size: 18px;
  line-height: 1.75;
  color: #e4e4e7;
}
.post-content h1, .post-content h2, .post-content h3 {
  margin: 1.5em 0 0.5em;
  letter-spacing: -0.02em;
}
.post-content h1 { font-size: 32px; }
.post-content h2 { font-size: 26px; }
.post-content h3 { font-size: 22px; }
.post-content p { margin-bottom: 1em; }
.post-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 18px;
  margin: 1.4em 0;
  color: var(--text-dim);
  font-style: italic;
}
.post-content code {
  background: rgba(255,255,255,0.08);
  padding: 2px 8px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9em;
}
.post-content pre {
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: 12px;
  overflow-x: auto;
  margin: 1.2em 0;
}
.post-content pre code { background: transparent; padding: 0; }
.post-content img {
  max-width: 100%;
  border-radius: 12px;
  margin: 1em 0;
}
.post-content ul, .post-content ol { padding-left: 24px; margin-bottom: 1em; }
.post-content li { margin-bottom: 0.4em; }

/* 404 page */
.page-center {
  min-height: 100vh;
  display: grid; place-items: center;
  text-align: center;
  padding: 24px;
}
.err-code {
  font-size: 120px; font-weight: 800;
  letter-spacing: -0.05em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}


/* ============ FILE SUMMARY (folder upload) ============ */
.file-summary {
  margin-top: 16px;
  padding: 14px 16px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 13px;
}
.fs-stats {
  display: flex; gap: 18px; flex-wrap: wrap;
  margin-bottom: 10px;
  color: var(--text-dim);
}
.fs-stats b { color: var(--text); }
.fs-list {
  max-height: 160px; overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-mute);
  line-height: 1.7;
}
.fs-list .pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10px;
  margin-right: 8px;
  background: var(--surface-2);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.fs-list .pill.img { color: var(--accent-2); }
.fs-list .pill.html { color: var(--accent-3); }

/* ============ GUIDELINE PAGE ============ */
.guide-wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 60px 24px 80px;
}
.guide-wrap h1 {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}
.guide-wrap > p.lead {
  color: var(--text-dim);
  font-size: 17px;
  max-width: 640px;
  margin-bottom: 32px;
}
.guide-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 22px;
}
.guide-card h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px;
}
.guide-card h2 .num {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--grad);
  color: white;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
}
.code-box {
  position: relative;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.65;
  color: #e4e4e7;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  max-height: 480px;
  overflow-y: auto;
}
.code-box .copy-btn {
  position: absolute;
  top: 10px; right: 10px;
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px; font-weight: 600;
  font-family: 'Google Sans', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}
.code-box .copy-btn:hover { background: var(--accent); border-color: var(--accent); }
.code-box .copy-btn.copied { background: var(--success); border-color: var(--success); }


/* ============ ADMIN INDICATORS ============ */
.admin-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 12px;
  padding: 4px 10px;
  background: linear-gradient(135deg, rgba(167,139,250,0.15), rgba(244,114,182,0.1));
  border: 1px solid rgba(167,139,250,0.3);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-transform: uppercase;
}
.admin-pill svg { width: 11px; height: 11px; }


/* ============ EDIT MODE ============ */
.edit-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(167,139,250,0.12), rgba(96,165,250,0.08));
  border: 1px solid rgba(167,139,250,0.3);
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-dim);
  animation: fadeUp 0.3s ease;
}
.edit-banner svg { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; }
.edit-banner b { color: var(--accent); font-family: 'JetBrains Mono', monospace; font-size: 12px; }

.ri-edit {
  opacity: 0;
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--accent);
  transition: all 0.15s;
}
.recent-item:hover .ri-edit { opacity: 1; }
.ri-edit:hover { background: rgba(167,139,250,0.15); }
.ri-edit svg { width: 14px; height: 14px; }
