:root {
  color-scheme: dark;
  --bg: #081006;
  --bg-panel: #121c0f;
  --bg-elevated: #1a2a15;
  --border: #23321e;
  --accent: #ff5c57;
  --accent-soft: rgba(255, 92, 87, 0.18);
  --accent-green: #4fd15c;
  --text: #f0f8ed;
  --text-muted: #a0c2a0;
  --success: #7afd99;
  --brand-red: #d62828;
  --brand-grass-top: #3fbe4a;
  --brand-grass-side: #7c5a2a;
  --brand-grass-bottom: #543820;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 20% 20%, rgba(79, 209, 92, 0.12), transparent 55%),
    radial-gradient(circle at 80% 10%, rgba(214, 40, 40, 0.12), transparent 65%),
    linear-gradient(135deg, rgba(24, 36, 18, 0.9), rgba(8, 16, 6, 0.95));
  color: var(--text);
  min-height: 100vh;
}

.ratkaisu-page {
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 20% 20%, rgba(79, 209, 92, 0.12), transparent 55%),
    radial-gradient(circle at 80% 10%, rgba(214, 40, 40, 0.12), transparent 65%),
    linear-gradient(135deg, rgba(24, 36, 18, 0.9), rgba(8, 16, 6, 0.95));
}

.ratkaisu-layout {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  display: flex;
  justify-content: center;
}

.ratkaisu-wrap {
  width: min(960px, 100%);
}

.ratkaisu-card {
  background: linear-gradient(160deg, rgba(18, 30, 15, 0.92), rgba(13, 22, 11, 0.96));
  border: 1px solid rgba(79, 209, 92, 0.18);
  border-radius: 20px;
  padding: 2rem;
  display: grid;
  gap: 1.5rem;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.ratkaisu-card h1 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

.ratkaisu-hidden {
  color: rgba(16, 28, 14, 0.92);
  transition: color 0.3s ease;
}

.ratkaisu-card h1:hover .ratkaisu-hidden,
.ratkaisu-card h1:focus-within .ratkaisu-hidden {
  color: var(--accent-green);
}

.ratkaisu-card video {
  width: 100%;
  border-radius: 16px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4);
}

.ratkaisu-card footer {
  display: grid;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.ratkaisu-card .back-link {
  justify-self: center;
  background: linear-gradient(135deg, var(--accent), #ff786d);
  color: #fff;
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  border: none;
}

header.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 2rem;
  border-bottom: 1px solid rgba(79, 209, 92, 0.25);
  background: linear-gradient(135deg, rgba(32, 48, 25, 0.95), rgba(15, 26, 10, 0.95));
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
}

.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 32px;
}

.logo-rect {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 32px;
  padding: 4px 6px;
  border-radius: 9px;
  background: var(--brand-red);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25), 0 6px 16px rgba(214, 40, 40, 0.25);
}

.logo-block {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

.logo-block-top {
  flex: 1;
  background: linear-gradient(to bottom, var(--brand-grass-top), #289a30);
  border-bottom: 2px solid rgba(0, 0, 0, 0.25);
}

.logo-block-side {
  flex: 1;
  background: linear-gradient(to bottom, var(--brand-grass-side), var(--brand-grass-bottom));
}

.logo-text {
  font-size: 1.25rem;
  color: var(--text);
}

.brand .beta {
  font-size: 0.65rem;
  color: var(--accent-green);
  border: 1px solid rgba(79, 209, 92, 0.35);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  letter-spacing: 0.08em;
}

.search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  max-width: 480px;
}

.search input {
  flex: 1;
  background: linear-gradient(145deg, rgba(18, 28, 15, 0.95), rgba(10, 17, 8, 0.95));
  border: 1px solid rgba(79, 209, 92, 0.25);
  border-radius: 999px;
  padding: 0.6rem 1rem;
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.search button {
  background: linear-gradient(135deg, var(--accent), #ff786d);
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 12px rgba(255, 92, 87, 0.25);
}

.ean-panel {
  display: grid;
  gap: 0.75rem;
  margin: 0.75rem auto 1.5rem;
  max-width: 360px;
  text-align: center;
  justify-items: center;
}

.search-feedback {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.search-feedback.is-success {
  color: var(--accent-green);
}

.ean-reward {
  padding: 0.85rem;
  background: linear-gradient(145deg, rgba(17, 29, 14, 0.92), rgba(12, 20, 10, 0.92));
  border: 1px solid rgba(79, 209, 92, 0.25);
  border-radius: 16px;
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.25);
}

.ean-reward img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-menu .upload {
  background: linear-gradient(135deg, var(--accent-green), #44bd68);
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1rem;
  color: #052205;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 6px 12px rgba(79, 209, 92, 0.25);
}

.user-indicator {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(79, 209, 92, 0.15);
  color: var(--accent-green);
  font-size: 1.1rem;
}

main.layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(420px, 1fr);
  gap: 2.5rem;
  padding: 2.5rem 2rem;
  max-width: 1500px;
  margin: 0 auto;
  width: 100%;
}

.video-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}


.video-frame {
  position: relative;
  background: linear-gradient(155deg, rgba(9, 14, 8, 0.95), rgba(6, 12, 7, 0.98));
  border: 1px solid rgba(79, 209, 92, 0.18);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 28px 38px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
}

.video-chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(79, 209, 92, 0.12);
}

.video-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.video-brand .spark {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent-green);
  box-shadow: 0 0 12px rgba(79, 209, 92, 0.6);
}

.video-brand .label {
  font-weight: 600;
}

.video-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ad-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.18rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 92, 87, 0.16);
  border: 1px solid rgba(255, 92, 87, 0.32);
  color: #ff7870;
}

.ad-indicator[hidden],
.skip-ad-button[hidden] {
  display: none !important;
}

.quality-pill {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: rgba(79, 209, 92, 0.18);
  border: 1px solid rgba(79, 209, 92, 0.3);
  color: var(--accent-green);
}

.video-frame video {
  width: 100%;
  display: block;
  background: #000;
  aspect-ratio: 16 / 9;
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
}

.skip-ad-button {
  position: absolute;
  right: 1.4rem;
  bottom: 3rem;
  z-index: 3;
  background: rgba(0, 0, 0, 0.82);
  color: #f7f9f2;
  border: 1px solid rgba(247, 249, 242, 0.25);
  border-radius: 999px;
  padding: 0.5rem 1.35rem;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: opacity 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.skip-ad-button:hover:not(:disabled) {
  opacity: 0.9;
}

.skip-ad-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  background: rgba(10, 22, 9, 0.75);
  color: var(--accent-green);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.video-overlay[data-state="loading"] {
  opacity: 1;
  pointer-events: auto;
}

.video-overlay[data-state="error"] {
  opacity: 1;
  background: rgba(18, 30, 15, 0.82);
  color: #f7f9f2;
}

.video-overlay .overlay-spinner {
  display: none;
}

.video-overlay[data-state="loading"] .overlay-spinner {
  display: block;
}

.video-overlay[data-state="error"] .overlay-spinner {
  display: none;
}

.video-overlay[data-state="error"] .overlay-text {
  text-transform: none;
  letter-spacing: 0.05em;
}

.overlay-spinner {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 4px solid rgba(79, 209, 92, 0.18);
  border-top-color: var(--accent-green);
  animation: spin 0.9s linear infinite;
}

.overlay-text {
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.video-meta {
  background: linear-gradient(160deg, rgba(18, 30, 15, 0.92), rgba(13, 22, 11, 0.96));
  border: 1px solid rgba(79, 209, 92, 0.16);
  border-radius: 18px;
  padding: 1.5rem;
  display: grid;
  gap: 0.75rem;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
}

.video-meta h1 {
  font-size: 1.8rem;
  line-height: 1.2;
}

.video-subline {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-row .tag {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: rgba(79, 209, 92, 0.12);
  border: 1px solid rgba(79, 209, 92, 0.35);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--accent-green);
  text-transform: uppercase;
}

.description {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-muted);
  white-space: pre-line;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.comments {
  background: linear-gradient(165deg, rgba(17, 27, 14, 0.92), rgba(11, 19, 9, 0.94));
  border: 1px solid rgba(79, 209, 92, 0.16);
  border-radius: 18px;
  padding: 1.5rem;
  display: grid;
  gap: 1.25rem;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
}

.comments-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.comments-header h2 {
  font-size: 1.1rem;
}

.comments-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.comment-form {
  display: grid;
  gap: 1rem;
  background: linear-gradient(160deg, rgba(24, 34, 19, 0.9), rgba(14, 22, 10, 0.92));
  border: 1px solid rgba(79, 209, 92, 0.18);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.comment-form label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  background: rgba(9, 18, 7, 0.95);
  border: 1px solid rgba(79, 209, 92, 0.22);
  border-radius: 10px;
  color: var(--text);
  padding: 0.75rem;
  font: inherit;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.comment-form textarea {
  min-height: 96px;
  resize: vertical;
}

.comment-form button {
  justify-self: start;
  background: linear-gradient(135deg, var(--accent-green), #3bbb61);
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.4rem;
  color: #061e07;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(79, 209, 92, 0.3);
}

.form-error {
  color: var(--accent);
  font-size: 0.85rem;
}

.comment-list {
  display: grid;
  gap: 1rem;
  list-style: none;
}

.comment {
  background: linear-gradient(160deg, rgba(24, 34, 19, 0.95), rgba(14, 22, 11, 0.95));
  border: 1px solid rgba(79, 209, 92, 0.18);
  border-radius: 14px;
  padding: 1rem;
  display: grid;
  gap: 0.5rem;
  box-shadow: 0 10px 16px rgba(0, 0, 0, 0.24);
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.comment-badges {
  display: flex;
  gap: 0.25rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.comment-badges .badge {
  background: rgba(79, 209, 92, 0.2);
  color: var(--accent-green);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}

.comment-badges .badge[data-badge="Muistojen vartija"] {
  background: linear-gradient(135deg, rgba(208, 32, 144, 0.3), rgba(208, 32, 144, 0.15));
  color: #ff66dd;
  border: 1px solid rgba(208, 32, 144, 0.45);
}

.comment-badges .badge[data-badge="Kartturi"] {
  background: linear-gradient(135deg, rgba(255, 214, 94, 0.3), rgba(255, 214, 94, 0.15));
  color: #ffd25a;
  border: 1px solid rgba(255, 214, 94, 0.45);
}

.comment-message {
  line-height: 1.4;
  color: var(--text);
}

.comment-timestamp {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.recommendations {
  display: grid;
  gap: 1.5rem;
  background: linear-gradient(165deg, rgba(18, 28, 15, 0.92), rgba(12, 20, 10, 0.94));
  border: 1px solid rgba(79, 209, 92, 0.16);
  border-radius: 18px;
  padding: 1.5rem;
  align-self: start;
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.22);
  min-width: 0;
  width: 100%;
  max-width: 420px;
  overflow: hidden;
}

.recommendation-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  list-style: none;
}

.recommendation-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(155deg, rgba(23, 33, 18, 0.95), rgba(13, 22, 11, 0.95));
  border: 1px solid rgba(79, 209, 92, 0.18);
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.22);
  min-height: 130px;
  text-align: left;
}

.recommendation-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 92, 87, 0.6);
}

.thumb-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  flex: 0 0 220px;
  min-height: 126px;
  align-self: stretch;
  display: flex;
  background: #000;
}

.thumb-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  flex: 1 1 auto;
}

.thumb-wrap .badge.duration {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  background: rgba(8, 16, 6, 0.85);
  color: var(--accent-green);
  border-radius: 6px;
  padding: 0.25rem 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.recommendation-card h3 {
  font-size: 1rem;
  margin-bottom: 0.2rem;
  line-height: 1.3;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recommendation-card .channel {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
  min-width: 0;
  text-transform: none;
}

.recommendation-card .meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recommendation-card .details {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.3rem;
  min-width: 0;
  flex: 1 1 auto;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1080px) {
  main.layout {
    grid-template-columns: 1fr;
  }

  .watch-layout {
    grid-template-columns: 1fr;
  }

  .recommendations {
    position: static;
  }

  .recommendation-card {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .thumb-wrap {
    flex: 0 0 auto;
    width: 100%;
    align-self: stretch;
  }
}

@media (max-width: 640px) {
  header.header {
    flex-wrap: wrap;
    padding: 1rem;
  }

  .search {
    order: 3;
    width: 100%;
  }

  main.layout {
    padding: 1.5rem 1rem 3rem;
  }

  .watch-layout {
    padding: 1.5rem 1rem 3rem;
  }

  .skip-ad-button {
    right: 1rem;
    bottom: 2.4rem;
  }
}
 .watch-page {
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 20% 20%, rgba(79, 209, 92, 0.12), transparent 55%),
    radial-gradient(circle at 80% 10%, rgba(214, 40, 40, 0.12), transparent 65%),
    linear-gradient(135deg, rgba(24, 36, 18, 0.9), rgba(8, 16, 6, 0.95));
}

.watch-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(0, 3fr) minmax(280px, 1fr);
  align-items: start;
}

.watch-player {
  display: grid;
  gap: 1.5rem;
}

.watch-layout .recommendations {
  max-height: none;
  overflow: visible;
  padding: 1.5rem;
}

.watch-layout .recommendation-card {
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
}

.player-hide-duration::-webkit-media-controls-timeline,
.player-hide-duration::-webkit-media-controls-current-time-display,
.player-hide-duration::-webkit-media-controls-time-remaining-display {
  display: none !important;
}

.watch-layout .thumb-wrap {
  flex: 0 0 auto;
  width: 100%;
  min-height: auto;
  aspect-ratio: 16 / 9;
}

.watch-frame {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(79, 209, 92, 0.18);
}

.watch-frame iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: none;
}

.watch-meta {
  background: linear-gradient(160deg, rgba(18, 30, 15, 0.92), rgba(13, 22, 11, 0.96));
  border: 1px solid rgba(79, 209, 92, 0.18);
  border-radius: 18px;
  padding: 1.5rem;
  display: grid;
  gap: 1rem;
}

.watch-channel,
.watch-stats {
  color: var(--text-muted);
}

.watch-description {
  white-space: pre-wrap;
  line-height: 1.6;
  color: var(--text-muted);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.watch-page .header {
  background: transparent;
  border-bottom: none;
  padding: 1.5rem 2rem 0;
  gap: 1rem;
}

.watch-page .brand .logo {
  font-size: 1.25rem;
  letter-spacing: 0.12em;
  color: var(--accent-green);
  font-weight: 700;
}

.back-home {
  background: linear-gradient(135deg, var(--accent), #ff786d);
  color: #fff;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  border: none;
}
.ratkaisu-card footer[hidden] {
  display: none;
}
