@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

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

html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  color: #111111;
  background: #ffffff;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #ffffff;
  border-bottom: 1px solid #e5e5e5;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #111111;
}

.header-tool-name {
  font-weight: 600;
  font-size: 15px;
  color: #111111;
}

.header-nav {
  display: flex;
  gap: 28px;
}

.header-nav a {
  font-size: 14px;
  color: #888888;
  text-decoration: none;
  transition: color 0.15s;
}

.header-nav a:hover {
  color: #111111;
}

.header-nav a[aria-current="page"] {
  color: #111111;
  font-weight: 500;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.hamburger span {
  width: 22px;
  height: 2px;
  background: #111111;
  border-radius: 2px;
  display: block;
  transition: all 0.2s ease;
}

/* Hamburger → X */
.site-header.nav-open .hamburger span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.site-header.nav-open .hamburger span:nth-child(2) {
  opacity: 0;
}
.site-header.nav-open .hamburger span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Footer ── */
.site-footer {
  margin-top: auto;
  background: #ffffff;
  border-top: 1px solid #e5e5e5;
  padding: 20px 24px;
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.footer-copy {
  font-size: 13px;
  color: #888888;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-nav a {
  font-size: 13px;
  color: #888888;
  text-decoration: none;
  transition: color 0.15s;
}

.footer-nav a:hover {
  color: #111111;
}

/* ── Main content ── */
main {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

/* ── Typography ── */
h1 {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 8px;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

p {
  font-size: 15px;
  line-height: 1.65;
  color: #333333;
}

.subtitle {
  font-size: 15px;
  color: #555555;
  margin-bottom: 40px;
  line-height: 1.5;
}

/* ── Tool area ── */
.tool-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.textarea-wrap {
  position: relative;
}

textarea {
  width: 100%;
  min-height: 160px;
  padding: 12px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: #111111;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
  line-height: 1.55;
}

textarea:focus {
  border-color: #111111;
}

textarea::placeholder {
  color: #aaaaaa;
}

.char-counter {
  text-align: right;
  font-size: 12px;
  color: #888888;
  margin-top: 4px;
}

/* ── Dropdowns row ── */
.dropdowns-row {
  display: flex;
  gap: 12px;
}

.dropdown-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.dropdown-wrap label {
  font-size: 12px;
  font-weight: 500;
  color: #555555;
  letter-spacing: 0.02em;
}

select {
  width: 100%;
  padding: 9px 32px 9px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: #111111;
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23555' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}

select:focus {
  border-color: #111111;
}

/* ── Button row ── */
.button-row {
  display: flex;
  gap: 12px;
}

.btn {
  flex: 1;
  height: 42px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
  outline: none;
}

.btn:focus-visible {
  box-shadow: 0 0 0 2px #111111;
}

.btn-outline {
  background: #ffffff;
  color: #111111;
  border: 1px solid #111111;
}

.btn-outline:hover:not(:disabled) {
  background: #f5f5f5;
}

.btn-filled {
  background: #111111;
  color: #ffffff;
  border: 1px solid #111111;
}

.btn-filled:hover:not(:disabled) {
  background: #333333;
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ── Status ── */
.status-text {
  font-size: 13px;
  color: #888888;
  min-height: 18px;
}

.status-text.error {
  color: #cc0000;
}

.status-text.success {
  color: #116611;
}

/* ── Player button (used in dynamically created audio cards) ── */
.player-btn {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid #e5e5e5;
  background: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.player-btn:hover {
  background: #f0f0f0;
}

.player-btn:focus-visible {
  outline: 2px solid #111111;
}

.player-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.player-btn svg {
  display: block;
}

/* ── About page ── */
.content-section {
  margin-bottom: 36px;
}

.content-section p {
  margin-top: 8px;
}

/* ── Contact form ── */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-field label {
  font-size: 13px;
  font-weight: 500;
  color: #555555;
}

.form-field input,
.form-field textarea {
  min-height: unset;
  resize: vertical;
}

.form-field textarea {
  min-height: 120px;
}

.form-status {
  font-size: 14px;
  color: #888888;
  min-height: 20px;
}

.form-status.success {
  color: #116611;
}

.form-status.error {
  color: #cc0000;
}

/* ── Privacy / Terms pages ── */
.privacy-body h2,
.terms-body h2 {
  margin-top: 32px;
  margin-bottom: 6px;
}

.privacy-body p,
.terms-body p {
  margin-bottom: 10px;
}

.privacy-body ul,
.terms-body ul {
  list-style: disc;
  padding-left: 20px;
  margin-top: 4px;
}

.privacy-body ul li,
.terms-body ul li {
  font-size: 15px;
  line-height: 1.65;
  color: #333333;
  margin-bottom: 4px;
}

.privacy-body a,
.terms-body a {
  color: #111111;
}

.last-updated {
  font-size: 13px;
  color: #888888;
  margin-bottom: 32px;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  /* Hamburger visible, nav hidden */
  .hamburger {
    display: flex;
  }

  .header-nav {
    display: none;
  }

  /* Mobile nav open */
  .site-header.nav-open .header-nav {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: #ffffff;
    border-bottom: 1px solid #e5e5e5;
    padding: 16px 24px;
    gap: 16px;
    z-index: 99;
  }

  .site-header.nav-open .header-nav a {
    font-size: 15px;
    color: #111111;
  }

  /* Footer stacks */
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-nav {
    gap: 12px;
  }

  /* Tool area */
  main {
    padding: 32px 16px 56px;
  }

  h1 {
    font-size: 24px;
  }

  .dropdowns-row {
    flex-direction: column;
  }

  .button-row {
    flex-direction: column;
  }

  .btn {
    flex: none;
    width: 100%;
  }
}

/* ════════════════════════════════════════════════════════════════════════════
   Flow app styles
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Shell ── */
.shell {
  flex: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 24px 64px;
  width: 100%;
}

/* ── Status pill ── */
.status-pill {
  display: inline-block;
  font-size: 12px;
  color: #888;
  margin-bottom: 32px;
}

/* ── Mode selector ── */
.mode-selector {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
}

.mode-btn {
  flex: 1;
  padding: 20px;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  border: 2px solid #e5e5e5;
  border-radius: 12px;
  background: #ffffff;
  color: #888;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-btn.active {
  border-color: #111;
  background: #111;
  color: #ffffff;
}

.mode-btn:hover:not(.active) {
  border-color: #111;
  color: #111;
}

/* ── Panel ── */
.panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel.hidden {
  display: none;
}

/* ── Instructions dropdown ── */
.instructions {
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 0;
  font-size: 14px;
}

.instructions summary {
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 500;
  color: #111;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.instructions summary::-webkit-details-marker {
  display: none;
}

.instructions summary::after {
  content: '+';
  font-size: 16px;
  color: #888;
}

.instructions[open] summary::after {
  content: '−';
}

.instructions ol {
  padding: 0 16px 16px 32px;
  color: #444;
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Dropzone ── */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px dashed #e5e5e5;
  border-radius: 12px;
  padding: 40px 24px;
  cursor: pointer;
  transition: border-color 0.15s;
  text-align: center;
}

.dropzone:hover {
  border-color: #111;
}

.dropzone input[type="file"] {
  display: none;
}

.dropzone-title {
  font-size: 15px;
  font-weight: 500;
  color: #111;
}

.dropzone .muted {
  font-size: 13px;
  color: #888;
}

/* ── File row ── */
.file-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
}

.file-row strong {
  font-size: 14px;
  color: #111;
  word-break: break-all;
}

/* ── Buttons ── */
.btn-primary {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  background: #111;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.85;
}

.btn-secondary {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  background: #ffffff;
  color: #111;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.btn-secondary:hover {
  border-color: #111;
}

/* ── Share box ── */
.share-box {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.share-code {
  font-size: 48px;
  font-weight: 600;
  letter-spacing: 8px;
  color: #111;
  text-align: center;
  padding: 24px;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
}

.share-link-row {
  display: flex;
  gap: 8px;
}

.share-link-input {
  flex: 1;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  color: #444;
  background: #fafafa;
  outline: none;
}

.status-text {
  font-size: 14px;
  color: #888;
  text-align: center;
}

/* ── Code input row ── */
.code-input-row {
  display: flex;
  gap: 8px;
}

.code-input {
  flex: 1;
  padding: 14px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 6px;
  text-align: center;
  font-family: inherit;
  border: 2px solid #e5e5e5;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
}

.code-input:focus {
  border-color: #111;
}

/* ── Progress ── */
.progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
  color: #111;
}

.progress-bar-track {
  width: 100%;
  height: 6px;
  background: #e5e5e5;
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: #111;
  border-radius: 99px;
  transition: width 0.2s ease;
}

.progress-stats {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #888;
}

/* ── Debug panel ── */
.debug {
  margin-top: 40px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 16px;
}

.debug-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.debug-head h2 {
  font-size: 14px;
  font-weight: 600;
  color: #111;
  margin: 0;
}

.debug dl {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 12px 0;
  font-size: 12px;
}

.debug dt {
  color: #888;
}

.debug dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.debug pre {
  max-height: 260px;
  overflow: auto;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 12px;
  background: #0f172a;
  color: #e5e7eb;
  font-size: 12px;
  line-height: 1.5;
}

/* ── Muted ── */
.muted {
  font-size: 13px;
  color: #888;
}

/* ── Hidden utility ── */
.hidden {
  display: none !important;
}

/* ── Mobile ── */
@media (max-width: 640px) {
  .shell {
    padding: 32px 16px 48px;
  }

  .share-code {
    font-size: 36px;
    letter-spacing: 6px;
  }

  .progress-stats {
    flex-wrap: wrap;
    gap: 6px;
  }
}
