:root {
  --bg: #0e1014;
  --panel: #11151c;
  --panel2: #18202b;
  --panel3: #0d131a;
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.2);
  --text: #f5f5f5;
  --muted: rgba(255, 255, 255, 0.72);
  --accent: #ff4c4c;
  --accent2: #ff7b3c;
  --skip: #2d6d93;
  --guess: #66d45a;
  --green: #1db954;
  --green-dark: #159a46;
  --radius: 16px;
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Segoe UI, system-ui, sans-serif;
  background: radial-gradient(
      1000px 420px at 50% -120px,
      rgba(255, 76, 76, 0.12),
      transparent 60%
    ),
    radial-gradient(
      700px 360px at 10% 20%,
      rgba(29, 185, 84, 0.06),
      transparent 65%
    ),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  text-decoration: none;
  color: inherit;
}

/* NAV */
.nav {
  background: rgba(21, 23, 27, 0.9);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
}

.nav-inner {
  max-width: var(--max);
  margin: auto;
  display: flex;
  justify-content: space-between;
  padding: 14px 18px;
  gap: 16px;
}

.brand {
  font-weight: 800;
  letter-spacing: 0.2px;
}

.nav-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.nav-links a {
  font-weight: 700;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.nav-links a:hover {
  opacity: 0.9;
}

.nav-links a.active {
  color: var(--accent);
}

/* PAGE */
.heardle-page {
  min-height: calc(100vh - 72px);
  padding: 16px 18px 28px;
}

.heardle-wrap {
  max-width: 760px;
  margin: 0 auto;
}

/* TOP BAR */
.heardle-topbar {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.icon-btn,
.info-link {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  justify-self: center;
  transition: transform 0.15s ease, background 0.15s ease,
    border-color 0.15s ease;
}

.icon-btn:hover,
.info-link:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-strong);
}

.heardle-title {
  margin: 0;
  text-align: center;
  font-size: clamp(1.9rem, 3.6vw, 2.9rem);
  font-weight: 900;
  font-family: Georgia, "Times New Roman", serif;
  background: linear-gradient(180deg, #ffffff, #cfd6df);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.7px;
  line-height: 1;
  text-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

.heardle-title span {
  display: inline-block;
  font-size: 0.72em;
  transform: translateY(-1px);
  -webkit-text-fill-color: initial;
  background: none;
}

/* MAIN PANEL */
.heardle-panel {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.045),
    rgba(255, 255, 255, 0.02)
  );
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px 18px 16px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  overflow: visible;
}

/* GUESS SLOTS */
.guess-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.guess-row {
  min-height: 50px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease,
    transform 0.15s ease;
}

.guess-row.correct {
  background: rgba(102, 212, 90, 0.16);
  border-color: rgba(102, 212, 90, 0.7);
}

.guess-row.incorrect {
  background: rgba(255, 76, 76, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

.guess-row.skip {
  color: var(--muted);
}

/* PROGRESS */
.progress-wrap {
  margin-bottom: 14px;
}

.clip-bar {
  width: 100%;
  height: 14px;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

.clip-progress {
  width: 0%;
  height: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  transition: width 0.15s linear;
}

.clip-times {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  font-weight: 800;
}

/* PLAY */
.play-wrap {
  text-align: center;
  margin-bottom: 16px;
}

.play-button {
  width: 68px;
  height: 68px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(180deg, var(--green), var(--green-dark));
  color: white;
  font-size: 1.7rem;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  box-shadow: 0 6px 18px rgba(29, 185, 84, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.15);
  animation: playPulse 2.5s infinite;
}

.play-button:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 28px rgba(29, 185, 84, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.play-button:active {
  transform: scale(0.95);
}

.play-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  animation: none;
  box-shadow: 0 4px 14px rgba(29, 185, 84, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.clip-info {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

@keyframes playPulse {
  0% {
    box-shadow: 0 6px 18px rgba(29, 185, 84, 0.35),
      0 0 0 0 rgba(29, 185, 84, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.15);
  }
  70% {
    box-shadow: 0 6px 18px rgba(29, 185, 84, 0.35),
      0 0 0 14px rgba(29, 185, 84, 0), inset 0 0 0 1px rgba(255, 255, 255, 0.15);
  }
  100% {
    box-shadow: 0 6px 18px rgba(29, 185, 84, 0.35), 0 0 0 0 rgba(29, 185, 84, 0),
      inset 0 0 0 1px rgba(255, 255, 255, 0.15);
  }
}

/* SEARCH */
.guess-input-wrap {
  position: relative;
  margin-bottom: 14px;
  overflow: visible;
  z-index: 40;
}

.search-shell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.24);
  background: rgba(0, 0, 0, 0.18);
  padding: 0 14px;
  transition: border-color 0.15s ease, background 0.15s ease,
    box-shadow 0.15s ease;
}

.search-shell:focus-within {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(0, 0, 0, 0.24);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.03);
}

.search-icon {
  color: white;
  font-size: 1.2rem;
  line-height: 1;
  flex: 0 0 auto;
}

.guess-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 1.02rem;
  min-width: 0;
}

.guess-input::placeholder {
  color: rgba(255, 255, 255, 0.74);
}

/* AUTOCOMPLETE */
.autocomplete-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  background: #193246;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  overflow: hidden;
  z-index: 9999;
  display: none;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.45);
}

.autocomplete-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  border: none;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-family: inherit;
  font-size: 0.98rem;
  transition: background 0.12s ease;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active,
.autocomplete-item:focus {
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

/* BUTTONS */
.controls-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 0;
}

.skip-btn,
.guess-btn,
.ghost-btn,
.btn {
  border: none;
  cursor: pointer;
  border-radius: 10px;
  font-weight: 900;
  font-family: inherit;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.skip-btn:hover,
.guess-btn:hover,
.ghost-btn:hover,
.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.skip-btn {
  background: var(--skip);
  color: white;
  padding: 12px 20px;
  min-width: 122px;
  font-size: 1rem;
  box-shadow: 0 8px 18px rgba(45, 109, 147, 0.22);
}

.guess-btn {
  background: var(--guess);
  color: white;
  padding: 12px 26px;
  min-width: 122px;
  font-size: 1rem;
  box-shadow: 0 8px 18px rgba(102, 212, 90, 0.22);
}

.ghost-btn {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 16px;
  font-size: 0.95rem;
}

.btn {
  padding: 12px 16px;
  border-radius: 10px;
  display: inline-block;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #111;
}

.btn-secondary {
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
}

/* HIDDEN YOUTUBE */
#youtube-player {
  position: absolute;
  top: -9999px;
  left: -9999px;
  width: 336px;
  height: 189px;
}

/* MODALS */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.66);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 100;
  backdrop-filter: blur(6px);
}

.modal.hidden {
  display: none;
}

.modal-panel {
  width: min(760px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.modal-head h2 {
  margin: 0;
}

/* STATS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

.stat-card {
  background: #1e2025;
  border-radius: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  text-align: center;
}

.stat-card strong {
  display: block;
  font-size: 22px;
  margin-bottom: 4px;
}

.stat-card span {
  color: var(--muted);
  font-size: 14px;
}

.distribution h3 {
  margin-top: 0;
}

.distribution-row {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.distribution-bar-wrap {
  background: #14161a;
  border-radius: 999px;
  overflow: hidden;
  height: 14px;
  border: 1px solid var(--border);
}

.distribution-bar {
  height: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  width: 0%;
}

/* INFO MODAL */
.info-panel {
  max-width: 860px;
  background: linear-gradient(
    180deg,
    rgba(17, 21, 28, 0.98),
    rgba(12, 15, 20, 0.98)
  );
  color: #fff;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.info-header {
  text-align: center;
  margin-bottom: 12px;
}

.info-header h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 900;
  letter-spacing: 0.2px;
}

.info-intro {
  text-align: center;
  font-size: 1.08rem;
  line-height: 1.5;
  max-width: 680px;
  margin: 0 auto 24px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
}

.info-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.14);
  margin: 0 auto 28px;
  max-width: 78%;
}

.info-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 26px;
}

.info-icon {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 900;
  color: #fff;
}

.info-text {
  font-size: 1.04rem;
  line-height: 1.55;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
}

.info-actions {
  text-align: center;
  margin-top: 8px;
}

.info-actions .guess-btn {
  min-width: 170px;
}

/* RESULT PAGE SHARED */
.content-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
}

.section {
  background: var(--panel);
  border-radius: 18px;
  border: 1px solid var(--border);
  padding: 22px;
  margin-bottom: 18px;
}

.section h2 {
  margin: 0 0 12px;
}

.section p {
  color: var(--muted);
  line-height: 1.6;
}

.cta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.countdown-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 220px;
  text-align: center;
}

/* RESPONSIVE WIDTH */
@media (max-width: 760px) {
  .heardle-panel {
    padding: 18px;
  }

  .heardle-title {
    font-size: 2.2rem;
  }

  .guess-row {
    min-height: 54px;
  }

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

  .skip-btn,
  .guess-btn {
    width: 100%;
  }

  .stats-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .heardle-topbar {
    grid-template-columns: 44px 1fr 44px;
  }
}

@media (max-width: 640px) {
  .info-row {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .info-icon {
    margin: 0 auto;
  }

  .info-text {
    font-size: 1rem;
  }
}

/* RESPONSIVE HEIGHT - LAPTOP FIT */
@media (max-height: 900px) {
  .heardle-page {
    padding-top: 10px;
    padding-bottom: 18px;
  }

  .heardle-topbar {
    margin-bottom: 10px;
  }

  .heardle-panel {
    padding: 16px 16px 14px;
  }

  .guess-grid {
    gap: 8px;
    margin-bottom: 12px;
  }

  .guess-row {
    min-height: 46px;
    font-size: 0.92rem;
  }

  .progress-wrap {
    margin-bottom: 12px;
  }

  .play-wrap {
    margin-bottom: 12px;
  }

  .play-button {
    width: 62px;
    height: 62px;
    font-size: 1.5rem;
  }

  .guess-input-wrap {
    margin-bottom: 12px;
  }

  .search-shell {
    min-height: 50px;
  }

  .clip-info {
    font-size: 0.86rem;
  }
}
