:root {
  --bg-page: #0b0d13;
  --bg-card: #131722;
  --bg-card-hover: #171c2a;
  --bg-subtle: #0f131c;
  --bg-inset: #080a0f;
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);
  --border-focus: #3b82f6;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-glow: rgba(37, 99, 235, 0.25);
  --green: #10b981;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ============================================================
   Header & Navigation (Fluid, High-End Modern Studio Layout)
   ============================================================ */
.header {
  border-bottom: 1px solid var(--border);
  background: rgba(11, 13, 19, 0.95);
  backdrop-filter: blur(16px);
  padding: 0.7rem 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: #fff;
  flex-shrink: 0;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: #1d9bf0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(29, 155, 240, 0.35);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-nav-links {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* Polished Dark Select Dropdown (Appearance Reset for Windows/Chrome) */
.lang-selector-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.lang-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: #141722 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2394a3b8' d='M1 1l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f1f5f9;
  height: 34px;
  padding: 0 28px 0 10px;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.lang-select:hover {
  background-color: #1a202c;
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.lang-select option {
  background: #141722;
  color: #f1f5f9;
  padding: 6px;
}

.header-nav-links a {
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 500;
  text-decoration: none;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.header-nav-links a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

/* ============================================================
   Main Hero Section
   ============================================================ */
.main {
  padding: 3rem 0 3.5rem;
  flex: 1;
}

.title-area {
  text-align: center;
  margin-bottom: 2rem;
}

.title-area h1 {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 1.25;
  margin-bottom: 0.65rem;
}

.title-area p {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 520px;
  margin: 0 auto;
}

/* ============================================================
   Platform Selection Tabs (Directly above input box)
   ============================================================ */
.platform-tabs-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.platform-tabs {
  display: inline-flex;
  background: #141722;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 4px;
  gap: 3px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.p-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 1.15rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 999px;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.p-tab:hover:not(.active) {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.p-tab.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* ============================================================
   Downloader Input Box
   ============================================================ */
.input-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
}

.input-form {
  display: flex;
  gap: 0.65rem;
}

.input-box-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.url-input {
  width: 100%;
  height: 50px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 4.8rem 0 1.15rem;
  font-size: 16px; /* Lock 16px to prevent iOS Safari auto-zoom */
  color: var(--text-main);
  outline: none;
  transition: all 0.15s ease;
}

.url-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.url-input::placeholder {
  color: var(--text-subtle);
  font-size: 0.9rem;
}

.btn-paste {
  position: absolute;
  right: 8px;
  height: 34px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-paste:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-submit {
  height: 50px;
  padding: 0 1.8rem;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  white-space: nowrap;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-submit:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.btn-submit:active {
  transform: translateY(0);
}

.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.quick-hints {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.1rem;
  font-size: 0.82rem;
  color: var(--text-subtle);
  flex-wrap: wrap;
}

.quick-hints span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* ============================================================
   Loading Status Box
   ============================================================ */
.status-box {
  margin-top: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: none;
  text-align: center;
}

.loading-bar {
  height: 3px;
  width: 100%;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.8rem;
}

.loading-line {
  height: 100%;
  width: 40%;
  background: var(--primary);
  border-radius: 999px;
  animation: moveBar 1.2s infinite ease-in-out;
}

@keyframes moveBar {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(100%); width: 60%; }
  100% { transform: translateX(250%); }
}

/* ============================================================
   Result Card
   ============================================================ */
.result-box {
  margin-top: 1.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: none;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.tweet-info {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 0.85rem;
  align-items: center;
  background: rgba(255, 255, 255, 0.015);
  position: relative;
}

.tweet-header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.btn-tweet-action {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.28rem 0.6rem;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
}

.btn-tweet-action:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* Bulk ZIP Download Bar */
.zip-download-bar {
  margin: 0.85rem 1.25rem 0.25rem;
  padding: 0.85rem 1rem;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.zip-bar-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.zip-bar-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.zip-bar-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.btn-zip-download {
  height: 36px;
  padding: 0 1.1rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.btn-zip-download:hover:not(:disabled) {
  background: #1d4ed8;
}

.btn-zip-download:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tweet-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-inset);
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.tweet-meta {
  overflow: hidden;
}

.tweet-name {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}

.tweet-handle {
  font-size: 0.8rem;
  color: var(--text-subtle);
}

.tweet-content {
  padding: 1.1rem 1.25rem;
  font-size: 0.92rem;
  color: var(--text-main);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  line-height: 1.55;
  word-break: break-word;
}

/* Format Selector Tabs (Pill style) */
.format-selector {
  display: flex;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
  margin: 1.1rem 1.25rem 0.5rem;
}

.format-tab {
  flex: 1;
  padding: 0.55rem 0.5rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 7px;
  cursor: pointer;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.format-tab:hover:not(.active) {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.format-tab.active {
  color: #fff;
  background: var(--primary);
  font-weight: 600;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* Downloads List */
.downloads-list {
  padding: 0.8rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.download-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  gap: 0.8rem;
  transition: all 0.15s ease;
}

.download-item:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.item-left {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.item-title {
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag-badge {
  font-size: 0.72rem;
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.25);
  padding: 0.15rem 0.5rem;
  border-radius: 5px;
  font-weight: 600;
}

.tag-hd {
  font-size: 0.7rem;
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 700;
}

.item-desc {
  font-size: 0.78rem;
  color: var(--text-subtle);
}

.btn-action {
  height: 38px;
  padding: 0 1.2rem;
  background: var(--primary);
  border: none;
  border-radius: 7px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.btn-action:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-action:active {
  transform: translateY(0);
}

.btn-action.audio-btn {
  background: #059669;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
}

.btn-action.audio-btn:hover {
  background: #047857;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
}

/* ============================================================
   GIF & Frame Tool Panel
   ============================================================ */
.tool-panel {
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tool-panel-header h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.2rem;
}

.tool-panel-header p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.preview-video-container {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.preview-video {
  width: 100%;
  max-height: 240px;
  background: #000;
  display: block;
  object-fit: contain;
}

.timeline-controller {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.timeline-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.timeline-label {
  color: var(--text-muted);
}

.timeline-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  background: var(--bg-inset);
  border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  border-radius: 5px;
}

.range-slider {
  width: 100%;
  height: 6px;
  background: var(--bg-inset);
  border-radius: 999px;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3b82f6;
  border: 2px solid #fff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.tool-actions {
  display: flex;
  gap: 0.6rem;
}

.btn-tool {
  flex: 1;
  height: 38px;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

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

.btn-gif {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.12);
}

.btn-gif:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-frame {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border-color: rgba(255, 255, 255, 0.08);
}

.btn-frame:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.gif-result-box {
  margin-top: 0.5rem;
  padding: 1.1rem;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  display: none;
}

.gif-preview-img {
  max-width: 100%;
  max-height: 220px;
  border-radius: var(--radius-sm);
  margin-bottom: 0.85rem;
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* ============================================================
   History Drawer (Browser LocalStorage Suite)
   ============================================================ */
.btn-history-trigger {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #141722;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f1f5f9;
  padding: 0 0.85rem;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.btn-history-trigger:hover {
  background-color: #1a202c;
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.history-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 420px;
  background: #0e111a;
  border-left: 1px solid var(--border);
  z-index: 100;
  display: none;
  flex-direction: column;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.6);
}

.history-drawer.open {
  display: flex !important;
}

.drawer-header {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
}

.drawer-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.drawer-actions-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-clear-history {
  background: transparent;
  border: none;
  color: var(--text-subtle);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: color 0.15s;
}

.btn-clear-history:hover {
  color: #f87171;
}

.btn-close-drawer {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-close-drawer:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.empty-history {
  margin: auto;
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-subtle);
}

.empty-history-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 0.75rem;
  color: var(--text-subtle);
  opacity: 0.5;
}

.empty-history p {
  font-size: 0.85rem;
  line-height: 1.5;
}

.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  transition: border-color 0.15s;
  position: relative;
}

.history-item:hover {
  border-color: var(--border-hover);
}

.history-thumb {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.history-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.history-author {
  font-size: 0.78rem;
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.history-text {
  font-size: 0.82rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.history-time {
  font-size: 0.72rem;
  color: var(--text-subtle);
}

.history-item-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.btn-history-reopen {
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-history-reopen:hover {
  background: var(--primary-hover);
}

.btn-history-del {
  padding: 0.25rem 0.45rem;
  font-size: 0.72rem;
  background: transparent;
  color: var(--text-subtle);
  border: none;
  cursor: pointer;
}

.btn-history-del:hover {
  color: #f87171;
}

/* ============================================================
   Simple How-To Guide
   ============================================================ */
.simple-guide {
  margin-top: 3.5rem;
  border-top: 1px solid var(--border);
  padding-top: 2.5rem;
}

.simple-guide h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--text-main);
}

.steps-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.step-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: border-color 0.15s;
}

.step-item:hover {
  border-color: var(--border-hover);
}

.step-num {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.4rem;
  letter-spacing: 0.05em;
}

.step-item h3 {
  font-size: 0.98rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: #fff;
}

.step-item p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ============================================================
   Footer: Enterprise-Grade Clean Layout (Houses all SEO links)
   ============================================================ */
.footer {
  border-top: 1px solid var(--border);
  padding: 3.5rem 0 2rem;
  background: #080a0f;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2.5rem;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.footer-desc {
  font-size: 0.82rem;
  color: var(--text-subtle);
  line-height: 1.55;
  max-width: 260px;
}

.footer-col h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
  margin-bottom: 0.2rem;
}

.footer-col a {
  color: var(--text-muted);
  font-size: 0.82rem;
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-col a:hover {
  color: #fff;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-subtle);
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ============================================================
   Modal (Countdown Waiting)
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.modal-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1.1rem;
}

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

.modal-box h3 {
  font-size: 1.15rem;
  margin-bottom: 0.4rem;
  color: #fff;
}

.modal-box p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ============================================================
   Mobile Queries (< 640px)
   ============================================================ */
@media (max-width: 640px) {
  .container {
    padding: 0 0.9rem;
  }

  .header-container {
    padding: 0 0.9rem;
  }

  /* Keep mobile header razor-sharp: logo on left, language & history on right */
  .header-nav-links {
    gap: 0.4rem;
  }

  .header-nav-links a {
    display: none; /* Secondary links stay in footer */
  }

  .lang-select {
    height: 32px;
    font-size: 0.74rem;
    padding: 0 24px 0 7px;
  }

  .btn-history-trigger {
    height: 32px;
    font-size: 0.74rem;
    padding: 0 0.6rem;
  }

  .platform-tabs {
    padding: 3px;
    gap: 2px;
  }

  .p-tab {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    gap: 0.3rem;
  }

  .history-drawer {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 100%;
    max-height: 82vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    display: none;
  }

  .history-drawer.open {
    display: flex !important;
  }

  .main {
    padding: 2rem 0 2.5rem;
  }

  .title-area h1 {
    font-size: 1.6rem;
  }

  .input-card {
    padding: 1rem;
  }

  .input-form {
    flex-direction: column;
    gap: 0.6rem;
  }

  .url-input {
    height: 48px;
    padding: 0 4.2rem 0 0.95rem;
  }

  .btn-submit {
    height: 48px;
    width: 100%;
  }

  .quick-hints {
    gap: 0.85rem;
    font-size: 0.78rem;
  }

  .format-selector {
    margin: 1rem 0.85rem 0.5rem;
    gap: 2px;
    padding: 3px;
  }

  .format-tab {
    padding: 0.5rem 0.25rem;
    font-size: 0.75rem;
  }

  .downloads-list {
    padding: 0.65rem 0.85rem 1rem;
  }

  .download-item {
    padding: 0.75rem 0.9rem;
  }

  .tool-actions {
    flex-direction: column;
  }

  .btn-tool {
    width: 100%;
  }

  .steps-list {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .step-item {
    padding: 1rem;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }

  .footer-col:first-child {
    grid-column: span 2;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
  }
}
