:root {
  --bg: #071012;
  --surface: #101a1d;
  --surface-strong: #17262a;
  --text: #f8faf8;
  --muted: #a8b7b8;
  --line: rgba(255, 255, 255, 0.12);
  --mint: #21f4bd;
  --pink: #ff3f81;
  --yellow: #ffd166;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(33, 244, 189, 0.18), transparent 34rem),
    linear-gradient(135deg, #071012 0%, #101416 52%, #190d14 100%);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.72fr);
  align-items: center;
  gap: 40px;
  min-height: calc(100vh - 84px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--mint);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(3.7rem, 8vw, 7.5rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.hero__copy {
  max-width: 620px;
  margin: 24px 0 28px;
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.7;
}

.download-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  max-width: 760px;
}

.input-group {
  display: flex;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.input-group input {
  width: 100%;
  min-width: 0;
  padding: 18px 16px;
  color: var(--text);
  border: 0;
  outline: 0;
  background: transparent;
}

.input-group input::placeholder {
  color: rgba(248, 250, 248, 0.45);
}

.icon-button,
.primary-button,
.ghost-button,
.download-link {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

.icon-button {
  width: 52px;
  flex: 0 0 52px;
  color: var(--text);
  background: transparent;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 58px;
  padding: 0 22px;
  color: #06100e;
  font-weight: 800;
  background: var(--mint);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.button-icon {
  font-size: 1.25rem;
}

.usage-note {
  max-width: 600px;
  margin: 16px 0 0;
  color: rgba(248, 250, 248, 0.62);
  font-size: 0.92rem;
}

.preview-panel {
  display: flex;
  justify-content: center;
}

.phone-frame {
  position: relative;
  width: min(100%, 380px);
  min-height: 640px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 36px;
  background: linear-gradient(180deg, #182326 0%, #0b1113 100%);
  box-shadow: var(--shadow);
}

.phone-top {
  position: absolute;
  top: 16px;
  left: 50%;
  z-index: 2;
  width: 104px;
  height: 26px;
  border-radius: 999px;
  background: #05090a;
  transform: translateX(-50%);
}

.empty-state,
.result-card {
  min-height: 640px;
}

.empty-state {
  display: grid;
  place-items: center;
  padding: 48px;
  color: var(--muted);
  text-align: center;
}

.pulse-mark {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin: 0 auto 18px;
  color: #06100e;
  font-size: 3rem;
  font-weight: 800;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mint), var(--yellow));
}

.result-card {
  display: flex;
  flex-direction: column;
}

.result-card img,
.result-card video {
  width: 100%;
  height: 395px;
  object-fit: cover;
  background: var(--surface-strong);
}

.result-card__body {
  padding: 20px;
}

.author {
  margin: 0 0 6px;
  color: var(--mint);
  font-size: 0.9rem;
  font-weight: 800;
}

.result-card h2 {
  display: -webkit-box;
  min-height: 48px;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.45;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.stats {
  display: flex;
  gap: 10px;
  margin: 14px 0 18px;
  color: var(--muted);
  font-size: 0.88rem;
}

.actions {
  display: grid;
  gap: 10px;
}

.download-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 14px;
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.08);
}

.download-link:first-child {
  color: #06100e;
  font-weight: 800;
  background: var(--pink);
}

.history-section {
  padding: 0 0 48px;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 18px 0 4px;
  color: rgba(248, 250, 248, 0.58);
  font-size: 0.92rem;
}

.site-footer a {
  color: var(--mint);
  font-weight: 700;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.35rem;
}

.ghost-button {
  min-height: 40px;
  padding: 0 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.history-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  padding: 10px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.history-media {
  display: block;
  width: 64px;
  height: 64px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface);
}

.history-item img,
.history-item video,
.history-placeholder {
  width: 64px;
  height: 64px;
}

.history-item img,
.history-item video {
  display: block;
  object-fit: cover;
}

.history-placeholder {
  display: grid;
  place-items: center;
  color: #06100e;
  font-weight: 800;
  background: linear-gradient(135deg, var(--mint), var(--yellow));
}

.history-item strong,
.history-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100% - 36px));
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(10, 16, 18, 0.94);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.is-hidden {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (hover: hover) {
  .primary-button:hover,
  .icon-button:hover,
  .ghost-button:hover,
  .download-link:hover,
  .history-item:hover {
    transform: translateY(-1px);
  }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

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

  .preview-panel {
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 20px, 1120px);
    padding: 24px 0;
  }

  h1 {
    font-size: 3.4rem;
  }

  .hero__copy {
    font-size: 1rem;
  }

  .phone-frame,
  .empty-state,
  .result-card {
    min-height: 560px;
  }

  .result-card img,
  .result-card video {
    height: 330px;
  }
}
