/* Shared control rhythm. Loaded after the legacy styles, before course-layout.css. */
:root { --mk-control-height: 44px; }
.mk-platform-page :is(.mk-primary-btn, .mk-secondary-btn) {
  min-height: var(--mk-control-height);
  box-sizing: border-box;
  line-height: 1.4;
  white-space: normal;
  text-align: center;
}
.mk-platform-page :is(.mk-form-stack, .mk-field, .mk-filter-panel) :is(input, select):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]):not([type="color"]) {
  height: var(--mk-control-height);
  min-height: var(--mk-control-height);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 16px;
  line-height: normal;
}
.mk-filter-panel label { min-width: 0; line-height: 1.4; }
.mk-filter-panel .row { align-items: flex-end; }
.mk-filter-panel .row > [class*="col-"] { min-width: 0; }
.mk-filter-panel button { width: 100%; margin: 0; }
.mk-field-label-line { flex-wrap: wrap; gap: 4px 8px; white-space: normal; }
.mk-field-label-line small { flex: 1 1 auto; white-space: normal; overflow-wrap: anywhere; }
.mk-field { align-content: start; min-width: 0; }
.mk-field-message:empty, .mk-field em:empty { display: none; }
.mk-form-stack label { min-width: 0; }
.mk-form-stack textarea { resize: vertical; max-width: 100%; box-sizing: border-box; }
.mk-privacy-box { align-items: flex-start; }
.mk-privacy-box input { flex: 0 0 18px; margin-top: 3px; }
.mk-privacy-box span { min-width: 0; overflow-wrap: anywhere; }
.mk-page-title, .mk-section-heading, .mk-watch-heading { gap: 12px; }
.mk-page-title p, .mk-watch-heading > span { overflow-wrap: anywhere; }
.mk-watch-heading > div { min-width: 0; }
.mk-watch-heading > span { flex-shrink: 0; max-width: 45%; text-align: right; white-space: normal; }
.mk-watch-info, .mk-watch-materials { height: 100%; box-sizing: border-box; }
.mk-watch-info > div { overflow-wrap: anywhere; }
.mk-player-status { flex-wrap: wrap; gap: 8px 16px; }
.mk-player-status > * { min-width: 0; overflow-wrap: anywhere; }
.mk-watch-materials > a { display: flex; align-items: center; gap: 8px; min-height: 44px; overflow-wrap: anywhere; }
.mk-table-card { min-width: 0; overflow: hidden; }
.mk-table-card .table-responsive { max-width: 100%; overscroll-behavior-x: contain; }
.mk-table th, .mk-table td { vertical-align: middle; }
.mk-table td a { overflow-wrap: anywhere; }
.mk-modal-dialog { max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow: auto; overscroll-behavior: contain; }
.mk-modal-close { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; line-height: 1; }

/* Bookmarks use the same thumbnail / time / title structure with or without an image. */
.mk-player-bookmark-row { grid-template-columns: minmax(0, 1fr) 44px 44px; gap: 4px; padding: 8px; }
.mk-player-bookmark-row .mk-player-bookmark-seek { display: grid; grid-column: auto; grid-template-columns: 56px minmax(0, 1fr); min-width: 0; min-height: 44px; gap: 8px; }
.mk-bookmark-point-media { display: grid; place-items: center; position: relative; width: 56px; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 3px; background: #2b2925; color: #b5a68c; font-size: 12px; }
.mk-bookmark-point-media > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mk-bookmark-point-copy { min-width: 0; }
.mk-player-bookmark-time { display: block; margin-bottom: 3px; }
.mk-player-bookmark-popover .mk-player-bookmark-label { display: block; max-width: none; height: auto; padding: 0; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
.mk-player-bookmark-delete { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }
.mk-player-bookmark-seek:focus-visible, .mk-player-bookmark-delete:focus-visible { outline: 2px solid #d7ae65; outline-offset: -2px; }
.mk-player-watermark { white-space: normal; overflow-wrap: anywhere; }
.mk-bookmark-editor-dialog { width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); margin: auto; padding: 24px; border: 1px solid #e5ded2; border-radius: 12px; background: #fff; color: #39362f; box-shadow: 0 24px 70px #0003; overflow: auto; }
.mk-bookmark-editor-dialog::backdrop { background: #17140e99; backdrop-filter: blur(3px); }
.mk-bookmark-editor-dialog[open] { animation: mk-layout-dialog-in .22s ease both; }
.mk-bookmark-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.mk-bookmark-editor-head h2 { font-size: 20px; line-height: 1.45; margin: 0; }
.mk-bookmark-editor-head button { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 6px; background: #f5f1eb; color: #6b5b42; font-size: 26px; }
.mk-bookmark-editor-dialog label { display: block; margin-bottom: 8px; font-size: 14px; }
.mk-bookmark-editor-dialog input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid #dcd5c8; border-radius: 5px; box-sizing: border-box; font-size: 16px; }
.mk-bookmark-editor-dialog p { font-size: 14px; line-height: 1.65; margin: 0 0 16px; }
.mk-bookmark-editor-dialog .mk-bookmark-editor-error { color: #a7372d; margin: 8px 0 0; }
.mk-bookmark-editor-error:empty { display: none; }
.mk-bookmark-editor-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 20px; }
@keyframes mk-layout-dialog-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 991.98px) {
  #header .primary-menu > .menu-container > .mk-mobile-user-item { border-bottom: 1px solid rgba(123, 93, 39, .24) !important; }
  .mk-guide-page { padding-top: 40px; }
  .mk-auth-card, .mk-form-card { padding: 24px; }
}
@media (max-width: 767.98px) {
  .mk-watch-heading { flex-direction: column; align-items: flex-start; margin-bottom: 18px; }
  .mk-watch-heading > span { max-width: 100%; text-align: left; }
  .mk-watch-info, .mk-watch-materials { height: auto; }
  .mk-my-page, .mk-auth-section { padding-bottom: 40px; }
  /* Touch controls live below the 16:9 picture rather than squeezing over it. */
  .mk-secure-player { --mk-mobile-controls-height: 128px; aspect-ratio: auto; min-height: 0; overflow: visible; }
  .mk-secure-player video { position: relative; inset: auto; display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 4px 4px 0 0; }
  .mk-secure-player::after { display: none; }
  .mk-secure-player .mk-player-loading, .mk-secure-player .mk-player-error { bottom: var(--mk-mobile-controls-height); border-radius: 4px 4px 0 0; padding: 12px; }
  .mk-secure-player .mk-player-center-play { top: calc((100% - var(--mk-mobile-controls-height)) / 2); }
  .mk-secure-player .mk-player-watermark { max-width: 40%; white-space: normal; overflow-wrap: anywhere; }
  .mk-secure-player .mk-player-controls { position: relative; inset: auto; padding: 0 8px 8px; background: #111; border-radius: 0 0 4px 4px; }
  .mk-secure-player.controls-hidden .mk-player-controls { opacity: 1; visibility: visible; transform: none; pointer-events: auto; }
  .mk-player-seek-wrap { height: 24px; margin-bottom: 4px; }
  #playerSeek { height: 24px; }
  .mk-player-toolbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-rows: 44px 44px; gap: 4px; }
  .mk-player-toolbar :is(.mk-player-icon-btn, .mk-player-skip-btn, .mk-player-text-btn) { display: inline-flex; width: 100%; min-width: 0; height: 44px; padding: 0 4px; box-sizing: border-box; }
  #playerPlayBtn { grid-column: 1; grid-row: 1; }
  #playerBackBtn { grid-column: 2; grid-row: 1; }
  #playerForwardBtn { grid-column: 3; grid-row: 1; }
  .mk-player-time { grid-column: 4 / 6; grid-row: 1; min-width: 0; margin: 0; justify-content: center; gap: 3px; font-size: 11px; }
  .mk-player-volume-group, .mk-player-toolbar-spacer { display: none; }
  #playerBookmarkAddBtn { grid-column: 1 / 3; grid-row: 2; min-width: 0; font-size: 12px; }
  #playerBookmarkAddBtn::before { content: none; }
  .mk-player-toolbar .mk-player-popover-wrap { position: static; min-width: 0; grid-row: 2; }
  .mk-player-toolbar .mk-player-popover-wrap:has(#playerBookmarkListBtn) { grid-column: 3; }
  .mk-player-toolbar .mk-player-popover-wrap:has(#playerSpeedBtn) { grid-column: 4; }
  #playerBookmarkListBtn { min-width: 0; padding: 0 2px; gap: 3px; font-size: 0; }
  #playerBookmarkListBtn::before { content: '▤'; font-size: 17px; }
  #playerBookmarkCount { padding: 0 3px; font-size: 9px; }
  #playerFullscreenBtn { grid-column: 5; grid-row: 2; }
  .mk-player-controls .mk-player-popover { left: 8px; right: 8px; bottom: calc(100% + 8px); width: auto; min-width: 0; max-width: none; max-height: min(310px, 50vh); max-height: min(310px, 50dvh); overflow: auto; }
  .mk-player-bookmark-list { max-height: 210px; }
  .mk-player-speed-popover { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mk-player-speed-popover[hidden] { display: none; }
  .mk-player-speed-popover button { min-height: 44px; height: auto; }
  .mk-player-bookmark-row { grid-template-columns: minmax(0, 1fr) 44px 44px; }
  .mk-secure-player:is(.is-fullscreen, :fullscreen) { height: 100vh; height: 100dvh; overflow: hidden; }
  .mk-secure-player:is(.is-fullscreen, :fullscreen) video { position: absolute; inset: 0; height: 100%; aspect-ratio: auto; border-radius: 0; }
  .mk-secure-player:is(.is-fullscreen, :fullscreen) .mk-player-controls { position: absolute; bottom: 0; left: 0; right: 0; background: #111d; }
  .mk-secure-player:is(.is-fullscreen, :fullscreen) .mk-player-center-play { top: 50%; }
  .mk-secure-player:is(.is-fullscreen, :fullscreen) .mk-player-error, .mk-secure-player:is(.is-fullscreen, :fullscreen) .mk-player-loading { bottom: 0; }
}
@media (max-width: 575.98px) {
  .mk-platform-page :is(.mk-catalog-hero, .mk-detail-page, .mk-my-page, .mk-auth-section, .mk-watch-main) { padding-top: 24px; }
  .mk-auth-card, .mk-form-card { padding: 20px 16px; }
  .mk-field-label-line { font-size: 14px; }
  .mk-field-label-line small { font-size: 11px; }
  .mk-section-heading { align-items: center; }
  .mk-section-heading h2 { font-size: 23px; }
  .mk-table { min-width: 680px; }
  .mk-bookmark-editor-dialog { padding: 18px; }
  .mk-bookmark-editor-head h2 { font-size: 18px; }
}
@media (max-width: 390px) { .mk-player-time { font-size: 10px; gap: 2px; } }
@media (prefers-reduced-motion: reduce) { .mk-bookmark-editor-dialog[open] { animation: none; } }
