.kcdl-app,
.kcdl-app * { box-sizing: border-box; }

.kcdl-app {
  --kcdl-gold: #f5b800;
  --kcdl-gold-dark: #ca9200;
  --kcdl-black: #111111;
  --kcdl-ink: #1f2328;
  --kcdl-muted: #667085;
  --kcdl-border: #e4e7ec;
  width: min(100%, 920px);
  margin: 24px auto;
  padding: 0 16px 32px;
  color: var(--kcdl-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

.kcdl-app h1,
.kcdl-app h2,
.kcdl-app p { margin-top: 0; }

.kcdl-login-shell {
  width: min(100%, 440px);
  margin: 8vh auto 24px;
  padding: 34px 24px 26px;
  border: 1px solid var(--kcdl-border);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 18px 60px rgba(16, 24, 40, .12);
  text-align: center;
}

.kcdl-brand-mark {
  display: grid;
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  place-items: center;
  border-radius: 18px;
  background: var(--kcdl-black);
  color: var(--kcdl-gold);
  font-size: 38px;
  font-weight: 900;
  line-height: 1;
  box-shadow: inset 0 -4px 0 rgba(245, 184, 0, .9);
}

.kcdl-eyebrow {
  margin-bottom: 6px;
  color: var(--kcdl-gold-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .11em;
}

.kcdl-login-shell h1 {
  margin-bottom: 7px;
  color: var(--kcdl-black);
  font-size: clamp(28px, 7vw, 38px);
  line-height: 1.08;
}

.kcdl-subtitle { margin-bottom: 24px; color: var(--kcdl-muted); }

.kcdl-login-form { text-align: left; }

.kcdl-login-form label {
  display: block;
  margin: 15px 0 6px;
  color: #344054;
  font-size: 14px;
  font-weight: 800;
}

.kcdl-login-form input {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid #cfd4dc;
  border-radius: 12px;
  background: #fff;
  color: var(--kcdl-black);
  font: inherit;
  font-size: 17px;
  outline: none;
  -webkit-appearance: none;
}

.kcdl-login-form input:focus {
  border-color: var(--kcdl-gold-dark);
  box-shadow: 0 0 0 4px rgba(245, 184, 0, .18);
}

.kcdl-primary-button,
.kcdl-install-button {
  border: 0;
  border-radius: 12px;
  background: var(--kcdl-gold);
  color: #111;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--kcdl-gold-dark);
}

.kcdl-primary-button {
  width: 100%;
  min-height: 54px;
  margin-top: 22px;
  padding: 13px 18px;
  font-size: 17px;
}

.kcdl-primary-button:active,
.kcdl-install-button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--kcdl-gold-dark); }

.kcdl-help { margin: 22px 0 0; color: var(--kcdl-muted); font-size: 14px; }
.kcdl-help a { color: var(--kcdl-ink); font-weight: 800; }

.kcdl-alert {
  margin-bottom: 15px;
  padding: 11px 13px;
  border-radius: 10px;
  background: #ecfdf3;
  color: #067647;
  font-size: 14px;
  text-align: left;
}

.kcdl-alert-error { background: #fef3f2; color: #b42318; }

.kcdl-library-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 24px;
  border-radius: 22px;
  background: var(--kcdl-black);
  color: #fff;
}

.kcdl-library-header h1 { margin-bottom: 5px; color: #fff; font-size: clamp(26px, 6vw, 38px); line-height: 1.1; }
.kcdl-library-header p:last-child { margin-bottom: 0; color: #d0d5dd; }
.kcdl-logout { flex: 0 0 auto; color: #fff !important; font-size: 14px; font-weight: 800; text-decoration: none; }

.kcdl-install-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px 18px;
  border: 1px solid #f1d37a;
  border-radius: 16px;
  background: #fffae8;
}

.kcdl-install-bar strong,
.kcdl-install-bar span { display: block; }
.kcdl-install-bar span { margin-top: 2px; color: #665b39; font-size: 13px; }
.kcdl-install-button { flex: 0 0 auto; padding: 10px 13px; font-size: 13px; }

.kcdl-video-list { display: grid; gap: 20px; }

.kcdl-video-card {
  overflow: hidden;
  border: 1px solid var(--kcdl-border);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(16, 24, 40, .07);
}

.kcdl-video-heading {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 17px 18px;
}

.kcdl-video-heading p { margin: 0 0 2px; color: var(--kcdl-gold-dark); font-size: 11px; font-weight: 900; letter-spacing: .09em; }
.kcdl-video-heading h2 { margin: 0; color: var(--kcdl-black); font-size: clamp(18px, 4vw, 23px); line-height: 1.2; }

.kcdl-lesson-number {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: var(--kcdl-black);
  color: var(--kcdl-gold);
  font-weight: 900;
}

.kcdl-player-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #000;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.kcdl-player-wrap video,
.kcdl-player-wrap iframe { display: block; width: 100%; height: 100%; border: 0; background: #000; }

.kcdl-secure-expand {
  position: absolute;
  z-index: 8;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 9px;
  background: rgba(0,0,0,.72);
  color: #fff;
  font: inherit;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(5px);
}

.kcdl-secure-expand > span { color: var(--kcdl-gold); font-size: 22px; line-height: .7; }
.kcdl-secure-expand > strong { font-weight: 850; white-space: nowrap; }

.kcdl-player-wrap.kcdl-secure-expanded {
  position: fixed !important;
  z-index: 2147483647 !important;
  inset: 0 !important;
  display: flex;
  width: 100vw !important;
  width: 100dvw !important;
  height: 100vh !important;
  height: 100dvh !important;
  align-items: center;
  justify-content: center;
  aspect-ratio: auto !important;
  background: #000;
}

.kcdl-player-wrap.kcdl-secure-expanded video,
.kcdl-player-wrap.kcdl-secure-expanded iframe {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
}

.kcdl-player-wrap.kcdl-secure-expanded .kcdl-secure-expand,
.kcdl-player-wrap:fullscreen .kcdl-secure-expand {
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  min-height: 44px;
  padding: 9px 12px;
  font-size: 13px;
}

.kcdl-player-wrap.kcdl-secure-expanded .kcdl-watermark,
.kcdl-player-wrap:fullscreen .kcdl-watermark {
  max-width: 70%;
  font-size: clamp(13px, 3vw, 24px);
}

body.kcdl-player-expanded { overflow: hidden !important; }

video::-webkit-media-controls-fullscreen-button { display: none !important; }

.kcdl-watermark {
  position: absolute;
  z-index: 4;
  top: 12%;
  left: 7%;
  max-width: 80%;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .32);
  color: rgba(255, 255, 255, .74);
  font-size: clamp(10px, 2.6vw, 14px);
  font-weight: 800;
  line-height: 1.15;
  pointer-events: none;
  text-shadow: 0 1px 2px #000;
  transition: top .7s ease, left .7s ease;
}

.kcdl-video-description { padding: 15px 18px; color: #475467; font-size: 14px; }
.kcdl-video-description > :last-child { margin-bottom: 0; }

.kcdl-empty { padding: 45px 22px; border: 1px dashed #cfd4dc; border-radius: 18px; text-align: center; }
.kcdl-empty > span { display: inline-grid; width: 56px; height: 56px; margin-bottom: 14px; place-items: center; border-radius: 50%; background: var(--kcdl-gold); color: #111; }
.kcdl-empty h2 { margin-bottom: 5px; }

.kcdl-install-help[hidden] { display: none !important; }
.kcdl-install-help { position: fixed; z-index: 999999; inset: 0; display: grid; place-items: end center; padding: 16px; background: rgba(0,0,0,.62); }
.kcdl-install-dialog { position: relative; width: min(100%, 500px); padding: 25px 22px; border-radius: 20px; background: #fff; box-shadow: 0 20px 70px rgba(0,0,0,.3); }
.kcdl-install-dialog h2 { padding-right: 30px; color: #111; }
.kcdl-install-dialog ol { padding-left: 22px; }
.kcdl-install-dialog li { margin-bottom: 8px; }
.kcdl-browser-note { margin: 14px 0 0; padding: 11px 12px; border-radius: 10px; background: #fff4cf; color: #594400; font-size: 14px; }
.kcdl-dialog-close { position: absolute; top: 12px; right: 14px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f2f4f7; color: #111; font-size: 25px; line-height: 1; cursor: pointer; }

.kcdl-app-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--kcdl-border); color: var(--kcdl-muted); font-size: 13px; }

body.kcdl-no-scroll { overflow: hidden; }

@media (max-width: 560px) {
  .kcdl-app { margin-top: 10px; padding-right: 10px; padding-left: 10px; }
  .kcdl-login-shell { margin-top: 3vh; padding: 28px 19px 22px; border-radius: 20px; }
  .kcdl-library-header { padding: 19px 17px; border-radius: 18px; }
  .kcdl-library-header p:last-child { font-size: 14px; }
  .kcdl-install-bar { align-items: flex-start; flex-direction: column; }
  .kcdl-install-button { width: 100%; min-height: 43px; }
  .kcdl-video-card { border-radius: 16px; }
  .kcdl-video-heading { padding: 14px; }
  .kcdl-lesson-number { flex-basis: 38px; width: 38px; height: 38px; }
  .kcdl-secure-expand > strong { display: none; }
  .kcdl-secure-expanded .kcdl-secure-expand > strong { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  .kcdl-watermark { transition: none; }
}
