:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #111312;
  color: #f6f1eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(244, 183, 194, 0.18), transparent 32rem),
    linear-gradient(135deg, #121413 0%, #181716 50%, #101112 100%);
}

button {
  font: inherit;
}

.app {
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 22px 0 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2.2vw, 2.1rem);
  font-weight: 760;
  letter-spacing: 0;
}

.mode-tabs {
  display: flex;
  gap: 8px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.06);
}

.mode-tab {
  min-height: 38px;
  padding: 0 13px;
  border: 0;
  color: #efe8dd;
  background: transparent;
  cursor: pointer;
}

.mode-tab.active {
  background: #f7dfe5;
  color: #151313;
}

.phone-preview {
  position: relative;
  width: min(100%, 390px);
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: #070707;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.38);
  container-type: inline-size;
}

video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.safe-fade {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
}

.safe-fade.top {
  top: 0;
  height: 13%;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.38), transparent);
}

.safe-fade.bottom {
  bottom: 0;
  height: 18%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.42), transparent);
}

.overlay-copy {
  position: absolute;
  left: 9%;
  right: 9%;
  top: 6%;
  max-height: 20%;
  padding: 0 2%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  font-size: clamp(1rem, 5.2cqw, 1.32rem);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: 0;
  text-transform: none;
  text-wrap: balance;
  text-shadow:
    -1.25px -1.25px 0 #0c0c0c,
    1.25px -1.25px 0 #0c0c0c,
    -1.25px 1.25px 0 #0c0c0c,
    1.25px 1.25px 0 #0c0c0c,
    0 4px 13px rgba(0, 0, 0, 0.62);
}

.overlay-copy[data-placement="low"] {
  top: auto;
  bottom: 13%;
  max-height: 18%;
}

.mode-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 44px;
  margin-bottom: 14px;
  padding: 0 2px;
  color: rgba(246, 241, 235, 0.74);
  font-size: 0.93rem;
}

.mode-meta strong {
  color: #f8efe6;
}

.content-feed {
  display: grid;
  gap: 26px;
}

.sample-card {
  display: grid;
  grid-template-columns: minmax(280px, 390px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
}

.sample-media {
  display: grid;
  justify-items: center;
  position: sticky;
  top: 16px;
}

.sample-body {
  display: grid;
  gap: 14px;
}

.sample-title-row,
.group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h2 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.15;
  letter-spacing: 0;
}

h3 {
  margin: 0 0 5px;
  font-size: 0.96rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.option-groups {
  display: grid;
  gap: 16px;
}

.option-group {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.12);
}

.sample-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.kept-count,
.context-line {
  color: rgba(246, 241, 235, 0.7);
  font-size: 0.88rem;
}

.sample-options {
  display: grid;
  gap: 10px;
}

.option {
  display: grid;
  gap: 9px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.065);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.option:hover,
.option.active {
  border-color: #f5c3ce;
  background: rgba(247, 223, 229, 0.12);
}

.option-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.option-index {
  color: #f7dfe5;
  font-weight: 760;
  font-size: 0.86rem;
}

.overlay-line {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.15;
  font-weight: 780;
}

.caption-line {
  margin: 0;
  color: rgba(246, 241, 235, 0.75);
  line-height: 1.35;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.keep-control {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #f8efe6;
  cursor: pointer;
  user-select: none;
}

.keep-control input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #f7dfe5;
  cursor: pointer;
}

.copy-btn {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #f8efe6;
  cursor: pointer;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

@media (max-width: 820px) {
  .topbar,
  .mode-meta,
  .sample-title-row,
  .group-head {
    align-items: stretch;
    flex-direction: column;
  }

  .mode-tabs {
    width: 100%;
  }

  .mode-tab {
    flex: 1;
  }

  .sample-card {
    grid-template-columns: 1fr;
    padding: 10px;
    gap: 14px;
  }

  .sample-media {
    position: static;
  }

  .sample-actions,
  .actions {
    justify-content: stretch;
  }

  .copy-btn,
  .keep-control {
    flex: 1;
    justify-content: center;
  }
}
