:root {
  --bg: #060816;
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #e7ebff;
  --muted: #adb6da;
  --accent: #7c8cff;
  --accent-hover: #6a7aef;
  --accent-2: #42d7ff;
  --filter-active-bg: rgba(124, 140, 255, 0.22);
  --filter-active-border: rgba(124, 140, 255, 0.85);
  --ok: #1ecf9a;
  --danger: #ff6f91;
  --hero-grad-1: #202d6b;
  --hero-grad-2: #1e4e72;
  --soft-bg: rgba(255, 255, 255, 0.04);
  --soft-bg-strong: rgba(255, 255, 255, 0.08);
  --footer-bg: rgba(4, 8, 24, 0.8);
  --iap-bg: linear-gradient(135deg, #1a1f35 0%, #15192a 50%, #12162a 100%);
  --iap-coral: rgba(124, 140, 255, 0.22);
  --cta-shadow: 0 4px 14px rgba(124, 140, 255, 0.28);
  --select-bg: linear-gradient(135deg, rgba(124, 140, 255, 0.22), rgba(66, 215, 255, 0.16));
}

[data-theme="light"] {
  --bg: #f3f6ff;
  --panel-border: rgba(39, 57, 118, 0.18);
  --text: #142041;
  --muted: #4b5f8f;
  --accent: #576bff;
  --accent-hover: #4a5eef;
  --accent-2: #20a6d6;
  --filter-active-bg: rgba(87, 107, 255, 0.18);
  --filter-active-border: rgba(87, 107, 255, 0.85);
  --ok: #148662;
  --danger: #d44668;
  --hero-grad-1: #c7d7ff;
  --hero-grad-2: #bdefff;
  --soft-bg: rgba(255, 255, 255, 0.75);
  --soft-bg-strong: rgba(255, 255, 255, 0.9);
  --footer-bg: rgba(243, 246, 255, 0.95);
  --iap-bg: linear-gradient(120deg, #eef2ff 0%, #e8f8ff 45%, #f0f4ff 100%);
  --iap-coral: rgba(87, 107, 255, 0.2);
  --cta-shadow: 0 6px 18px rgba(87, 107, 255, 0.22);
  --select-bg: linear-gradient(135deg, rgba(87, 107, 255, 0.14), rgba(32, 166, 214, 0.14));
}

[data-theme="dark"] body {
  background:
    radial-gradient(circle at 12% 14%, rgba(187, 162, 255, 0.2) 0%, transparent 35%),
    radial-gradient(circle at 86% 10%, rgba(151, 137, 255, 0.18) 0%, transparent 38%),
    radial-gradient(circle at 48% 88%, rgba(78, 84, 112, 0.26) 0%, transparent 45%),
    var(--bg);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background: radial-gradient(circle at 15% 20%, var(--hero-grad-1) 0%, transparent 42%),
    radial-gradient(circle at 82% 8%, var(--hero-grad-2) 0%, transparent 38%), var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.25s ease, color 0.25s ease;
  line-height: 1.5;
}

.background-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(124, 140, 255, 0.08), rgba(66, 215, 255, 0.05));
}

.app-shell {
  max-width: min(98vw, 1800px);
  margin: 0 auto;
  padding: 26px;
  position: relative;
  z-index: 1;
}

.premium-image-badge {
  position: fixed;
  top: 12px;
  left: 12px;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 34px;
  background: linear-gradient(135deg, #ffda6f, #ffc54a);
  box-shadow: 0 10px 28px rgba(255, 197, 74, 0.35);
  z-index: 70;
}

.view.hidden,
.view[hidden] {
  display: none !important;
}

.tool-page-bar {
  margin-bottom: 18px;
}

.back-btn {
  font-weight: 600;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  min-height: 64px;
}

.topbar-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-transform: none;
}

.brand-logo-wrap {
  position: relative;
  display: inline-flex;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

.brand-crown {
  position: absolute;
  right: -6px;
  top: -6px;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: linear-gradient(135deg, #ffcc61, #ff9d1f);
  box-shadow: 0 6px 14px rgba(255, 157, 31, 0.35);
  font-size: 11px;
  line-height: 1;
  flex-shrink: 0;
}

.top-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.language-select {
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--select-bg);
  color: var(--text);
  padding: 10px 40px 10px 12px;
  font: inherit;
  min-width: 120px;
  max-width: 170px;
  width: auto;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text) 50%),
    linear-gradient(135deg, var(--text) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.filter-btn {
  background: var(--soft-bg);
  color: var(--text);
  border: 1px solid var(--panel-border);
  padding: 11px 14px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.filter-btn:hover {
  border-color: var(--filter-active-border);
  background: var(--filter-active-bg);
  box-shadow: 0 2px 10px rgba(124, 140, 255, 0.12);
}

.filter-btn.active {
  border-color: rgba(124, 140, 255, 0.85);
  background: rgba(124, 140, 255, 0.22);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(124, 140, 255, 0.25);
}

.hero {
  margin-bottom: 24px;
  text-align: center;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.hero-top > div {
  width: 100%;
  max-width: 980px;
  margin-inline: auto;
  text-align: center;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 2.8vw, 2.9rem);
  font-family: Arial, sans-serif;
}

.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 820px;
  margin-inline: auto;
  font-family: Arial, sans-serif;
}

.hero-pills {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-pills span {
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--muted);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.hero-pills span:hover {
  border-color: var(--filter-active-border);
  color: var(--text);
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}

.tool-list-panel,
.card {
  background: linear-gradient(155deg, var(--soft-bg), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  backdrop-filter: blur(10px);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.tool-list-panel {
  padding: 24px;
}

.tools-head {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}

.filter-row {
  width: min(100%, 720px);
  display: grid;
  grid-template-columns: minmax(260px, 420px) 220px;
  gap: 12px;
}

.tools-head h2 {
  margin: 0;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
  align-items: stretch;
}

.tool-search {
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: var(--soft-bg);
  color: var(--text);
  font: inherit;
  padding: 12px 14px;
}

.tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  height: 150px;
  min-height: 150px;
  min-width: 150px;
  border: 1px solid var(--panel-border);
  border-radius: 15px;
  padding: 10px 8px;
  background: var(--soft-bg);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.18s ease, box-shadow 0.2s ease;
  font-weight: 600;
  font-size: 12px;
  line-height: 1.3;
  text-align: center;
}

.tool-icon {
  font-size: 1.5rem;
  width: 32px;
  text-align: center;
  flex-shrink: 0;
}

.tool-name {
  flex: 1;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tool-desc {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}

.tool-btn:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 1px;
}

.tool-btn:hover,
.tool-btn.active {
  border-color: rgba(124, 140, 255, 0.8);
  background: rgba(124, 140, 255, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(124, 140, 255, 0.15);
}

.card:hover,
.feature-card:hover,
.step-card:hover,
.related-tool:hover,
.faq-item:hover,
.iap-banner:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
}

.tool-workspace {
  display: grid;
  gap: 18px;
}

.card {
  padding: 26px;
}

.workspace-main-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.download-card {
  background: linear-gradient(120deg, rgba(86, 107, 255, 0.25), rgba(32, 166, 214, 0.2));
  width: 100%;
  min-height: 360px;
  border-radius: 26px;
}

.converter-card {
  width: 100%;
  min-height: 360px;
  border-radius: 26px;
}

.converter-card .card-head h2,
.download-card h3 {
  font-size: 1.35rem;
}

.info-section {
  background: linear-gradient(155deg, var(--soft-bg), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 20px;
  margin-top: 18px;
}

.info-section h2 {
  margin: 0 0 14px;
}

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

.feature-card {
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.feature-card h3 {
  margin: 0 0 6px;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.step-card {
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.faq-item {
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
}

.faq-item p {
  margin: 8px 0 0;
  color: var(--muted);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.related-tool {
  border: 1px solid var(--panel-border);
  background: var(--soft-bg);
  color: var(--text);
  border-radius: 12px;
  padding: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.related-tool:hover {
  border-color: var(--filter-active-border);
  background: var(--filter-active-bg);
}

.rating-strip {
  max-width: min(98vw, 1800px);
  margin: 18px auto 0;
}

.rating-dialog {
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 18px;
  background: linear-gradient(155deg, var(--soft-bg), rgba(255, 255, 255, 0.03));
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 8px;
}

.rating-dialog h3,
.rating-dialog p {
  margin: 0;
}

.rating-dialog__stars {
  font-size: 1.5rem;
  letter-spacing: 6px;
  color: #ffcc66;
  text-shadow: 0 0 10px rgba(255, 204, 102, 0.3);
}

.rating-dialog p {
  margin-top: 2px;
  color: var(--muted);
}

.download-card h3 {
  margin: 0 0 8px;
}

.download-card p {
  margin: 0 0 12px;
  color: var(--muted);
}

.card-head h2 {
  margin: 0 0 6px;
}

.card-head p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 1.02rem;
}

.field-group {
  margin-bottom: 16px;
}

label {
  display: block;
  margin-bottom: 9px;
  font-weight: 600;
  font-size: 1.03rem;
}

input[type="file"],
textarea {
  width: 100%;
  border: 1px solid var(--panel-border);
  background: var(--soft-bg);
  color: var(--text);
  border-radius: 14px;
  padding: 14px;
  font: inherit;
  min-height: 52px;
}

input[type="file"] {
  padding: 10px;
}

input[type="file"]::file-selector-button {
  border: 1px solid rgba(124, 140, 255, 0.5);
  border-radius: 10px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #07111f;
  padding: 8px 12px;
  margin-right: 10px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.15s ease;
}

input[type="file"]::file-selector-button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.selected-file-row {
  margin-top: 10px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.selected-file-name {
  font-size: 0.92rem;
  color: var(--text);
}

.selected-file-actions {
  display: inline-flex;
  gap: 8px;
}

.selected-file-actions .ghost-btn {
  padding: 7px 10px;
  border-radius: 10px;
}

textarea {
  resize: vertical;
}

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

button {
  border: 0;
  border-radius: 14px;
  padding: 13px 16px;
  font: inherit;
  cursor: pointer;
}

.cta-btn {
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.primary-btn {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #07111f;
  font-weight: 700;
  box-shadow: var(--cta-shadow);
}

.primary-btn:hover:not(:disabled) {
  background: linear-gradient(120deg, var(--accent-hover), #38c8ef);
  filter: brightness(1.05);
  box-shadow: 0 8px 22px rgba(124, 140, 255, 0.38);
  transform: translateY(-1px);
}

.primary-btn:active:not(:disabled) {
  transform: translateY(0);
}

.ghost-btn {
  background: var(--soft-bg-strong);
  color: var(--text);
  border: 1px solid var(--panel-border);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.ghost-btn:hover {
  border-color: rgba(124, 140, 255, 0.65);
  background: rgba(124, 140, 255, 0.12);
}

.theme-toggle {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.theme-toggle__track {
  width: 56px;
  height: 26px;
  border-radius: 999px;
  padding: 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #f2f2f2, #e4e4e4);
  box-shadow: inset 0 0 0 1px rgba(16, 16, 16, 0.08);
}

.theme-toggle__sun {
  font-size: 12px;
  margin-left: 6px;
  color: #9a9a9a;
}

.theme-toggle__knob {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #2f2f2f;
  color: #fff;
  transform: translateX(0);
  transition: transform 0.2s ease, background 0.2s ease;
}

.theme-toggle__moon {
  font-size: 11px;
  line-height: 1;
}

[data-theme="light"] .theme-toggle__track {
  background: linear-gradient(135deg, #23252f, #171821);
}

[data-theme="light"] .theme-toggle__sun {
  color: #f7f7f7;
}

[data-theme="light"] .theme-toggle__knob {
  transform: translateX(-30px);
  background: #f4f4f4;
  color: #2f2f2f;
}

.iap-banner {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(180px, 0.9fr);
  gap: 20px;
  align-items: center;
  padding: 22px 24px;
  border-radius: 22px;
  border: 1px solid var(--panel-border);
  background: var(--iap-bg);
  overflow: hidden;
  position: relative;
}

.iap-banner__text h3 {
  margin: 0 0 12px;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.premium-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #07111f;
  background: linear-gradient(120deg, #ffda6f, #ffd24a);
  border: 1px solid rgba(255, 210, 74, 0.7);
  box-shadow: 0 4px 12px rgba(255, 210, 74, 0.3);
  gap: 6px;
}

.premium-tag--top {
  position: absolute;
  top: 22px;
  left: 24px;
  z-index: 82;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  margin: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: inherit;
  pointer-events: none;
}

.premium-tag--top:not(.hidden) + .topbar .brand {
  padding-left: 215px;
}

.premium-badge-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  font-size: 24px;
  line-height: 1;
  color: #fff;
  background: linear-gradient(180deg, #ffae47, #ff8509);
  box-shadow: 0 8px 18px rgba(255, 133, 9, 0.45);
}

.premium-badge-text {
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #f5f6ff;
  white-space: nowrap;
}

.iap-banner__list {
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.iap-banner__list li {
  position: relative;
  padding-left: 26px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.iap-banner__list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(46, 204, 113, 0.2);
  color: var(--ok);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.iap-plan-line {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
}

.iap-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #07111f;
  font-weight: 800;
  font-size: 1rem;
  border: none;
  box-shadow: var(--cta-shadow);
}

.iap-cta:hover:not(:disabled) {
  background: linear-gradient(120deg, var(--accent-hover), #38c8ef);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(124, 140, 255, 0.4);
}

.iap-cta:active:not(:disabled) {
  transform: translateY(0);
}

.iap-cta:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.iap-cta__icon {
  font-size: 1.1rem;
  line-height: 1;
}

.iap-banner__visual {
  position: relative;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.iap-banner__coral {
  position: absolute;
  inset: 8px;
  border-radius: 20px;
  background: var(--iap-coral);
  border: 2px solid rgba(124, 140, 255, 0.35);
  transform: rotate(-2deg);
}

.iap-banner__doc {
  position: relative;
  z-index: 1;
  width: min(100%, 200px);
  background: var(--soft-bg-strong);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--panel-border);
}

[data-theme="light"] .iap-banner__doc {
  background: #fff;
}

.iap-banner__doc-line {
  display: block;
  height: 3px;
  border-radius: 2px;
  background: var(--accent-2);
  margin-bottom: 10px;
}

.iap-banner__doc-block {
  height: 48px;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(124, 140, 255, 0.28), rgba(66, 215, 255, 0.22));
  margin-bottom: 8px;
}

.iap-banner__doc-block--sm {
  height: 22px;
  width: 70%;
  opacity: 0.85;
}

.iap-banner__spark {
  position: absolute;
  right: 12%;
  bottom: 18%;
  z-index: 2;
  color: var(--accent-2);
  font-size: 1.4rem;
  text-shadow: 0 0 12px rgba(66, 215, 255, 0.45);
}

.status-card h3 {
  margin: 0 0 12px;
}

.status {
  color: var(--ok);
  min-height: 34px;
  line-height: 1.4;
  font-size: 1.02rem;
}

.status-meter {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-bottom: 10px;
  position: relative;
}

.status-meter__fill {
  height: 100%;
  width: 12%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px;
  transition: width 0.22s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 14px rgba(66, 215, 255, 0.35);
}

.status-meter__fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.35) 50%, transparent 100%);
  transform: translateX(-100%);
  animation: meter-shimmer 1.6s infinite;
}

@keyframes meter-shimmer {
  to {
    transform: translateX(100%);
  }
}

.status.busy {
  color: var(--accent-2);
}

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

.hidden {
  display: none;
}

.is-busy .primary-btn {
  opacity: 0.7;
  cursor: not-allowed;
}

.file-helper {
  display: inline-block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.sort-filter {
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: var(--select-bg);
  color: var(--text);
  padding: 12px 40px 12px 12px;
  font: inherit;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text) 50%),
    linear-gradient(135deg, var(--text) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.sort-filter option,
.language-select option {
  background: #111a38;
  color: #dfe7ff;
}

[data-theme="light"] .sort-filter option,
[data-theme="light"] .language-select option {
  background: #eef2ff;
  color: #1a2b5c;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(92vw, 360px);
  background: rgba(11, 20, 44, 0.92);
  border: 1px solid rgba(255, 111, 145, 0.45);
  color: #ffe6ec;
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 40;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  border-color: rgba(30, 207, 154, 0.52);
  color: #d9fff2;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.auth-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 24, 0.68);
}

.auth-modal__dialog {
  position: relative;
  width: min(92vw, 460px);
  min-height: 520px;
  max-height: min(84vh, 620px);
  margin: 6vh auto 0;
  border-radius: 20px;
  border: 1px solid var(--panel-border);
  background: linear-gradient(160deg, var(--soft-bg-strong), rgba(255, 255, 255, 0.04));
  backdrop-filter: blur(12px);
  padding: 22px;
  overflow: hidden;
}

.auth-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.auth-head h3 {
  margin: 0;
}

.auth-close-btn {
  padding: 8px 12px;
}

.auth-close-icon {
  border: 1px solid var(--panel-border);
  background: var(--soft-bg);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  font-size: 1.4rem;
  line-height: 1;
  padding: 0;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}

.auth-close-icon:hover {
  transform: translateY(-1px) scale(1.02);
  border-color: rgba(124, 140, 255, 0.8);
  background: rgba(124, 140, 255, 0.16);
}

.premium-dialog-content {
  display: grid;
  gap: 12px;
}

.premium-dialog-title {
  margin: 0;
  text-align: center;
  font-size: 2rem;
  line-height: 1.1;
}

.premium-dialog-subtitle {
  margin: 0;
  text-align: center;
  color: var(--muted);
}

.premium-dialog-list {
  margin: 0;
}

.premium-benefits-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.premium-benefit-card {
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.premium-benefit-card h5 {
  margin: 0 0 5px;
  font-size: 0.98rem;
}

.premium-benefit-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.pill-filter {
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.pill-filter:hover {
  border-color: var(--filter-active-border);
}

.pill-filter.active {
  color: var(--text);
  border-color: rgba(124, 140, 255, 0.85);
  background: rgba(124, 140, 255, 0.18);
}

.site-footer {
  margin-top: 18px;
  background: var(--footer-bg);
  border-top: 1px solid var(--panel-border);
  position: relative;
  z-index: 1;
}

.footer-grid {
  max-width: min(98vw, 1800px);
  margin: 0 auto;
  padding: 20px 22px 24px;
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px;
}

.footer-col h4 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.footer-col a {
  display: block;
  text-decoration: none;
  color: var(--muted);
  margin-bottom: 5px;
  font-size: 0.88rem;
}

.footer-col a:hover {
  color: var(--text);
}

.footer-copyline {
  border-top: 1px solid var(--panel-border);
  text-align: center;
  padding: 10px 14px 12px;
  color: var(--muted);
  font-size: 0.84rem;
}

@media (max-width: 1199px) {
  .tool-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

@media (max-width: 960px) {
  .topbar {
    align-items: stretch;
    gap: 10px;
  }

  .brand {
  width: auto;
  }

  .language-select {
    min-width: 110px;
    max-width: 150px;
  }

  .topbar-controls {
    width: auto;
    justify-content: flex-end;
  }

  .top-links {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .hero-top {
    flex-direction: column;
    align-items: center;
  }

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

  .workspace-main-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .sort-filter {
    width: 100%;
  }

  .feature-grid,
  .related-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .steps-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-grid {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    padding: 24px 18px 28px;
    gap: 18px;
  }

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

  .iap-banner__visual {
    min-height: 100px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 16px;
  }

  .brand {
    font-size: 22px;
  }

  .premium-image-badge {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    font-size: 28px;
  }

  .topbar {
    gap: 8px;
  }

  .premium-tag--top {
    top: 16px;
    left: 16px;
    gap: 6px;
    padding: 2px 6px;
  }

  .premium-tag--top:not(.hidden) + .topbar .brand {
    padding-left: 0;
  }

  .premium-badge-text {
    display: none;
  }

  .language-select {
    min-width: 98px;
    max-width: 130px;
    padding: 9px 30px 9px 9px;
  }

  .sort-filter {
    padding: 10px 34px 10px 10px;
  }

  .theme-toggle__track {
    width: 50px;
    height: 24px;
  }

  .theme-toggle__knob {
    width: 18px;
    height: 18px;
  }

  [data-theme="light"] .theme-toggle__knob {
    transform: translateX(-26px);
  }

  .premium-dialog-title {
    font-size: 1.6rem;
  }

  .premium-benefits-grid {
    grid-template-columns: 1fr;
  }

  .card,
  .tool-list-panel {
    padding: 18px;
    border-radius: 18px;
  }

  .tool-btn {
    height: auto;
    min-height: 130px;
    min-width: 0;
  }

  .feature-grid,
  .steps-grid,
  .related-grid {
    grid-template-columns: 1fr;
  }

  .workspace-main-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .converter-card,
  .download-card {
    width: 100%;
    height: auto;
    min-height: 250px;
    border-radius: 18px;
  }

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

@media (max-width: 430px) {
  .topbar {
    justify-content: space-between;
  }

  .topbar-controls {
    gap: 6px;
  }

  .language-select {
    min-width: 92px;
    max-width: 118px;
    font-size: 0.9rem;
  }

  .top-links {
    gap: 8px;
  }

  .filter-btn {
    padding: 9px 11px;
    font-size: 0.95rem;
  }

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