:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #201d1a;
  --muted: #6a635c;
  --soft: #eee7dc;
  --line: #ded4c6;
  --accent: #c7354a;
  --accent-dark: #9b263d;
  --green: #1f6a56;
  --blue: #2f5c99;
  --amber: #a35c00;
  --shadow: 0 18px 50px rgba(48, 39, 31, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0) 260px),
    var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  padding: 14px clamp(18px, 4vw, 42px);
  border-bottom: 1px solid rgba(222, 212, 198, 0.86);
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
}

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

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

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

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-actions a,
.top-actions button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  padding: 9px 13px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 370px) minmax(0, 1fr);
  gap: clamp(18px, 3vw, 34px);
  width: min(1220px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 42px);
}

.app-drawer,
.tool-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.app-drawer {
  position: sticky;
  top: 104px;
  align-self: start;
  max-height: calc(100vh - 128px);
  overflow: auto;
  padding: 22px;
}

.drawer-heading h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.search-label,
.download-form label,
.youtube-form label,
.pdf-form label,
.text-editor label,
.text-form label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.88rem;
  font-weight: 850;
}

.search-label {
  margin-top: 26px;
}

.search-input,
.input-row input,
.youtube-form input,
.youtube-form select,
.pdf-form input,
.pdf-form select,
.text-form input,
.text-form select {
  width: 100%;
  min-width: 0;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 0 15px;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.search-input:focus,
.input-row input:focus,
.youtube-form input:focus,
.youtube-form select:focus,
.pdf-form input:focus,
.pdf-form select:focus,
.text-form input:focus,
.text-form select:focus,
.text-editor textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(47, 92, 153, 0.12);
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 20px;
}

button,
.tab {
  font: inherit;
}

.tab {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 850;
  padding: 0 12px;
}

.tab.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

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

.app-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  min-height: 92px;
  padding: 13px;
  text-align: left;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.app-card:hover {
  border-color: #b7aa99;
  box-shadow: 0 10px 26px rgba(48, 39, 31, 0.1);
  transform: translateY(-1px);
}

.app-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(199, 53, 74, 0.12);
}

.app-card[aria-disabled="true"] {
  cursor: default;
  opacity: 0.72;
}

.app-card[aria-disabled="true"]:hover {
  border-color: var(--line);
  box-shadow: none;
  transform: none;
}

.app-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 950;
}

.app-card[data-tone="red"] .app-icon {
  background: #ffe6e9;
  color: var(--accent-dark);
}

.app-card[data-tone="blue"] .app-icon {
  background: #e7eef9;
  color: var(--blue);
}

.app-card[data-tone="amber"] .app-icon {
  background: #ffefd7;
  color: var(--amber);
}

.app-name,
.app-summary,
.app-state {
  display: block;
}

.app-name {
  font-size: 0.98rem;
  font-weight: 900;
}

.app-summary {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.35;
}

.app-state {
  margin-top: 9px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 750;
  padding: 18px;
}

.tool-stage {
  min-width: 0;
}

.tool-header {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding-top: 2px;
}

.tool-header h2 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.tool-header p:last-child {
  max-width: 650px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.15rem);
  font-weight: 650;
  line-height: 1.55;
}

.tool-panel {
  padding: clamp(22px, 5vw, 42px);
}

.instagram-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #f0a733, #c7354a 48%, #4f62bd);
}

.instagram-mark span {
  width: 27px;
  height: 27px;
  border: 3px solid #fff;
  border-radius: 8px;
  box-shadow: 10px -10px 0 -8px #fff;
}

.youtube-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 8px;
  background: #d82727;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 950;
}

.tool-copy {
  margin-top: 24px;
}

.compact-copy {
  margin-top: 0;
}

.tool-copy h3,
.placeholder-panel h3,
.pdf-form h4,
.text-form h4 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.45rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.tool-copy p,
.placeholder-panel p,
.pdf-form p,
.text-form p {
  max-width: 620px;
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.55;
}

.download-form {
  margin-top: 30px;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

#download-button {
  min-width: 132px;
  height: 52px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  padding: 0 22px;
  transition:
    background 160ms ease,
    transform 160ms ease;
}

#download-button:hover {
  background: var(--accent-dark);
}

#download-button:active {
  transform: translateY(1px);
}

#download-button[disabled] {
  cursor: wait;
  opacity: 0.78;
}

#youtube-button {
  justify-self: start;
  min-width: 178px;
  height: 52px;
  border: 0;
  border-radius: 8px;
  background: #d82727;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  padding: 0 22px;
  transition:
    background 160ms ease,
    transform 160ms ease;
}

#youtube-button:hover {
  background: #a91f1f;
}

#youtube-button:active {
  transform: translateY(1px);
}

#youtube-button[disabled] {
  cursor: wait;
  opacity: 0.78;
}

.button-loading,
.is-loading .button-idle {
  display: none;
}

.is-loading .button-loading {
  display: inline;
}

.status {
  min-height: 24px;
  margin: 18px 0 0;
  color: var(--muted);
  font-weight: 760;
  line-height: 1.45;
}

.status.error {
  color: var(--accent-dark);
}

.status.success {
  color: var(--green);
}

.notes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.notes span {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  padding: 8px 12px;
}

.youtube-form {
  display: grid;
  gap: 14px;
  margin-top: 30px;
}

.youtube-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.youtube-form label {
  margin-bottom: 0;
}

.youtube-form label input,
.youtube-form label select {
  margin-top: 8px;
}

.time-picker-label {
  display: grid;
  gap: 8px;
}

.time-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.time-unit {
  display: grid;
  grid-template-columns: 74px auto;
  align-items: center;
  gap: 7px;
}

.time-unit input {
  margin-top: 0 !important;
  text-align: center;
}

.time-unit span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

.pdf-tabs,
.text-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 28px 0 18px;
}

.pdf-tab,
.text-tab {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 850;
  padding: 0 12px;
}

.pdf-tab.is-active,
.text-tab.is-active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.pdf-panels,
.text-panels {
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.pdf-form,
.text-form {
  display: none;
  max-width: 660px;
}

.pdf-form.is-active,
.text-form.is-active {
  display: grid;
  gap: 12px;
}

.pdf-form h4,
.text-form h4 {
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.pdf-form p,
.text-form p {
  margin-top: -2px;
  margin-bottom: 8px;
}

.pdf-form label,
.text-form label {
  margin-bottom: -4px;
}

.pdf-form input[type="file"] {
  height: auto;
  min-height: 58px;
  padding: 15px;
}

.pdf-form select,
.text-form select {
  appearance: none;
}

.pdf-form button,
.text-form button {
  justify-self: start;
  min-width: 150px;
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  padding: 0 20px;
}

.pdf-form button:hover,
.text-form button:hover {
  background: #244a7f;
}

.pdf-form button[disabled],
.text-form button[disabled] {
  cursor: wait;
  opacity: 0.72;
}

.text-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 26px;
}

.text-editor {
  min-width: 0;
}

.text-editor textarea {
  width: 100%;
  min-height: 280px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: 0.95rem/1.55 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  outline: none;
  padding: 14px;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.text-editor textarea[readonly] {
  background: #fbfaf7;
}

.text-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.text-stats span {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 8px 10px;
}

.text-stats strong {
  display: block;
  color: var(--ink);
  font-size: 1rem;
}

.text-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.text-actions button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 850;
  padding: 0 12px;
}

.text-form label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  margin: 0;
  color: var(--muted);
}

.text-form input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

.placeholder-panel {
  background: repeating-linear-gradient(
      135deg,
      rgba(222, 212, 198, 0.26) 0,
      rgba(222, 212, 198, 0.26) 1px,
      transparent 1px,
      transparent 18px
    ),
    var(--surface);
}

.consent-banner {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  width: min(680px, calc(100% - 36px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  box-shadow: 0 18px 50px rgba(32, 29, 26, 0.2);
}

.consent-banner strong,
.consent-banner p {
  display: block;
}

.consent-banner strong {
  font-size: 1rem;
  font-weight: 900;
}

.consent-banner p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.45;
}

.consent-banner a {
  color: var(--blue);
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.consent-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.consent-actions button {
  min-width: 92px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  padding: 0 14px;
}

.consent-actions button[data-consent-action="accept"] {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.privacy-page {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 42px);
}

.privacy-page h1 {
  max-width: 760px;
  margin: 0 0 18px;
  font-size: clamp(2rem, 5vw, 3.7rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.privacy-page h2 {
  margin: 28px 0 8px;
  font-size: 1.25rem;
  line-height: 1.2;
}

.privacy-page p {
  max-width: 720px;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.65;
}

[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .app-drawer {
    position: static;
    max-height: none;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions a {
    flex: 1;
    text-align: center;
  }

  .top-actions button {
    flex: 1;
  }

  .workspace {
    padding: 16px;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .text-grid,
  .text-stats {
    grid-template-columns: 1fr;
  }

  #download-button {
    width: 100%;
  }

  .youtube-options {
    grid-template-columns: 1fr;
  }

  #youtube-button {
    width: 100%;
  }

  .consent-banner {
    grid-template-columns: 1fr;
  }

  .consent-actions {
    justify-content: stretch;
  }

  .consent-actions button {
    flex: 1;
  }
}
