:root {
  color-scheme: light;
  --ink: #102e2b;
  --muted: #65736f;
  --green-950: #063c2d;
  --green-900: #07583f;
  --green-800: #0b6a4c;
  --green-100: #dff1e8;
  --lime: #d5f36a;
  --yellow: #f7ca52;
  --cream: #f6f3e8;
  --paper: #fffef9;
  --danger: #a93b39;
  --shadow: 0 18px 55px rgba(15, 55, 45, 0.13);
  --soft-shadow: 0 10px 28px rgba(15, 55, 45, 0.1);
  --radius-lg: 30px;
  --radius-md: 20px;
  --radius-sm: 13px;
  font-family: "Arial Hebrew", "Noto Sans Hebrew", Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  background: var(--cream);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(213, 243, 106, 0.28), transparent 23rem),
    radial-gradient(circle at 93% 73%, rgba(247, 202, 82, 0.2), transparent 22rem),
    var(--cream);
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 22rem;
  height: 22rem;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.2;
  pointer-events: none;
}

.ambient-one {
  top: -10rem;
  right: -7rem;
  background: var(--lime);
}

.ambient-two {
  bottom: -11rem;
  left: -8rem;
  background: var(--yellow);
}

.centered-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  text-align: center;
}

#loading-view {
  color: var(--green-900);
  font-weight: 800;
}

.loader-ball {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  font-size: 52px;
  animation: ball-bounce 0.9s ease-in-out infinite alternate;
}

@keyframes ball-bounce {
  to {
    transform: translateY(-14px) rotate(18deg);
  }
}

.auth-card {
  position: relative;
  width: min(100%, 440px);
  overflow: hidden;
  padding: 42px;
  border: 1px solid rgba(7, 88, 63, 0.12);
  border-radius: var(--radius-lg);
  background: rgba(255, 254, 249, 0.94);
  box-shadow: var(--shadow);
}

.auth-card::before {
  position: absolute;
  top: -90px;
  left: -60px;
  width: 180px;
  height: 180px;
  border: 28px solid rgba(7, 88, 63, 0.06);
  border-radius: 50%;
  content: "";
}

.auth-card h1 {
  margin: 7px 0 10px;
  font-size: clamp(2rem, 8vw, 3rem);
  line-height: 1.05;
}

.auth-copy {
  max-width: 30ch;
  margin: 0 auto 28px;
  color: var(--muted);
  line-height: 1.6;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 15px;
  color: white;
  background: var(--green-900);
  box-shadow: 0 8px 18px rgba(7, 88, 63, 0.2);
  font-size: 25px;
}

.brand-mark-large {
  position: relative;
  width: 82px;
  height: 82px;
  margin: 0 auto 20px;
  border-radius: 26px;
  font-size: 47px;
  transform: rotate(-4deg);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--green-800);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.eyebrow-light {
  color: var(--lime);
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 32px));
  margin: 14px auto;
  padding: 10px 12px 10px 18px;
  border: 1px solid rgba(7, 88, 63, 0.12);
  border-radius: 20px;
  background: rgba(255, 254, 249, 0.88);
  box-shadow: 0 7px 25px rgba(15, 55, 45, 0.08);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1rem;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
}

.topbar-actions,
.modal-header-actions,
.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.button {
  min-height: 44px;
  padding: 10px 17px;
  border: 0;
  border-radius: 13px;
  font-weight: 800;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(1px);
}

.button:focus-visible,
.icon-button:focus-visible,
.video-card:focus-visible,
.filter-chip:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

.button-primary {
  color: white;
  background: var(--green-900);
  box-shadow: 0 8px 18px rgba(7, 88, 63, 0.2);
}

.button-primary:hover {
  background: var(--green-800);
}

.button-dark {
  color: white;
  background: var(--ink);
}

.button-quiet {
  color: var(--ink);
  background: var(--green-100);
}

.button-success {
  min-width: 190px;
  color: var(--green-950);
  background: var(--lime);
}

.button-danger {
  color: var(--danger);
  background: #f8e5e3;
}

.button-wide {
  width: 100%;
}

.button[disabled] {
  cursor: wait;
  opacity: 0.6;
  transform: none;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  position: relative;
  display: grid;
  min-height: 365px;
  grid-template-columns: minmax(0, 1.2fr) minmax(250px, 0.7fr);
  align-items: end;
  gap: 32px;
  overflow: hidden;
  padding: clamp(32px, 6vw, 68px);
  border-radius: 34px;
  color: white;
  background:
    linear-gradient(125deg, rgba(6, 60, 45, 0.95), rgba(7, 88, 63, 0.91)),
    var(--green-900);
  box-shadow: var(--shadow);
}

.hero::after {
  position: absolute;
  top: -50%;
  left: -7%;
  width: 45%;
  height: 190%;
  background: linear-gradient(90deg, transparent, rgba(213, 243, 106, 0.07), transparent);
  content: "";
  transform: rotate(18deg);
}

.pitch-lines {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  pointer-events: none;
}

.pitch-circle {
  position: absolute;
  top: 50%;
  left: -90px;
  width: 310px;
  height: 310px;
  border: 4px solid white;
  border-radius: 50%;
  transform: translateY(-50%);
}

.pitch-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 65px;
  width: 4px;
  background: white;
}

.hero-copy,
.progress-card {
  position: relative;
  z-index: 1;
}

.hero h1 {
  max-width: 11ch;
  margin: 9px 0 16px;
  font-size: clamp(2.7rem, 6vw, 5rem);
  line-height: 0.96;
  letter-spacing: -0.055em;
}

.hero-copy > p:last-child {
  max-width: 38ch;
  margin: 0;
  color: rgba(255, 255, 255, 0.75);
  font-size: 1.05rem;
  line-height: 1.6;
}

.progress-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(12px);
}

.progress-card strong,
.progress-card span {
  display: block;
}

.progress-card strong {
  margin-bottom: 4px;
  font-size: 1.05rem;
}

.progress-card div > span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.82rem;
}

.progress-ring {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 76px;
  height: 76px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--lime) calc(var(--progress) * 1%), rgba(255, 255, 255, 0.16) 0);
}

.progress-ring::before {
  position: absolute;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--green-900);
  content: "";
}

.progress-ring > span {
  position: relative;
  z-index: 1;
  font-size: 0.82rem;
  font-weight: 900;
}

.library {
  padding: 52px 0 72px;
}

.section-heading,
.manage-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.section-heading h2 {
  margin: 3px 0 0;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  letter-spacing: -0.035em;
}

.count-pill {
  flex: 0 0 auto;
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--green-900);
  background: var(--green-100);
  font-size: 0.8rem;
  font-weight: 900;
}

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 24px -4px 26px;
  padding: 4px;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 8px 15px;
  border: 1px solid rgba(16, 46, 43, 0.1);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 254, 249, 0.72);
  font-weight: 800;
}

.filter-chip[aria-pressed="true"] {
  border-color: var(--ink);
  color: white;
  background: var(--ink);
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.video-card {
  position: relative;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 24px;
  color: inherit;
  background: var(--paper);
  box-shadow: var(--soft-shadow);
  text-align: right;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.video-card:hover {
  box-shadow: 0 18px 38px rgba(15, 55, 45, 0.16);
  transform: translateY(-4px);
}

.card-cover {
  position: relative;
  display: grid;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  place-items: center;
  background: linear-gradient(145deg, var(--green-900), #123932);
}

.card-cover::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(5, 28, 24, 0.58), transparent 60%);
  content: "";
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-pitch {
  position: absolute;
  inset: 16px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 12px;
}

.cover-pitch::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 62px;
  height: 62px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  content: "";
  transform: translate(-50%, -50%);
}

.cover-pitch::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: rgba(255, 255, 255, 0.28);
  content: "";
}

.play-button {
  position: absolute;
  z-index: 2;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 50%;
  color: var(--green-950);
  background: var(--lime);
  box-shadow: 0 9px 22px rgba(5, 28, 24, 0.26);
  font-size: 19px;
}

.card-status {
  position: absolute;
  z-index: 3;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  color: white;
  background: rgba(6, 60, 45, 0.86);
  font-size: 0.72rem;
  font-weight: 900;
  backdrop-filter: blur(8px);
}

.card-body {
  padding: 18px;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.source-badge,
.category-label {
  display: inline-flex;
  align-items: center;
  width: max-content;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 900;
}

.source-badge {
  padding: 6px 9px;
  color: var(--source-color, var(--green-900));
  background: var(--source-bg, var(--green-100));
}

.source-youtube {
  --source-color: #a91717;
  --source-bg: #fee7e4;
}

.source-facebook {
  --source-color: #184f9e;
  --source-bg: #e6efff;
}

.source-direct {
  --source-color: #604498;
  --source-bg: #eee8fa;
}

.category-label {
  color: var(--muted);
}

.video-card h3 {
  margin: 0 0 8px;
  font-size: 1.16rem;
  line-height: 1.35;
}

.card-instructions {
  display: -webkit-box;
  min-height: 2.8em;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 0.87rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-repetitions {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 15px 0 0;
  color: var(--green-800);
  font-size: 0.8rem;
  font-weight: 900;
}

.empty-state {
  padding: 55px 24px;
  border: 2px dashed rgba(7, 88, 63, 0.17);
  border-radius: var(--radius-lg);
  background: rgba(255, 254, 249, 0.55);
  text-align: center;
}

.empty-state h3 {
  margin: 14px 0 7px;
  font-size: 1.5rem;
}

.empty-state p {
  margin: 0 0 20px;
  color: var(--muted);
}

.empty-illustration {
  display: grid;
  width: 92px;
  height: 92px;
  margin: auto;
  place-items: center;
  border-radius: 50%;
  background: var(--green-100);
  font-size: 52px;
}

footer {
  display: flex;
  justify-content: center;
  gap: 10px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
  border-top: 1px solid rgba(16, 46, 43, 0.09);
  color: var(--muted);
  font-size: 0.8rem;
}

.modal {
  width: min(calc(100% - 28px), 760px);
  max-height: calc(100dvh - 28px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 28px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 25px 90px rgba(5, 28, 24, 0.3);
}

.modal::backdrop {
  background: rgba(5, 28, 24, 0.72);
  backdrop-filter: blur(5px);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 26px 18px;
}

.modal-header h2 {
  margin: 4px 0 0;
  font-size: clamp(1.45rem, 4vw, 2rem);
}

.icon-button {
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 14px;
  color: var(--ink);
  background: #eef1ea;
  font-size: 1.8rem;
  line-height: 1;
}

.compact-modal {
  width: min(calc(100% - 28px), 460px);
}

.dialog-form {
  padding: 0 26px 28px;
}

.player-modal {
  width: min(calc(100% - 28px), 940px);
}

.player-header {
  align-items: center;
}

.player-header .source-badge {
  margin-bottom: 7px;
}

.player-stage {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 16 / 9;
  place-items: center;
  color: white;
  background: #071d19;
}

.player-stage iframe,
.player-stage video {
  width: 100%;
  height: 100%;
  border: 0;
}

.demo-player {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(145deg, #07583f, #063c2d);
}

.demo-player::before {
  position: absolute;
  inset: 9%;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  content: "";
}

.demo-player span {
  position: relative;
  z-index: 1;
  font-size: clamp(4rem, 14vw, 8rem);
}

.player-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 26px 27px;
}

.player-instructions {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
}

.repetitions {
  margin: 6px 0 0;
  color: var(--green-800);
  font-size: 0.86rem;
  font-weight: 900;
}

.parent-modal {
  width: min(calc(100% - 28px), 1120px);
}

.parent-modal-header {
  position: sticky;
  z-index: 3;
  top: 0;
  border-bottom: 1px solid rgba(16, 46, 43, 0.08);
  background: rgba(255, 254, 249, 0.94);
  backdrop-filter: blur(16px);
}

.parent-layout {
  display: grid;
  grid-template-columns: minmax(330px, 0.8fr) minmax(0, 1.2fr);
  min-height: 560px;
}

.form-panel,
.manage-panel {
  padding: 28px;
}

.form-panel {
  border-left: 1px solid rgba(16, 46, 43, 0.09);
  background: #f4f5ed;
}

.form-panel h3,
.manage-panel h3 {
  margin: 0 0 5px;
  font-size: 1.25rem;
}

.panel-copy {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.stack-form {
  display: grid;
  gap: 9px;
  text-align: right;
}

.stack-form label {
  margin-top: 6px;
  font-size: 0.82rem;
  font-weight: 900;
}

.stack-form input,
.stack-form select,
.stack-form textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid rgba(16, 46, 43, 0.15);
  border-radius: 12px;
  color: var(--ink);
  background: white;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.stack-form textarea {
  resize: vertical;
}

.stack-form input:focus,
.stack-form select:focus,
.stack-form textarea:focus {
  border-color: var(--green-800);
  box-shadow: 0 0 0 3px rgba(11, 106, 76, 0.12);
}

.stack-form small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-grid > div {
  display: grid;
  gap: 9px;
}

.form-error {
  min-height: 1.2em;
  margin: 2px 0;
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 700;
}

.demo-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.manage-heading {
  align-items: flex-start;
}

.manage-list {
  display: grid;
  gap: 10px;
}

.manage-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(16, 46, 43, 0.09);
  border-radius: 16px;
  background: white;
}

.manage-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 13px;
  background: var(--green-100);
  font-size: 24px;
}

.manage-copy {
  min-width: 0;
}

.manage-copy strong,
.manage-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manage-copy small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
}

.manage-actions {
  display: flex;
  gap: 5px;
}

.manage-actions button {
  min-height: 38px;
  padding: 7px 10px;
  border: 0;
  border-radius: 10px;
  font-size: 0.76rem;
  font-weight: 900;
}

.manage-empty {
  padding: 40px 16px;
  border: 1px dashed rgba(16, 46, 43, 0.16);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}

.demo-banner {
  position: fixed;
  z-index: 20;
  right: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  padding: 8px 13px;
  border: 1px solid rgba(6, 60, 45, 0.18);
  border-radius: 999px;
  color: var(--green-950);
  background: rgba(213, 243, 106, 0.94);
  box-shadow: var(--soft-shadow);
  font-size: 0.72rem;
  font-weight: 900;
  transform: translateX(50%);
}

.toast {
  position: fixed;
  z-index: 100;
  right: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100% - 32px);
  padding: 13px 16px;
  border-radius: 14px;
  color: white;
  background: var(--ink);
  box-shadow: 0 15px 40px rgba(5, 28, 24, 0.3);
  font-size: 0.84rem;
  font-weight: 800;
  transform: translateX(50%);
}

.toast button {
  padding: 5px 9px;
  border: 0;
  border-radius: 8px;
  color: var(--green-950);
  background: var(--lime);
  font-size: 0.75rem;
  font-weight: 900;
}

@media (max-width: 900px) {
  .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .form-panel {
    border-bottom: 1px solid rgba(16, 46, 43, 0.09);
    border-left: 0;
  }
}

@media (max-width: 700px) {
  .topbar {
    width: calc(100% - 20px);
    margin: 10px auto;
  }

  .brand small,
  #install-button {
    display: none !important;
  }

  .brand strong {
    font-size: 0.9rem;
  }

  .button-dark {
    padding-inline: 12px;
    font-size: 0.78rem;
  }

  main {
    width: calc(100% - 20px);
  }

  .hero {
    min-height: 430px;
    grid-template-columns: 1fr;
    align-content: space-between;
    padding: 32px 24px 24px;
    border-radius: 28px;
  }

  .hero h1 {
    font-size: clamp(2.8rem, 14vw, 4rem);
  }

  .progress-card {
    justify-self: stretch;
  }

  .library {
    padding-top: 38px;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-end;
  }

  .section-heading h2 {
    font-size: 1.8rem;
  }

  .player-details {
    align-items: stretch;
    flex-direction: column;
  }

  .button-success {
    width: 100%;
  }

  .parent-modal-header {
    align-items: center;
    padding: 17px;
  }

  .parent-modal-header .button-quiet {
    display: none;
  }

  .parent-layout {
    min-height: auto;
  }

  .form-panel,
  .manage-panel {
    padding: 22px 18px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .manage-item {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .manage-actions {
    grid-column: 1 / -1;
  }

  .manage-actions button {
    flex: 1;
  }

  footer {
    align-items: center;
    flex-direction: column;
    width: calc(100% - 20px);
  }

  footer span[aria-hidden="true"] {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
