:root {
  color-scheme: light;
  --bg: #fff7fb;
  --panel: #fffefe;
  --panel-soft: #fff1f7;
  --line: #ecd5e3;
  --text: #463344;
  --muted: #8a6f82;
  --accent: #7fd8c8;
  --accent-strong: #ff8fbd;
  --accent-warm: #ffd56f;
  --warn: #d9812d;
  --radius: 8px;
}

body.night-mode {
  --bg: #071f25;
  --panel: #0d2e35;
  --panel-soft: #123b43;
  --line: #2f6971;
  --text: #e9fffb;
  --muted: #9ac6c4;
  --accent: #5fe0c7;
  --accent-strong: #6bb7ff;
  --accent-warm: #ffdf7e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 143, 189, 0.28), transparent 20%),
    radial-gradient(circle at 88% 16%, rgba(127, 216, 200, 0.32), transparent 22%),
    radial-gradient(circle at 75% 92%, rgba(255, 213, 111, 0.26), transparent 24%),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial,
    sans-serif;
}

body::before,
body::after {
  position: fixed;
  z-index: 0;
  width: 180px;
  height: 180px;
  border: 2px solid rgba(255, 143, 189, 0.22);
  border-radius: 38% 62% 52% 48%;
  content: "";
  pointer-events: none;
}

body.night-mode {
  background:
    radial-gradient(circle at 14% 10%, rgba(95, 224, 199, 0.2), transparent 22%),
    radial-gradient(circle at 86% 18%, rgba(107, 183, 255, 0.18), transparent 24%),
    radial-gradient(circle at 74% 90%, rgba(21, 90, 101, 0.28), transparent 24%),
    var(--bg);
}

body::before {
  left: -58px;
  top: 120px;
  background: rgba(255, 255, 255, 0.36);
}

body::after {
  right: -72px;
  bottom: 90px;
  background: rgba(127, 216, 200, 0.2);
}

button,
input,
textarea {
  font: inherit;
}

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

button {
  border: 0;
  cursor: pointer;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.workspace {
  display: grid;
  gap: 18px;
}

.topbar,
.section-head,
.actions {
  display: flex;
  align-items: center;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
}

h2 {
  font-size: 18px;
}

.status {
  max-width: 46ch;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
}

body.night-mode .status {
  background: rgba(13, 46, 53, 0.78);
}

.guide-panel,
.paste-panel,
.items-panel,
.editor-panel,
.output-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 254, 254, 0.9);
  box-shadow: 0 18px 50px rgba(180, 107, 139, 0.16);
}

body.night-mode .guide-panel,
body.night-mode .paste-panel,
body.night-mode .items-panel,
body.night-mode .editor-panel,
body.night-mode .output-panel {
  background: rgba(13, 46, 53, 0.92);
  box-shadow: 0 18px 50px rgba(0, 28, 34, 0.3);
}

.guide-panel {
  padding: 16px;
}

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

.guide-grid div {
  min-height: 86px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff9fc;
}

body.night-mode .guide-grid div,
body.night-mode input,
body.night-mode textarea,
body.night-mode table {
  background: #092932;
}

.guide-grid strong {
  display: block;
  margin-bottom: 8px;
  color: var(--accent-strong);
}

.guide-grid span {
  color: var(--muted);
  line-height: 1.45;
}

.paste-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

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

input,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #fffafd;
  outline: none;
}

input {
  height: 40px;
  padding: 0 11px;
}

textarea {
  resize: vertical;
  padding: 10px 11px;
  line-height: 1.45;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(65, 199, 185, 0.14);
}

.primary,
.secondary,
.ghost,
.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 700;
  white-space: nowrap;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    border-color 150ms ease,
    background 150ms ease;
}

.primary {
  color: #2d2630;
  background: linear-gradient(135deg, #8ee8d5, #ffd8ea);
}

.primary:hover {
  background: linear-gradient(135deg, #98efdf, #ffc7df);
  box-shadow: 0 10px 22px rgba(255, 143, 189, 0.26);
  transform: translateY(-1px);
}

.secondary {
  color: var(--text);
  background: #fff7fb;
  border: 1px solid var(--line);
}

.secondary:hover,
.ghost:hover {
  border-color: var(--accent-strong);
  box-shadow: 0 8px 18px rgba(127, 216, 200, 0.18);
  transform: translateY(-1px);
}

body.night-mode .primary {
  color: #06282d;
  background: linear-gradient(135deg, #5fe0c7, #6bb7ff);
}

body.night-mode .primary:hover {
  background: linear-gradient(135deg, #73efd9, #7fc2ff);
  box-shadow: 0 10px 22px rgba(95, 224, 199, 0.25);
}

body.night-mode .secondary,
body.night-mode .ghost,
body.night-mode .gear-item {
  background: #123b43;
}

.ghost {
  color: var(--muted);
  background: #fff9fc;
  border: 1px solid var(--line);
}

.icon-btn {
  width: 42px;
  min-width: 42px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  gap: 18px;
}

.items-panel,
.editor-panel,
.output-panel {
  padding: 16px;
}

.section-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.item-list {
  display: grid;
  gap: 10px;
  max-height: 620px;
  overflow: auto;
}

.item-list.empty {
  min-height: 160px;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 14px;
}

.gear-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: inherit;
  text-align: left;
  background: #fff9fc;
  cursor: grab;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.gear-item:hover {
  border-color: var(--accent-strong);
  box-shadow: 0 12px 24px rgba(255, 143, 189, 0.14);
  transform: translateY(-1px);
}

body.night-mode .gear-item:hover {
  box-shadow: 0 12px 24px rgba(95, 224, 199, 0.14);
}

.gear-item.active {
  border-color: var(--accent);
  background: #f2fffb;
  box-shadow: 0 10px 24px rgba(127, 216, 200, 0.2);
}

.gear-item.dragging {
  opacity: 0.6;
  transform: scale(0.98);
}

.gear-item.drag-over {
  border-color: var(--accent-strong);
  box-shadow: inset 0 0 0 2px rgba(255, 143, 189, 0.25);
}

.text-thumb {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: #2d2630;
  background: linear-gradient(135deg, #ffd8ea, #8ee8d5);
  font-weight: 800;
}

.gear-main {
  min-width: 0;
  padding: 0;
  color: inherit;
  text-align: left;
  background: transparent;
}

.gear-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gear-item span {
  color: var(--muted);
  font-size: 12px;
}

.item-actions {
  display: flex;
  gap: 6px;
}

.mini-btn {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #4d3a48;
  background: #ffffff;
  font-weight: 800;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    border-color 140ms ease;
}

.mini-btn:hover {
  border-color: var(--accent-strong);
  background: #fff0f7;
  box-shadow: 0 8px 14px rgba(255, 143, 189, 0.2);
  transform: translateY(-1px) scale(1.05);
}

body.night-mode .mini-btn:hover {
  background: #174a53;
  box-shadow: 0 8px 14px rgba(95, 224, 199, 0.18);
}

body.night-mode .mini-btn {
  border-color: #67d8c8;
  color: #e9fffb;
  background: #174a53;
  box-shadow: inset 0 0 0 1px rgba(95, 224, 199, 0.18);
}

body.night-mode .copy-one {
  color: #092932;
  background: #5fe0c7;
}

body.night-mode .delete-one {
  color: #fff2f8;
  border-color: #ff8fbd;
  background: #6b3654;
}

body.night-mode .copy-one:hover {
  background: #73efd9;
  box-shadow: 0 8px 16px rgba(95, 224, 199, 0.28);
}

body.night-mode .delete-one:hover {
  background: #824365;
  box-shadow: 0 8px 16px rgba(255, 143, 189, 0.24);
}

.gear-form {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 10px 12px;
  align-content: start;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  color: var(--text);
  font-weight: 700;
}

.checkline input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.output-panel {
  display: grid;
  gap: 12px;
}

.output {
  min-height: 160px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: #fffafd;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: #6b425d;
  background: #ffe5f0;
  font-size: 13px;
}

body.night-mode th {
  color: #dffefa;
  background: #164d57;
}

td {
  color: var(--text);
  line-height: 1.45;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 1px solid rgba(255, 143, 189, 0.55);
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 250, 253, 0.96);
  box-shadow: 0 16px 40px rgba(180, 107, 139, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

body.night-mode .toast {
  border-color: rgba(95, 224, 199, 0.55);
  background: rgba(9, 41, 50, 0.96);
  box-shadow: 0 16px 40px rgba(0, 28, 34, 0.38);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .shell {
    padding: 18px;
  }

  .topbar,
  .top-actions,
  .paste-panel,
  .content-grid,
  .guide-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

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

  .checkline {
    margin-top: 4px;
  }
}

@media (max-width: 560px) {
  .shell {
    padding: 12px;
  }

  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .actions,
  .section-head {
    width: 100%;
  }

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

  .primary,
  .secondary,
  .ghost {
    width: 100%;
  }

  .toast {
    right: 12px;
    bottom: 12px;
  }
}
