:root {
  color-scheme: light;
  --bg: #eef1f5;
  --panel: #ffffff;
  --panel-soft: #f7f8fa;
  --line: #d9dee7;
  --line-strong: #b8c0cc;
  --text: #17202e;
  --muted: #627083;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --warning: #9a5b00;
  --ink: #111827;
  --blue: #2454a6;
  --green: #15803d;
  --shadow: 0 14px 34px rgba(20, 31, 46, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.home-shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0;
}

.home-header {
  min-height: 230px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 34px;
  background: #17202e;
  color: #f8fafc;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand-row,
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-row {
  margin-bottom: 24px;
}

.brand {
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #f6c85f;
  color: #17202e;
  display: inline-grid;
  place-items: center;
  font-weight: 900;
  flex: 0 0 auto;
}

.brand-kicker {
  color: #c7d0df;
  font-size: 13px;
  font-weight: 800;
}

.home-header h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1;
  letter-spacing: 0;
}

.home-header p {
  max-width: 720px;
  margin: 18px 0 0;
  color: #c7d0df;
  font-size: 16px;
  line-height: 1.6;
}

.page-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.page-card {
  min-height: 150px;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.page-card:hover {
  border-color: #99d8d1;
  transform: translateY(-1px);
}

.page-code {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef8f7;
  color: var(--accent-dark);
  font-weight: 900;
}

.page-card strong {
  color: var(--ink);
  font-size: 17px;
}

.page-card small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  background: #17202e;
  color: #f8fafc;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand-title {
  display: block;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.15;
}

.brand-subtitle {
  display: block;
  color: #aeb8c7;
  font-size: 12px;
  margin-top: 4px;
}

.mode-list {
  display: grid;
  gap: 8px;
}

.mode-button {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #e5e7eb;
  border-radius: 8px;
  padding: 11px 12px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  text-align: left;
}

.mode-button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.mode-button.active {
  background: #eef8f7;
  color: #0f2f2c;
  border-color: #99d8d1;
}

.mode-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.1);
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
}

.mode-button.active .mode-icon {
  background: var(--accent);
  color: #ffffff;
}

.mode-name,
.mode-path,
.upload-name,
.upload-url {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mode-name {
  font-size: 13px;
  font-weight: 750;
}

.mode-path {
  margin-top: 2px;
  font-size: 11px;
  color: #aeb8c7;
}

.mode-button.active .mode-path {
  color: #42625f;
}

.sidebar-note {
  margin-top: auto;
  color: #c7d0df;
  font-size: 12px;
  line-height: 1.55;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 16px;
}

.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 76px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.page-title {
  min-width: 0;
}

.page-title h1 {
  margin: 0;
  font-size: 23px;
  line-height: 1.2;
  color: var(--ink);
}

.page-title p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.health {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 12px;
  white-space: nowrap;
}

.home-header .health {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: #c7d0df;
}

.health-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warning);
}

.health.ok .health-dot {
  background: var(--green);
}

.content {
  padding: 22px 28px 32px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  align-items: start;
}

.section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.section + .section {
  margin-top: 20px;
}

.section-header {
  min-height: 58px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fbfcfd;
}

.section-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

.section-caption {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.section-body {
  padding: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
  align-content: start;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  color: #263243;
  font-size: 12px;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--ink);
  background: #ffffff;
  padding: 10px 11px;
  outline: none;
  min-height: 41px;
}

textarea {
  min-height: 160px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.check-field {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 41px;
  padding-top: 22px;
}

.url-row,
.upload-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

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

.hidden-file-input {
  display: none;
}

.icon-button,
.small-button,
.primary-button,
.secondary-button {
  border: 1px solid transparent;
  border-radius: 7px;
  min-height: 41px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  white-space: nowrap;
}

.icon-button {
  width: 42px;
  padding: 0;
  background: var(--panel-soft);
  border-color: var(--line);
  color: var(--blue);
  font-size: 16px;
}

.icon-button.busy {
  color: #ffffff;
  background: var(--warning);
  border-color: var(--warning);
}

.small-button {
  min-height: 34px;
  padding: 0 10px;
  background: var(--panel-soft);
  border-color: var(--line);
  color: #334155;
  font-size: 12px;
}

.primary-button {
  width: 100%;
  padding: 0 16px;
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  padding: 0 14px;
  color: #263243;
  background: #ffffff;
  border-color: var(--line-strong);
}

.primary-button:disabled,
.secondary-button:disabled,
.small-button:disabled,
.icon-button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.actions .primary-button {
  flex: 1;
}

.upload-box {
  display: grid;
  gap: 12px;
}

.file-picker {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
  display: grid;
  gap: 10px;
}

.uploads-list {
  display: grid;
  gap: 8px;
}

.upload-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--panel-soft);
  display: grid;
  gap: 9px;
}

.upload-name {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
}

.upload-url {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.use-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status {
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 12px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.status.error {
  border-color: #f2b8b5;
  background: #fff1f0;
  color: var(--danger);
}

.status.success {
  border-color: #a6d8b3;
  background: #effaf2;
  color: #14532d;
}

.progress {
  margin-top: 10px;
  height: 7px;
  border-radius: 999px;
  background: #d7dde6;
  overflow: hidden;
  display: none;
}

.progress.active {
  display: block;
}

.progress span {
  display: block;
  height: 100%;
  width: 38%;
  border-radius: inherit;
  background: var(--accent);
  animation: loading 1.1s ease-in-out infinite;
}

@keyframes loading {
  0% {
    transform: translateX(-110%);
  }

  100% {
    transform: translateX(280%);
  }
}

.video-frame {
  background: #0b1220;
  border-radius: 8px;
  overflow: hidden;
  min-height: 214px;
  display: grid;
  place-items: center;
  color: #aeb8c7;
  text-align: center;
  padding: 12px;
}

.video-frame video {
  display: none;
  width: 100%;
  max-height: 520px;
  background: #000000;
}

.video-frame.has-video {
  padding: 0;
}

.video-frame.has-video video {
  display: block;
}

.video-frame.has-video .empty-video {
  display: none;
}

.result-link {
  display: none;
  margin-top: 12px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.result-link.active {
  display: block;
}

pre {
  margin: 0;
  max-height: 360px;
  overflow: auto;
  background: #111827;
  color: #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: #17202e;
  color: #ffffff;
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  font-size: 13px;
  display: none;
  z-index: 20;
}

.toast.active {
  display: block;
}

@media (max-width: 1120px) {
  .page-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .home-header {
    flex-direction: column;
    padding: 24px;
  }

  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .mode-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-note {
    display: none;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .content {
    padding: 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .check-field {
    padding-top: 0;
  }
}

@media (max-width: 560px) {
  .page-grid,
  .mode-list,
  .actions,
  .upload-row,
  .url-row {
    grid-template-columns: 1fr;
  }

  .url-row,
  .upload-row,
  .actions {
    display: grid;
  }

  .icon-button {
    width: 100%;
  }
}
