:root {
  --ink:#0f172a;
  --muted:#64748b;
  --bg:#0b1020;
  --card:#ffffff;
  --btn:#10b981;
}

* {
  box-sizing:border-box;
}

html, body {
  margin:0;
  padding:0;
  font-family:Inter,system-ui,Segoe UI,Arial;
  color:var(--ink);
  background:#f7f7f8;
}

.wrap {
  max-width:1280px;
  margin:0 auto;
  padding:0 18px;
}

.topbar {
  background:#0b1020;
  color:#e5e7eb;
  position:sticky;
  top:0;
  z-index:10;
}

.topbar .bar {
  display:flex;
  align-items:center;
  gap:16px;
  padding:12px 0;
}

.brand {
  color:#e5e7eb;
  text-decoration:none;
  font-weight:800;
  font-size:18px;
}

.topbar nav a {
  color:#cbd5e1;
  text-decoration:none;
  margin-left:14px;
}

.topbar .btn {
  background:var(--btn);
  color:#0b1020;
  padding:8px 12px;
  border-radius:10px;
  font-weight:800;
}

.search {
  flex:1;
  display:flex;
  justify-content:center;
}

.search input {
  width:420px;
  max-width:60vw;
  padding:8px 12px;
  border-radius:10px;
  border:1px solid #1f2937;
  background:#111827;
  color:#e5e7eb;
}

.hero {
  padding:22px 0 6px;
}

h1 {
  margin:0 0 6px;
}

.muted {
  color:var(--muted);
}

.muted.sm {
  font-size:12px;
}

.masonry {
  column-count:4;
  column-gap:18px;
}

@media (max-width:1200px) {
  .masonry { column-count:3; }
}

@media (max-width:900px) {
  .masonry { column-count:2; }
}

@media (max-width:600px) {
  .masonry { column-count:1; }
}

.m-card {
  break-inside:avoid;
  background:var(--card);
  border-radius:16px;
  overflow:hidden;
  box-shadow:0 10px 28px rgba(2,6,23,.06);
  margin:0 0 18px;
}

.m-card .thumb { display:block; }
.m-card img { width:100%; height:auto; display:block; }

.m-card .m-meta {
  padding:10px 12px 12px;
}

.m-card .title a {
  color:#0f172a;
  text-decoration:none;
  font-weight:800;
}

.m-card .sub {
  font-size:12px;
  color:#64748b;
  margin-top:6px;
}

.empty {
  color:#475569;
  background:white;
  padding:22px;
  border-radius:12px;
  box-shadow:0 8px 22px rgba(2,6,23,.04);
}

.pagination {
  display:flex;
  gap:8px;
  margin:18px 0 36px;
}

.page {
  padding:6px 10px;
  background:white;
  border-radius:10px;
  text-decoration:none;
  color:#0f172a;
  box-shadow:0 4px 12px rgba(2,6,23,.06);
}

.page.active {
  background:var(--btn);
  color:white;
}

.btn {
  background:var(--btn);
  color:white;
  padding:10px 14px;
  border:none;
  border-radius:12px;
  cursor:pointer;
  font-weight:800;
  text-decoration:none;
  display:inline-block;
}

.btn.big { padding:12px 18px; border-radius:14px; }
.btn.danger { background:#ef4444; }

.footer {
  color:#64748b;
  padding:18px 0 36px;
}

.form label {
  display:block;
  margin:10px 0;
}

.form input,
.form select {
  width:100%;
  padding:10px;
  border:1px solid #e5e7eb;
  border-radius:10px;
}

.grid2 {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px;
}

@media (max-width:800px) {
  .grid2 { grid-template-columns:1fr; }
}

.error {
  background:#fee2e2;
  color:#b91c1c;
  padding:12px;
  border-radius:10px;
}

.actions {
  margin-top:10px;
  display:flex;
  gap:10px;
  align-items:center;
}

.uploader {
  background:white;
  border:2px dashed #cbd5e1;
  border-radius:16px;
  padding:18px;
  margin-top:8px;
}

.uploader.drag {
  border-color:#10b981;
  background:#ecfdf5;
}

.uploader-inner {
  text-align:center;
}

.preview img {
  max-width:100%;
  max-height:300px;
  border-radius:12px;
  box-shadow:0 10px 28px rgba(2,6,23,.06);
  margin-bottom:10px;
}

.image-page {
  display:grid;
  grid-template-columns:1fr 360px;
  gap:24px;
  align-items:start;
  padding:18px 0 36px;
}

@media (max-width:1000px) {
  .image-page { grid-template-columns:1fr; }
}

.full {
  width:100%;
  border-radius:16px;
  box-shadow:0 20px 60px rgba(2,6,23,.08);
  user-select:none;
  -webkit-user-drag:none;
}

.info {
  background:white;
  border-radius:16px;
  box-shadow:0 10px 28px rgba(2,6,23,.06);
  padding:16px;
}

.info .actions {
  margin-top:12px;
  display:flex;
  gap:10px;
}

code {
  background:#f1f5f9;
  padding:2px 6px;
  border-radius:6px;
}

.card.pad,
.pad {
  background:white;
  border-radius:16px;
  box-shadow:0 10px 28px rgba(2,6,23,.06);
  padding:16px;
}
/* ==== Fix long text overflow on detail card ==== */
.image-page { display: grid; grid-template-columns: 1fr 420px; gap: 28px; }
@media (max-width: 980px) { .image-page { grid-template-columns: 1fr; } }

.img-protect img { max-width: 100%; height: auto; display: block; }

/* trong ô thông tin bên phải */
.info .proof a,
.info .proof code,
.info .muted,
.info .proof div {
  word-break: break-word;          /* modern */
  overflow-wrap: anywhere;         /* modern */
  white-space: normal;
}

.info { max-width: 520px; }
.info .proof code { display: inline-block; padding: 2px 6px; border-radius: 6px; background:#f1f5f9; }
.info .proof a,
.info .proof code,
.info .proof div { word-break: break-word; overflow-wrap: anywhere; white-space: normal; }

