:root {
  --bg: #0b0c0d;
  --surface: #121415;
  --surface-2: #191c1f;
  --surface-3: #22262a;
  --text: #f7f7f2;
  --muted: #aeb5ad;
  --soft: #d8dfd2;
  --green: #1ed760;
  --green-2: #13aa4b;
  --rose: #ef7d78;
  --amber: #f0b35c;
  --line: rgba(255, 255, 255, 0.1);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --player-height: 98px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, "Segoe UI", Roboto, Arial, sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

body::selection {
  background: rgba(30, 215, 96, 0.35);
}

button,
a {
  color: inherit;
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(30, 215, 96, 0.75);
  outline-offset: 3px;
}

img {
  display: block;
  max-width: 100%;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(145deg, rgba(30, 215, 96, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(239, 125, 120, 0.16), transparent 36%),
    linear-gradient(180deg, #101211 0%, #0b0c0d 48%, #17100f 100%);
}

.start-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 6, 6, 0.78);
  backdrop-filter: blur(18px);
  transition:
    opacity 420ms ease,
    visibility 420ms ease;
  overflow: hidden;
}

.start-gate::before {
  content: "";
  position: absolute;
  inset: -60px;
  background:
    linear-gradient(180deg, rgba(5, 6, 6, 0.24), rgba(5, 6, 6, 0.82)),
    url("assets/caso-indefinido-cover.png?v=4") center / cover;
  filter: blur(30px) saturate(0.86);
  opacity: 0.28;
  transform: scale(1.08);
}

body.is-started .start-gate {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.gate-panel {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  padding: clamp(28px, 5vw, 54px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(30, 215, 96, 0.12), rgba(239, 125, 120, 0.1)),
    rgba(18, 20, 21, 0.94);
  box-shadow: var(--shadow);
  text-align: center;
}

.gate-panel h1 {
  max-width: 12ch;
  margin: 8px auto 26px;
  font-size: clamp(2.35rem, 7vw, 5.4rem);
  line-height: 0.92;
  text-wrap: balance;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  min-height: calc(100vh - var(--player-height));
  padding-bottom: var(--player-height);
}

.sidebar {
  position: sticky;
  top: 0;
  height: calc(100vh - var(--player-height));
  padding: 24px 16px;
  border-right: 1px solid var(--line);
  background: rgba(7, 8, 8, 0.86);
  backdrop-filter: blur(18px);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 10px;
  font-size: 1.08rem;
  font-weight: 900;
}

.brand-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background:
    linear-gradient(135deg, var(--green), var(--amber));
  box-shadow: 0 0 20px rgba(30, 215, 96, 0.28);
}

.main-nav {
  display: grid;
  gap: 7px;
  margin: 28px 0 30px;
}

.nav-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  transition:
    background 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.nav-item:hover,
.nav-item:focus-visible,
.nav-item.is-active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.nav-item:hover {
  transform: translateX(2px);
}

.library-block {
  padding: 16px 10px 0;
  border-top: 1px solid var(--line);
}

.sidebar-title {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.library-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.library-card img {
  width: 54px;
  height: 54px;
  border-radius: 5px;
  object-fit: cover;
}

.library-card strong,
.library-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.86rem;
}

.content {
  min-width: 0;
  padding: 0 clamp(18px, 4vw, 54px) 54px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  margin: 0 calc(clamp(18px, 4vw, 54px) * -1);
  padding: 0 clamp(18px, 4vw, 54px);
  background: rgba(11, 12, 13, 0.76);
  backdrop-filter: blur(18px);
}

.window-controls {
  display: flex;
  gap: 8px;
}

.window-controls span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.window-controls span:nth-child(1) {
  background: var(--rose);
}

.window-controls span:nth-child(2) {
  background: var(--amber);
}

.window-controls span:nth-child(3) {
  background: var(--green);
}

.spotify-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--soft);
  font-size: 0.92rem;
  font-weight: 800;
  text-decoration: none;
}

.spotify-link:hover,
.spotify-link:focus-visible {
  border-color: rgba(30, 215, 96, 0.55);
  color: var(--text);
}

.hero-section {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 360px) minmax(0, 1fr);
  align-items: end;
  gap: clamp(20px, 4vw, 40px);
  min-height: clamp(410px, 56vh, 590px);
  margin: 0 calc(clamp(18px, 4vw, 54px) * -1) 34px;
  padding: clamp(28px, 5vw, 64px) clamp(18px, 4vw, 54px) 34px;
  background:
    linear-gradient(180deg, rgba(30, 215, 96, 0.2), rgba(11, 12, 13, 0.12) 52%, rgba(11, 12, 13, 0)),
    linear-gradient(120deg, rgba(240, 179, 92, 0.2), transparent 45%),
    linear-gradient(315deg, rgba(239, 125, 120, 0.16), transparent 42%);
  scroll-margin-top: 84px;
  overflow: hidden;
  isolation: isolate;
}

.hero-section::before,
.hero-section::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.hero-section::before {
  inset: -90px;
  background: url("assets/caso-indefinido-cover.png?v=4") center / cover;
  filter: blur(34px) saturate(0.88);
  opacity: 0.22;
  transform: scale(1.08);
}

.hero-section::after {
  background:
    linear-gradient(90deg, rgba(11, 12, 13, 0.12), rgba(11, 12, 13, 0.58)),
    linear-gradient(180deg, rgba(11, 12, 13, 0), rgba(11, 12, 13, 0.42));
}

.cover-frame {
  position: relative;
  z-index: 1;
  width: min(100%, 360px);
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.48);
}

.cover-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: inherit;
  pointer-events: none;
}

.cover-frame::before {
  content: "";
  position: absolute;
  inset: 14px;
  z-index: 1;
  border: 1px solid rgba(30, 215, 96, 0.22);
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
}

body.is-playing .cover-frame::before {
  animation: coverBreath 2.8s ease-in-out infinite;
}

.cover-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 800px;
}

.hero-copy h2,
.section-heading h2 {
  margin: 0;
  font-size: clamp(2.15rem, 6vw, 5.6rem);
  line-height: 0.96;
  text-wrap: balance;
}

.hero-copy p:not(.eyebrow) {
  max-width: 650px;
  margin: 18px 0 0;
  color: var(--soft);
  font-size: clamp(1rem, 2vw, 1.22rem);
  line-height: 1.58;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.primary-action,
.ghost-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 24px;
  border-radius: 999px;
  font-weight: 900;
  transition:
    transform 180ms ease,
    filter 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.primary-action {
  gap: 10px;
  background: var(--green);
  color: #041107;
}

.primary-action.compact {
  min-width: 132px;
}

.primary-action:hover,
.primary-action:focus-visible,
.ghost-action:hover,
.ghost-action:focus-visible {
  transform: translateY(-2px);
}

.primary-action:hover {
  filter: brightness(1.06);
}

.ghost-action {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
}

.ghost-action:hover,
.ghost-action:focus-visible {
  border-color: rgba(30, 215, 96, 0.5);
  background: rgba(255, 255, 255, 0.1);
}

.play-symbol {
  width: 0;
  height: 0;
  margin-left: 3px;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid currentColor;
}

body.is-playing .play-button .play-symbol,
body.is-playing .primary-action.compact .play-symbol {
  width: 13px;
  height: 16px;
  margin-left: 0;
  border: 0;
  background:
    linear-gradient(90deg, currentColor 0 36%, transparent 36% 64%, currentColor 64% 100%);
}

.story-section,
.music-section,
.letter-section {
  margin: 0 auto 38px;
  padding-top: 28px;
  scroll-margin-top: 84px;
}

.story-section {
  padding-top: 68px;
  padding-bottom: 52px;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading h2 {
  font-size: clamp(1.8rem, 4vw, 3.45rem);
}

.chat-board {
  display: grid;
  gap: 12px;
  max-width: 860px;
}

.message {
  width: min(78%, 620px);
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.18);
}

.message span {
  display: block;
  margin-bottom: 8px;
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 900;
}

.message p {
  margin: 0;
  color: var(--soft);
  line-height: 1.5;
}

.from-cristiano {
  justify-self: end;
  background:
    linear-gradient(135deg, rgba(30, 215, 96, 0.18), rgba(255, 255, 255, 0.07));
}

.from-cristiano span {
  color: var(--amber);
}

.message.is-singing {
  border-color: rgba(30, 215, 96, 0.35);
}

.track-table {
  display: grid;
  gap: 7px;
  max-width: 1040px;
}

.track-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) minmax(82px, auto) 54px;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 0 16px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--soft);
  text-align: left;
  transition:
    background 180ms ease,
    transform 180ms ease;
}

button.track-row:hover,
button.track-row:focus-visible,
.track-row:hover {
  background: rgba(255, 255, 255, 0.085);
}

button.track-row:hover {
  transform: translateX(2px);
}

.track-row.is-current {
  border: 1px solid rgba(30, 215, 96, 0.3);
  background:
    linear-gradient(90deg, rgba(30, 215, 96, 0.16), rgba(255, 255, 255, 0.05));
}

.track-number {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.track-title {
  min-width: 0;
}

.track-title strong,
.track-title small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-title strong {
  color: var(--text);
}

.track-title small {
  margin-top: 3px;
  color: var(--muted);
}

.track-tag {
  min-width: 82px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--soft);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.track-duration {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.spotify-embed {
  max-width: 720px;
  margin-top: 22px;
}

.spotify-embed iframe {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: var(--surface);
}

.letter {
  max-width: 820px;
  padding: clamp(22px, 4vw, 42px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04)),
    rgba(18, 20, 21, 0.86);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}

.letter p {
  margin: 0 0 18px;
  color: #f1ede4;
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  line-height: 1.82;
}

.letter p:last-child {
  margin-bottom: 0;
}

.signature {
  padding-top: 8px;
  color: var(--text);
  font-weight: 900;
}

.letter-finale {
  max-width: 820px;
  margin-top: 16px;
  padding: 22px clamp(22px, 4vw, 42px) 0;
  border-top: 1px solid rgba(255, 255, 255, 0.11);
}

.letter-finale p {
  max-width: 520px;
  margin: 0 0 16px;
  color: var(--soft);
  font-size: clamp(1rem, 1.6vw, 1.12rem);
  line-height: 1.56;
}

.letter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-action.subtle {
  min-height: 46px;
  padding-inline: 18px;
}

.letter-actions .ghost-action {
  min-height: 46px;
  padding-inline: 18px;
}

.player-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(320px, 1.25fr) minmax(120px, 1fr);
  align-items: center;
  gap: 20px;
  min-height: var(--player-height);
  padding: 14px clamp(14px, 2vw, 24px);
  border-top: 1px solid var(--line);
  background: rgba(12, 13, 13, 0.94);
  backdrop-filter: blur(22px);
}

.now-playing {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.now-playing img {
  width: 62px;
  height: 62px;
  border-radius: 5px;
  object-fit: cover;
}

.now-playing strong,
.now-playing span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.now-playing span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.player-controls {
  display: grid;
  grid-template-columns: 42px 50px 42px;
  justify-content: center;
  justify-items: center;
  gap: 10px;
}

.icon-button,
.play-button {
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text);
}

.icon-button {
  width: 42px;
  height: 42px;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
}

.play-button {
  width: 50px;
  height: 50px;
  background: var(--text);
  color: #090b0a;
}

.icon-button:hover,
.icon-button:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.play-button:hover,
.play-button:focus-visible {
  transform: scale(1.04);
}

.progress-wrap {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 42px minmax(160px, 420px) 42px;
  align-items: center;
  gap: 10px;
  width: min(520px, 100%);
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.player-status {
  grid-column: 1 / -1;
  max-width: min(520px, 100%);
  margin: -3px 0 0;
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
}

.progress-track {
  position: relative;
  height: 8px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--amber));
}

.sound-bars {
  justify-self: end;
  display: flex;
  align-items: end;
  gap: 5px;
  width: 104px;
  height: 42px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.sound-bars span {
  width: 8px;
  height: 9px;
  border-radius: 999px;
  background: var(--green);
  animation: barPulse 1.1s ease-in-out infinite;
  animation-play-state: paused;
}

.sound-bars span:nth-child(2) {
  animation-delay: 0.16s;
}

.sound-bars span:nth-child(3) {
  animation-delay: 0.32s;
}

.sound-bars span:nth-child(4) {
  animation-delay: 0.48s;
}

.sound-bars span:nth-child(5) {
  animation-delay: 0.64s;
}

body.is-playing .sound-bars span {
  animation-play-state: running;
}

.reveal {
  transform: translateY(18px);
  opacity: 0;
  transition:
    opacity 520ms ease,
    transform 520ms ease;
}

.reveal.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@keyframes barPulse {
  0%,
  100% {
    height: 10px;
  }

  50% {
    height: 33px;
  }
}

@keyframes coverBreath {
  0%,
  100% {
    opacity: 0.16;
    transform: scale(0.985);
  }

  50% {
    opacity: 0.52;
    transform: scale(1);
  }
}

@media (max-width: 980px) {
  :root {
    --player-height: 124px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    height: auto;
    padding: 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .main-nav {
    display: flex;
    gap: 8px;
    margin: 18px 0;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav-item {
    grid-template-columns: 22px max-content;
    min-width: max-content;
  }

  .library-block {
    display: none;
  }

  .hero-section {
    grid-template-columns: 1fr;
    align-items: start;
    min-height: auto;
    padding-top: 34px;
  }

  .cover-frame {
    width: min(260px, 78vw);
  }

  .player-bar {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .now-playing {
    display: none;
  }

  .player-controls {
    width: 100%;
  }

  .sound-bars {
    display: none;
  }
}

@media (max-width: 640px) {
  :root {
    --player-height: 136px;
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    overflow-x: visible;
  }

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
    min-width: 0;
    min-height: 46px;
    padding: 5px 4px;
    font-size: 0.78rem;
    text-align: center;
  }

  .nav-item span {
    font-size: 0.92rem;
  }

  .content {
    padding-inline: 16px;
  }

  .topbar {
    min-height: 62px;
  }

  .spotify-link {
    min-height: 34px;
    padding-inline: 12px;
    font-size: 0.82rem;
  }

  .cover-frame {
    width: min(210px, 62vw);
  }

  .hero-copy h2 {
    font-size: clamp(1.95rem, 10vw, 2.9rem);
  }

  .hero-copy p:not(.eyebrow) {
    display: none;
  }

  .hero-actions {
    display: none;
  }

  .letter-finale {
    padding-inline: 22px;
  }

  .letter-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: min(100%, 220px);
  }

  .message {
    width: 94%;
  }

  .track-row {
    grid-template-columns: 34px minmax(0, 1fr) 48px;
    min-height: 64px;
    padding: 0 12px;
  }

  .track-tag {
    display: none;
  }

  .track-duration {
    font-size: 0.86rem;
  }

  .progress-wrap {
    grid-template-columns: 38px minmax(120px, 1fr) 38px;
  }

  .gate-panel h1 {
    max-width: 10ch;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
