[x-cloak] { display: none !important; }
html { scroll-behavior: smooth; }

/* Storyboard cyan accent (applies to both light & dark themes) */
:root {
  --pico-primary: #0090dd;
  --pico-primary-hover: #00a6ff;
  --pico-primary-focus: rgba(0, 166, 255, 0.2);
  --pico-primary-inverse: #06121d;
}
[data-theme="dark"], :root:not([data-theme="light"]) {
  --pico-primary: #00a6ff;
  --pico-primary-hover: #33b8ff;
  --pico-primary-focus: rgba(0, 166, 255, 0.25);
  --pico-primary-inverse: #06121d;
}

nav.topnav {
  position: sticky; top: 0; z-index: 100;
  background: var(--pico-card-background-color);
  border-bottom: 1px solid var(--pico-muted-border-color);
}
nav.topnav .container {
  display: flex; align-items: center; justify-content: space-between;
  padding-block: 0.5rem;
}
nav.topnav .brand-icon { display: inline-flex; }
nav.topnav .brand-icon img { height: 1.75rem; width: 1.75rem; }
nav.topnav ul { display: flex; gap: 1rem; list-style: none; margin: 0 0 0 auto; padding: 0; }
nav.topnav a { text-decoration: none; color: var(--pico-muted-color); }
nav.topnav .active a { color: var(--pico-primary); font-weight: 600; }
nav.topnav .theme-toggle { margin: 0; padding: 0.3rem; line-height: 0; width: auto; display: inline-flex; align-items: center; justify-content: center; }

section[id], article[id], #convert-error { scroll-margin-top: 60px; }

.alert { padding: 0.75rem 1rem; border-radius: 0.25rem; margin-bottom: 1rem; border: 1px solid transparent; }
.alert-danger { background: var(--pico-card-background-color); border-color: var(--pico-form-element-invalid-border-color); color: var(--pico-form-element-invalid-border-color); }
.alert-warning { background: var(--pico-card-background-color); border-color: var(--pico-muted-border-color); color: var(--pico-muted-color); }

.btn-group { display: inline-flex; }
.btn-group button { margin: 0; border-radius: 0; padding: 0.1rem 0.4rem; font-size: 0.875rem; min-width: 3rem; text-align: center; }
/* of-type so a leftover <template x-if> is not treated as the end cap */
.btn-group > button:first-of-type { border-radius: var(--pico-border-radius) 0 0 var(--pico-border-radius); }
.btn-group > button:last-of-type { border-radius: 0 var(--pico-border-radius) var(--pico-border-radius) 0; }
.btn-group button.active { background: var(--pico-primary); color: var(--pico-primary-inverse); border-color: var(--pico-primary); }

.chart-container { position: relative; height: 400px; margin: 1rem 0; }
.chart-controls { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.mass-control { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.mass-control input[type="range"] { margin: 0.15rem 0 0; padding: 0; }
.mass-display { font-weight: 600; min-width: 3rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; margin-top: 1rem; }
.preview { margin-bottom: 1rem; }
.preview .chart-controls { justify-content: center; }

.loading-spinner { display: inline-block; width: 1.5rem; height: 1.5rem; border: 3px solid var(--pico-muted-border-color); border-top-color: var(--pico-primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.muted { color: var(--pico-muted-color); }
.center { text-align: center; }
.small { font-size: 0.875rem; }
small { font-size: 80%; }
.danger { color: var(--pico-form-element-invalid-border-color); }

/* ==================== Converter redesign ==================== */

.hero { text-align: center; margin: 1.5rem 0 1.25rem; }
.hero-title { font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; margin: 0 0 0.5rem; letter-spacing: -0.02em; }
.hero-sub { color: var(--pico-muted-color); font-size: 1.125rem; margin: 0 auto; max-width: 44rem; }

/* Privacy pill */
.privacy-pill {
  display: inline-flex; align-items: center; gap: 0.5rem;
  margin: 0 auto 1.5rem; padding: 0.45rem 1rem;
  border-radius: 999px; font-size: 0.85rem;
  background: var(--pico-card-sectioning-background-color, var(--pico-card-background-color));
  border: 1px solid var(--pico-muted-border-color);
  color: var(--pico-muted-color);
}
.center > .privacy-pill { display: inline-flex; }
.privacy-pill.center { display: flex; width: fit-content; }
.pill-check { width: 18px; height: 18px; flex-shrink: 0; color: var(--pico-primary); opacity: 0.85; }

/* Cards */
.card {
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 16px;
  padding: 1.25rem 1.4rem;
}
.card-title { font-size: 1.25rem; font-weight: 700; margin: 0 0 0.25rem; }
.card-sub { color: var(--pico-muted-color); font-size: 0.9rem; margin: 0 0 1rem; }

/* Dropzone */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.4rem; text-align: center; cursor: pointer;
  padding: 2.5rem 1.5rem; margin-bottom: 1.25rem;
  border: 2px dashed var(--pico-muted-border-color); border-radius: 16px;
  background: var(--pico-card-background-color);
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.dragging {
  border-color: var(--pico-primary);
  background: var(--pico-primary-focus);
}
.dropzone-icon {
  display: flex; align-items: center; justify-content: center;
  width: 72px; height: 72px; margin-bottom: 0.5rem;
  border-radius: 50%; color: var(--pico-primary);
  background: var(--pico-primary-focus);
}
.dropzone-title { font-size: 1.4rem; font-weight: 700; }
.dropzone-sub { color: var(--pico-muted-color); }
.dropzone-btn {
  margin-top: 0.75rem; padding: 0.7rem 1.4rem; border-radius: 12px;
  font-weight: 700; background: var(--pico-primary); color: var(--pico-primary-inverse);
}

/* Settings grid */
.settings-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
@media (max-width: 768px) { .settings-grid { grid-template-columns: 1fr; } }

.check-row { display: flex; align-items: flex-start; gap: 0.6rem; margin-bottom: 1rem; cursor: pointer; }
.check-row:last-child { margin-bottom: 0; }
.check-row input[type="checkbox"] { margin-top: 0.15rem; flex-shrink: 0; }
.check-row > span { display: flex; flex-direction: column; gap: 0.15rem; }
.check-row small { color: var(--pico-muted-color); }
.check-row.compact { margin-bottom: 0.6rem; }
.check-label { display: block; }
.check-label strong { font-weight: 600; }
.help-link { text-decoration: none; color: var(--pico-primary); font-weight: 400; white-space: nowrap; }

.weight-row { display: flex; gap: 0.6rem; align-items: center; }
.weight-row input[type="number"] { max-width: 7rem; margin: 0; }
.weight-row select { max-width: 6rem; margin: 0; }
.advanced-link { display: inline-block; margin-top: 0.9rem; font-size: 0.9rem; font-weight: 600; text-decoration: none; }

/* Success header */
.success-header {
  display: grid; grid-template-columns: auto 1fr auto; gap: 1rem 1.25rem;
  align-items: start; margin-bottom: 1.25rem; padding: 1.4rem 1.5rem;
  border-radius: 16px;
  background: var(--pico-primary-focus);
  border: 1px solid var(--pico-primary);
}
.success-icon { color: var(--pico-primary); line-height: 0; }
.success-title { font-size: 1.55rem; font-weight: 800; margin: 0 0 0.3rem; }
.success-sub { margin: 0 0 0.75rem; color: var(--pico-color); opacity: 0.85; }
.success-file { font-weight: 600; margin: 0; word-break: break-all; }
.success-format { font-size: 0.9rem; margin: 0.15rem 0 0; }
.success-actions { display: flex; flex-direction: column; gap: 0.5rem; min-width: 210px; }
.success-actions button { margin: 0; white-space: nowrap; }
@media (max-width: 768px) {
  .success-header { grid-template-columns: auto 1fr; }
  .success-actions { grid-column: 1 / -1; }
}

/* Result two-column layout */
.result-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1rem; }
@media (max-width: 768px) { .result-grid { grid-template-columns: 1fr; } }
.result-side { display: flex; flex-direction: column; gap: 1rem; }
.chart-card { padding: 1.25rem 1rem 0.85rem; }
.chart-card .chart-container { height: 393px; margin: 0.5rem 0 0.35rem; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem 0.5rem; }
.summary-grid strong { font-size: 1.35rem; font-weight: 800; }

/* Supported format pills */
.formats-section { margin: 1.25rem 0 1rem; display: flex; justify-content: center; }
.formats-inner { display: inline-flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.formats-label { font-size: 0.9rem; }
.format-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.format-pill {
  padding: 0.35rem 0.9rem; border-radius: 999px; font-size: 0.85rem;
  background: var(--pico-primary-focus); color: var(--pico-primary);
}
.sample-link { margin: -0.25rem 0 1.5rem; }
.sample-link a { font-weight: 600; }
.footer-support { margin-top: 1.25rem; }

/* Content pages (About, Download) */
.page-hero { margin: 1.5rem 0 2rem; }
.page-hero h1 { font-size: clamp(1.9rem, 4.5vw, 2.75rem); font-weight: 700; margin: 0 0 0.5rem; letter-spacing: -0.02em; }
.page-hero p { color: var(--pico-muted-color); font-size: 1.1rem; margin: 0; max-width: 46rem; }

.page-card { margin-bottom: 1.25rem; }
.page-card h2 { font-size: 1.4rem; font-weight: 700; margin: 0 0 0.75rem; }
.page-card h3 { font-size: 1.1rem; font-weight: 600; margin: 1.25rem 0 0.5rem; }
.page-card > :last-child { margin-bottom: 0; }
.page-card ul, .page-card ol { margin-bottom: 0.75rem; }

.page-card details { border-bottom: 1px solid var(--pico-muted-border-color); }
.page-card details:last-child { border-bottom: none; }
.page-card details summary { font-weight: 600; }

.download-hero { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; text-align: center; }
.download-btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.8rem 1.6rem; border-radius: 12px; font-weight: 700;
  background: var(--pico-primary); color: var(--pico-primary-inverse);
  text-decoration: none;
}
.download-btn.unavailable { opacity: 0.5; pointer-events: none; }
