:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #eef7f6;
  --ink: #20242b;
  --muted: #667085;
  --line: #d9e1ea;
  --teal: #0f766e;
  --teal-strong: #0b5f59;
  --coral: #e85d4f;
  --amber: #e5a82d;
  --blue: #2f6fed;
  --success: #0f8a5f;
  --danger: #bc2d34;
  --shadow: 0 18px 44px rgba(35, 42, 58, 0.13);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  min-width: 320px;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.site-header {
  position: relative;
  overflow: hidden;
  min-height: 360px;
  color: #ffffff;
  background: #18312f;
}

.header-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.header-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(9, 28, 26, 0.9), rgba(15, 118, 110, 0.58), rgba(232, 93, 79, 0.18));
}

.header-inner {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 44px;
}

.brand-row,
.workbench-intro,
.workbench-grid,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.17);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.brand strong {
  display: block;
  font-size: 1rem;
}

.brand small {
  display: block;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.78rem;
}

.top-links {
  display: flex;
  gap: 14px;
  font-size: 0.93rem;
}

.top-links a {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.82);
}

.workbench-intro {
  align-items: flex-end;
  padding-top: 74px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 8px;
  color: #bff4ed;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.78rem;
}

h1 {
  margin: 0;
  max-width: 710px;
  font-size: clamp(2.35rem, 6vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.intro-copy {
  max-width: 620px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.08rem;
  line-height: 1.6;
}

.tool-workbench {
  width: min(1180px, calc(100% - 32px));
  margin: -38px auto 0;
  position: relative;
  z-index: 3;
}

.tool-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tool-tab {
  min-height: 48px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

.tool-tab svg,
.brand svg,
.button-row svg,
.trust-panel svg,
.dropzone svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.1;
}

.tool-tab.is-active {
  background: var(--teal);
  color: #ffffff;
}

.workbench-grid {
  align-items: flex-start;
  margin-top: 18px;
}

.panels {
  flex: 1 1 auto;
  min-width: 0;
}

.tool-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 16px 32px rgba(40, 48, 68, 0.08);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.panel-kicker {
  color: var(--teal);
  margin-bottom: 6px;
}

h2 {
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 2.05rem);
  letter-spacing: 0;
}

.panel-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  background: #fff6da;
  color: #81560a;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 188px;
  padding: 26px;
  border: 1.5px dashed #a7bdc8;
  border-radius: 8px;
  background: #f8fbfc;
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.dropzone:hover,
.dropzone.is-dragging {
  border-color: var(--teal);
  background: var(--surface-soft);
  transform: translateY(-1px);
}

.dropzone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.dropzone svg {
  width: 38px;
  height: 38px;
  color: var(--teal);
}

.dropzone strong {
  font-size: 1.05rem;
}

.dropzone small,
.file-list,
.trust-panel span,
.output-meta,
.site-footer {
  color: var(--muted);
}

.file-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 18px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  font-size: 0.92rem;
}

.file-item span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.merge-shell {
  border: 1px solid #c9d4df;
  background: #ffffff;
}

.merge-shell input[type="file"] {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.merge-canvas {
  min-height: 312px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 34px;
  padding: 28px;
  background: #fdfdfd;
  overflow-x: auto;
}

.merge-canvas.is-dragging {
  background: #f3fbfa;
  outline: 2px dashed var(--teal);
  outline-offset: -10px;
}

.merge-preview-list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  min-width: min-content;
}

.merge-card {
  width: 212px;
  min-height: 282px;
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  padding: 14px 14px 12px;
  border: 1px solid #dfe5ec;
  border-radius: 4px;
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(31, 41, 55, 0.08);
  text-align: center;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.merge-card:hover,
.merge-card:focus-visible,
.merge-card.is-selected {
  border-color: var(--blue);
  box-shadow: 0 18px 40px rgba(47, 111, 237, 0.18);
  transform: translateY(-1px);
  outline: 0;
}

.merge-card-top {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #263242;
  font-size: 0.92rem;
}

.merge-card-actions {
  display: inline-flex;
  gap: 8px;
  flex: 0 0 auto;
}

.merge-card-actions button,
.icon-only-action,
.merge-preview-close {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #d6dde6;
  border-radius: 999px;
  background: #ffffff;
  color: #20242b;
  box-shadow: 0 3px 9px rgba(31, 41, 55, 0.12);
}

.merge-card-actions svg,
.icon-only-action svg,
.merge-preview-close svg,
.merge-add-card svg {
  width: 19px;
  height: 19px;
}

.merge-thumb {
  min-height: 176px;
  display: grid;
  place-items: center;
}

.merge-thumb img {
  max-width: 142px;
  max-height: 176px;
  object-fit: contain;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(35, 42, 58, 0.18);
}

.merge-thumb-fallback {
  width: 114px;
  height: 154px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #f7fafc;
  color: var(--teal);
}

.merge-card strong {
  display: block;
  min-width: 0;
  color: #1f2937;
  font-size: 0.94rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.merge-add-card {
  width: 146px;
  height: 146px;
  flex: 0 0 146px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #ffffff;
  color: #172033;
  box-shadow: 0 8px 18px rgba(31, 41, 55, 0.12);
}

.merge-add-card span {
  max-width: 112px;
  color: #172033;
  font-weight: 500;
  line-height: 1.3;
}

.merge-action-bar {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px;
  border-top: 1px solid #c9d4df;
  background: #ffffff;
}

.merge-action-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.merge-select-button,
.merge-submit-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  padding: 0 30px;
  font-weight: 750;
}

.merge-select-button {
  min-width: 160px;
  border: 1px solid #006fbd;
  background: #ffffff;
  color: #111827;
  box-shadow: 0 3px 8px rgba(0, 111, 189, 0.14);
}

.merge-submit-button {
  min-width: 160px;
  border: 1px solid #006fbd;
  background: #0073c8;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(0, 111, 189, 0.22);
}

.icon-only-action {
  border-color: #0073c8;
  background: #0073c8;
  color: #ffffff;
}

.icon-only-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.merge-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 24, 39, 0.6);
}

.merge-preview-dialog {
  position: relative;
  width: min(520px, 100%);
  display: grid;
  gap: 14px;
  justify-items: center;
  padding: 24px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
}

.merge-preview-dialog img {
  max-width: 100%;
  max-height: 68vh;
  object-fit: contain;
  box-shadow: 0 6px 18px rgba(35, 42, 58, 0.18);
}

.merge-preview-close {
  position: absolute;
  top: 10px;
  right: 10px;
}

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

.single-field {
  display: block;
  margin: 18px 0;
}

label span {
  display: block;
  margin-bottom: 7px;
  color: #3b4655;
  font-size: 0.9rem;
  font-weight: 750;
}

input[type="text"],
input[type="password"],
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cbd6e1;
  border-radius: 7px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--ink);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--teal);
}

output {
  display: inline-block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 18px;
}

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

.check-row span {
  margin: 0;
  font-weight: 650;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.primary-action,
.ghost-action,
.download-link {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 7px;
  padding: 0 16px;
  text-decoration: none;
  font-weight: 800;
}

.primary-action {
  border: 1px solid var(--teal-strong);
  background: var(--teal);
  color: #ffffff;
}

.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.ghost-action {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.download-link {
  border: 1px solid #0b6e50;
  background: #0f8a5f;
  color: #ffffff;
}

.tool-output {
  margin-top: 18px;
}

.output-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f7fbf9;
}

.output-box.is-error {
  background: #fff5f5;
  border-color: #f1b4b8;
  color: var(--danger);
}

.output-box.is-working {
  background: #f7f9ff;
  border-color: #c3d2f3;
  color: #244a91;
}

.output-box.is-success {
  background: #f3fbf7;
  border-color: #b6dfce;
}

.output-title {
  margin: 0 0 10px;
  font-weight: 850;
}

.output-meta {
  margin: 8px 0 0;
  font-size: 0.9rem;
}

.side-column {
  width: 292px;
  flex: 0 0 292px;
  display: grid;
  gap: 14px;
}

.ad-slot {
  min-height: 110px;
  display: grid;
  place-items: center;
  gap: 6px;
  border: 1px solid rgba(163, 174, 190, 0.55);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--muted);
  text-align: center;
  overflow: hidden;
}

.ad-slot span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 5px;
  background: rgba(32, 36, 43, 0.08);
  color: #526070;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.ad-slot strong {
  color: #3c4655;
  font-size: 0.92rem;
}

.ad-slot-top {
  width: min(360px, 100%);
  min-height: 96px;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.36);
  backdrop-filter: blur(12px);
}

.ad-slot-top span {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.ad-slot-top strong {
  color: #ffffff;
}

.ad-slot-side {
  min-height: 260px;
}

.ad-strip {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 0;
}

.ad-strip .ad-slot {
  min-height: 118px;
}

.trust-panel {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.trust-panel svg {
  color: var(--teal);
  flex: 0 0 auto;
}

.trust-panel strong {
  display: block;
  margin-bottom: 4px;
}

.trust-panel span {
  font-size: 0.9rem;
  line-height: 1.45;
}

.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 34px auto 26px;
  justify-content: flex-start;
  flex-wrap: wrap;
  font-size: 0.92rem;
}

.site-footer span {
  font-weight: 850;
  color: var(--ink);
}

.content-page {
  width: min(860px, calc(100% - 32px));
  margin: 42px auto;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(22px, 5vw, 42px);
}

.content-page h1 {
  color: var(--ink);
  font-size: clamp(2rem, 5vw, 3.1rem);
  line-height: 1;
}

.content-page h2 {
  margin-top: 28px;
}

.content-page p,
.content-page li {
  color: #4a5566;
  line-height: 1.7;
}

@media (max-width: 940px) {
  .workbench-intro,
  .workbench-grid {
    display: grid;
  }

  .side-column {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
  }

  .ad-slot-side {
    min-height: 130px;
  }
}

@media (max-width: 720px) {
  .site-header {
    min-height: 420px;
  }

  .brand-row {
    align-items: flex-start;
  }

  .top-links {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .workbench-intro {
    padding-top: 48px;
  }

  .tool-workbench,
  .ad-strip,
  .site-footer,
  .header-inner {
    width: min(100% - 20px, 1180px);
  }

  .tool-panel {
    padding: 18px;
  }

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

  .button-row {
    display: grid;
  }

  .merge-canvas {
    min-height: 280px;
    justify-content: flex-start;
    padding: 18px;
  }

  .merge-preview-list {
    justify-content: flex-start;
    gap: 16px;
  }

  .merge-action-bar {
    display: grid;
  }

  .merge-action-group {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .merge-select-button,
  .merge-submit-button {
    width: 100%;
  }

  .primary-action,
  .ghost-action,
  .download-link {
    width: 100%;
  }
}

@media (max-width: 460px) {
  .brand-row {
    display: grid;
  }

  .top-links {
    justify-content: flex-start;
  }

  .tool-tab {
    min-width: 112px;
    justify-content: center;
  }

  .panel-heading {
    display: grid;
  }

  .panel-badge {
    width: max-content;
  }

  .merge-card {
    width: 184px;
    min-height: 260px;
  }

  .merge-thumb img {
    max-width: 122px;
    max-height: 160px;
  }

  .merge-add-card {
    width: 128px;
    height: 128px;
    flex-basis: 128px;
  }

  .file-item {
    display: grid;
    gap: 4px;
  }
}
