:root{
  /* Light theme only */
  --bg:#f5f7fb;
  --panel:#ffffff;
  --text:#101828;
  --muted:#475467;
  --accent:#2563eb;
  --ok:#16a34a;
  --bad:#dc2626;
  /* shiny border vars */
  --shiny-cta-bg:#ffffff;
  --shiny-cta-bg-subtle:#e9ecf3;
  --shiny-cta-fg:#101828;
  --shiny-cta-highlight:#2563eb;
  --shiny-cta-highlight-subtle:#7aa2ff;
}
*{box-sizing:border-box}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background:var(--bg);
  color:var(--text);
}
.topbar{position:sticky;top:0;z-index:50;background:rgba(255,255,255,.8);backdrop-filter: blur(8px);border-bottom:1px solid #e0e7ff}
.topbar-inner{max-width:100%;padding:8px 16px;display:flex;align-items:center;justify-content:space-between}
.topbar-description{display:flex;gap:14px;align-items:flex-start;padding:16px;border-top:1px solid #eef2ff;background:rgba(255,255,255,.8)}
.topbar-icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto}
.topbar-icon svg{width:40px;height:40px}
.topbar-text{max-width:1100px}
.topbar-title{margin:0 0 6px 0;font-size:28px;font-weight:800;color:#0f172a}
.topbar-description p{margin:2px 0;color:var(--muted);line-height:1.5}
.icon-btn{background:transparent;border:1px solid #2a3153;color:var(--text);padding:6px 10px;border-radius:8px;cursor:pointer}
.secondary{background:#263056;border:1px solid #2a3153}
.error{background:#2b1620;color:#ffd6e0;border:1px solid #5b2136;padding:10px 12px;border-radius:8px;margin-bottom:12px}
.preloader{position:fixed;inset:0;background:#000;display:flex;align-items:center;justify-content:center;z-index:9999}
.preloader.hidden{display:none}
.hidden{display:none}
.preloader svg{height:150px;width:150px}
.container{max-width:100%;margin:32px auto;padding:0 16px}
h1{margin:0 0 16px 0;font-size:24px;font-weight:700}
.grid{
  display:grid;
  grid-template-columns: 1fr; /* всегда одна колонка */
  gap:16px;
}
.card{
  background:var(--panel);
  border:1px solid #e0e7ff;
  border-radius:10px;
  padding:12px;
}
/* Hero card */
.hero-card{display:grid;grid-template-columns:1fr 300px;gap:16px;background:#ffffff;border:1px solid #e6ebf6;border-radius:12px;padding:16px;box-shadow:0 6px 14px rgba(2,6,23,0.04);margin-bottom:16px}
.hero-left{display:flex;flex-direction:column;gap:10px;align-items:flex-start}
.hero-lang{display:flex;gap:6px}
.lang-btn{border:1px solid #e2e8f0;background:#fff;border-radius:8px;padding:6px 8px;cursor:pointer;font-size:16px}
.lang-btn.active{outline:2px solid #2563eb}
.hero-row{display:flex;gap:14px;align-items:flex-start}
.hero-icon{display:inline-flex;align-items:center;justify-content:center;width:56px;height:56px;border-radius:14px;background:#eff6ff;border:1px solid #e5ecff}
.hero-text h2{margin:0 0 6px 0;font-size:22px;color:#0f172a}
.hero-text p{margin:4px 0;color:#475467;line-height:1.5}
.hero-right{border:2px dashed #d7dcef;border-radius:10px;display:flex;align-items:center;justify-content:center;color:#98a2b3;background:#f8fafc}
label{display:block;font-size:14px;color:var(--muted);margin-bottom:8px}
textarea{
  width:100%;
  min-height:260px;
  resize:vertical;
  background:#ffffff;
  color:var(--text);
  border: none;
  border-radius:10px;
  padding:10px;
  line-height:1.4;
  white-space: pre; /* не переносить внутри строки, но сохранять переводы строк */
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.controls{display:flex;align-items:center;gap:12px;margin-top:10px}
.field-actions{display:flex;gap:8px;margin-bottom:8px}
button{appearance:none;border:none;cursor:pointer;font-weight:600}
/* Unified green rounded button style */
.btn{outline:none;height:40px;line-height:40px;text-align:center;min-width:130px;padding:0 16px;border-radius:40px;background:#fff;border:2px solid #1ECD97;color:#1ECD97;letter-spacing:1px;text-shadow:0;display:inline-flex;align-items:center;justify-content:center;gap:6px}
.btn:hover{color:#fff;background:#1ECD97}
.btn:active{letter-spacing:2px}
.btn.onclic{min-width:40px;width:40px;border-color:#bbbbbb;border-width:3px;font-size:0;border-left-color:#1ECD97;animation:rotating 2s .25s linear infinite}
.btn.validate{font-size:13px;color:#fff;background:#1ECD97}
.btn.btn--sm{min-width:auto;padding:0 10px;height:34px;line-height:34px}
@keyframes rotating{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}

/* Alt color (for Clear All) */
.btn.btn--alt{border-color:#f97316;color:#f97316;background:#fff}
.btn.btn--alt:hover{background:#f97316;color:#fff}
.btn.btn--alt.onclic{border-left-color:#f97316}
.btn.btn--alt.validate{background:#f97316;color:#fff}

/* Toast */
.toast{position:fixed;right:16px;bottom:16px;max-width:280px;padding:10px 12px;border-radius:8px;background:rgba(16,24,40,.95);color:#fff;box-shadow:0 8px 30px rgba(0,0,0,.2);opacity:0;pointer-events:none;transform:translateY(8px);transition:opacity .25s ease, transform .25s ease;z-index:99999;font-size:14px}
.toast.show{opacity:1;transform:translateY(0)}
.toast.success{background:#16a34a}
.toast.info{background:#2563eb}
/* Fancy "learn-more" button style for check */
/* Removed special learn-more button styling */
button:disabled{opacity:.6;cursor:not-allowed}
#stats{color:var(--muted);font-size:13px}
.ok{color:var(--ok)}
.bad{color:var(--bad)}
.summary{font-size:16px;font-weight:700}
.hidden{display:none}

/* ========== Shiny border for fields ========== */
@property --gradient-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}
@property --gradient-angle-offset {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}
@property --gradient-percent {
  syntax: "<percentage>";
  initial-value: 5%;
  inherits: false;
}
@property --gradient-shine {
  syntax: "<color>";
  initial-value: white;
  inherits: false;
}

.shiny-field{
  --animation: gradient-angle linear infinite;
  --duration: 4s;
  --shadow-size: 2px;
  position: relative;
  isolation: isolate;
  outline: none;
  border: 1px solid transparent; /* важен для отображения градиентной рамки */
  background: linear-gradient(var(--shiny-cta-bg), var(--shiny-cta-bg)) padding-box,
    conic-gradient(
      from calc(var(--gradient-angle) - var(--gradient-angle-offset)),
      transparent,
      var(--shiny-cta-highlight) var(--gradient-percent),
      var(--gradient-shine) calc(var(--gradient-percent) * 2),
      var(--shiny-cta-highlight) calc(var(--gradient-percent) * 3),
      transparent calc(var(--gradient-percent) * 4)
    ) border-box;
  box-shadow: inset 0 0 0 1px var(--shiny-cta-bg-subtle);
}

.shiny-field, .shiny-field::before, .shiny-field::after{
  animation: var(--animation) var(--duration),
             var(--animation) calc(var(--duration) / 0.4) reverse paused;
  animation-composition: add;
}

.shiny-field:hover, .shiny-field:focus{
  --gradient-percent: 20%;
  --gradient-angle-offset: 95deg;
  --gradient-shine: var(--shiny-cta-highlight-subtle);
  animation-play-state: running;
}

@keyframes gradient-angle { to { --gradient-angle: 360deg; } }

/* Fancy theme toggle (compact subset) */
.topbar .toggle{background:transparent;border:0;cursor:pointer;position:relative;height:36px;aspect-ratio:1.8/1;border-radius:24px;padding:0;margin:0 0 0 8px}
.topbar .toggle .socket{position:absolute;inset:0;border-radius:24px;background:light-dark(#e6e8ef,#0a0d18);box-shadow:-0.05em 0.1em 0.2em -0.2em rgba(255,255,255,0.8)}
.topbar .toggle .socket-shadow{position:absolute;inset:0;border-radius:inherit;opacity:.3;box-shadow:0 0.075em 0.1em 0 rgba(255,255,255,.8)}
.topbar .toggle .face{position:absolute;inset:3px;border-radius:24px}
.topbar .toggle .face-plate{background:conic-gradient(from 45deg,#0000,rgba(255,255,255,.08)),light-dark(#d7d9e2,#111827);box-shadow:-0.05em 0.1em 0.2em -0.2em rgba(255,255,255,.8) inset}
.topbar .toggle .glow{width:25%;position:absolute;top:50%;left:50%;transform:translate(-52%,-48%);filter:drop-shadow(0 0 .2em hsl(182 90% 92%))}
.topbar .toggle .trail-holder{position:absolute;top:50%;left:50%;transform:translate(-52%,-48%);filter:blur(6px)}
.topbar .toggle .trail{stroke-width:4}
.topbar .toggle[aria-pressed="true"] .trail{stroke-dashoffset:-70;opacity:1;transition:stroke-dashoffset .3s}
.topbar .toggle .trail{opacity:0;transition:opacity .5s}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}

/* Removed dark theme; light only */


/* ========== Прогресс-бар ========== */
.progress-wrap{
  margin-top:12px;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.progress-row{
  display:flex;
  align-items:center;
  gap:10px;
}
.progress-track{
  flex:1;
  height:8px;
  background:#e0e7ff;
  border-radius:8px;
  overflow:hidden;
}
.progress-bar-fill{
  height:100%;
  background:linear-gradient(90deg,#1ECD97,#2563eb);
  border-radius:8px;
  width:0%;
  transition:width 0.18s ease;
}
.progress-label{
  font-size:13px;
  color:var(--muted);
  white-space:nowrap;
  min-width:90px;
  text-align:right;
}

/* Соотношение валид/невалид в реальном времени */
.ratio-wrap{
  display:flex;
  align-items:center;
  gap:10px;
  font-size:12px;
  color:var(--muted);
}
.ratio-bar{
  flex:1;
  height:6px;
  background:#e0e7ff;
  border-radius:6px;
  overflow:hidden;
  display:flex;
}
.ratio-segment{
  height:100%;
  border-radius:0;
  transition:width 0.15s ease;
}
.ratio-valid{background:var(--ok);}
.ratio-invalid{background:var(--bad);}
.ratio-label{
  white-space:nowrap;
  min-width:90px;
  text-align:right;
}
.ratio-label .v{color:var(--ok)}
.ratio-label .x{color:var(--bad)}

/* Кнопка «Стоп» */
.btn.btn--stop{border-color:#dc2626;color:#dc2626;background:#fff}
.btn.btn--stop:hover{background:#dc2626;color:#fff}
.btn.btn--stop.onclic{border-left-color:#dc2626}

/* ========== Зона загрузки файла ========== */
.upload-zone{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:56px;
  padding:12px 16px;
  margin-bottom:8px;
  border:2px dashed #d7dcef;
  border-radius:10px;
  background:#f8fafc;
  color:var(--muted);
  font-size:14px;
  cursor:pointer;
  transition:border-color .2s, background .2s;
}
.upload-zone:hover{
  border-color:#2563eb;
  background:#eff6ff;
}
.upload-zone.dragover{
  border-color:#2563eb;
  background:#eff6ff;
}
.upload-text{pointer-events:none}

/* Оценка времени до конца */
.eta-label{
  font-size:13px;
  color:var(--muted);
  white-space:nowrap;
  min-width:70px;
  text-align:right;
}

/* ========== Mobile tweaks ========== */
@media (max-width: 600px){
  .container{padding:0 12px;margin:20px auto}
  h1{font-size:20px;margin-bottom:12px}
  .hero-card{grid-template-columns:1fr;gap:12px;padding:12px}
  .hero-right{min-height:80px}
  .topbar-description{padding:12px}
  .topbar-icon svg{width:32px;height:32px}
  .topbar-title{font-size:22px}
  .topbar-description p{font-size:13px}
  .card{padding:10px}
  label{font-size:13px}
  textarea{min-height:180px;font-size:14px}
  .controls{flex-wrap:wrap;gap:8px}
  .controls #stats{width:100%;order:3;margin-top:4px}
  .btn{width:100%;justify-content:center}
  .btn.btn--sm{height:32px;line-height:32px;padding:0 8px}
  .field-actions{gap:6px}
  .topbar-inner{padding:6px 12px}
  .toast{left:12px;right:12px;bottom:12px}
}
