/* Look based on game.video: black page, dark gradient cards, blue gradient buttons */
:root {
  --primary: #22277f;
  --secondary: #287cac;
  --accent: #be3dd9;
  --bg: #000;
  --nav-bg: #060406;
  --card-bg: #0d0c13;
  --card-line: #2a2e47;
  --input-bg: #1e202a;
  --input-line: #5f6177;
  --heading: #fffffd;
  --text: #c0c0c0;
  --muted: #8a8c9e;
  --error: #fa4d50;
  --error-bg: #fa4d5014;
  --warn: #ef9f27;
  --success: #3ccf91;
  --radius-card: 24px;
  --radius: 8px;
  --font-heading: "TASA Orbiter", "Tasa Orbiter Display", Montserrat, Arial, sans-serif;
  --font-body: Lato, system-ui, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image: radial-gradient(1200px 600px at 50% -200px, #22277f40, transparent 70%);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.4;
}

[hidden] { display: none !important; }

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--nav-bg);
  box-shadow: 0 0 0 2px var(--card-line);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--heading);
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 18px;
}
.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  box-shadow: inset 0 2.5px 6px -2px #fff3, inset 0 0 0 1px #ffffff1a;
}
.nav-user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.nav-user #logged-in-as { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--muted); }

/* Layout */
.screen { max-width: 1200px; margin: 0 auto; padding: 48px 16px 80px; }
.screen-center {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  box-sizing: border-box;
  padding-top: 16px;
  padding-bottom: 16px;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 32px;
  margin-bottom: 32px;
}
.page-head .text { margin-bottom: 0; }
.org-field { width: min(100%, 320px); }
/* Required fields left, debug options right, generate + jobs full width below */
.layout { display: flex; flex-direction: column; gap: 2em; }
.layout > .alert { margin-bottom: 0; }
.generate-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "required debug"
    "actions  debug";
  gap: 2em;
  align-items: start;
}
.card.required-card { grid-area: required; padding: 2em; }
.debug { grid-area: debug; }
@media (max-width: 600px) { .card.required-card { padding: 1.5em 1.25em; } }
.generate-actions { grid-area: actions; display: flex; }
@media (max-width: 900px) {
  .generate-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-template-areas: "required" "debug" "actions";
  }
  .generate-actions .btn { width: 100%; }
}

/* Typography */
.heading {
  color: var(--heading);
  font-family: var(--font-heading);
  font-weight: 500;
  line-height: 1.2;
  margin: 0 0 10px;
  font-size: 32px;
}
.heading-xl { font-size: 50px; }
.heading-sm { font-size: 24px; }
@media (max-width: 600px) {
  .heading-xl { font-size: 34px; }
}
.text { margin: 0 0 16px; color: var(--text); }
.hint { color: var(--muted); font-size: 14px; margin: 0; }
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--heading);
  background: #ffffff10;
  padding: 1px 5px;
  border-radius: 4px;
}
.hint code { white-space: nowrap; }

/* Cards */
.card {
  position: relative;
  color: #fffff1;
  background-color: var(--card-bg);
  background-image: linear-gradient(#2a2e474d, #2a2e4700);
  border-radius: var(--radius-card);
  box-shadow: inset 0 24px 48px #c7d3ea0d, inset 0 1px 1px #c7d3ea1f;
  padding: 3em 2em 2em;
}
@media (max-width: 600px) {
  .card { border-radius: 16px; padding: 2em 1.25em 1.5em; }
}
.login-card { width: 100%; max-width: 440px; }
.jobs-card { padding-top: 2em; }

/* Debug options: always shown, each field collapses on its own */
.card.debug { padding: 2em; }
.debug-title {
  color: var(--heading);
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 500;
  line-height: 1.2;
  margin: 0 0 6px;
}
.debug-intro { margin-bottom: 18px; }
.debug-field { border-top: 1px solid var(--card-line); }
.debug-field:last-child { border-bottom: 1px solid var(--card-line); }
.debug-field-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.debug-field-summary::-webkit-details-marker { display: none; }
.debug-field-summary::before {
  content: "▸";
  color: var(--muted);
  transition: transform .2s;
}
.debug-field[open] > .debug-field-summary::before { transform: rotate(90deg); }
.debug-field-summary .label { flex: 1; }
.debug-field-summary:hover .label { color: #6fb6e0; }
.debug-field-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.debug-field-body { display: flex; flex-direction: column; gap: 8px; padding: 0 0 18px; }
.opt.opt-set { color: #bfe3f7; background: #287cac33; }
@media (max-width: 600px) { .card.debug { padding: 1.5em 1.25em; } }
@media (prefers-reduced-motion: reduce) { .debug-field-summary::before { transition: none; } }

/* Forms */
.stack { display: flex; flex-direction: column; gap: 22px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.label { color: var(--heading); font-weight: 700; font-size: 15px; }
.req, .opt {
  font-weight: 400;
  font-size: 12px;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 99px;
}
.req { color: #fff; background: #be3dd933; }
.opt { color: var(--muted); background: #ffffff0d; }

.input {
  width: 100%;
  color: #fffff1;
  background-color: var(--input-bg);
  border: 1px solid var(--input-line);
  border-radius: var(--radius);
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  line-height: 1.3;
  transition: border-color .35s, background-color .35s;
}
.input:focus { outline: none; border-color: var(--secondary); background-color: #23263a; }
.input::placeholder { color: #6d6f84; }
.input.invalid { border-color: var(--error); }
textarea.input { resize: vertical; min-height: 90px; }
.mono { font-family: var(--font-mono); font-size: 14px; }
.input-code { font-family: var(--font-mono); font-size: 22px; letter-spacing: 0.4em; text-align: center; }
select.input { appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, #c0c0c0 50%), linear-gradient(135deg, #c0c0c0 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}
select.input option { background: var(--input-bg); }

.title-row { display: flex; gap: 8px; }
.color-input {
  flex: none;
  width: 48px;
  padding: 4px;
  background: var(--input-bg);
  border: 1px solid var(--input-line);
  border-radius: var(--radius);
  cursor: pointer;
}
.color-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.color-input:disabled { opacity: .35; cursor: not-allowed; }
.shadow-row { display: flex; align-items: center; gap: 12px; }
.shadow-row .color-input { height: 34px; }
.color-row { display: flex; align-items: center; gap: 12px; cursor: pointer; color: var(--text); }
.color-row[hidden] { display: none; }
.color-row .color-input { height: 42px; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text); }
.checkbox input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }

.field-error { color: var(--error); font-size: 14px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius);
  padding: 12px 16px;
  font: inherit;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: transform .4s, box-shadow .4s, opacity .4s, background-color .4s;
}
.btn-primary {
  color: #fffffd;
  background-color: var(--secondary);
  background-image: linear-gradient(90deg, var(--secondary), var(--primary));
  box-shadow: inset 0 2.5px 6px -2px #fff3, inset 0 0 0 1px #ffffff1a;
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: inset 0 2.5px 6px -2px #fff3, inset 0 0 0 1px #ffffff1a, 0 8px 24px #287cac40; }
.btn-primary .arrow { transition: transform .4s; }
.btn-primary:hover:not(:disabled) .arrow { transform: translateX(3px); }
.btn-ghost {
  color: #fffffd;
  background: #ffffff0a;
  box-shadow: inset 0 0 0 1px var(--card-line);
}
.btn-ghost:hover:not(:disabled) { background: #ffffff14; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-block { width: 100%; }
.btn-large { padding: 14px 22px; font-size: 20px; }
.btn-small { padding: 6px 10px; font-size: 14px; }

/* Alerts */
.alert {
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 20px;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.alert-error { color: #ffdede; background: var(--error-bg); box-shadow: inset 0 0 0 1px #fa4d5055; }
.alert-info { color: var(--text); background: #287cac14; box-shadow: inset 0 0 0 1px #287cac55; }
.alert-warn { color: #ffe9c9; background: #ef9f2714; box-shadow: inset 0 0 0 1px #ef9f2755; margin-bottom: 0; }

/* Drop zone */
.dropzone {
  border: 1.5px dashed var(--input-line);
  border-radius: 16px;
  background: #ffffff05;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .3s, background-color .3s;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--secondary); outline: none; }
.dropzone.dragover { border-color: var(--accent); background: #be3dd914; }
.dropzone-title { color: var(--heading); font-size: 17px; margin-bottom: 6px; }
.link { color: #6fb6e0; text-decoration: underline; }

.thumbs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}
.thumb {
  position: relative;
  background: var(--input-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--card-line);
}
.thumb.bad { box-shadow: inset 0 0 0 1px var(--error); }
.thumb img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #111; }
.thumb-meta { padding: 8px 10px; font-size: 13px; }
.thumb-name { color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb-size { color: var(--muted); }
.thumb-problem { color: var(--error); font-size: 12px; margin-top: 2px; }
.thumb-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 0;
  color: #fff;
  background: #000000b3;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.thumb-remove:hover { background: var(--error); }

/* Jobs */
.jobs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 14px;
  align-items: start;
}
.job {
  background: #ffffff06;
  border-radius: 16px;
  padding: 16px;
  box-shadow: inset 0 0 0 1px var(--card-line);
}
.job-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.job-name { color: var(--heading); font-family: var(--font-heading); font-size: 18px; font-weight: 500; word-break: break-word; }
.job-id { color: var(--muted); font-family: var(--font-mono); font-size: 12px; word-break: break-all; margin-top: 2px; }
.job-status-text { margin-top: 10px; font-size: 15px; }
.job-elapsed { color: var(--muted); font-size: 13px; margin-top: 4px; }
.job-error { color: #ffdede; font-size: 14px; margin-top: 8px; }
.job-error code { color: #ffdede; }

.badge {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 99px;
  white-space: nowrap;
}
.badge-active { color: #bfe3f7; background: #287cac33; }
.badge-succeeded { color: #c9f5e1; background: #3ccf9133; }
.badge-failed { color: #ffdede; background: #fa4d5033; }
.badge-needs_attention, .badge-timeout { color: #ffe3b8; background: #ef9f2733; }

.badge-active::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #6fb6e0;
  vertical-align: 1px;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .25; } }

.job-result { margin: 12px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.job-result dt { color: var(--muted); }
.job-result dd { margin: 0; color: var(--heading); word-break: break-all; }
.job-thumb { display: block; width: 100%; max-width: 360px; margin-top: 12px; border-radius: 12px; background: #111; }

/* Full-screen and opaque: nothing of the page shows through */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #000 radial-gradient(700px 360px at 50% 50%, #fa4d501a, transparent 70%);
}
.modal-box { display: flex; flex-direction: column; align-items: center; gap: 48px; text-align: center; }

/* Shown instead of the generator when the organization has no subscription */
.forbidden {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  border-radius: var(--radius-card);
  background: radial-gradient(600px 300px at 50% 50%, #fa4d5014, transparent 70%);
}
.forbidden-title {
  margin: 0;
  color: var(--heading);
  font-family: var(--font-heading);
  font-weight: 600;
  max-width: 18ch;
  font-size: clamp(32px, 6vw, 64px);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
