/* =============================================================================
   Kadusko streaming layout (TV show / episode / movie pages) + player overlays.
   Mobile first. Colours follow the site: black surfaces, Kadusko red accent.
   ============================================================================= */

.kd-stream {
	--kd-red: var(--bs-primary, #e50914);
	--kd-red-2: #ff3b3b;
	--kd-bg: #000;
	--kd-card: #141414;
	--kd-card-2: #1e1e1e;
	--kd-line: rgba(255, 255, 255, .1);
	--kd-text: #fff;
	--kd-muted: #a3a3a3;
	--kd-radius: 10px;
	color: var(--kd-text);
	background: var(--kd-bg);
	padding-bottom: 32px;
}
.kd-stream svg { width: 1em; height: 1em; fill: currentColor; flex: none; }
.kd-stream__inner { max-width: 1120px; margin: 0 auto; padding: 0 16px; position: relative; }

/* ---- Banner (show / movie) ------------------------------------------------- */
.kd-hero-banner { position: relative; margin-bottom: -56px; }
.kd-hero-banner img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.kd-hero-banner:after {
	content: ''; position: absolute; inset: 0;
	background: linear-gradient(to top, var(--kd-bg) 4%, rgba(0, 0, 0, .55) 30%, rgba(0, 0, 0, 0) 60%);
}
@media (max-width: 767px) {
	.kd-hero-banner img { aspect-ratio: 4 / 5; max-height: 72vh; object-position: center top; }
}
@media (min-width: 992px) {
	.kd-hero-banner img { max-height: 70vh; }
	.kd-hero-banner { margin-bottom: -140px; }
}

/* ---- Heading --------------------------------------------------------------- */
.kd-head { position: relative; z-index: 1; padding-top: 8px; }
.kd-detail--episode .kd-head { padding-top: 20px; }
.kd-eyebrow {
	display: inline-block; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase;
	color: var(--kd-muted); text-decoration: none; margin-bottom: 6px;
}
a.kd-eyebrow:hover { color: var(--kd-text); }
.kd-title { font-size: clamp(1.6rem, 5vw, 2.6rem); line-height: 1.15; margin: 0 0 10px; font-weight: 800; }
.kd-detail--episode .kd-title { font-size: clamp(1.25rem, 3.6vw, 1.9rem); }
.kd-title__code { color: var(--kd-red-2); margin-right: .35em; }
.kd-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--kd-muted); font-size: .92rem; }
.kd-meta span + span:before { content: '•'; margin-right: 14px; color: #555; }

/* ---- Watch Now ------------------------------------------------------------- */
.kd-watch { margin: 18px 0 6px; max-width: 460px; }
.kd-watch__btn {
	display: flex; align-items: center; justify-content: center; gap: 10px;
	width: 100%; min-height: 54px; padding: 12px 20px; border-radius: var(--kd-radius);
	background: linear-gradient(90deg, var(--kd-red), var(--kd-red-2));
	color: #fff; font-weight: 700; font-size: 1.05rem; text-decoration: none;
	box-shadow: 0 8px 24px rgba(229, 9, 20, .28);
	transition: transform .15s ease, filter .15s ease;
}
.kd-watch__btn:hover, .kd-watch__btn:focus-visible { color: #fff; filter: brightness(1.08); transform: translateY(-1px); }
.kd-watch__btn svg { font-size: 1.2em; }
.kd-watch__btn.is-locked { background: #2a2a2a; box-shadow: none; border: 1px solid var(--kd-line); }
.kd-watch__progress { height: 4px; background: rgba(255, 255, 255, .15); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.kd-watch__progress span { display: block; height: 100%; background: var(--kd-red); }
.kd-watch__sub { color: var(--kd-muted); font-size: .88rem; margin: 6px 0 0; }

/* ---- Synopsis -------------------------------------------------------------- */
.kd-synopsis { background: var(--kd-card); border: 1px solid var(--kd-line); border-radius: var(--kd-radius); padding: 14px 16px; margin: 18px 0; }
.kd-synopsis__title { font-size: .95rem; font-weight: 700; margin: 0 0 6px; }
.kd-synopsis__text {
	color: #cfcfcf; margin: 0; line-height: 1.55; font-size: .95rem;
	display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.kd-synopsis__text.is-open { -webkit-line-clamp: unset; display: block; }
.kd-synopsis__more { background: none; border: 0; color: var(--kd-text); font-weight: 600; padding: 6px 0 0; }

/* ---- Actions --------------------------------------------------------------- */
.kd-actions { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 20px; padding: 0; max-width: 460px; }
.kd-action { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.kd-action .action-btn, .kd-action > a, .kd-action > button {
	width: 48px; height: 48px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
	background: var(--kd-card-2) !important; border: 1px solid var(--kd-line) !important; color: #fff; font-size: 1.25rem; padding: 0;
}
.kd-action .action-btn:hover, .kd-action .action-btn:focus-visible { border-color: var(--kd-red) !important; }
.kd-action .is-liked, .kd-action .in-watchlist, .kd-action .is-disliked { color: var(--kd-red-2) !important; border-color: var(--kd-red) !important; }
.kd-action__label { font-size: .8rem; color: var(--kd-muted); }
.kd-action .tooltip { display: none; }

/* ---- Tabs ------------------------------------------------------------------ */
.kd-tabs__list { display: flex; gap: 4px; border-bottom: 1px solid var(--kd-line); overflow-x: auto; scrollbar-width: none; margin-bottom: 16px; }
.kd-tabs__list::-webkit-scrollbar { display: none; }
.kd-tabs__tab {
	position: relative; background: none; border: 0; color: var(--kd-muted); font-weight: 700; white-space: nowrap;
	padding: 12px 14px; font-size: .98rem;
}
.kd-tabs__tab[aria-selected="true"] { color: var(--kd-text); }
.kd-tabs__tab[aria-selected="true"]:after { content: ''; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--kd-red); }
.kd-tabs__tab:focus-visible { outline: 2px solid var(--kd-red); outline-offset: -2px; border-radius: 6px; }

/* ---- Season picker --------------------------------------------------------- */
.kd-season { display: inline-block; margin: 0 0 14px; }
.kd-season__select {
	appearance: none; -webkit-appearance: none; background: var(--kd-card-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 12px center / 18px;
	color: #fff !important; border: 1px solid var(--kd-line) !important; border-radius: 999px !important; padding: 9px 40px 9px 18px !important; font-weight: 600; font-size: .95rem; height: auto !important; min-width: 140px;
}
.kd-season__select:focus-visible { outline: 2px solid var(--kd-red); }

/* ---- Episode list ---------------------------------------------------------- */
.kd-episodes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
/* Only the selected season is shown. Without this, display:flex above overrides the hidden
   attribute and every season stacks, so "Season 2" appeared to show Season 1's episodes. */
.kd-episodes[hidden], .kd-tabs__panel[hidden] { display: none !important; }
.kd-ep__link {
	display: grid; grid-template-columns: minmax(130px, 42%) 1fr; gap: 12px; align-items: start;
	padding: 10px; border-radius: var(--kd-radius); color: inherit; text-decoration: none; border: 1px solid transparent;
}
.kd-ep__link:hover, .kd-ep__link:focus-visible { background: var(--kd-card); border-color: var(--kd-line); color: inherit; }
.kd-ep__link:focus-visible { outline: 2px solid var(--kd-red); }
.kd-ep.is-current .kd-ep__link { background: var(--kd-card); border-color: rgba(229, 9, 20, .55); }
.kd-ep__thumb { position: relative; display: block; border-radius: 8px; overflow: hidden; background: #222; aspect-ratio: 16 / 9; }
.kd-ep__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kd-ep__play {
	position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
	width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
	background: rgba(0, 0, 0, .55); border: 2px solid rgba(255, 255, 255, .85); color: #fff; font-size: 1rem;
}
.kd-ep__play svg { margin-left: 2px; }
.kd-ep__bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, .25); }
.kd-ep__bar span { display: block; height: 100%; background: var(--kd-red); }
.kd-ep.is-watched .kd-ep__thumb img { opacity: .6; }
.kd-ep__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kd-ep__top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kd-ep__num { font-size: .8rem; color: var(--kd-muted); text-transform: uppercase; letter-spacing: .06em; }
.kd-ep__badge { font-size: .7rem; font-weight: 700; color: #fff; background: var(--kd-red); padding: 2px 7px; border-radius: 999px; }
.kd-ep__badge--done { background: #2f6f3a; }
.kd-ep__title { font-weight: 700; font-size: .98rem; line-height: 1.3; }
.kd-ep__time { font-size: .82rem; color: var(--kd-muted); }
.kd-ep__desc {
	font-size: .85rem; color: #bdbdbd; line-height: 1.45;
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
@media (max-width: 480px) {
	/* Keep the episode description on phones (two lines), under the episode it belongs to. */
	.kd-ep__link { padding: 8px 6px; grid-template-columns: minmax(120px, 40%) 1fr; }
	.kd-ep__desc { font-size: .8rem; -webkit-line-clamp: 2; }
}
@media (min-width: 768px) {
	.kd-ep__link { grid-template-columns: 260px 1fr; gap: 18px; }
	.kd-ep__title { font-size: 1.05rem; }
	.kd-ep__desc { -webkit-line-clamp: 3; }
}

/* ---- Similar --------------------------------------------------------------- */
.kd-similar { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (min-width: 768px) { .kd-similar { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1200px) { .kd-similar { grid-template-columns: repeat(6, 1fr); } }
.kd-similar__card { display: block; color: inherit; text-decoration: none; }
.kd-similar__card img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 8px; display: block; background: #222; transition: transform .15s ease; }
.kd-similar__card:hover img, .kd-similar__card:focus-visible img { transform: scale(1.03); }
.kd-similar__card:focus-visible { outline: 2px solid var(--kd-red); outline-offset: 3px; border-radius: 8px; }
.kd-similar__title { display: block; font-size: .85rem; margin-top: 6px; line-height: 1.3; }

/* ---- Trailer --------------------------------------------------------------- */
.kd-trailer__poster { position: relative; display: block; width: 100%; padding: 0; border: 0; border-radius: var(--kd-radius); overflow: hidden; background: #111; }
.kd-trailer__poster img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; opacity: .7; }
.kd-trailer__play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.05rem; }
.kd-trailer__play svg { font-size: 2.2rem; }
.kd-trailer__frame { position: relative; aspect-ratio: 16 / 9; border-radius: var(--kd-radius); overflow: hidden; }
.kd-trailer__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---- Episode page player --------------------------------------------------- */
.kd-detail--episode .kd-player-wrap { background: #000; }

/* =============================================================================
   Player overlays (player.js): resume toast, up-next card, watermark
   ============================================================================= */
.kd-player { position: relative; }
.kd-player-toast {
	position: absolute; left: 16px; bottom: 64px; z-index: 6; display: flex; align-items: center; gap: 12px;
	background: rgba(0, 0, 0, .82); color: #fff; padding: 10px 14px; border-radius: 8px; font-size: .9rem;
	transition: opacity .5s ease;
}
.kd-player-toast.is-hiding { opacity: 0; pointer-events: none; }
.kd-player-toast__btn { background: none; border: 1px solid rgba(255, 255, 255, .5); color: #fff; border-radius: 6px; padding: 4px 10px; font-size: .85rem; }

.kd-next {
	position: absolute; inset: 0; z-index: 8; display: flex; align-items: flex-end; justify-content: flex-end; padding: 16px;
	background: linear-gradient(to top, rgba(0, 0, 0, .85), rgba(0, 0, 0, .25));
}
.kd-next__card { display: flex; gap: 14px; background: #111; border: 1px solid rgba(255, 255, 255, .12); border-radius: 12px; padding: 12px; max-width: 520px; width: 100%; color: #fff; }
.kd-next__thumb { position: relative; flex: 0 0 42%; border-radius: 8px; overflow: hidden; aspect-ratio: 16 / 9; background: #222; }
.kd-next__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kd-next__ring { position: absolute; right: 6px; bottom: 6px; width: 34px; height: 34px; transform: rotate(-90deg); display: none; }
.kd-next.is-counting .kd-next__ring { display: block; }
.kd-next__ring circle { fill: rgba(0, 0, 0, .55); stroke: rgba(255, 255, 255, .25); stroke-width: 3; }
.kd-next__ring .kd-next__ring-fill { fill: none; stroke: #fff; stroke-dasharray: 100; stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear; }
.kd-next__body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kd-next__label { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: #bbb; }
.kd-next__label span { color: #ff3b3b; }
.kd-next__title { font-weight: 700; line-height: 1.3; }
.kd-next__count { font-size: .85rem; color: #ddd; min-height: 1.2em; }
.kd-next__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.kd-next__actions .btn { padding: 6px 14px; font-size: .9rem; }
@media (max-width: 575px) {
	.kd-next { padding: 8px; align-items: center; }
	.kd-next__thumb { display: none; }
}

/* Preview over the end credits: small card, video stays visible and clickable. */
.kd-next.is-preview { background: none; pointer-events: none; padding-bottom: 64px; }
.kd-next.is-preview .kd-next__card { pointer-events: auto; max-width: 420px; background: rgba(17, 17, 17, .92); }
.kd-next.is-preview .kd-next__switch-hint { display: none; }
@media (max-width: 575px) { .kd-next.is-preview { align-items: flex-end; padding-bottom: 48px; } }

.kd-switch { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; color: #ccc; cursor: pointer; margin: 2px 0 0; }
.kd-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kd-switch__track { position: relative; width: 34px; height: 20px; border-radius: 20px; background: #444; transition: background .2s; flex: none; }
.kd-switch__track:after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.kd-switch input:checked + .kd-switch__track { background: #e50914; }
.kd-switch input:checked + .kd-switch__track:after { transform: translateX(14px); }
.kd-switch input:focus-visible + .kd-switch__track { outline: 2px solid #fff; outline-offset: 2px; }

.kd-watermark {
	position: absolute; z-index: 5; pointer-events: none; user-select: none;
	color: rgba(255, 255, 255, .28); font-size: clamp(10px, 1.6vw, 15px); font-weight: 600; white-space: nowrap;
	text-shadow: 0 1px 2px rgba(0, 0, 0, .5); transition: left 1.2s ease, top 1.2s ease;
}

/* Keep the WhatsApp bubble and bottom nav from covering the next-episode card on phones. */
@media (max-width: 1024px) { .kd-stream { padding-bottom: 96px; } }

/* Player full screen on the wrapper (player.js), so Up next and the watermark stay visible. */
.kd-fs-btn {
	position: absolute; top: 10px; right: 10px; z-index: 9; width: 40px; height: 40px; border-radius: 8px;
	border: 0; background: rgba(0, 0, 0, .55); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer;
	opacity: .85; transition: opacity .2s;
}
.kd-fs-btn:hover, .kd-fs-btn:focus-visible { opacity: 1; outline: 2px solid #fff; outline-offset: 2px; }
.kd-fs-btn svg { width: 22px; height: 22px; }
.kd-player.is-fullscreen, .kd-player:fullscreen, .kd-player:-webkit-full-screen {
	width: 100vw !important; height: 100vh !important; max-width: none !important; background: #000; display: flex; align-items: center; justify-content: center;
}
.kd-player.is-fullscreen > div:not(.kd-next):not(.kd-player-toast):not(.kd-watermark),
.kd-player:fullscreen > div:not(.kd-next):not(.kd-player-toast):not(.kd-watermark) {
	position: absolute !important; inset: 0 !important; padding: 0 !important; width: 100% !important; height: 100% !important;
}
.kd-player.is-fullscreen iframe, .kd-player:fullscreen iframe { width: 100% !important; height: 100% !important; }
.kd-player.is-fullscreen .kd-next__card { max-width: 560px; }
