:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --color-bg: #f7f8fc;
  --color-surface: #ffffff;
  --color-surface-alt: #f1f2f9;
  --color-border: #e6e8f0;
  --color-text: #14162b;
  --color-text-muted: #656a83;

  --color-primary: #5b4cf5;
  --color-primary-dark: #4735e0;
  --color-primary-light: #7c6ff8;
  --color-accent-soft: #eeecfe;
  --gradient-primary: linear-gradient(135deg, #6a5bf7 0%, #9b6ef3 100%);
  --gradient-text: linear-gradient(135deg, #5b4cf5 0%, #b060ea 100%);

  --color-success: #12a878;
  --color-success-soft: #e5f8f1;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-xs: 0 1px 2px rgba(20, 22, 43, 0.05);
  --shadow-sm: 0 2px 8px rgba(20, 22, 43, 0.06);
  --shadow-md: 0 8px 24px rgba(20, 22, 43, 0.08);
  --shadow-lg: 0 20px 48px rgba(20, 22, 43, 0.14);

  --max-width: 1140px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0f1020;
    --color-surface: #171933;
    --color-surface-alt: #1e2140;
    --color-border: #2c2f52;
    --color-text: #edeefb;
    --color-text-muted: #9a9fc4;
    --color-accent-soft: #232653;
    --color-success-soft: #123328;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 24px 56px rgba(0, 0, 0, 0.45);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-dark); }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ============ Header ============ */
.site-header {
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text);
}
.logo:hover { color: var(--color-text); }
.logo img {
  border-radius: 8px;
  box-shadow: var(--shadow-xs);
}
.logo strong { color: var(--color-primary); font-weight: 800; }
.main-nav { display: flex; gap: 8px; }
.main-nav a {
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, color 0.15s ease;
}
.main-nav a:hover {
  color: var(--color-primary);
  background: var(--color-accent-soft);
}
@media (max-width: 640px) {
  .main-nav { display: none; }
}

/* ============ Ad slots ============ */
.ad-slot {
  position: relative;
  margin: 28px auto;
  text-align: center;
  min-height: 90px;
  background: var(--color-surface-alt);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px;
}
.ad-label {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 3px 10px;
  margin-bottom: 8px;
}
.ad-slot--sidebar { margin: 0; }
.ad-slot--leaderboard { max-width: var(--max-width); }

/* ============ Hero ============ */
.hero {
  position: relative;
  text-align: center;
  padding: 72px 20px 32px;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 420px;
  background:
    radial-gradient(closest-side, rgba(91, 76, 245, 0.16), transparent),
    radial-gradient(closest-side at 80% 20%, rgba(176, 96, 234, 0.14), transparent);
  z-index: -1;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--color-accent-soft);
  color: var(--color-primary-dark);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 7px 16px;
  border-radius: 999px;
  margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin: 0 0 16px;
  max-width: 760px;
  margin-inline: auto;
}
.hero h1 .accent {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p {
  color: var(--color-text-muted);
  max-width: 620px;
  margin: 0 auto;
  font-size: 1.08rem;
}
.hero-trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 28px;
  margin-top: 28px;
  color: var(--color-text-muted);
  font-size: 0.88rem;
  font-weight: 600;
}
.hero-trust span { display: inline-flex; align-items: center; gap: 6px; }
.hero-trust svg { color: var(--color-success); flex-shrink: 0; }

/* ============ Tabs ============ */
.tools { padding: 32px 20px 8px; }
.tabs {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
  margin: 0 auto 28px;
  padding: 5px;
  background: var(--color-surface-alt);
  border-radius: 999px;
  width: 100%;
  max-width: 100%;
  justify-content: center;
}
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 11px 20px;
  font-size: 0.92rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: 999px;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  white-space: nowrap;
}
.tab-btn svg { flex-shrink: 0; opacity: 0.8; }
.tab-btn:hover { color: var(--color-text); }
.tab-btn.active {
  color: #fff;
  background: var(--gradient-primary);
  box-shadow: var(--shadow-sm);
}
.tab-btn.active svg { opacity: 1; }

@media (max-width: 700px) {
  .tabs {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .tabs::-webkit-scrollbar { display: none; }
}

.tool-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}
.tool-main {
  width: 100%;
  max-width: 820px;
}
.tool-sidebar {
  width: 100%;
  max-width: 820px;
}

.tool-panel { display: none; }
.tool-panel.active {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 32px;
  animation: panel-in 0.25s ease;
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.tool-panel h2 { margin: 0 0 6px; font-size: 1.4rem; }
.panel-desc { color: var(--color-text-muted); margin: 0 0 24px; }

/* ============ Dropzone ============ */
.dropzone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 44px 20px;
  text-align: center;
  background: var(--color-surface-alt);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
  cursor: pointer;
}
.dropzone:hover { border-color: var(--color-primary-light); }
.dropzone.dragover {
  border-color: var(--color-primary);
  background: var(--color-accent-soft);
  transform: scale(1.01);
}
.dropzone-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--color-accent-soft);
  color: var(--color-primary);
}
.dropzone p { margin: 4px 0; }
.dropzone .muted { color: var(--color-text-muted); font-size: 0.85rem; margin: 8px 0; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 20px;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease, opacity 0.15s ease;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) { box-shadow: var(--shadow-md); }
.btn-primary:disabled { background: var(--color-border); color: var(--color-text-muted); cursor: not-allowed; box-shadow: none; }
.btn-secondary {
  background: var(--color-surface);
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
}
.btn-secondary:hover { background: var(--color-accent-soft); }
.btn-download {
  background: var(--color-success-soft);
  color: var(--color-success);
  padding: 7px 14px;
  font-size: 0.85rem;
}
.btn-download:hover { background: var(--color-success); color: #fff; }

/* ============ Options row ============ */
.options-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-end;
  margin: 24px 0;
  padding: 18px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
}
.options-row label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-text-muted);
}
.options-row select, .options-row input[type="range"] {
  font-family: inherit;
  font-size: 0.92rem;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
}
.options-row select:focus, .options-row input:focus {
  outline: 2px solid var(--color-primary-light);
  outline-offset: 1px;
}
.options-row .btn { margin-left: auto; }
.options-hint {
  color: var(--color-text-muted);
  font-size: 0.88rem;
  max-width: 480px;
}
.options-row--center {
  justify-content: center;
  text-align: center;
}
.options-row--center .btn { margin-left: 0; }

/* Unit converter */
.units-converter {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.units-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
}
.units-side label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-text-muted);
}
.units-side input, .units-side select {
  font-family: inherit;
  font-size: 1rem;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
}
.units-side input[readonly] {
  background: var(--color-accent-soft);
  font-weight: 700;
  color: var(--color-primary-dark);
}
.units-swap {
  font-size: 1.2rem;
  line-height: 1;
  padding: 10px 14px;
  margin-bottom: 2px;
}

/* Time zone converter */
.time-result {
  margin-top: 20px;
  padding: 20px;
  background: var(--color-accent-soft);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}

/* ============ File list ============ */
.file-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.file-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--color-surface-alt);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 500;
}
.file-list .file-size { color: var(--color-text-muted); font-size: 0.78rem; font-weight: 600; }

/* ============ Results ============ */
.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.result-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.result-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.result-card img {
  max-width: 100%;
  max-height: 120px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #eee 25%, transparent 25%),
    linear-gradient(-45deg, #eee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee 75%),
    linear-gradient(-45deg, transparent 75%, #eee 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0px;
}
.result-card .result-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  word-break: break-all;
  margin-bottom: 6px;
}
.result-card .result-savings {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}
.result-card .result-savings strong { color: var(--color-success); }
.results-toolbar {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 4px;
}

/* ============ Info sections ============ */
.info-section { padding: 56px 20px; }
.info-section h2 {
  text-align: center;
  margin-bottom: 36px;
  font-size: 1.7rem;
}
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}
.step {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 26px 22px;
  text-align: center;
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.step:hover { box-shadow: var(--shadow-sm); transform: translateY(-3px); }
.step h3 { margin: 4px 0 8px; font-size: 1.05rem; }
.step p { color: var(--color-text-muted); margin: 0; font-size: 0.92rem; }
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #fff;
  font-weight: 800;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.other-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.other-tool-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}
.other-tool-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
  border-color: var(--color-primary-light);
  text-decoration: none;
}
.other-tool-card strong {
  display: block;
  color: var(--color-text);
  font-size: 1rem;
  margin-bottom: 4px;
}
.other-tool-card span {
  display: block;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

#faq { max-width: 760px; margin: 0 auto; }
#faq details {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 4px 20px;
  margin-bottom: 12px;
  transition: box-shadow 0.15s ease;
}
#faq details[open] { box-shadow: var(--shadow-sm); }
#faq summary {
  font-weight: 700;
  cursor: pointer;
  padding: 16px 0;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#faq summary::-webkit-details-marker { display: none; }
#faq summary::after {
  content: "+";
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--color-primary);
  transition: transform 0.2s ease;
  margin-left: 12px;
}
#faq details[open] summary::after { transform: rotate(45deg); }
#faq p { color: var(--color-text-muted); margin: 0 0 16px; }

/* ============ Footer ============ */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 28px 0;
  margin-top: 32px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}
.footer-inner nav a { margin-left: 18px; font-weight: 600; color: var(--color-text-muted); }
.footer-inner nav a:hover { color: var(--color-primary); }

/* ============ Simple pages (privacy/terms) ============ */
.simple-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 20px;
}
.simple-page h1 { margin-bottom: 8px; font-size: 2rem; }
.simple-page h2 { margin-top: 36px; font-size: 1.2rem; }
.simple-page p { color: var(--color-text); }
.simple-page .updated { color: var(--color-text-muted); font-size: 0.85rem; margin-bottom: 36px; }
