:root {
  --bg: #0b0b0c;
  --card: #141417;
  --border: #24242a;
  --text: #f2f2f2;
  --muted: #a6a6b3;
  --link: #9ec0ff;
  --btn: #2b6cff;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    sans-serif;
}
.container {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px;
}
.topbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.icon-btn.is-auth {
  color: #7ddc9d;
  border-color: #2a5c3c;
}
.login-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 16px;
}
.login-form {
  justify-content: flex-end;
}
.login-status {
  margin: 0;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}
h1,
h2 {
  margin: 0 0 10px 0;
}
.hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
input[type="password"],
input[type="text"],
input[type="file"] {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0f0f12;
  color: var(--text);
  min-width: 220px;
}
button {
  padding: 10px 14px;
  border-radius: 10px;
  border: 0;
  background: var(--btn);
  color: #fff;
  cursor: pointer;
}
button:hover {
  opacity: 0.92;
}
button.secondary {
  background: #2a2a33;
  border: 1px solid var(--border);
}
.danger {
  background: #5c1f28;
  border: 1px solid #7a2a36;
}
.small-btn {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.status {
  margin-top: 10px;
  color: #ffd38a;
  font-size: 13px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.imgcard {
  background: #111114;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.imgcard img {
  width: 100%;
  height: 170px;
  object-fit: cover;
  display: block;
  background: #0e0e12;
  cursor: pointer;
}
.meta {
  padding: 10px;
  font-size: 12px;
  color: #cfcfd7;
}
.name {
  font-weight: 700;
  margin-bottom: 6px;
  word-break: break-word;
}
.details {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
  color: #d7d7df;
}
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
a {
  color: var(--link);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
.sep {
  color: #6f6f7d;
}
.small {
  color: #b6b6c4;
  word-break: break-all;
}

.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
}

.modal-content {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 72px;
}

.modal-card {
  width: min(480px, 90vw);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  align-items: stretch;
  justify-content: flex-start;
  flex-direction: column;
  gap: 16px;
}

.modal-card h3 {
  margin: 0;
}

.modal-form {
  display: grid;
  gap: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.modal-content img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #0e0e12;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(15, 15, 18, 0.8);
}

.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(15, 15, 18, 0.7);
}

.modal-nav.prev {
  left: 16px;
}

.modal-nav.next {
  right: 16px;
}

.modal-nav:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
