* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #0b0b0f;
  color: #eaeaf0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

header {
  text-align: center;
  padding: 15px 20px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid #1f1f2b;
}

header h1 {
  margin: 0 0 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

header input {
  padding: 12px 14px;
  width: 280px;
  border-radius: 8px;
  border: 1px solid #2a2a3b;
  background: #151520;
  color: #fff;
  outline: none;
}

header input::placeholder {
  color: #777;
}

header button {
  padding: 12px 18px;
  margin-left: 8px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #6a5cff, #4b7cff);
  color: white;
  cursor: pointer;
  font-weight: 500;
}

header button:hover {
  opacity: 0.9;
}

.layout {
  display: flex;
  gap: 20px;
  padding: 24px;
  height: calc(100vh - 150px);
}

.player {
  flex: 3;
  background: #0f0f18;
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 0 0 1px #1d1d2a, 0 12px 40px rgba(0,0,0,.6);
  overflow: hidden;
}

.player h2 {
  margin-top: 0;
  margin-bottom: 10px;
}

.description {
  margin: 0 0 12px;
  color: #b3b3c7;
  font-size: 14px;
}

.player video {
  width: 77%;
  max-height: 77%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  background: black;
  display: block;
  margin: 0 auto;
  margin-bottom: 10px;
}

.video-id {
  font-size: 12px;
  color: #7f7f9a;
  font-weight: 500;
  white-space: nowrap;
}

.player-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.sidebar {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  background: #0f0f18;
  border-radius: 14px;
  box-shadow: 0 0 0 1px #1d1d2a, 0 12px 40px rgba(0,0,0,.6);
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #2c2c3d;
  border-radius: 10px;
}

.item {
  display: flex;
  gap: 12px;
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  border-radius: 10px;
  background: #141420;
  transition: background 0.2s, transform 0.15s;
}

.item:hover {
  background: #1d1d2b;
  transform: translateY(-1px);
}

.item img {
  width: 120px;
  height: 68px;
  object-fit: cover;
  object-position: center;
  border-radius: 8px;
  background: #000;
}

.item h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}

.hidden {
  display: none;
}

.page {
  max-width: 1800px;
  margin: 0 auto;
  padding: 0 20px 20px;
}

.meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-description {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
  color: #a9a9c2;
  opacity: 0.9;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.message {
  text-align: center;
  margin: 30px auto 0;
  color: #9a9ab5;
  font-size: 14px;
}

.message.error {
  color: #ff7a7a;
}

.lang-switch {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.lang-switch button {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid #2a2a3b;
  background: #151520;
  color: #ccc;
  cursor: pointer;
}

.lang-switch button.active {
  background: linear-gradient(135deg, #6a5cff, #4b7cff);
  color: white;
  border: none;
}

.download-box {
  margin-top: 12px;
  font-size: 13px;
  color: #bdbdd3;
}

/* Etiqueta code */
.download-box code {
  display: block;
  margin-top: 6px;
  padding: 10px 12px;
  background: #141420;
  border-radius: 8px;
  font-size: 12px;
  color: #eaeaf0;

  /* 🔥 Lo importante */
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}

.empty-player {
  height: 100%;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #8f8fa8;
  font-size: 16px;
  font-weight: 500;
}

@media screen and (max-width: 900px) {
  .layout {
    flex-direction: column;
    height: auto;
  }

  .player {
    width: 100%;
  }

  .sidebar {
    width: 100%;
    max-height: 45vh;
  }

  header h1 {
    font-size: 18px;
    margin-bottom: 10px;
  }

  header input {
    width: 100%;
    max-width: 100%;
    margin-bottom: 10px;
  }

  header button {
    width: 100%;
    margin-left: 0;
    padding: 14px 18px;
    margin-top: 6px;
  }

  .player {
    padding: 18px;
  }

  .player h2 {
    font-size: 16px;
  }

  .description {
    font-size: 13px;
  }

  .video-id {
    font-size: 11px;
  }

  .player video {
    width: 100%;
    max-height: none;
    margin: 12px 0;
  }

  .item h4 {
    font-size: 13px;
  }

  .item-description {
    font-size: 11px;
  }

  .empty-player {
    font-size: 14px;
  }
}
