* {
  box-sizing: border-box;
}

:root {
  --pm-bg: #08131d;
  --pm-surface: #0f1d2b;
  --pm-surface-2: #142638;
  --pm-border: rgba(255, 255, 255, 0.1);
  --pm-text: #e8eef6;
  --pm-muted: #9fb0c2;
  --pm-accent: #ff6b2c;
  --pm-accent-hover: #ff8247;
  --pm-ok: #16a34a;
  --pm-danger: #dc2626;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--pm-bg);
  color: var(--pm-text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(circle at 18% 22%, rgba(255, 107, 44, 0.08), transparent 34%),
    radial-gradient(circle at 82% 82%, rgba(255, 107, 44, 0.07), transparent 32%);
  background-attachment: fixed;
}

img,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

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

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

h1,
h2,
h3,
p {
  min-width: 0;
}

h1 {
  margin: 0 0 0.625rem;
  font-size: clamp(1.35rem, 2.5vw, 1.8rem);
}

h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.1rem, 2.1vw, 1.35rem);
}

.wrap {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 1.25rem;
  min-width: 0;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(14px);
  background: linear-gradient(180deg, rgba(8, 19, 29, 0.94), rgba(8, 19, 29, 0.84));
  border-bottom: 1px solid var(--pm-border);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
}

.topbar__left {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
}

.crumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--pm-muted);
}

.crumbs__a {
  color: var(--pm-accent);
}

.crumbs__sep {
  opacity: 0.7;
}

.crumbs__cur {
  color: #d8e3ef;
}

.topbar__right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.55rem;
  min-width: 0;
}

.topbar__right .btn,
.topbar__right a.btn {
  max-width: 100%;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid rgba(255, 107, 44, 0.28);
  background: linear-gradient(135deg, #ff6b2c, #cc5500);
  color: #fff;
  padding: 0.6rem 0.95rem;
  border-radius: 0.625rem;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  box-shadow: 0 4px 14px rgba(255, 107, 44, 0.24);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(255, 107, 44, 0.32);
  text-decoration: none;
}

.btn.ok {
  border-color: rgba(22, 163, 74, 0.35);
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.24);
}

.btn.ok:hover {
  box-shadow: 0 8px 20px rgba(22, 163, 74, 0.32);
}

.btn.danger {
  border-color: rgba(220, 38, 38, 0.35);
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.24);
}

.btn.danger:hover {
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.32);
}

.btn[disabled],
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 0.9rem;
}

.card {
  display: block;
  border: 1px solid var(--pm-border);
  background: linear-gradient(135deg, rgba(15, 29, 43, 0.94), rgba(20, 38, 56, 0.9));
  border-radius: 0.9rem;
  padding: 0.7rem;
  color: inherit;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  min-width: 0;
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 107, 44, 0.35);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.25);
}

.card__imgwrap {
  border-radius: 0.7rem;
  overflow: hidden;
  background: #0b1220;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card__imgwrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  margin-top: 0.55rem;
  min-width: 0;
}

.card__id {
  font-size: 0.82rem;
  color: #d8e3ef;
  white-space: nowrap;
}

.card__ph {
  font-size: 0.8rem;
  color: var(--pm-muted);
  padding: 0.75rem;
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.1rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  margin-left: 0.3rem;
  font-size: 0.72rem;
  line-height: 1;
  background: linear-gradient(135deg, #ff6b2c, #cc5500);
  color: #fff;
  font-weight: 700;
}

.pager {
  display: flex;
  justify-content: center;
  margin: 1rem 0 2rem;
}

.btn-load-more {
  padding: 0.7rem 1.3rem;
  border-radius: 0.625rem;
  border: 1px solid rgba(255, 107, 44, 0.35);
  background: rgba(255, 107, 44, 0.1);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.btn-load-more:hover:not(:disabled) {
  background: rgba(255, 107, 44, 0.2);
  transform: translateY(-1px);
}

.btn-load-more:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 9999;
}

.modal.is-open {
  display: block;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

  .modal__panel {
  position: relative;
  margin: 1.35rem auto;
  max-width: 920px;
  width: min(calc(100% - 1.25rem), 920px);
  max-height: calc(100dvh - 2.7rem);
  overflow: auto;
  border-radius: 0.9rem;
  border: 1px solid var(--pm-border);
  background: linear-gradient(135deg, rgba(15, 29, 43, 0.98), rgba(20, 38, 56, 0.95));
  padding: 0.75rem;
}

.modal__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.55rem;
  padding-right: 2.2rem;
  min-width: 0;
}

.modal__title {
  font-size: 0.86rem;
  color: #d8e3ef;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal__link {
  font-size: 0.8rem;
  text-decoration: none;
  border: 1px solid var(--pm-border);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.33rem 0.55rem;
  border-radius: 0.5rem;
  color: #d8e3ef;
}

.modal__close {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  border: 1px solid var(--pm-border);
  background: rgba(255, 255, 255, 0.04);
  color: #e8eef6;
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
}

.modal__img {
  width: 100%;
  height: auto;
  border-radius: 0.75rem;
  border: 1px solid var(--pm-border);
  background: #0b1220;
}

code {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--pm-border);
  border-radius: 0.45rem;
  padding: 0.1rem 0.35rem;
  color: #ffb08a;
  font-family: Consolas, Monaco, monospace;
}

@media (max-width: 1024px) {
  .wrap {
    padding: 1rem;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

@media (max-width: 768px) {
  body {
    background-attachment: scroll;
  }

  .wrap {
    padding: 0.85rem;
  }

  .topbar__inner {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar__right {
    width: 100%;
    justify-content: flex-start;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .card {
    padding: 0.55rem;
  }

  .card__meta {
    flex-wrap: wrap;
  }

  .card__meta .btn {
    flex: 1 1 7rem;
    min-width: 0;
  }

  .modal__panel {
    width: calc(100% - 0.9rem);
    margin: 0.45rem auto;
    max-height: calc(100dvh - 0.9rem);
  }

  .modal__head {
    flex-direction: column;
    align-items: flex-start;
    padding-right: 2rem;
  }
}

@media (max-width: 640px) {
  .wrap {
    padding: 0.75rem 0.65rem;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .btn {
    font-size: 0.85rem;
    padding: 0.58rem 0.85rem;
  }

  .crumbs {
    font-size: 0.78rem;
  }

  .card__meta {
    flex-direction: column;
    align-items: stretch;
  }

  .card__id {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .topbar__right .btn,
  .topbar__right a.btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }

  .pager {
    margin-bottom: 1.3rem;
  }
}
