:root {
  --bg-1: #121212;
  --bg-2: #1b1712;
  --surface: rgba(20, 20, 20, 0.9);
  --surface-soft: rgba(34, 34, 34, 0.92);
  --surface-strong: #231f18;
  --text: #f3efe7;
  --muted: #b9ad9b;
  --line: rgba(220, 190, 140, 0.15);
  --accent: #d8a04c;
  --accent-2: #94652a;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

html {
  color-scheme: dark;
  height: 100%;
}

body {
  margin: 0;
  height: 100%;
  min-height: 100vh;
  overflow: hidden;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(216, 160, 76, 0.14), transparent 22%),
    radial-gradient(circle at bottom right, rgba(148, 101, 42, 0.12), transparent 24%),
    linear-gradient(135deg, #090909 0%, var(--bg-1) 35%, var(--bg-2) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
    repeating-linear-gradient(
      115deg,
      transparent 0 22px,
      rgba(216, 160, 76, 0.025) 22px 24px
    );
  opacity: 0.7;
}

.shell {
  width: min(1380px, calc(100% - 28px));
  height: calc(100vh - 24px);
  margin: 12px auto;
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
}

.topbar,
.panel {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.topbar {
  position: relative;
  z-index: 50;
  overflow: visible;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 28px;
  min-height: 84px;
  padding: 18px 28px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(22px, 3vw, 38px);
  line-height: 1;
  text-align: center;
}

.language-dropdown-wrap {
  position: absolute;
  right: 28px;
  top: 22px;
  z-index: 20;
}

.main-grid {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 0;
}

.content {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  min-height: 0;
}

.player-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.78fr);
  gap: 12px;
  min-height: 0;
}

.panel {
  padding: 14px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-head h2,
.panel-head p {
  margin: 0;
}

.panel-head p {
  color: var(--muted);
  font-size: 14px;
}

.language-toggle,
.language-button {
  border: 1px solid rgba(216, 160, 76, 0.16);
  background: var(--surface-soft);
  color: var(--text);
  border-radius: 999px;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.language-toggle {
  min-width: 92px;
  padding: 8px 14px;
}

.language-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  display: none;
  width: 408px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
  border-radius: 20px;
  border: 1px solid rgba(216, 160, 76, 0.16);
  background: rgba(18, 18, 18, 0.96);
  box-shadow: var(--shadow);
  z-index: 100;
}

.language-menu.open {
  display: grid;
}

.language-menu .language-button {
  min-height: 54px;
  padding: 8px;
}

.language-menu .lang-code {
  display: none;
}

.language-button:hover,
.language-toggle:hover,
.language-toggle.active,
.language-button.active {
  transform: translateY(-1px);
  border-color: rgba(216, 160, 76, 0.48);
  background: #2c2419;
}

.flag-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
  background: #17130f;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.flag-tr { background: linear-gradient(90deg, #c21414 0 100%); }
.flag-en { background: linear-gradient(135deg, #163c8f 0 50%, #b22222 50% 100%); }
.flag-de { background: linear-gradient(180deg, #111 0 33%, #b81414 33% 66%, #d7a100 66% 100%); }
.flag-el { background: linear-gradient(180deg, #1a5ec8 0 50%, #f5f7fb 50% 100%); }
.flag-fr { background: linear-gradient(90deg, #1f4fb4 0 33%, #f8f8f8 33% 66%, #c51919 66% 100%); }
.flag-hu { background: linear-gradient(180deg, #c31f1f 0 33%, #f3f3f3 33% 66%, #167240 66% 100%); }
.flag-ru { background: linear-gradient(180deg, #f3f3f3 0 33%, #2453b8 33% 66%, #c62424 66% 100%); }
.flag-ro { background: linear-gradient(90deg, #1a49b2 0 33%, #d5a400 33% 66%, #c81f1f 66% 100%); }
.flag-pl { background: linear-gradient(180deg, #f4f4f4 0 50%, #cb2448 50% 100%); }
.flag-pt { background: linear-gradient(90deg, #156d35 0 42%, #c82626 42% 100%); }
.flag-nl { background: linear-gradient(180deg, #b11b1b 0 33%, #f3f3f3 33% 66%, #1d49b1 66% 100%); }
.flag-cs { background: linear-gradient(135deg, #1a4bb5 0 45%, #f4f4f4 45% 72%, #c62222 72% 100%); }
.flag-da { background: linear-gradient(90deg, #bb1d1d 0 100%); }

.lang-code {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.toggle-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.category-button {
  border: 1px solid rgba(216, 160, 76, 0.18);
  background: var(--surface-soft);
  color: var(--text);
  border-radius: 18px;
  padding: 12px 14px;
  min-width: 180px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.category-button:hover,
.category-button.active {
  transform: translateY(-1px);
  border-color: rgba(216, 160, 76, 0.48);
  background: #2c2419;
}

.category-button strong,
.category-button span {
  display: block;
}

.category-button strong {
  margin-bottom: 4px;
  font-size: 15px;
}

.category-button span {
  color: var(--muted);
  font-size: 12px;
}

.video-panel,
.playlist-panel {
  min-height: 0;
}

.video-shell {
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  background: #000;
}

.video-preview,
.video-shell iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.video-preview {
  position: absolute;
  inset: 0;
  padding: 0;
  cursor: pointer;
  background: #000;
  z-index: 3;
}

.video-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-preview img[hidden] {
  display: none;
}

.video-preview.external-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background:
    radial-gradient(circle at top left, rgba(216, 160, 76, 0.28), transparent 22%),
    linear-gradient(135deg, #17120d 0%, #22180f 52%, #0f0d0a 100%);
}

.video-preview.external-preview img {
  display: none;
}

.video-preview-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.5));
}

.play-icon {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(216, 160, 76, 0.92);
  color: #1a1209;
  font-size: 30px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.video-shell iframe {
  position: relative;
  z-index: 2;
  border: 0;
  display: none;
}

.video-meta {
  padding-top: 12px;
}

.badge {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(216, 160, 76, 0.12);
  color: #f4c981;
  font-size: 12px;
  font-weight: 700;
}

.video-meta h2 {
  margin: 10px 0 6px;
  font-size: clamp(20px, 2.2vw, 30px);
}

.video-meta p {
  margin: 0 0 6px;
  color: var(--muted);
  word-break: break-all;
}

#videoLinkText {
  display: none;
}

.video-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 10px;
}

.nav-button {
  border: none;
  border-radius: 999px;
  padding: 13px 18px;
  background: var(--accent);
  color: #120d08;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.nav-button:hover {
  transform: translateY(-1px);
  background: #efba67;
}

.youtube-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  padding-bottom: 3px;
  border-bottom: 2px solid rgba(216, 160, 76, 0.28);
}

.playlist {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 320px);
  overflow: auto;
  padding-right: 4px;
}

.playlist-item {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(216, 160, 76, 0.14);
  background: var(--surface-strong);
  color: var(--text);
  border-radius: 18px;
  padding: 12px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.playlist-item:hover,
.playlist-item.active {
  transform: translateY(-1px);
  border-color: rgba(216, 160, 76, 0.42);
  background: #302519;
}

.playlist-item strong,
.playlist-item span {
  display: block;
}

.playlist-item strong {
  margin-bottom: 6px;
}

.playlist-item span {
  color: var(--muted);
  font-size: 13px;
  word-break: break-all;
}

@media (max-width: 1140px) {
  body {
    overflow: auto;
  }

  .shell {
    height: auto;
    min-height: calc(100vh - 24px);
  }

  .player-grid {
    grid-template-columns: 1fr;
  }

  .playlist {
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 16px, 1380px);
    margin: 8px auto;
  }

  .topbar {
    padding: 16px 20px;
    min-height: 84px;
  }

  .panel {
    padding: 16px;
    border-radius: 22px;
  }

  .topbar {
    border-radius: 22px;
  }

  .language-dropdown-wrap {
    right: 20px;
    top: 16px;
  }

  .language-menu {
    width: 320px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .category-button {
    min-width: calc(50% - 6px);
  }

  .video-actions .nav-button,
  .video-actions .youtube-link {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 420px) {
  .language-menu {
    width: 240px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
