:root {
  --bg: #141117;
  --panel: #211b25;
  --panel-soft: #2a222f;
  --text: #f7f1f4;
  --muted: #b7a9b3;
  --accent: #a90f2c;
  --accent-2: #d21f3f;
  --accent-3: #ff405f;
  --line: rgba(255, 255, 255, .09);
  --danger: #ff6b8e;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 0% 0%, rgba(210, 31, 63, .20), transparent 34%),
    radial-gradient(circle at 100% 4%, rgba(108, 24, 40, .32), transparent 32%),
    linear-gradient(180deg, #17121a 0%, var(--bg) 44%, #100e12 100%);
  color: var(--text);
}
button, textarea { font: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: rgba(20, 17, 23, .93);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand-wrap { min-width: 0; display: flex; align-items: center; gap: 11px; }
.brand-mark { flex: 0 0 auto; width: 43px; height: 43px; display: grid; place-items: center; overflow: hidden; }
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: contain; }
.brand-copy { min-width: 0; }
.brand { font-weight: 900; letter-spacing: .015em; color: var(--text); font-size: 20px; line-height: 1.05; }
.subtitle { color: var(--muted); margin-top: 4px; font-size: 12px; line-height: 1.1; }
.refresh {
  width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(42, 34, 47, .82); color: var(--text); font-size: 21px; cursor: pointer;
  transition: transform .16s ease, border-color .16s ease;
}
.refresh:active { transform: scale(.95) rotate(-12deg); }
@media (hover: hover) { .refresh:hover { border-color: rgba(210, 31, 63, .52); } }

main { padding: 12px 10px 28px; }
.grid { column-count: 2; column-gap: 10px; }
.card {
  position: relative; display: inline-block; width: 100%; margin: 0 0 10px; break-inside: avoid;
  border-radius: 17px; overflow: hidden; background: rgba(42, 34, 47, .68);
  border: 1px solid rgba(255, 255, 255, .075); box-shadow: 0 12px 30px rgba(0,0,0,.22);
  cursor: pointer; transform: translateZ(0);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.card:active { transform: scale(.985); }
@media (hover: hover) {
  .card:hover { transform: translateY(-2px); border-color: rgba(210, 31, 63, .46); box-shadow: 0 18px 42px rgba(0,0,0,.32); }
}
.card-media { position: relative; overflow: hidden; background: #0d0b10; }
.card-media img { width: 100%; height: auto; object-fit: contain; display: block; }
.card-code {
  padding: 9px 10px 10px; color: #c9bec6; font-size: 12px; font-weight: 700; line-height: 1;
  letter-spacing: .025em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pin {
  position: absolute; top: 8px; right: 8px; width: 27px; height: 27px; border-radius: 9px;
  display: grid; place-items: center; color: white; background: linear-gradient(135deg, var(--accent), var(--accent-3));
  box-shadow: 0 8px 20px rgba(210, 31, 63, .34); font-size: 14px; z-index: 1;
}
.empty, .loader { padding: 42px 20px; text-align: center; color: var(--muted); }
.loader { column-span: all; }
.hidden { display: none !important; }

.modal {
  position: fixed; inset: 0; z-index: 10; background: rgba(0,0,0,.76); overflow-y: auto;
  padding: 10px; animation: fadeIn .16s ease;
}
.modal-card {
  position: relative; margin: 0 auto 30px; max-width: 780px; background: linear-gradient(180deg, #251d2a, var(--panel));
  border: 1px solid var(--line); border-radius: 24px; padding: 12px;
  box-shadow: 0 24px 70px rgba(0,0,0,.44); animation: slideUp .18s ease;
}
.close {
  position: absolute; right: 14px; top: 14px; z-index: 2; border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 999px; width: 38px; height: 38px; font-size: 25px; background: rgba(0,0,0,.50);
  color: white; cursor: pointer; backdrop-filter: blur(10px);
}
.renders {
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding-bottom: 10px; scrollbar-width: thin;
}
.renders img {
  min-width: 88%; max-height: 76vh; object-fit: contain; background: #0d0b10; border-radius: 18px;
  scroll-snap-align: center; border: 1px solid rgba(255,255,255,.06);
}
.model-head { padding: 2px 2px 0; }
h1 { margin: 12px 0 8px; font-size: 26px; line-height: 1.12; }
.model-note { margin: 0 0 12px; color: var(--muted); line-height: 1.38; font-size: 14px; }
textarea {
  width: 100%; min-height: 108px; resize: vertical; margin: 4px 0 14px;
  border: 1px solid var(--line); border-radius: 16px; background: rgba(13, 11, 16, .58);
  color: var(--text); padding: 13px 14px; outline: none; font-size: 16px;
}
textarea::placeholder { color: #8e8293; }
textarea:focus { border-color: rgba(210, 31, 63, .68); }
.request {
  width: 100%; border: none; border-radius: 17px; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white; font-size: 17px; font-weight: 900; padding: 15px;
  box-shadow: 0 12px 30px rgba(210, 31, 63, .28); cursor: pointer;
}
.request:active { transform: scale(.992); }
.request:disabled { opacity: .65; }
.status {
  position: fixed; left: 14px; right: 14px; bottom: 16px; z-index: 20; padding: 14px 15px;
  background: rgba(33, 27, 37, .97); border: 1px solid rgba(210, 31, 63, .45);
  border-radius: 16px; color: var(--text); line-height: 1.4; white-space: pre-line;
  box-shadow: 0 16px 42px rgba(0,0,0,.42); backdrop-filter: blur(14px);
}
.status.error { border-color: var(--danger); color: var(--danger); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(10px); opacity: .85; } to { transform: translateY(0); opacity: 1; } }

@media (min-width: 720px) {
  .grid { column-count: 3; column-gap: 12px; }
  .card { margin-bottom: 12px; }
  main { padding-left: 16px; padding-right: 16px; }
}
@media (min-width: 1080px) {
  .grid { column-count: 4; column-gap: 14px; }
  .card { margin-bottom: 14px; }
  main { max-width: 1180px; margin: 0 auto; }
}
