:root {
  color-scheme: dark;
  --bg: #10130f;
  --panel: #171c18;
  --panel-2: #1f2520;
  --line: #344033;
  --text: #f0f4e8;
  --muted: #9faa9a;
  --green: #73e4a2;
  --cyan: #69d7d0;
  --amber: #f2c56a;
  --red: #f0786e;
  --ink: #070906;
  --shadow: 0 26px 80px rgba(0, 0, 0, 0.36);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(115, 228, 162, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(242, 197, 106, 0.07) 1px, transparent 1px),
    radial-gradient(circle at 15% 0%, rgba(105, 215, 208, 0.18), transparent 30%),
    radial-gradient(circle at 92% 18%, rgba(240, 120, 110, 0.14), transparent 32%),
    var(--bg);
  background-size: 48px 48px, 48px 48px, auto, auto, auto;
}

button,
textarea,
input {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid rgba(240, 244, 232, 0.16);
  color: var(--text);
  background: #242b24;
  border-radius: 7px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

button:hover:not(:disabled) {
  border-color: rgba(115, 228, 162, 0.7);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

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

.hero {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(280px, 1fr) minmax(340px, 1.2fr);
  align-items: stretch;
  gap: 14px;
  min-height: 168px;
  margin-bottom: 14px;
}

.brand-block,
.flow-strip,
.status-console,
.panel,
.core,
.format-dock article {
  border: 1px solid rgba(240, 244, 232, 0.14);
  background: linear-gradient(145deg, rgba(31, 37, 32, 0.96), rgba(16, 19, 15, 0.94));
  box-shadow: var(--shadow);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px;
  border-radius: 8px;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 74px;
  aspect-ratio: 1;
  border: 1px solid rgba(115, 228, 162, 0.45);
  background: #0d110d;
  border-radius: 8px;
  overflow: hidden;
}

.brand-mark span {
  position: absolute;
  display: block;
  width: 54px;
  height: 8px;
  background: var(--green);
  transform: rotate(var(--rotate));
  box-shadow: 0 0 24px rgba(115, 228, 162, 0.38);
}

.brand-mark span:nth-child(1) {
  --rotate: 0deg;
}

.brand-mark span:nth-child(2) {
  --rotate: 60deg;
  background: var(--cyan);
}

.brand-mark span:nth-child(3) {
  --rotate: -60deg;
  background: var(--amber);
}

.eyebrow,
.panel-head p {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.75rem, 4vw, 3.55rem);
  line-height: 0.98;
}

h2 {
  font-size: 1.15rem;
}

.flow-strip {
  display: grid;
  grid-template-columns: 1fr 42px 1fr 42px 1fr;
  align-items: center;
  gap: 8px;
  padding: 22px;
  border-radius: 8px;
}

.flow-strip b {
  display: grid;
  min-height: 54px;
  place-items: center;
  padding: 0 10px;
  color: var(--ink);
  background: var(--amber);
  border-radius: 7px;
  text-align: center;
  font-size: 0.92rem;
}

.flow-strip b:nth-of-type(2) {
  color: var(--text);
  background: #28362f;
  border: 1px solid rgba(115, 228, 162, 0.34);
}

.flow-strip b:nth-of-type(3) {
  background: var(--cyan);
}

.flow-strip i {
  height: 2px;
  background: linear-gradient(90deg, var(--amber), var(--green));
}

.status-console {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 18px;
  padding: 22px;
  border-radius: 8px;
}

.status-console span {
  display: block;
  margin-bottom: 8px;
  color: var(--amber);
  font-weight: 800;
}

.status-console p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

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

.status-grid div,
.core-card {
  padding: 12px;
  border: 1px solid rgba(240, 244, 232, 0.11);
  background: rgba(7, 9, 6, 0.36);
  border-radius: 7px;
}

dt,
.core-card span {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

dd,
.core-card b {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
  word-break: break-word;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 220px minmax(0, 1.1fr);
  gap: 14px;
  align-items: stretch;
}

.panel,
.core {
  height: 620px;
  border-radius: 8px;
}

.panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 78px;
  padding: 16px;
  border-bottom: 1px solid rgba(240, 244, 232, 0.1);
}

.segmented {
  display: grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(240, 244, 232, 0.12);
  background: #0d110d;
  border-radius: 8px;
}

.segmented button {
  min-width: 54px;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  color: var(--muted);
  background: transparent;
  border-radius: 6px;
}

.segmented button.is-active {
  color: var(--ink);
  background: var(--green);
}

.dropzone {
  display: grid;
  gap: 6px;
  margin: 14px 16px 0;
  padding: 14px;
  border: 1px dashed rgba(105, 215, 208, 0.5);
  background: rgba(105, 215, 208, 0.08);
  border-radius: 8px;
  cursor: pointer;
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dropzone span {
  color: var(--cyan);
  font-weight: 800;
}

.dropzone small {
  color: var(--muted);
}

.dropzone.is-dragging {
  border-color: var(--amber);
  background: rgba(242, 197, 106, 0.12);
}

textarea {
  width: calc(100% - 32px);
  min-height: 0;
  margin: 14px 16px;
  padding: 16px;
  flex: 1 1 0;
  overflow: auto;
  resize: none;
  color: #e8f2e5;
  background:
    linear-gradient(rgba(240, 244, 232, 0.04) 1px, transparent 1px),
    #0a0d09;
  background-size: 100% 30px;
  border: 1px solid rgba(240, 244, 232, 0.12);
  border-radius: 8px;
  outline: none;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.55;
  tab-size: 2;
}

.output-preview {
  width: calc(100% - 32px);
  min-height: 0;
  margin: 14px 16px;
  padding: 0;
  flex: 1 1 0;
  overflow: auto;
  color: #e8f2e5;
  background: #0a0d09;
  border: 1px solid rgba(240, 244, 232, 0.12);
  border-radius: 8px;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
}

.txt-row {
  display: grid;
  grid-template-columns: max-content;
  min-width: max-content;
  border-bottom: 1px solid rgba(240, 244, 232, 0.07);
}

.txt-row code {
  display: block;
  min-height: 34px;
  padding: 8px 14px;
  white-space: pre;
}

textarea:focus {
  border-color: rgba(115, 228, 162, 0.72);
  box-shadow: 0 0 0 3px rgba(115, 228, 162, 0.12);
}

.panel-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.panel-actions button {
  padding: 0 14px;
}

.primary {
  color: var(--ink);
  border-color: transparent;
  background: var(--amber);
  font-weight: 800;
}

.panel > .panel-actions {
  justify-content: flex-end;
  padding: 0 16px 16px;
}

.core {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
}

.core-ring {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 176px;
  border: 1px solid rgba(115, 228, 162, 0.2);
  background: #0b0f0b;
  border-radius: 8px;
  overflow: hidden;
}

.core-ring span {
  position: absolute;
  width: 132px;
  aspect-ratio: 1;
  border: 12px solid transparent;
  border-top-color: var(--green);
  border-right-color: var(--cyan);
  border-bottom-color: var(--amber);
  border-radius: 50%;
  animation: spin 11s linear infinite;
}

.core-ring strong {
  z-index: 1;
  font-size: 1.1rem;
  color: var(--text);
}

.core-ring em {
  z-index: 1;
  margin-top: 38px;
  color: var(--muted);
  font-style: normal;
  font-size: 0.78rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.platform-meter {
  display: grid;
  gap: 10px;
}

.platform-line {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  min-height: 48px;
  padding: 10px;
  overflow: hidden;
  border: 1px solid rgba(240, 244, 232, 0.1);
  background: rgba(7, 9, 6, 0.34);
  border-radius: 7px;
}

.platform-line span,
.platform-line b {
  position: relative;
  z-index: 1;
}

.platform-line b {
  color: var(--amber);
}

.platform-line i {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--green), var(--cyan));
}

.warning-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--red);
  font-size: 0.84rem;
}

.warning-list li {
  padding: 10px;
  border: 1px solid rgba(240, 120, 110, 0.3);
  background: rgba(240, 120, 110, 0.08);
  border-radius: 7px;
}

.swap-button {
  margin-top: auto;
  color: var(--ink);
  background: var(--cyan);
  border-color: transparent;
  font-weight: 800;
}

.swap-button span {
  margin-right: 6px;
}

.output-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px 16px;
}

.output-footer > span {
  min-width: 0;
  color: var(--muted);
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.format-dock {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.format-dock article {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 8px;
}

.format-dock b {
  color: var(--green);
}

.format-dock span {
  color: var(--muted);
  line-height: 1.55;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  color: var(--ink);
  background: var(--green);
  border-radius: 7px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

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

  .panel,
  .core {
    height: auto;
  }

  .panel {
    height: 560px;
  }

  .core {
    display: grid;
    grid-template-columns: 190px 1fr;
  }

  .swap-button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 1480px);
    padding-top: 10px;
  }

  .brand-block,
  .status-console,
  .panel-head,
  .output-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .brand-block,
  .status-console {
    display: grid;
    grid-template-columns: 1fr;
  }

  .flow-strip {
    grid-template-columns: 1fr;
  }

  .flow-strip i {
    width: 2px;
    height: 22px;
    margin: 0 auto;
  }

  .segmented {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .output-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .status-grid,
  .core,
  .format-dock {
    grid-template-columns: 1fr;
  }

  .panel {
    height: 540px;
  }

  textarea {
    font-size: 0.78rem;
  }
}
