:root {
  --bg: #0b1b23;
  --card: #f6f1e8;
  --accent: #d06b3f;
  --text: #1a1a1a;
  --error: #b30000;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Fira Sans", sans-serif;
  background: radial-gradient(circle at 20% 20%, #183543, var(--bg));
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--text);
}

.card {
  width: min(1200px, 96vw);
  background: var(--card);
  padding: 28px;
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  overflow: hidden;
}

h1 { margin: 0 0 6px; }

.title-center {
  text-align: center;
}

p { margin: 0 0 18px; }

form {
  display: grid;
  gap: 14px;
}

.workspace-grid {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.connection-block {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.field-span-2 {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #d2c7b8;
  border-radius: 10px;
  font-size: 14px;
}

.input-error {
  border-color: #b30000;
  box-shadow: 0 0 0 2px rgba(179, 0, 0, 0.15);
}

button {
  padding: 12px 14px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  font-size: 15px;
  cursor: pointer;
}

.formats {
  margin-top: 10px;
}

.formats h2 {
  margin: 6px 0 10px;
  font-size: 16px;
}

.format-list {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.format-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #d2c7b8;
  border-radius: 12px;
  background: #fff9f0;
  min-width: 0;
}

.format-card input[type="radio"] {
  align-self: start;
}

.format-title {
  font-weight: 600;
}

.format-desc {
  font-size: 13px;
  color: #4a4a4a;
  overflow-wrap: anywhere;
}

.format-card button {
  justify-self: start;
}

.format-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.format-card.disabled {
  opacity: 0.6;
}

.disabled-field {
  opacity: 0.55;
}

.disabled-field input {
  background: #ebe5dd;
  cursor: not-allowed;
}

.error {
  background: #ffe7e7;
  border: 1px solid #f1b8b8;
  color: var(--error);
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 20, 26, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.loading-overlay.visible {
  display: flex;
}

.loading-card {
  background: var(--card);
  padding: 18px 20px;
  border-radius: 14px;
  width: min(420px, 92vw);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.loading-title {
  font-weight: 600;
  margin-bottom: 10px;
}

.loading-bar {
  height: 10px;
  background: #e4dacb;
  border-radius: 999px;
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  width: 40%;
  background: var(--accent);
  border-radius: 999px;
  animation: loading-move 1.2s ease-in-out infinite;
}

.loading-note {
  margin-top: 10px;
  font-size: 12px;
  color: #4a4a4a;
}

@keyframes loading-move {
  0% { transform: translateX(-60%); }
  50% { transform: translateX(80%); }
  100% { transform: translateX(-60%); }
}

@media (min-width: 980px) {
  .workspace-grid {
    grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.25fr);
    align-items: start;
  }

  .connection-block {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    background: #fff9f0;
    border: 1px solid #d2c7b8;
    border-radius: 12px;
    padding: 12px;
  }

  .formats {
    margin-top: 0;
  }

  .format-list {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}

@media (min-width: 980px) and (max-width: 1260px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .formats {
    margin-top: 8px;
  }

  .format-list {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 979px) {
  .card {
    width: min(760px, 96vw);
    padding: 22px;
  }

  .connection-block {
    grid-template-columns: 1fr;
  }

  .field-span-2 {
    grid-column: auto;
  }

  .format-list {
    grid-template-columns: 1fr;
  }
}
