:root {
  --bg: #f4ede2;
  --paper: rgba(255, 252, 248, 0.97);
  --paper-deep: #f7efe5;
  --ink: #1f1a16;
  --muted: #76695d;
  --accent: #972326;
  --accent-soft: rgba(151, 35, 38, 0.08);
  --line: rgba(31, 26, 22, 0.12);
  --line-strong: rgba(151, 35, 38, 0.28);
  --shadow: rgba(72, 45, 16, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(214, 172, 118, 0.08), transparent 26%),
    radial-gradient(circle at bottom right, rgba(151, 35, 38, 0.035), transparent 24%),
    linear-gradient(180deg, #fbf7f1 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
}

button,
textarea {
  font: inherit;
}

.shell {
  width: min(860px, calc(100% - 24px));
  margin: 0 auto;
  padding: 44px 0 60px;
}

.card {
  position: relative;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), transparent 34%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-deep) 100%);
  box-shadow: 0 28px 70px var(--shadow);
  backdrop-filter: blur(16px);
}

.card::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(151, 35, 38, 0.08);
  border-radius: 22px;
  pointer-events: none;
}

.hero {
  position: relative;
  display: grid;
  gap: 8px;
  padding-right: 120px;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-note {
  color: var(--muted);
  font-size: 0.95rem;
}

.hero-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(31, 26, 22, 0.08);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  text-decoration: none;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.hero-link:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 26, 22, 0.16);
  background: rgba(255, 255, 255, 0.9);
}

.eyebrow {
  width: fit-content;
  padding: 0.28rem 0.68rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", "Source Han Serif SC", serif;
  font-size: clamp(2.45rem, 4.2vw, 3.55rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: 0.01em;
}

.form {
  display: grid;
  gap: 14px;
  margin-top: 30px;
}

.drop-panel {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 18px;
  height: 330px;
  padding: 28px 28px 24px;
  border: 1px solid rgba(151, 35, 38, 0.2);
  border-radius: 28px;
  background:
    radial-gradient(circle at top, rgba(213, 167, 110, 0.09), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(251, 246, 239, 0.98)),
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 31px,
      rgba(151, 35, 38, 0.018) 31px,
      rgba(151, 35, 38, 0.018) 32px
    );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 10px 28px rgba(78, 53, 23, 0.04);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.drop-panel::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px dashed rgba(151, 35, 38, 0.2);
  border-radius: 20px;
  pointer-events: none;
}

.drop-panel[data-dragging="true"] {
  transform: translateY(-2px);
  border-color: rgba(151, 35, 38, 0.44);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 20px 44px rgba(151, 35, 38, 0.08);
}

.drop-panel[data-selected="true"] {
  border-color: rgba(24, 109, 70, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(247, 243, 236, 0.98)),
    radial-gradient(circle at top left, rgba(125, 175, 147, 0.06), transparent 42%);
}

.drop-copy {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  width: 100%;
  height: 100%;
  padding: 18px 28px;
  min-height: 0;
  text-align: center;
}

.drop-panel[data-mode="files"] .drop-copy {
  justify-items: stretch;
  align-content: start;
  gap: 8px;
  padding: 12px 18px 4px;
  text-align: left;
}

.drop-panel[data-mode="text"] .drop-copy {
  justify-items: stretch;
  align-content: stretch;
  gap: 0;
  padding: 22px 26px;
  text-align: left;
}

.drop-kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.6rem;
  padding: 0.4rem 0.78rem;
  border-radius: 999px;
  border: 1px solid rgba(31, 26, 22, 0.08);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.drop-kind[hidden] {
  display: none;
}

.drop-kind[data-variant="file"] {
  color: var(--accent);
  background: rgba(151, 35, 38, 0.07);
}

.drop-kind[data-variant="folder"],
.drop-kind[data-variant="batch"] {
  color: #6c5535;
  background: rgba(178, 147, 100, 0.14);
}

.drop-kind[data-variant="text"] {
  color: #246247;
  background: rgba(36, 98, 71, 0.1);
}

.drop-title {
  max-width: 18ch;
  font-family: "Songti SC", "STSong", "Source Han Serif SC", serif;
  font-size: clamp(1.8rem, 3.4vw, 2.7rem);
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: 0.01em;
  word-break: break-word;
}

.drop-panel[data-mode="empty"] .drop-title {
  max-width: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.drop-detail {
  max-width: min(42rem, 100%);
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
  word-break: break-word;
}

.file-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  width: 100%;
  height: 100%;
  margin-top: 0;
  padding-right: 4px;
  overflow: auto;
  align-content: start;
}

.file-list[hidden] {
  display: none;
}

.file-list[data-count="1"] {
  align-content: center;
  justify-items: center;
}

.file-list[data-count="1"] .file-card {
  width: min(100%, 360px);
}

.file-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px 15px;
  border: 1px solid rgba(31, 26, 22, 0.07);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 8px 18px rgba(78, 53, 23, 0.04);
}

.file-card-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.file-card-name {
  min-width: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  word-break: break-word;
}

.file-card-remove {
  flex: none;
  padding: 5px 10px;
  border: 1px solid rgba(31, 26, 22, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1;
  cursor: pointer;
  transition:
    background 180ms ease,
    color 180ms ease,
    border-color 180ms ease;
}

.file-card-remove:hover {
  color: var(--accent);
  border-color: rgba(151, 35, 38, 0.16);
  background: rgba(151, 35, 38, 0.06);
}

.file-card-meta {
  min-width: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
  word-break: break-word;
}

.drop-detail[hidden] {
  display: none;
}

.inline-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 0.18em;
  padding: 0.1em 0.48em 0.14em;
  border-radius: 999px;
  border: 1px solid rgba(31, 26, 22, 0.08);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", sans-serif;
  font-size: 0.66em;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.05;
  vertical-align: middle;
  transform: translateY(0);
}

.inline-chip-action {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  color: inherit;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.inline-chip-action:hover {
  transform: translateY(0);
  box-shadow: none;
}

.inline-chip-action:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(151, 35, 38, 0.14);
}

.inline-chip-file {
  color: #8f2327;
  background: rgba(151, 35, 38, 0.06);
}

.inline-chip-folder {
  color: #6b5537;
  background: rgba(174, 145, 100, 0.1);
}

.inline-separator {
  display: inline-block;
  margin: 0 0.08em;
  color: rgba(31, 26, 22, 0.72);
}

.drop-title[data-variant="file"] {
  color: #7e1d20;
  font-size: clamp(1.28rem, 2.2vw, 1.7rem);
  letter-spacing: 0.01em;
}

.drop-title[data-variant="folder"],
.drop-title[data-variant="batch"] {
  color: #685132;
  font-size: clamp(1.28rem, 2.2vw, 1.7rem);
}

.drop-title[data-variant="text"] {
  color: #245b45;
  font-size: clamp(1.28rem, 2.2vw, 1.7rem);
}

.drop-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
}

.drop-actions[hidden] {
  display: none;
}

.text-toggle,
.clear-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(31, 26, 22, 0.08);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.clear-button-global {
  min-width: 72px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.82);
}

.clear-button-floating {
  position: absolute;
  top: -48px;
  right: 18px;
  z-index: 2;
  min-width: 72px;
  min-height: 40px;
  padding: 8px 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.84);
}

.text-toggle {
  min-width: 104px;
  color: var(--accent);
  background: rgba(151, 35, 38, 0.07);
  font-weight: 600;
}

.text-toggle:hover,
.clear-button:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 26, 22, 0.16);
  background: rgba(255, 255, 255, 0.9);
}

.text-input {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  resize: none;
  line-height: 1.75;
  outline: none;
}

.text-input:focus {
  background: transparent;
  box-shadow: none;
}

.text-input::placeholder {
  color: rgba(31, 26, 22, 0.48);
}

.form-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-end;
  gap: 16px;
  min-height: 56px;
  padding: 0 4px;
}

.footer-side {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1 1 auto;
  min-height: 48px;
  min-width: 0;
}

.action-cluster {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: none;
}

.submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 9.5rem;
  min-height: 48px;
  padding: 13px 24px;
  border: 1px solid rgba(151, 35, 38, 0.12);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #b93033);
  color: white;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(151, 35, 38, 0.16);
  flex: none;
}

.submit:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
}

.status {
  min-height: 1.4rem;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 34rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status[data-type="success"] {
  color: #186d46;
}

.status[data-type="error"] {
  color: #a02525;
}

.status:empty {
  visibility: hidden;
}

.risk-note {
  margin: 18px 4px 0;
  padding: 12px 14px;
  border: 1px solid rgba(151, 35, 38, 0.12);
  border-radius: 16px;
  background: rgba(151, 35, 38, 0.05);
  color: #7b2a2d;
  font-size: 0.92rem;
  line-height: 1.6;
}

.risk-note strong {
  font-weight: 600;
}

.shell-wide {
  width: min(1180px, calc(100% - 24px));
}

.ops-actions {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}

.ops-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.ops-card,
.ops-section {
  position: relative;
  padding: 22px;
  border: 1px solid rgba(31, 26, 22, 0.08);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 10px 24px rgba(78, 53, 23, 0.04);
}

.ops-card-label {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric-item {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(249, 243, 236, 0.96));
  border: 1px solid rgba(31, 26, 22, 0.06);
}

.metric-item strong {
  font-size: 1.4rem;
  line-height: 1;
}

.metric-item span {
  color: var(--muted);
  font-size: 0.9rem;
}

.stack-list {
  display: grid;
  gap: 10px;
}

.stack-item {
  display: grid;
  gap: 4px;
  padding: 13px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(31, 26, 22, 0.06);
}

.stack-item strong {
  font-size: 0.98rem;
}

.stack-item span,
.stack-item em {
  color: var(--muted);
  font-size: 0.88rem;
  font-style: normal;
  word-break: break-word;
}

.stack-item[data-available="false"] {
  border-color: rgba(151, 35, 38, 0.18);
  background: rgba(151, 35, 38, 0.04);
}

.ops-section {
  margin-top: 18px;
}

.ops-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.ops-section-head h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", "Source Han Serif SC", serif;
  font-size: 1.45rem;
}

.ops-section-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.table-shell {
  overflow-x: auto;
}

.ops-table {
  width: 100%;
  border-collapse: collapse;
}

.ops-table th,
.ops-table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(31, 26, 22, 0.08);
  text-align: left;
  vertical-align: top;
}

.ops-table th {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.table-subtle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 0.32rem 0.64rem;
  border-radius: 999px;
  background: rgba(31, 26, 22, 0.08);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
}

.pill[data-status="completed"] {
  background: rgba(24, 109, 70, 0.12);
  color: #186d46;
}

.pill[data-status="failed"],
.pill[data-status="timeout"] {
  background: rgba(151, 35, 38, 0.1);
  color: #972326;
}

.pill[data-status="running"] {
  background: rgba(178, 147, 100, 0.16);
  color: #6c5535;
}

.pill[data-status="queued"] {
  background: rgba(102, 89, 70, 0.12);
  color: #665946;
}

.pill[data-status="canceled"] {
  background: rgba(31, 26, 22, 0.08);
  color: var(--muted);
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 16px, 760px);
    padding-top: 18px;
  }

  .card {
    padding: 20px;
    border-radius: 22px;
  }

  .card::after {
    inset: 10px;
    border-radius: 16px;
  }

  .hero {
    padding-right: 0;
  }

  .drop-panel {
    height: 250px;
    padding: 22px;
  }

  .drop-panel::before {
    border-radius: 18px;
  }

  .drop-copy {
    padding: 10px 18px;
  }

  .drop-panel[data-mode="files"] .drop-copy {
    padding: 12px 12px 4px;
  }

  .drop-panel[data-mode="text"] .drop-copy {
    padding: 16px 18px;
  }

  .drop-panel[data-mode="empty"] .drop-title {
    max-width: 12ch;
    display: inline;
    white-space: normal;
  }

  .clear-button-floating {
    top: -40px;
    right: 12px;
    min-width: 64px;
    min-height: 36px;
    padding: 7px 12px;
  }

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

  .form-footer {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .ops-actions {
    grid-template-columns: 1fr;
  }

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

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

  .ops-section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-side {
    justify-content: space-between;
  }

  .action-cluster {
    width: 100%;
    justify-content: stretch;
  }

  .submit {
    width: 100%;
    justify-content: center;
  }
}
