:root {
  --bg-base: #222127;
  --bg-card: rgba(40, 39, 49, 0.9);
  --bg-card-strong: #2a2932;
  --text-main: #f7f7f7;
  --text-muted: #c6c8d8;
  --line-soft: rgba(247, 247, 247, 0.15);
  --accent-main: #5464ff;
  --accent-alt: #7c88ff;
  --accent-main-strong: #8f9aff;
  --danger: #ff6670;
  --ok: #69d4a4;
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.36);
  --radius-lg: 20px;
  --radius-md: 12px;
  --container: 1060px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  font-family: "Outfit", "Segoe UI", sans-serif;
  color: var(--text-main);
  background: linear-gradient(145deg, #222127 0%, #1b1a20 100%);
  line-height: 1.4;
  overflow-x: hidden;
}

.bg-shape {
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: -1;
  filter: blur(1px);
  animation: floatSquare 11s ease-in-out infinite;
  --shape-rot: 0deg;
}

.bg-shape-a {
  width: 250px;
  height: 250px;
  top: 62px;
  right: 6%;
  border-radius: 8px;
  background: linear-gradient(165deg, rgba(84, 100, 255, 0.3), rgba(84, 100, 255, 0.1));
  --shape-rot: 8deg;
}

.bg-shape-b {
  width: 190px;
  height: 190px;
  bottom: 9%;
  left: 5%;
  border-radius: 6px;
  background: linear-gradient(165deg, rgba(84, 100, 255, 0.24), rgba(84, 100, 255, 0.08));
  --shape-rot: -7deg;
  animation-duration: 13s;
}

.container {
  width: min(var(--container), 92vw);
  margin-inline: auto;
}

.hero {
  padding: 2.6rem 0 1.2rem;
  animation: riseIn 480ms ease-out both;
}

.hero-title-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.hero-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex: 0 0 auto;
}

.hero-title {
  margin: 0;
  font-family: "Syne", "Outfit", sans-serif;
  font-size: clamp(1.65rem, 4vw, 2.5rem);
  line-height: 1.1;
}

.hero-subline {
  margin-top: 0.8rem;
  max-width: none;
  color: var(--text-muted);
  line-height: 1.5;
}

.hero-subtitle {
  color: var(--text-muted);
}

.howto-link {
  display: inline;
  padding: 0;
  border: 0;
  margin-left: 0.2rem;
  background: transparent;
  color: var(--accent-main-strong);
  text-decoration: underline;
  font: 600 0.92rem/1.2 "Outfit", sans-serif;
  cursor: pointer;
  vertical-align: baseline;
  white-space: nowrap;
}

.lang-switch {
  margin-top: 1rem;
  display: inline-flex;
  gap: 0.45rem;
  padding: 0.3rem;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: rgba(42, 41, 50, 0.9);
}

.lang-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.38rem 0.75rem;
  font: 600 0.82rem/1 "Outfit", sans-serif;
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
}

.lang-btn[aria-pressed="true"] {
  background: var(--accent-main);
  color: #ffffff;
}

.layout {
  display: grid;
  grid-template-columns: minmax(290px, 1fr) minmax(280px, 0.92fr);
  gap: 1rem;
  align-items: start;
  padding-bottom: 1.2rem;
}

.panel {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 1.2rem 1rem;
  animation: riseIn 540ms ease-out both;
}

.panel h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-family: "Syne", "Outfit", sans-serif;
  font-size: 1.1rem;
}

.field + .field {
  margin-top: 0.9rem;
}

.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.field input[type="file"] {
  width: 100%;
}

.file-picker {
  border: 1px dashed rgba(84, 100, 255, 0.5);
  border-radius: var(--radius-md);
  background: var(--bg-card-strong);
  padding: 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.file-native {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.btn-file {
  padding: 0.58rem 0.8rem;
  font-size: 0.86rem;
  background: linear-gradient(150deg, var(--accent-main), #3949db);
  color: #fff;
  white-space: nowrap;
}

.file-picker-text {
  min-width: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field-help {
  margin: 0.42rem 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.field-file {
  margin: 0.52rem 0 0;
  font: 600 0.88rem/1.35 "Outfit", sans-serif;
  color: var(--accent-main-strong);
  word-break: break-word;
}

.limits-box {
  margin-top: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(84, 100, 255, 0.5);
  background: rgba(84, 100, 255, 0.14);
  padding: 0.8rem;
}

.limits-box h3 {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
}

.limits-box p {
  margin: 0;
  color: var(--text-main);
  font-size: 0.91rem;
}

.actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.62rem;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border-radius: 12px;
  border: 1px solid transparent;
  font: 600 0.94rem/1 "Outfit", sans-serif;
  padding: 0.74rem 1rem;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background: linear-gradient(150deg, var(--accent-main), #3949db);
  color: #ffffff;
  box-shadow: 0 10px 28px rgba(84, 100, 255, 0.31);
}

#compile-btn {
  box-shadow: none;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-ghost {
  background: #2f2e38;
  color: var(--text-main);
  border-color: var(--line-soft);
}

.status-summary {
  margin: 0 0 0.7rem;
  padding: 0.62rem 0.72rem;
  border-radius: var(--radius-md);
  background: rgba(84, 100, 255, 0.14);
  color: var(--accent-main-strong);
  font-weight: 600;
}

.status-summary.error {
  color: var(--danger);
  background: rgba(189, 30, 41, 0.12);
}

.status-summary.success {
  color: var(--ok);
  background: rgba(18, 117, 79, 0.12);
}

.status-log {
  display: none;
}

.status-log li {
  border-radius: 11px;
  border: 1px solid var(--line-soft);
  background: rgba(42, 41, 50, 0.9);
  padding: 0.56rem 0.66rem;
  font-family: "Outfit", sans-serif;
  font-size: 0.79rem;
  line-height: 1.35;
  word-break: break-word;
}

.status-log li.warn {
  border-color: rgba(84, 100, 255, 0.5);
  background: rgba(84, 100, 255, 0.15);
}

.status-log li.error {
  border-color: rgba(189, 30, 41, 0.42);
  background: rgba(189, 30, 41, 0.09);
}

.status-log li.ok {
  border-color: rgba(18, 117, 79, 0.42);
  background: rgba(18, 117, 79, 0.1);
}

.footer {
  padding: 0.2rem 0 2rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
}

.download-box {
  margin-top: 0.6rem;
  padding-top: 0.5rem;
}

.download-note {
  margin: 0 0 0.5rem;
  color: var(--text-muted);
}

.modal[hidden] {
  display: none;
}

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

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.modal-card {
  position: relative;
  width: min(520px, 92vw);
  margin: 10vh auto 0;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: #2a2932;
  box-shadow: var(--shadow-soft);
  padding: 1rem;
}

.modal-card h2 {
  margin: 0 0 0.6rem;
  font-family: "Syne", "Outfit", sans-serif;
}

.modal-intro {
  margin: 0 0 0.7rem;
  color: var(--text-main);
}

.modal-steps {
  margin: 0 0 0.75rem;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.42rem;
}

.modal-steps li {
  color: var(--text-main);
  line-height: 1.4;
}

.modal-note {
  margin: 0 0 0.8rem;
  color: var(--text-muted);
  font-size: 0.93rem;
}

.footer a {
  color: var(--accent-main-strong);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

.footer-credit {
  margin: 0.45rem 0 0;
}

.footer-sep {
  opacity: 0.6;
  margin: 0 0.3rem;
}

@media (max-width: 920px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes floatSquare {
  0%,
  100% {
    transform: translateY(0) rotate(var(--shape-rot));
  }
  50% {
    transform: translateY(-10px) rotate(calc(var(--shape-rot) + 2deg));
  }
}
