:root {
  --bg: #141416;
  --paper: #22232a;
  --ink: #f5f5f4;
  --muted: #a8a29e;
  --line: #34363f;
  --crimson: #ff1a1a;
  --cyan: #00c2e0;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  --header: 76px;
  --font: "Source Sans 3", "Segoe UI", sans-serif;
  --display: "Outfit", "Source Sans 3", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
}
body.has-player { padding-bottom: 92px; }
img { max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.wrap { width: min(1180px, calc(100% - 28px)); margin: 0 auto; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(20, 20, 22, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  min-height: var(--header);
  display: flex;
  align-items: center;
  gap: 18px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.03em;
  flex: 0 0 auto;
}
.logo-mark {
  width: 42px;
  height: 42px;
  object-fit: contain;
  background: none;
}
.logo span { font-size: 1.15rem; }
.header-search { position: relative; flex: 1; max-width: 460px; }
.header-search input, .hero-search input, .field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--line);
  background: #1b1c22;
  color: var(--ink);
  border-radius: 999px;
  padding: 12px 16px;
  outline: none;
}
.field textarea, .field select { border-radius: 14px; }
.header-search input:focus, .hero-search input:focus, .field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(8, 145, 178, .15);
}
.desktop-nav, .mobile-tools { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }
.desktop-nav a, .nav-btn, .profile-menu summary {
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 999px;
  background: transparent;
  border: 0;
}
.desktop-nav a:hover, .nav-btn:hover { background: #2c2e36; }
.icon-link, .menu-toggle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
}
.mobile-tools { display: none; }
.mobile-drawer { display: none; }
.dropdown { position: relative; }
.dropdown::after {
  content: "";
  position: absolute;
  z-index: 60;
  inset-inline: 0;
  top: 100%;
  height: 12px;
}
.dropdown-panel, .profile-pop {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  min-width: 220px;
  width: max-content;
  max-width: min(280px, 86vw);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 8px;
  display: none;
  z-index: 60;
}
.dropdown:hover .dropdown-panel, .dropdown:focus-within .dropdown-panel, .profile-menu[open] .profile-pop { display: grid; }
.dropdown-panel { grid-template-columns: 1fr; }
.dropdown-panel a, .profile-pop a, .suggest a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 650;
}
.dropdown-panel a:hover, .profile-pop a:hover, .suggest a:hover { background: #2c2e36; }
.suggest {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-start: 0;
  inset-inline-end: 0;
  background: var(--paper);
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 8px;
  z-index: 35;
}
.suggest[hidden] { display: none; }
.suggest strong { display: block; padding: 6px 10px 2px; color: var(--muted); font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; }

.hero {
  padding: 42px 0 18px;
  background:
    radial-gradient(circle at 12% 20%, rgba(200, 16, 46, .12), transparent 28%),
    radial-gradient(circle at 90% 0%, rgba(8, 145, 178, .16), transparent 26%),
    var(--bg);
  border-bottom: 1px solid var(--line);
}
.hero h1 { font-family: var(--display); font-size: clamp(2rem, 4vw, 3.4rem); line-height: .95; margin: 0 0 8px; letter-spacing: -0.04em; }
.hero p { margin: 0 0 18px; color: var(--muted); font-size: 1.15rem; }
.hero-search { display: flex; gap: 8px; }
.hero-search input { border-radius: 16px; padding: 16px 18px; font-size: 1.05rem; }
.hero-search button, .btn {
  border: 0;
  border-radius: 14px;
  background: var(--crimson);
  color: white;
  font-weight: 800;
  padding: 14px 18px;
  box-shadow: 0 8px 16px rgba(200, 16, 46, .22);
}
.btn.secondary { background: var(--paper); color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.section { padding: 28px 0; }
.section h2 { font-family: var(--display); margin: 0 0 16px; letter-spacing: -0.03em; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.cat-card, .panel, .auth-card, .random-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.cat-card { padding: 14px; text-decoration: none; display: flex; gap: 10px; align-items: center; }
.cat-card i { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #ecfeff; color: var(--cyan); }
.ad-frame {
  width: min(1480px, calc(100% - 16px));
  margin: 8px auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.ad-frame.has-left { grid-template-columns: 168px minmax(0, 1fr); }
.ad-frame.has-right { grid-template-columns: minmax(0, 1fr) 168px; }
.ad-frame.has-left.has-right { grid-template-columns: 168px minmax(0, 1fr) 168px; }
.ad-rail { position: sticky; top: calc(var(--header) + 12px); }
.ad-slot { margin: 8px auto 18px; display: grid; place-items: center; }
.ad-slot:empty { display: none; }
.ad-slot-horizontal { width: min(728px, 100%); min-height: 90px; }
.ad-slot-vertical { width: 160px; min-height: 600px; margin: 0 auto; }
.ad-slot-rectangle { width: min(970px, 100%); min-height: 250px; }
.ad-slot ins { width: 100%; }
.ad-map { display: grid; gap: 12px; margin: 16px 0; }
.ad-map-row { display: grid; grid-template-columns: 200px minmax(0, 1fr) 200px; gap: 12px; align-items: stretch; }
.ad-map-box { display: grid; gap: 8px; align-content: start; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.ad-map-box input, .ad-map-box textarea { width: 100%; background: #1b1c22; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.ad-map-box input[type="checkbox"] { width: auto; }
@media (max-width: 1280px) {
  .ad-frame,
  .ad-frame.has-left,
  .ad-frame.has-right,
  .ad-frame.has-left.has-right { grid-template-columns: 1fr; }
  .ad-rail { display: none; }
  .ad-map-row { grid-template-columns: 1fr; }
}

/* Centered round-button grid. Nine fit on a wide row; a short row stays centered. */
.sound-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 18px;
  max-width: 1152px;
  margin-inline: auto;
}

.sound-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 112px;
  flex: 0 0 112px;
  max-width: 112px;
  min-width: 0;
  position: relative;
}
.new-flag {
  position: absolute;
  top: 0;
  inset-inline-end: 8px;
  background: var(--crimson);
  color: white;
  font-size: .65rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 2px 6px;
}

.sound-button {
  width: 88px;
  height: 88px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
  cursor: pointer;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}
.sound-button img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}
.sound-item.is-large {
  width: auto;
  flex: none;
}
.sound-item.is-large .sound-button {
  width: 148px;
  height: 148px;
}

.sound-title {
  display: block;
  margin-top: 14px;
  max-width: 100%;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.sound-title:hover { color: var(--crimson); }
.sound-actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 8px;
}
.sound-button, .favorite-button, .copy-button, .share-button { touch-action: manipulation; }
.favorite-button, .copy-button, .share-button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 3px 0 rgba(0,0,0,.16), 0 6px 10px rgba(0,0,0,.12);
}
.favorite-button {
  background: radial-gradient(circle at 35% 30%, #ff9aaf, #e11d48 58%, #9f1239);
}
.favorite-button.is-active {
  background: radial-gradient(circle at 35% 30%, #ffd0da, #fb7185 40%, #be123c);
  transform: scale(1.06);
}
.copy-button, .share-button {
  background: radial-gradient(circle at 35% 30%, #99f6ff, #06b6d4 55%, #0e7490);
}
.favorite-button:active, .copy-button:active, .share-button:active { transform: translateY(2px) scale(.96); }

.sound-actions { gap: 4px; }
.share-picker {
  position: fixed;
  z-index: 80;
  max-height: 70vh;
  overflow: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 6px;
}
.share-picker-title { margin: 0; padding: 8px 12px 4px; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.share-picker-item {
  display: block;
  width: 100%;
  text-align: start;
  background: transparent;
  border: 0;
  color: var(--ink);
  font-weight: 700;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  cursor: pointer;
}
.share-picker-item:hover { background: #2c2e36; }
.sound-item.is-large .favorite-button,
.sound-item.is-large .copy-button,
.sound-item.is-large .share-button,
.sound-item.is-large .report-flag { width: 48px; height: 48px; }

.detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  align-items: start;
}
.detail-main { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 20px; }
.prose { text-align: start; width: min(680px, 100%); margin-top: 22px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: .92rem; margin: 0 0 8px; }
.crumbs a { color: var(--cyan); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tags a { background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; text-decoration: none; }
.counts { color: var(--muted); margin: 8px 0 0; }

.player {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 50;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}
.player[hidden] { display: none; }
.player-title { font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player input[type="range"] { flex: 1; }
.player button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); color: var(--ink); }

.toast-stack { position: fixed; top: 88px; inset-inline-end: 14px; z-index: 70; display: grid; gap: 8px; }
.toast { background: #1c1917; color: white; border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow); }

.site-footer { background: #17191f; color: #f5f5f4; margin-top: 30px; padding: 36px 0 18px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 18px; }
.site-footer a { color: #e7e5e4; text-decoration: none; display: block; padding: 4px 0; }
.site-footer h3 { margin: 0 0 8px; }
.legal-bar { border-top: 1px solid rgba(255,255,255,.08); margin-top: 18px; padding-top: 12px; color: #a8a29e; }

.auth-card, .panel { padding: 22px; max-width: 520px; margin: 28px auto; }
.auth-card h1 { margin-top: 0; }
.auth-card .btn, .connect-panel .btn { width: 100%; display: block; box-sizing: border-box; }
.oauth-stack, .connect-panel { display: grid; gap: 10px; }
.connect-panel { margin-top: 14px; }
.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 8px;
  box-sizing: border-box;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.oauth-google { background: #fff; color: #1f1f1f; border: 1px solid #747775; }
.oauth-facebook { background: #1877F2; color: #fff; border: 0; }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .8rem; letter-spacing: .08em; margin: 16px 0; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.profile-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.profile-avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: #2c2e36; }
.profile-avatar-empty { display: grid; place-items: center; font-weight: 800; color: var(--ink); }
.avatar-form { margin: 0; }
.avatar-picker { position: relative; display: block; width: 72px; height: 72px; cursor: pointer; }
.avatar-picker input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.avatar-edit {
  position: absolute;
  inset-inline-end: 0;
  bottom: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--crimson);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: .7rem;
  pointer-events: none;
}
.profile-menu summary { display: inline-flex; align-items: center; gap: 8px; }
.nav-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.badge { display: inline-block; margin: 0 4px 4px 0; padding: 3px 8px; border-radius: 999px; background: #2c2e36; font-size: .75rem; font-weight: 700; }
.badge-google { background: #fff; color: #1f1f1f; border: 1px solid #dadce0; }
.badge-facebook { background: #1877F2; color: #fff; }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.color-picker { display: flex; flex-wrap: wrap; gap: 10px; }
.color-picker label { display: grid; justify-items: center; gap: 4px; font-size: .75rem; }
.color-picker { position: relative; }
.color-picker label { position: relative; }
.color-picker .sound-swatch { width: 54px; height: 54px; object-fit: contain; }
.color-picker input { position: absolute; opacity: 0; }
.color-picker input:checked + .sound-swatch { outline: 3px solid var(--cyan); outline-offset: 3px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 8px 12px; border-radius: 999px; text-decoration: none; background: var(--paper); border: 1px solid var(--line); font-weight: 700; }
.tabs a.is-on { background: var(--crimson); color: white; border-color: transparent; }
.dropzone {
  border: 2px dashed var(--line);
  border-radius: 20px;
  background: var(--paper);
  min-height: 180px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 20px;
}
.table-wrap { overflow-x: auto; background: var(--paper); border-radius: 16px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: start; }
.store-links { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  background: #050505;
  color: #fff;
  text-decoration: none;
  font-size: .72rem;
  font-weight: 800;
  border: 1px solid #3a3a3a;
  white-space: nowrap;
}
.store-badge:hover { border-color: var(--crimson); }
.report-menu { position: absolute; top: 0; inset-inline-start: 0; z-index: 2; }
.report-menu summary { list-style: none; }
.report-menu summary::-webkit-details-marker { display: none; }
.report-flag {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #3f3f46;
  color: #fff;
  cursor: pointer;
}
.report-pop {
  position: absolute;
  z-index: 30;
  bottom: calc(100% + 8px);
  inset-inline-start: 0;
  width: 180px;
  display: grid;
  gap: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  box-shadow: var(--shadow);
}
.report-pop select, .report-pop button { width: 100%; }
.admin-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.admin-side { background: #101114; color: white; padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; }
.admin-brand { font-weight: 800; font-size: 1.05rem; margin-bottom: 10px; }
.admin-side a { color: white; text-decoration: none; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; }
.admin-side a b { margin-inline-start: auto; background: var(--crimson); color: #fff; border-radius: 999px; min-width: 22px; text-align: center; font-size: .75rem; padding: 2px 6px; }
.admin-side a:hover, .admin-side a.is-on { background: rgba(255,255,255,.08); }
.admin-side form { margin-top: 12px; }
.admin-main { padding: 22px; }
.admin-main h1 { margin-top: 0; }
.admin-block { margin: 18px 0; }
.admin-block h2 { margin: 0 0 10px; font-size: 1.1rem; }
.admin-filters { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.admin-filters input, .admin-filters select { background: #1b1c22; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.row-actions form { margin: 0; }
.row-actions button, .row-actions a { background: #2c2e36; color: var(--ink); border: 0; border-radius: 8px; padding: 6px 8px; text-decoration: none; font-size: .85rem; }
tr.is-hot td { background: rgba(255, 26, 26, .12); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat-grid a, .stat-grid article { background: var(--paper); border-radius: 16px; padding: 14px; border: 1px solid var(--line); text-decoration: none; }
.stat-grid a:hover { border-color: var(--crimson); }
.stat-grid strong { font-size: 1.6rem; }
.flash { padding: 10px 12px; border-radius: 12px; margin-bottom: 12px; }
.flash.success { background: #ecfdf3; color: #166534; }
.flash.error { background: #fff1f2; color: #9f1239; }
.empty-note { color: var(--muted); background: var(--paper); border-radius: 16px; padding: 18px; }

@media (max-width: 860px) {
  .desktop-nav { display: none; }
  .mobile-tools { display: flex; }
  .header-search { display: none; }
  .header-search.is-open {
    display: block;
    position: absolute;
    top: var(--header);
    left: 14px;
    right: 14px;
    max-width: none;
  }
  .mobile-drawer {
    display: none;
    background: var(--paper);
    border-top: 1px solid var(--line);
    padding: 10px 14px 16px;
  }
  .mobile-drawer.is-open { display: grid; }
  .ad-frame,
  .ad-frame.has-left,
  .ad-frame.has-right,
  .ad-frame.has-left.has-right { grid-template-columns: 1fr; }
  .ad-rail { display: none; }
  .store-badge span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .store-badge { width: 34px; justify-content: center; padding: 0; }
  .footer-grid, .detail, .admin-shell { grid-template-columns: 1fr; }
  .hero-search { flex-direction: column; }
}
[dir="rtl"] .logo { flex-direction: row-reverse; }
