:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --glass: rgba(255, 255, 255, 0.82);
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --border-hairline: rgba(0, 0, 0, 0.08);
  --apple-blue: #0071e3;
  --apple-blue-hover: #0077ed;
  --apple-green: #248a3d;
  --radius-card: 16px;
  --radius-pill: 999px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

.page-shell {
  max-width: 780px;
  margin: 0 auto;
  padding: 48px 24px 96px;
  transition: padding 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Distraction-free centered Input State */
.page-shell.state-input {
  min-height: 88vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero {
  text-align: center;
  margin-bottom: 32px;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-title {
  font-size: 2.3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.hero-subtitle {
  font-size: 1.02rem;
  color: var(--text-secondary);
  max-width: 580px;
  margin: 0 auto 30px;
  line-height: 1.48;
  font-weight: 400;
}

/* Centered Distraction-Free URL Input Bar */
.url-bar {
  display: flex;
  align-items: center;
  max-width: 640px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-card);
  padding: 7px 7px 7px 20px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}

.url-bar:focus-within {
  border-color: rgba(0, 113, 227, 0.5);
  box-shadow: 0 14px 38px rgba(0, 113, 227, 0.12);
}

.url-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.96rem;
  color: var(--text-primary);
  background: transparent;
  font-family: inherit;
}

.url-input::placeholder {
  color: #a1a1a6;
}

.btn-convert {
  background: var(--apple-blue);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 11px 24px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.btn-convert:hover {
  background: var(--apple-blue-hover);
}

.btn-convert:active {
  transform: scale(0.98);
}

/* Loading Card */
.loading-card {
  background: var(--surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-card);
  padding: 44px 24px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.94rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
  margin-top: 12px;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 2.5px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--apple-blue);
  border-radius: 50%;
  margin: 0 auto 14px;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Results View Smooth Transition */
.results-view {
  animation: fadeSlideUp 0.42s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Frosted Glass Action Bar */
.glass-dock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-card);
  padding: 10px 12px 10px 18px;
  margin-bottom: 22px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.06);
}

.stat-pill {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

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

.dock-btn {
  border-radius: 12px;
  padding: 9px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s ease;
}

.dock-btn-ghost {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

.dock-btn-ghost:hover {
  background: rgba(0, 0, 0, 0.09);
}

.dock-btn-primary {
  background: var(--apple-blue);
  color: #ffffff;
}

.dock-btn-primary:hover {
  background: var(--apple-blue-hover);
}

.dock-btn-dark {
  background: var(--text-primary);
  color: #ffffff;
}

.dock-btn-dark:hover {
  background: #333336;
}

.dock-btn.copied-state {
  background: var(--apple-green) !important;
  color: #ffffff !important;
}

/* Suggested Hook Card */
.hooks-card {
  background: var(--surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-card);
  padding: 26px 28px;
  margin-bottom: 24px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.04);
}

.hooks-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}

.hooks-title {
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.hooks-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* Apple Segmented Control */
.segmented-control {
  display: inline-flex;
  background: #f0f0f3;
  padding: 3px;
  border-radius: 11px;
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 9px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.18s ease;
}

.seg-btn.active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.hooks-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.hook-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  background: #fbfbfd;
  border: 1px solid var(--border-hairline);
  border-radius: 14px;
  padding: 18px 20px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.hook-item:hover {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.14);
}

.hook-content {
  flex: 1;
}

.hook-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--apple-blue);
  margin-bottom: 8px;
}

.hook-text {
  font-size: 0.94rem;
  line-height: 1.56;
  color: var(--text-primary);
  white-space: pre-line;
}

.hook-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-refresh-hook {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-primary);
  border: 1px solid var(--border-hairline);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-refresh-hook:hover {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.16);
}

.btn-refresh-hook:disabled {
  opacity: 0.6;
  cursor: wait;
}

.btn-refresh-hook svg {
  width: 14px;
  height: 14px;
  transition: transform 0.35s ease;
}

.btn-refresh-hook.spinning svg {
  animation: spin 0.7s linear infinite;
}

.btn-copy-hook {
  flex-shrink: 0;
  background: rgba(0, 113, 227, 0.08);
  color: var(--apple-blue);
  border: 1px solid rgba(0, 113, 227, 0.16);
  border-radius: 10px;
  padding: 7px 14px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-copy-hook:hover {
  background: var(--apple-blue);
  color: #ffffff;
}

.btn-copy-hook.copied-state {
  background: var(--apple-green) !important;
  border-color: var(--apple-green) !important;
  color: #ffffff !important;
}

/* Editorial Paper Card */
.paper-card {
  background: var(--surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-card);
  padding: 44px 48px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.04);
}

.preview-badge-row {
  margin-bottom: 14px;
}

.preview-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  background: #f5f5f7;
  padding: 4px 10px;
  border-radius: 8px;
}

.paper-header {
  border-bottom: 1px solid var(--border-hairline);
  padding-bottom: 24px;
  margin-bottom: 28px;
}

.art-title {
  font-size: 1.95rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.22;
  margin-bottom: 8px;
}

.art-subtitle {
  font-size: 1.08rem;
  color: var(--text-secondary);
  line-height: 1.45;
  font-weight: 400;
}

/* Formatted Body Typography */
.art-body h1 {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 34px 0 14px;
  color: var(--text-primary);
}

.art-body h2 {
  font-size: 1.34rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 30px 0 12px;
  color: var(--text-primary);
}

.art-body h3 {
  font-size: 1.12rem;
  font-weight: 600;
  margin: 24px 0 10px;
  color: var(--text-primary);
}

.art-body p {
  font-size: 1.01rem;
  line-height: 1.68;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.art-body a {
  color: var(--apple-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.art-body code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: #f5f5f7;
  padding: 2px 6px;
  border-radius: 5px;
}

.art-body blockquote {
  border-left: 3px solid var(--text-primary);
  padding: 4px 0 4px 18px;
  margin: 20px 0;
  color: var(--text-secondary);
  font-size: 1.02rem;
  font-style: italic;
}

.art-body ul,
.art-body ol {
  padding-left: 24px;
  margin-bottom: 18px;
}

.art-body li {
  font-size: 1.01rem;
  line-height: 1.65;
  margin-bottom: 8px;
}

/* Paired Media + Captions with Modern Minimalist Icon Buttons */
.media-figure {
  margin: 26px 0 8px;
  position: relative;
}

.media-frame {
  position: relative;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: #f5f5f7;
  border: 1px solid var(--border-hairline);
}

.media-img,
.media-video {
  display: block;
  width: 100%;
  height: auto;
}

.media-video {
  background: #000000;
}

.media-overlay-bar {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 5;
}

.media-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(29, 29, 31, 0.72);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  cursor: pointer;
  text-decoration: none;
  opacity: 0.86;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  transition: opacity 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.media-icon-btn:hover {
  opacity: 1;
  background: rgba(29, 29, 31, 0.92);
  transform: translateY(-1px);
}

.media-icon-btn:active {
  transform: scale(0.95);
}

.media-icon-btn.copied-state {
  background: var(--apple-green) !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
  opacity: 1;
}

.media-icon-btn svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.media-caption {
  margin-top: 8px;
  margin-bottom: 22px;
  text-align: center;
  font-size: 0.86rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.45;
}

/* Apple Pill Toast */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(29, 29, 31, 0.92);
  backdrop-filter: blur(16px);
  color: #ffffff;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  font-size: 0.86rem;
  font-weight: 500;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  z-index: 100;
}

.hidden {
  display: none !important;
}

@media (max-width: 640px) {
  .paper-card {
    padding: 28px 20px;
  }
  .hooks-card {
    padding: 20px;
  }
  .hook-item {
    flex-direction: column;
  }
}
