:root {
  --bg: #0f1b24;
  --bg-glow: #132433;
  --surface: #172633;
  --surface2: #1e3344;
  --border: #2a4558;
  --text: #e8f0f5;
  --muted: #8aa0b0;
  --accent: #2a9d8f;
  --accent-hover: #238b7e;
  --danger: #e76f51;
  --ok: #52b788;
  --font: "DM Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", Consolas, monospace;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(42, 157, 143, 0.14), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(30, 51, 68, 0.9), transparent 50%),
    linear-gradient(180deg, var(--bg-glow), var(--bg) 40%);
  background-attachment: fixed;
}

body {
  line-height: 1.45;
}

.page {
  width: min(880px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 3rem;
}

.hero {
  margin-bottom: 1.5rem;
  animation: rise 0.55s ease both;
}

.brand {
  margin: 0 0 0.35rem;
  font-size: clamp(2rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.hero h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.lead {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  max-width: 36rem;
}

.tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 1rem;
  animation: rise 0.55s ease 0.08s both;
}

.tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.7rem 0.5rem;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.tab:hover {
  color: var(--text);
  background: var(--surface2);
}

.tab.is-active {
  background: var(--accent);
  color: #fff;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.35rem 1.4rem 1.5rem;
  animation: rise 0.55s ease 0.14s both;
}

.tool[hidden] {
  display: none !important;
}

.hint {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.form {
  display: grid;
  gap: 1rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

  .tabs {
    flex-wrap: wrap;
  }

  .tab {
    flex: 1 1 45%;
  }
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field > span,
.field-check > span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="month"],
input[type="file"],
select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="file"] {
  padding: 0.55rem;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.2);
}

select option {
  background: var(--surface2);
  color: var(--text);
}

.check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  font-size: 0.92rem;
  cursor: pointer;
}

.subhead {
  margin: 0.25rem 0 0;
  font-size: 1rem;
  font-weight: 600;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-top: 0.25rem;
}

.btn {
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.72rem 1.2rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease, opacity 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

.status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  margin: 1rem 0 0.75rem;
  min-height: 1.5rem;
  animation: rise 0.55s ease 0.2s both;
}

.status {
  color: var(--muted);
  font-size: 0.92rem;
}

.status.is-ok {
  color: var(--ok);
}

.status.is-err {
  color: var(--danger);
}

.status.is-busy {
  color: var(--accent);
}

.downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.downloads a {
  color: #fff;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.82rem;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.downloads a:hover {
  border-color: var(--accent);
  background: rgba(42, 157, 143, 0.18);
}

.log-wrap {
  animation: rise 0.55s ease 0.24s both;
}

.log-wrap h2 {
  margin: 0 0 0.45rem;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--muted);
}

.log {
  margin: 0;
  min-height: 8rem;
  max-height: 16rem;
  overflow: auto;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-family: var(--mono);
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
