:root {
  color-scheme: dark;
  --bg: #0d1117;
  --bg-deep: #101722;
  --ink: #e6edf3;
  --muted: #a6b0bb;
  --accent: #4c79ff;
  --accent-dark: #cbd5f5;
  --card: #121826;
  --border: rgba(230, 237, 243, 0.12);
  --shadow: 0 24px 50px rgba(0, 0, 0, 0.35);
  font-family: "Noto Sans Khmer", "Space Grotesk", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(140deg, var(--bg), var(--bg-deep));
  color: var(--ink);
  min-height: 100vh;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 10% 15%, rgba(76, 121, 255, 0.18), transparent 45%),
    radial-gradient(circle at 90% 10%, rgba(24, 39, 66, 0.32), transparent 45%),
    repeating-linear-gradient(
      120deg,
      rgba(230, 237, 243, 0.04) 0,
      rgba(230, 237, 243, 0.04) 1px,
      transparent 1px,
      transparent 24px
    );
  z-index: -1;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  padding: 36px;
  background: var(--card);
  border-radius: 28px;
  box-shadow: var(--shadow);
  animation: rise 0.5s ease-out;
  border: 1px solid rgba(76, 121, 255, 0.2);
}

.hero.compact {
  align-items: center;
}

.eyebrow {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.32em;
  margin: 0 0 12px;
  color: var(--muted);
}

h1 {
  margin: 0 0 12px;
  font-family: "Noto Sans Khmer", "Space Grotesk", sans-serif;
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  letter-spacing: -0.02em;
}

h2 {
  margin: 0 0 12px;
  font-family: "Noto Sans Khmer", "Space Grotesk", sans-serif;
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  letter-spacing: -0.01em;
}

.lead {
  margin: 0;
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 520px;
}

.search {
  min-width: 260px;
  background: #0f1624;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(76, 121, 255, 0.2);
}

.search label {
  font-weight: 600;
  display: block;
  margin-bottom: 8px;
}

.search-row {
  display: flex;
  gap: 12px;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--ink);
}

button {
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--accent), #3559c7);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(76, 121, 255, 0.25);
}

button.ghost {
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid rgba(203, 213, 245, 0.3);
}

.section {
  margin-top: 40px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.records-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.record-card {
  cursor: pointer;
}

.plate-badge {
  width: 104px;
  height: 38px;
  border-radius: 10px;
  background: #f5f6f8;
  color: #101318;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.95rem;
  border: 2px solid #1b2230;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.08);
}

.plate-civilian {
  background: #ffffff;
  color: #1f4aa8;
  border-color: #1f4aa8;
}

.plate-government {
  background: #0f5b3a;
  color: #ffffff;
  border-color: #ffffff;
}

.plate-ngo {
  background: #1a7ea8;
  color: #ffffff;
  border-color: #ffffff;
}

.plate-cd {
  background: #f3d35a;
  color: #1f4aa8;
  border-color: #1f4aa8;
}

.plate-police {
  background: #ffffff;
  color: #c4232b;
  border-color: #c4232b;
}

.plate-special {
  background: #b0191f;
  color: #f6d548;
  border-color: #f6d548;
}

.record-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.record-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.source-link {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.record-card {
  background: var(--card);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(230, 237, 243, 0.08);
  animation: fade 0.4s ease-out;
  display: grid;
  gap: 10px;
  grid-template-rows: auto auto 1fr;
  align-content: start;
}

.record-card img {
  width: 100%;
  border-radius: 14px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.record-card h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.record-card .meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.record-card .actions {
  display: flex;
  justify-content: flex-end;
}

.record-card .actions button {
  background: #0b1220;
  color: var(--ink);
  border: 1px solid var(--border);
}

.muted {
  color: var(--muted);
  margin: 8px 0 0;
}

.notice {
  background: #0f1624;
  border-radius: 22px;
  padding: 24px;
  border: 1px solid rgba(76, 121, 255, 0.2);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 20;
}

.modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 12, 0.7);
}

.modal-card {
  position: relative;
  background: var(--card);
  border-radius: 24px;
  padding: 28px;
  width: min(900px, 92vw);
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  border: 1px solid rgba(230, 237, 243, 0.12);
  display: grid;
  gap: 18px;
  animation: rise 0.3s ease-out;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid rgba(203, 213, 245, 0.3);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 18px;
}

.modal-notes {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.modal-source {
  display: grid;
  gap: 6px;
}

.modal-source .muted {
  margin: 0;
}

.modal-source .source-text {
  color: var(--ink);
}

.modal-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.modal-gallery img {
  width: 100%;
  border-radius: 16px;
  object-fit: cover;
}

.modal-video iframe {
  width: 100%;
  height: 360px;
  border: none;
  border-radius: 16px;
}

.form {
  display: grid;
  gap: 16px;
  max-width: 520px;
}

label {
  font-weight: 600;
  display: grid;
  gap: 8px;
}

.hidden {
  display: none;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 820px) {
  .hero {
    flex-direction: column;
  }

  .search-row {
    flex-direction: column;
  }

  .modal-card {
    padding: 20px;
  }

  .modal-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .modal-video iframe {
    height: 220px;
  }
}
