:root {
  --bg: #050816;
  --bg-soft: #0b1020;
  --accent: #ff7ac4;
  --accent-soft: rgba(255, 122, 196, 0.25);
  --border: #1f2933;
  --text: #f9fafb;
  --text-muted: #d1d5db;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(
    120deg,
    #ff7ac4 0%,
    #f4b4ff 35%,
    #c4d7ff 70%,
    #8ed5ff 100%
  );
  color: var(--text);
}

/* =====================================
   Layout: Inhalt + Chat-Sidebar
   ===================================== */

.page-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
}

/* Wenn Detailansicht + Chat aktiv → zweite Spalte für Chat */
body.view-detail.chat-open .page-shell {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 28vw);
  column-gap: 0rem;
}

.page {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0.75rem 1.2rem 1.5rem;
}

main#app {
  margin-top: 0.5rem;
}

/* =====================================
   CHAT-SIDEBAR (rechte Spalte)
   ===================================== */

/* Grundlayout der Sidebar: volle Fensterhöhe */
.chat-sidebar {
  display: none; /* wird über body.view-detail.chat-open aktiviert */
  padding: 0.75rem 1.2rem 1.5rem 0;
  height: 100vh;
  box-sizing: border-box;
}

/* Sidebar nur in Detail + Chat offen anzeigen */
body.view-detail.chat-open .chat-sidebar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* Oben: 16:9 Freiraum, nur Gradient sichtbar */
.chat-placeholder {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 0.75rem;
  background: transparent;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}

/* Chat-Karte: füllt den gesamten restlichen Platz bis unten */
.chat-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.9);
  overflow: hidden;
  min-height: 0;
}

/* iFrame füllt die Chat-Box vollständig aus */
.chat-inner iframe {
  flex: 1;
  width: 100%;
  border: 0;
  min-height: 0;
}

/* =====================================
   HEADER
   ===================================== */

header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  column-gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  border-radius: 1rem;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(15, 23, 42, 0.94)),
    linear-gradient(120deg, rgba(255, 122, 196, 0.35), rgba(142, 213, 255, 0.35));
  border: 1px solid rgba(248, 250, 252, 0.18);
  box-shadow: 0 20px 35px rgba(15, 23, 42, 0.75);
  margin-bottom: 0.8rem;
  min-height: 90px;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.brand-logo-button {
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.brand-logo {
  display: block;
  height: 28px;
  max-width: 180px;
  object-fit: contain;
}

/* Badge – JAHRESRÜCKBLICK <Jahr> */
.brand-badge {
  font-size: 1.5rem;
  padding: 0.28rem 1.6rem;
  border-radius: 999px;
  border: 1px solid rgba(248, 250, 252, 0.35);
  background: rgba(15, 23, 42, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  margin: 0; /* wichtig wegen h1 */
}

/* Header Mitte – absolut in der Mitte */
.header-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.15rem;
  min-width: 0;
}

/* Clip x von y | Datum | Creator */
.header-subtitle {
  order: 2;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--text-muted);
  max-width: 32rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Clip-Titel */
.header-title {
  order: 3;
  font-size: 1rem;
  font-weight: 600;
  max-width: 32rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Chip für Clip-Anzahl */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.7);
}

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.2);
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text);
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease-out;
  white-space: nowrap;
}

.btn:hover {
  border-color: rgba(248, 250, 252, 0.9);
  background: rgba(15, 23, 42, 1);
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.6);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #ec4899);
  border-color: transparent;
  color: white;
  box-shadow: 0 12px 25px rgba(255, 122, 196, 0.5);
}

.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 16px 35px rgba(255, 122, 196, 0.7);
}

.btn-ghost {
  background: transparent;
  border-color: rgba(148, 163, 184, 0.5);
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.btn-icon {
  padding-inline: 0.5rem;
  font-size: 1rem;
  line-height: 1;
  border-radius: 999px;
  min-width: 0;
}

/* Icon-only Buttons (runde Buttons mit Icon-Bild) */
.btn-icon-only {
  padding: 0.45rem;
  border-radius: 999px;
  min-width: 0;
}

.btn-icon-img {
  width: 18px;
  height: 18px;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.9;
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

/* Hover-Boost fürs Icon */
.btn:hover .btn-icon-img,
.btn-ghost:hover .btn-icon-img {
  opacity: 1;
  transform: translateY(-0.5px);
}

/* --------- Speziell: Teilen + Vollbild --------- */

.btn-share,
.btn-fullscreen {
  border: none;
  background: transparent;
  box-shadow: none;
}

.btn-share:hover,
.btn-share:focus,
.btn-fullscreen:hover,
.btn-fullscreen:focus {
  border: none;
  background: transparent;
  box-shadow: none;
  outline: none;
}

.btn-share .btn-icon-img,
.btn-fullscreen .btn-icon-img {
  filter: brightness(0) invert(73%) sepia(8%) saturate(360%)
          hue-rotate(182deg) brightness(95%) contrast(90%);
  opacity: 0.5;
  transition: filter 0.15s ease-out, opacity 0.15s ease-out, transform 0.15s ease-out;
}

.btn-share:hover .btn-icon-img,
.btn-fullscreen:hover .btn-icon-img {
  filter: brightness(0) invert(1);
  opacity: 1;
  transform: translateY(-0.5px);
}

/* Jahr-Auswahl */

.year-select-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.year-select {
  background: rgba(15, 23, 42, 0.9);
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  color: var(--text);
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  outline: none;
}

.year-select:focus {
  border-color: rgba(248, 250, 252, 0.9);
}

/* SECTION HEADER */

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding: 0 0.25rem;
}

.section-header h2 {
  font-size: 1.05rem;
  margin: 0;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.section-header span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* GALLERY */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.card {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.95), rgba(2, 6, 23, 0.95));
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.9);
  display: flex;
  flex-direction: column;
  min-height: 0;
  cursor: pointer;
}

.card-thumb-wrapper {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.02);
  transition: transform 0.22s ease-out, filter 0.22s ease-out;
  filter: saturate(1.1) contrast(1.03);
}

.card:hover .card-thumb {
  transform: scale(1.06);
  filter: saturate(1.3) contrast(1.07) brightness(1.02);
}

.card-gradient {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(168, 85, 247, 0.05), transparent 55%);
  pointer-events: none;
}

.card-meta-top {
  position: absolute;
  inset: 0.55rem 0.55rem auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.7rem;
}

.card-meta-top span {
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  backdrop-filter: blur(12px);
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.6);
  color: var(--text);
}

.card-content {
  padding: 0.75rem 0.9rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
}

/* DETAIL-LAYOUT */

.detail-layout {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch;
  width: 100%;
}

.detail-main {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.detail-video {
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  overflow: hidden;
  background: black;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.9);
  position: relative;
}

.detail-video iframe {
  display: block;
  width: 100%;
  height: calc(100vh - 260px);
  max-height: none;
  border: 0;
}

/* Vollbild: Social-Icons ausblenden und Video höher machen */
body.fullscreen-active.view-detail .social-links {
  display: none;
}

body.fullscreen-active.view-detail .detail-video iframe {
  height: calc(100vh - 220px);
}

/* NAV-LEISTE UNTER DEM VIDEO */

.detail-meta {
  border-radius: 1rem;
  padding: 0.35rem 0.9rem 0.4rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.96);
  box-shadow: 0 12px 25px rgba(15, 23, 42, 0.9);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.detail-nav-left,
.detail-nav-right {
  flex: 1;
  display: flex;
  justify-content: flex-start;
}

.detail-nav-right {
  justify-content: flex-end;
  gap: 0.5rem;
}

.detail-nav-center {
  flex: 2;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  position: relative;
}

.home-inline {
  position: absolute;
  right: 100%;
  margin-right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
}

.home-inline:hover {
  transform: translateY(-50%);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.6);
  border-color: rgba(248, 250, 252, 0.9);
  background: rgba(15, 23, 42, 1);
}

.detail-small-info {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
  opacity: 0;
  transition: opacity 0.2s ease-out;
  display: none;
  text-align: left;
}

/* EMPTY STATE */

.empty-state {
  border-radius: 1rem;
  padding: 1.2rem 1.1rem;
  border: 1px dashed rgba(148, 163, 184, 0.6);
  background: repeating-linear-gradient(
    -45deg,
    rgba(15, 23, 42, 0.95),
    rgba(15, 23, 42, 0.95) 12px,
    rgba(15, 23, 42, 0.8) 12px,
    rgba(15, 23, 42, 0.8) 24px
  );
}

.empty-state h2 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
}

.empty-state p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* FOOTER */

footer {
  margin-top: 0.8rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.9;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.social-links a {
  width: auto;
  height: auto;
  border: none;
  background: transparent;
  padding: 0;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.social-links img.social-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
  transition: transform 0.15s ease-out, opacity 0.15s ease-out;
}

.social-links a:hover img.social-icon {
  transform: translateY(-1px);
  opacity: 0.9;
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

.dev-footer {
  margin-top: 0.15rem;
  font-size: 0.8rem;
  color: #f9fafb;
  text-shadow: 0 0 6px rgba(5, 8, 22, 0.8);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.dev-footer a {
  color: var(--accent);
  font-weight: 500;
}

.dev-footer-text {
  grid-column: 2;
  text-align: center;
}

/* Footer-Chat-Button (das 🟣) */
.chat-toggle-footer {
  grid-column: 3;
  justify-self: end;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out, opacity 0.15s ease-out;
  opacity: 0.7;
}

.chat-toggle-footer:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.65);
  opacity: 1;
}

/* MOBILE LAYOUT */

@media (max-width: 720px) {
  .page-shell {
    display: block;
  }

  header {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      "logo"
      "badge"
      "year"
      "subtitle"
      "title";
    justify-items: center;
    text-align: center;
    padding: 0.55rem 0.8rem;
    row-gap: 0.2rem;
  }

  .header-left {
    grid-area: logo;
    justify-content: center;
    width: 100%;
  }

  .brand-logo-button {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .brand-logo {
    width: 66%;
    height: auto;
    max-width: 260px;
    display: block;
    margin: 0 auto;
  }

  .header-center {
    display: contents;
    position: static;
    transform: none;
    left: auto;
  }

  #header-badge {
    grid-area: badge;
    margin-top: 0.15rem;
    font-size: 1rem;
    padding: 0.2rem 1rem;
    white-space: normal;
  }

  .header-subtitle {
    grid-area: subtitle;
    font-size: 0.75rem;
    max-width: 100%;
    white-space: normal;
  }

  .header-title {
    grid-area: title;
    font-size: 0.9rem;
    max-width: 100%;
    white-space: normal;
  }

  .header-right {
    display: contents;
  }

  .year-select-wrapper {
    grid-area: year;
    margin-top: 0.15rem;
    justify-self: center;
  }

  body.view-detail .year-select-wrapper {
    display: none;
  }

  .chip {
    display: none;
  }

  .detail-meta {
    padding-inline: 0.6rem;
  }

  .detail-nav-left,
  .detail-nav-right,
  .home-inline {
    display: none;
  }

  .detail-nav-center {
    flex: 1;
    justify-content: center;
    gap: 0.4rem;
  }

  .detail-nav-center .btn {
    min-width: 0;
  }

  .detail-video {
    height: auto;
    aspect-ratio: 16 / 18;
  }

  .detail-video iframe {
    width: 100%;
    height: 100%;
  }

  .chat-sidebar {
    display: none !important;
  }
}