:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #172033;
  --muted: #637083;
  --border: #dce3ec;
  --primary: #0f766e;
  --primary-hover: #115e59;
  --danger: #ef4444;
  --info: #0891b2;
  --warning: #f59e0b;
  --radius: 8px;
  --shadow: 0 16px 42px rgba(20, 32, 51, 0.10);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 360px),
    linear-gradient(180deg, #fbfdff 0%, var(--bg) 100%);
  color: var(--text);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

.icon-sprite {
  position: absolute;
}

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

a {
  color: var(--primary);
  font-weight: 700;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 92px;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 14px;
}

.hero {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(240, 247, 250, 0.96));
}

.hero-brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
}

.hero-brand-icon.tiktok {
  color: #111827;
  background: linear-gradient(135deg, rgba(37, 244, 238, 0.22), rgba(254, 44, 85, 0.16));
  box-shadow: inset 0 0 0 1px rgba(37, 244, 238, 0.28);
}

.hero-brand-icon.youtube {
  color: #dc2626;
  background: #fee2e2;
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.16);
}

.hero-brand-icon.facebook {
  color: #1d4ed8;
  background: #dbeafe;
  box-shadow: inset 0 0 0 1px rgba(29, 78, 216, 0.16);
}

.hero-brand-icon svg {
  width: 34px;
  height: 34px;
}

.hero-brand-plus {
  color: var(--muted);
  font-size: 1.3rem;
  font-weight: 900;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.65rem);
  line-height: 1.08;
}

h2 {
  margin: 0;
  font-size: 1.55rem;
}

.section-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--primary);
  background: #e8f5f3;
}

.title-icon.tiktok {
  color: #111827;
  background: linear-gradient(135deg, rgba(37, 244, 238, 0.22), rgba(254, 44, 85, 0.16));
}

.title-icon.youtube {
  color: #dc2626;
  background: #fee2e2;
}

.title-icon.facebook {
  color: #1d4ed8;
  background: #dbeafe;
}

.title-icon svg {
  width: 18px;
  height: 18px;
}

.hero-copy,
.body-copy,
.hint {
  color: var(--muted);
  line-height: 1.6;
}

.hero-copy {
  margin: 10px 0 0;
}

.hero-ribbon {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.9fr 1.2fr;
  gap: 8px;
  width: min(420px, 100%);
  margin-bottom: 16px;
}

.hero-ribbon-segment {
  display: block;
  height: 14px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.34), 0 8px 18px rgba(20, 32, 51, 0.10);
}

.hero-ribbon-segment.aqua {
  background: linear-gradient(135deg, #14b8a6, #2dd4bf);
}

.hero-ribbon-segment.coral {
  background: linear-gradient(135deg, #fb7185, #f97316);
}

.hero-ribbon-segment.gold {
  background: linear-gradient(135deg, #f59e0b, #facc15);
}

.hero-ribbon-segment.blue {
  background: linear-gradient(135deg, #2563eb, #60a5fa);
}

.platform-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.platform-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-weight: 800;
}

.platform-pill.tiktok {
  color: #111827;
  box-shadow: inset 0 0 0 1px rgba(37, 244, 238, 0.22);
}

.platform-pill.youtube {
  color: #991b1b;
  box-shadow: inset 0 0 0 1px rgba(255, 0, 0, 0.18);
}

.platform-pill.facebook {
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(29, 78, 216, 0.18);
}

.platform-icon {
  width: 18px;
  height: 18px;
}

.sidebar,
.content,
.panel {
  width: 100%;
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 16px;
  align-self: start;
  display: grid;
  gap: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(20, 32, 51, 0.08);
}

.nav-button,
.primary-button,
.ghost-button,
.download-button {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.nav-button {
  width: 100%;
  min-width: 0;
  padding: 0 14px;
  text-align: left;
  color: var(--text);
  background: var(--panel-soft);
  border: 1px solid var(--border);
  white-space: normal;
}

.button-content {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: var(--primary);
}

.nav-icon.youtube {
  color: #dc2626;
}

.nav-button.is-active,
.nav-button:hover {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.nav-button.is-active .nav-icon,
.nav-button:hover .nav-icon {
  color: currentColor;
}

.primary-button {
  padding: 0 18px;
  color: #fff;
  background: var(--primary);
}

.primary-button:hover,
.download-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(20, 32, 51, 0.16);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}

.ghost-button {
  padding: 0 14px;
  color: var(--primary);
  background: #e8f5f3;
}

.refresh-button {
  padding: 0 16px;
  color: #fff;
  background: linear-gradient(135deg, #f97316, #ea580c);
  box-shadow: 0 10px 22px rgba(249, 115, 22, 0.24);
}

.refresh-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(234, 88, 12, 0.30);
}

.content {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  display: none;
  padding: 22px;
}

.panel.is-active {
  display: block;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

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

.field-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
}

.input-container {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  padding: 14px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  line-height: 1.55;
}

.text-input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
}

.input-container:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.14);
}

.text-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.14);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 14px 0;
}

.status {
  min-height: 24px;
  color: var(--muted);
  font-weight: 700;
}

.status.is-error {
  color: var(--danger);
}

.results {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.result-card {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.result-title {
  margin: 0;
  font-size: 1.08rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--info);
  font-size: 0.8rem;
  font-weight: 800;
}

.meta-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.meta-table th,
.meta-table td {
  padding: 10px;
  border-bottom: 1px solid #edf1f5;
  text-align: left;
  vertical-align: top;
}

.meta-table th {
  width: 178px;
  color: var(--muted);
  font-weight: 800;
}

.download-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.download-button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  color: #fff;
  text-decoration: none;
  background: var(--primary);
}

.download-button.secondary {
  background: var(--info);
}

.preview {
  width: min(420px, 100%);
  max-height: 460px;
  margin-top: 12px;
  border-radius: var(--radius);
  background: #000;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.image-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.notice {
  padding: 14px;
  color: #7a4b00;
  background: #fff7df;
  border: 1px solid #ffe3a3;
  border-radius: var(--radius);
  line-height: 1.6;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.about-grid a {
  padding: 14px;
  text-decoration: none;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 12px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--border);
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 720px;
    padding: 18px 10px 92px;
  }

  .hero {
    grid-template-columns: 1fr;
    padding: 18px;
    width: 100%;
    overflow: hidden;
  }

  .hero-brand {
    width: fit-content;
  }

  .hero-brand-icon {
    width: 56px;
    height: 56px;
  }

  .hero-brand-icon svg {
    width: 30px;
    height: 30px;
  }

  .sidebar {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    overflow: hidden;
  }

  .nav-button {
    text-align: center;
  }

  .button-content {
    justify-content: center;
  }

  .panel {
    padding: 16px;
    overflow: hidden;
  }

  .panel-heading,
  .result-head {
    display: grid;
  }

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

  .meta-table,
  .meta-table tbody,
  .meta-table tr,
  .meta-table th,
  .meta-table td {
    display: block;
    width: 100%;
  }

  .meta-table th {
    padding-bottom: 4px;
    border-bottom: 0;
  }
}

@media (max-width: 460px) {
  h1 {
    font-size: 1.72rem;
  }

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