:root {
  --bg: #0d141a;
  --panel: rgba(23, 33, 43, 0.92);
  --panel-2: rgba(31, 45, 58, 0.96);
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f7fb;
  --muted: #aab8c6;
  --accent: #49a2ff;
  --accent-2: #78c4ff;
  --danger: #ff5f73;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "SF Pro Display", system-ui, sans-serif;
  background:
    radial-gradient(circle at top right, rgba(73, 162, 255, 0.18), transparent 26%),
    linear-gradient(180deg, #091015 0%, #0d141a 40%, #111923 100%);
  color: var(--text);
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

.app-shell {
  max-width: 1380px;
  margin: 0 auto;
  padding: 18px 18px 32px;
}

.topbar,
.search-panel,
.summary-row {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 16px;
  margin-bottom: 14px;
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: 1.55rem;
}

.eyebrow {
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
}

.search-panel {
  padding: 14px;
  margin-bottom: 12px;
}

.search-panel label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

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

.search-row input {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 14px;
  padding: 14px 16px;
  outline: none;
}

.search-row input::placeholder {
  color: #8794a5;
}

.ghost-btn,
.load-more {
  border: 1px solid rgba(120, 196, 255, 0.24);
  background: rgba(73, 162, 255, 0.08);
  color: var(--accent-2);
  border-radius: 14px;
  padding: 12px 16px;
  cursor: pointer;
}

.summary-row {
  padding: 12px 14px;
  margin-bottom: 14px;
  color: var(--muted);
}

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

.media-card {
  min-width: 0;
}

.card-hitbox {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: inherit;
  border-radius: 22px;
  overflow: hidden;
  padding: 0;
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.card-hitbox:hover {
  transform: translateY(-2px);
  border-color: rgba(120, 196, 255, 0.26);
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.42);
}

.thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #101821;
}

.card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background:
    radial-gradient(circle at top right, rgba(120, 196, 255, 0.12), transparent 28%),
    linear-gradient(135deg, #101821 0%, #18222d 100%);
}

.card-thumb.is-fallback {
  object-fit: cover;
}

.thumb-badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  background: rgba(5, 10, 16, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.76rem;
  color: #f3f7fc;
}

.card-body {
  padding: 14px 14px 12px;
}

.card-title {
  margin: 0 0 8px;
  font-size: 1rem;
  line-height: 1.34;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 4.02em;
}

.card-model,
.card-stats {
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.35;
}

.card-model {
  min-height: 2.7em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.load-more {
  width: 100%;
  margin-top: 16px;
}

.empty-state {
  text-align: center;
  padding: 32px 18px;
  color: var(--muted);
}

.detail-sheet[hidden] {
  display: none;
}

.detail-sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(5px);
}

.sheet-card {
  position: absolute;
  inset: auto 0 0;
  max-width: 880px;
  margin: 0 auto;
  background: linear-gradient(180deg, #101922 0%, #0f161d 100%);
  border-top-left-radius: 26px;
  border-top-right-radius: 26px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 14px 14px 20px;
}

.sheet-close {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 10px 6px 14px;
  cursor: pointer;
}

.detail-gallery {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.detail-gallery img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #101821;
}

.detail-body {
  padding: 14px 6px 0;
}

.detail-body h2 {
  margin: 0 0 10px;
  font-size: 1.2rem;
  line-height: 1.25;
}

.detail-meta {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

.primary-btn {
  width: 100%;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #3d9cff 0%, #67c4ff 100%);
  color: #06131d;
  font-weight: 700;
  padding: 15px 18px;
  cursor: pointer;
}

.primary-btn[disabled] {
  opacity: 0.65;
  cursor: wait;
}

.send-status {
  min-height: 22px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .app-shell {
    padding: 12px 10px 24px;
  }

  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .thumb-wrap {
    aspect-ratio: 4 / 5;
  }

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