:root {
  --bg: #101112;
  --card: #181a1d;
  --text: #f7f4ef;
  --muted: #a7a19a;
  --accent: #6ccf9b;
  --accent-2: #f4b45f;
  --border: rgba(255, 255, 255, .1);
  --radius: 18px;
  --surface: rgba(255, 255, 255, .055);
  --surface-strong: rgba(255, 255, 255, .095);
  --shadow-soft: 0 14px 40px rgba(0, 0, 0, .24);
  --shadow-card: 0 10px 30px rgba(0, 0, 0, .18);
}

html {
  background: var(--bg);
}

body {
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(108, 207, 155, .13), transparent 34rem),
    linear-gradient(180deg, #111312 0%, #151312 42%, #0f1011 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.45;
}

header {
  background: rgba(16, 17, 18, .78);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 10px 32px rgba(0, 0, 0, .16);
  backdrop-filter: blur(18px) saturate(1.08);
}

.h-wrap {
  max-width: 1240px;
  min-height: 48px;
  flex-wrap: wrap;
}

.title {
  color: var(--text);
  font-size: 18px;
  font-weight: 850;
}

.tools {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.select,
.pill {
  min-height: 42px;
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}

.select {
  padding: 9px 36px 9px 14px;
  border-radius: 14px;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 18px,
    calc(100% - 13px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  font-weight: 650;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 13px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 650;
}

.pill strong {
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
}

.upload-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.upload-input {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  max-width: 190px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}

.upload-input input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-submit {
  flex: 0 0 auto;
  color: var(--accent);
}

.container {
  max-width: 1240px;
  margin: 22px auto 86px;
  padding: 0 14px;
}

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

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-color: var(--border);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .035));
  box-shadow: var(--shadow-card);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, .18);
  box-shadow: var(--shadow-soft);
}

.img-wrap {
  flex: 1 1 auto;
  padding: 7px;
  background: #0c0d0e;
}

.img-wrap a {
  height: 100%;
  border-radius: 16px;
  outline: none;
}

.img-wrap a:focus-visible {
  box-shadow: 0 0 0 3px rgba(108, 207, 155, .55);
}

.img-wrap img {
  border-radius: 16px;
  background: #0b0c0d;
}

.overlay-bar {
  flex-wrap: nowrap;
  justify-content: center;
  gap: 5px;
  max-width: calc(100% - 10px);
  margin: auto auto 10px;
  padding: 5px;
  border-color: var(--border);
  border-radius: 12px;
  background: rgba(15, 16, 17, .74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 10px 26px rgba(0, 0, 0, .18);
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-color: var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
  transition: transform .12s ease, background .18s ease, border-color .18s ease, color .18s ease, opacity .18s ease;
}

.icon-btn:hover {
  background: var(--surface-strong);
  border-color: rgba(255, 255, 255, .18);
}

.icon-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(108, 207, 155, .5), inset 0 1px 0 rgba(255, 255, 255, .08);
}

.icon-btn:active {
  transform: translateY(1px) scale(.98);
}

.overlay-bar .icon-btn {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 11px;
}

.overlay-bar .icon {
  width: 19px;
  height: 19px;
}

.vote:not([disabled]) {
  color: #ffcf80;
}

.vote[disabled] {
  color: var(--accent);
}

.count {
  flex: 0 0 auto;
  min-width: 1.8ch;
  color: var(--accent-2);
  font-size: 14px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  text-shadow: none;
}

.del-btn {
  color: #ff8a8a;
}

.del-btn:hover {
  background: rgba(207, 69, 69, .28);
  color: #ffe2e2;
}

.lightbox {
  background: rgba(5, 6, 7, .86);
  backdrop-filter: blur(12px) saturate(1.05);
}

.lb-inner {
  gap: 12px;
  width: min(100%, 1320px);
}

.lb-stage {
  border-radius: 22px;
}

.lb-img {
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .4);
}

.lb-nav {
  background: rgba(16, 17, 18, .74);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .08);
}

.lb-promo {
  width: min(100%, 560px);
  border-color: rgba(255, 255, 255, .12);
  border-radius: 16px;
  background: rgba(18, 19, 20, .82);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .2);
}

.lb-promo a {
  color: var(--accent);
}

.lb-actions {
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 18px;
  background: rgba(16, 17, 18, .62);
  backdrop-filter: blur(12px);
}

#bottomFooter {
  background: rgba(16, 17, 18, .78);
  border-top-color: var(--border);
  color: var(--muted);
  backdrop-filter: blur(16px);
}

#toTop {
  box-shadow: 0 12px 28px rgba(0, 0, 0, .26);
}

@media (max-width: 760px) {
  header {
    padding: calc(env(safe-area-inset-top) + 8px) 12px 9px;
  }

  .h-wrap {
    align-items: flex-start;
    gap: 10px;
  }

  .tools {
    width: 100%;
    gap: 8px;
  }

  .tools form {
    flex: 1 1 150px;
  }

  .tools .upload-form {
    flex: 1 1 100%;
  }

  .upload-input {
    flex: 1 1 auto;
    max-width: none;
  }

  .select {
    width: 100%;
    min-width: 0;
  }

  .pill {
    flex: 0 0 auto;
  }

  .container {
    margin-top: 14px;
    padding: 0 10px;
  }

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

  .card {
    border-radius: 17px;
  }

  .card:hover {
    transform: none;
  }

  .img-wrap {
    padding: 5px;
  }

  .img-wrap img,
  .img-wrap a {
    border-radius: 13px;
  }

  .overlay-bar {
    gap: 4px;
    margin: auto auto 8px;
    padding: 4px;
    border-radius: 11px;
  }

  .overlay-bar .icon-btn {
    width: 32px;
    height: 32px;
  }

  .count {
    font-size: 13px;
  }

  .lb-img {
    border-radius: 16px;
  }

  .lb-actions {
    border-radius: 16px;
  }
}

@media (max-width: 380px) {
  .grid {
    gap: 8px;
  }

  .overlay-bar {
    gap: 3px;
  }

  .overlay-bar .icon-btn {
    width: 30px;
    height: 30px;
  }

  .overlay-bar .icon {
    width: 18px;
    height: 18px;
  }
}
