/* Split screen: card set on the left, a second LearnHip page on the right */

.split-wrap {
  --split-bg: #e1dacd;
  --split-ring: rgba(24, 117, 208, 0.42);
  --split-edge: rgba(60, 45, 20, 0.07);
  --split-shadow: 0 8px 24px rgba(60, 45, 20, 0.08);
  --split-ratio: 0.5;
}

.split-divider[hidden],
.split-pane[hidden],
.split-missing[hidden] {
  display: none !important;
}

/* 1. Compact player: used in a split and inside an embedded panel */

@media (min-width: 761px) {
  body.is-split {
    overflow: hidden;
  }

  body.is-split .grid {
    gap: 0;
  }

  body.is-split .split-wrap {
    display: flex;
    box-sizing: border-box;
    height: var(--split-h, calc(100vh - 64px));
    padding: 10px 14px 14px;
    background: var(--split-bg);
  }

  body.is-split .split-left,
  body.is-split .split-pane {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 0 0 1px var(--split-edge), var(--split-shadow);
    transition: box-shadow 160ms ease;
  }

  body.is-split .split-left {
    flex: 0 0 calc((100% - 16px) * var(--split-ratio));
    background: var(--table, #e9e3d8);
  }

  body.is-split .split-pane {
    flex: 1 1 0;
    background: #fff;
  }

  .split-wrap[data-active="left"] .split-left,
  .split-wrap[data-active="right"] .split-pane {
    box-shadow: 0 0 0 2px var(--split-ring), var(--split-shadow);
  }

  body.is-split .lh-player {
    height: 100%;
  }
}

@media (min-width: 761px) {
  body.is-split .lh-player,
  body.is-embed .lh-player {
    display: flex;
    flex-direction: column;
    padding: 16px 20px 18px;
    overflow: auto;
  }
}

body.is-embed .lh-player {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 16px 20px 18px;
  overflow: auto;
}

body.is-split .lh-player h1,
body.is-embed .lh-player h1 {
  color: var(--muted);
  font-size: 16px;
}

body.is-split .lh-player .player-description,
body.is-embed .lh-player .player-description {
  margin-top: 4px;
  font-size: 14px;
}

@media (min-width: 761px) {
  body.is-split .lh-player #playView:not([hidden]) {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: min(100%, var(--card-w), calc((var(--pane-h, 100vh) - 200px) * 3 / 2));
    min-height: 0;
    margin: 10px auto 0;
  }

  body.is-split .lh-player .player-actions {
    margin-top: 30px;
  }
}

body.is-embed .lh-player #playView:not([hidden]) {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(100%, var(--card-w), calc((100vh - 200px) * 3 / 2));
  min-height: 0;
  margin: 10px auto 0;
}

body.is-embed .lh-player .player-actions {
  margin-top: 30px;
}

body.is-split .lh-player .deck,
body.is-embed .lh-player .deck {
  width: 100%;
}

body.is-split .lh-player .player-ad,
body.is-embed .lh-player .player-ad {
  display: none;
}

body.is-embed {
  margin: 0;
  overflow: hidden;
}

/* 2. Second panel */

.split-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  opacity: 0;
  transition: opacity 160ms ease;
}

.split-frame.is-ready {
  opacity: 1;
}

.split-missing {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 24px;
  background: #fff;
  color: #8a7f6c;
  font-family: "Nunito", sans-serif;
  font-size: 16px;
  font-weight: 800;
  text-align: center;
}

.split-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 0 0 1px rgba(60, 45, 20, 0.08), 0 2px 8px rgba(60, 45, 20, 0.14);
  color: #7d7466;
  cursor: pointer;
  transition: color 120ms ease, opacity 200ms ease;
}

.split-close:hover {
  background: #fff;
  color: #2b2a28;
}

.split-close:focus {
  outline: none;
}

.split-close:focus-visible {
  box-shadow: 0 0 0 3px rgba(24, 117, 208, 0.35);
}

.split-close svg {
  display: block;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* 3. Divider */

.split-divider {
  display: flex;
  flex: 0 0 16px;
  align-items: center;
  justify-content: center;
  cursor: col-resize;
  touch-action: none;
}

.split-divider:focus {
  outline: none;
}

.split-grip {
  display: block;
  width: 4px;
  height: 44px;
  border-radius: 2px;
  background: #bdb3a1;
  transition: background 120ms ease, height 160ms ease, opacity 200ms ease;
}

.split-divider:hover .split-grip,
body.is-resizing .split-grip {
  height: 64px;
  background: #8a7f6c;
}

.split-divider:focus-visible .split-grip {
  background: #1875d0;
}

body.is-resizing,
body.is-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

body.is-resizing .split-frame {
  pointer-events: none;
}

/* 4. Full screen covers both panels */

.split-wrap:fullscreen,
.split-wrap:-webkit-full-screen {
  height: 100% !important;
  padding: 12px;
}

body.is-idle .split-close,
body.is-idle .split-grip {
  opacity: 0;
  pointer-events: none;
}

.split-wrap:fullscreen .lh-player.is-idle,
.split-wrap:fullscreen .lh-player.is-idle *,
body.is-embed .lh-player.is-idle,
body.is-embed .lh-player.is-idle * {
  cursor: none;
}

.split-wrap:fullscreen .lh-player.is-idle .player-heading,
.split-wrap:fullscreen .lh-player.is-idle .player-description,
.split-wrap:fullscreen .lh-player.is-idle .player-actions,
body.is-embed .lh-player.is-idle .player-heading,
body.is-embed .lh-player.is-idle .player-description,
body.is-embed .lh-player.is-idle .player-actions {
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

/* 5. Picker */

.lh-player .split-panel {
  width: min(356px, calc(100vw - 48px));
}

.lh-player .split-panel,
.lh-player .split-panel * {
  text-align: left;
}

.lh-player .split-panel .split-view[hidden],
.lh-player .split-panel .split-filter[hidden],
.lh-player .split-panel .split-note[hidden],
.lh-player .split-panel .split-error[hidden] {
  display: none;
}

.lh-player .split-choices {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 7px;
}

.lh-player .split-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 13px 4px 11px;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--white);
  color: var(--title);
  transition: background 120ms ease, border-color 120ms ease;
}

.lh-player .split-choice:hover {
  border-color: #c9bfae;
  background: var(--table);
  color: var(--ink);
}

.lh-player .split-choice svg {
  display: block;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lh-player .split-choice span {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}

.lh-player .split-paste {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--edge);
}

.lh-player .split-paste .options-label {
  display: block;
}

.lh-player .split-paste-row {
  display: flex;
  gap: 6px;
}

.lh-player .split-panel input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 40px;
  margin: 0;
  padding: 0 11px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}

.lh-player .split-panel input::placeholder {
  color: #b3a993;
}

.lh-player .split-panel input:focus {
  border-color: #9dbfe4;
  outline: none;
  box-shadow: 0 0 0 3px var(--focus);
}

.lh-player .split-add {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 15px;
  border-radius: 8px;
  background: var(--blue);
  color: var(--white);
  font-size: 14px;
  font-weight: 800;
}

.lh-player .split-add:hover {
  background: var(--blue-edge);
  color: var(--white);
}

.lh-player .split-error {
  margin: 8px 0 0;
  color: #b23a2e;
  font-size: 13px;
  font-weight: 700;
}

.lh-player .split-list-head {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: -4px 0 8px -6px;
}

.lh-player .split-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--icon);
}

.lh-player .split-back:hover {
  background: var(--table);
  color: var(--ink);
}

.lh-player .split-back svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lh-player .split-list-head p {
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.lh-player .split-filter {
  margin-bottom: 6px;
}

.lh-player .split-list {
  max-height: 264px;
  margin: 0 -6px;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.lh-player .split-list li {
  margin: 0;
  padding: 0;
}

.lh-player .split-item {
  display: block;
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.lh-player .split-item:hover {
  background: var(--table);
  color: var(--ink);
}

.lh-player .split-note a {
  color: var(--blue);
  font-size: inherit;
  font-weight: 800;
  text-decoration: underline;
}

.lh-player .split-note a:hover {
  color: var(--blue-edge);
}

.lh-player .split-note {
  margin: 6px 0 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

/* 6. Narrow screens: card set only */

@media (max-width: 760px) {
  .lh-player .split-btn,
  body.is-split .split-divider,
  body.is-split .split-pane {
    display: none !important;
  }
}
