:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #111827;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #4f46e5;
  --accent-2: #eef2ff;
  --danger: #b91c1c;
  --shadow: 0 18px 50px rgba(15, 23, 42, .08);
  --radius: 18px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.page-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.site-header { height: 72px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: #111827; font-size: 12px; letter-spacing: .04em; }
.main-nav { display: flex; gap: 8px; }
.main-nav a { color: #334155; font-weight: 650; font-size: 14px; padding: 9px 12px; border-radius: 9px; }
.main-nav a:hover { background: #fff; }
main { padding-bottom: 24px; }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.home-hero { padding: 78px 0 46px; max-width: 780px; }
.home-hero h1, .tool-hero h1 { letter-spacing: -.045em; line-height: 1.02; margin: 12px 0 18px; }
.home-hero h1 { font-size: clamp(46px, 7vw, 78px); }
.home-hero p, .tool-hero p { color: var(--muted); line-height: 1.7; margin: 0; }
.home-hero p { font-size: 18px; max-width: 720px; }
.primary-tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.primary-tool-card { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease; }
.primary-tool-card:hover { transform: translateY(-3px); box-shadow: 0 24px 60px rgba(15, 23, 42, .11); }
.tool-visual { height: 238px; background: linear-gradient(145deg, #eef2ff, #f8fafc); display: grid; place-items: center; position: relative; overflow: hidden; }
.viewer-visual span { position: absolute; background: white; border: 1px solid #dbe3ef; box-shadow: 0 12px 28px rgba(15,23,42,.08); border-radius: 12px; }
.viewer-visual span:nth-child(1){ width: 230px; height: 150px; transform: rotate(-7deg) translate(-16px,8px); }
.viewer-visual span:nth-child(2){ width: 230px; height: 150px; transform: rotate(6deg) translate(24px,-8px); }
.viewer-visual span:nth-child(3){ width: 230px; height: 150px; background: linear-gradient(135deg,#c7d2fe,#e0f2fe 55%,#fef3c7); }
.merge-visual { grid-template-columns: repeat(3, 120px); gap: 8px; justify-content: center; }
.merge-visual span { height: 145px; border-radius: 12px; border: 5px solid white; box-shadow: 0 12px 28px rgba(15,23,42,.08); }
.merge-visual span:nth-child(1){ background: linear-gradient(160deg,#bfdbfe,#ddd6fe); }
.merge-visual span:nth-child(2){ background: linear-gradient(160deg,#fde68a,#fecaca); }
.merge-visual span:nth-child(3){ background: linear-gradient(160deg,#bbf7d0,#bae6fd); }
.tool-card-copy { padding: 26px 28px 28px; }
.tool-kicker { color: var(--accent); font-size: 11px; font-weight: 850; letter-spacing: .1em; }
.tool-card-copy h2 { font-size: 28px; margin: 8px 0 10px; letter-spacing: -.03em; }
.tool-card-copy p { color: var(--muted); line-height: 1.65; min-height: 54px; }
.tool-card-copy strong { display: inline-block; margin-top: 12px; font-size: 14px; }
.format-section { margin: 72px 0 30px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 60px; align-items: end; }
.format-section h2 { font-size: 32px; line-height: 1.2; letter-spacing: -.03em; margin: 10px 0 0; }
.format-links { display: flex; flex-wrap: wrap; gap: 9px; }
.format-links a { background: white; border: 1px solid var(--line); border-radius: 999px; padding: 10px 14px; font-weight: 700; font-size: 13px; }
.privacy-strip { margin: 36px 0 60px; padding: 20px 22px; border: 1px solid #dbeafe; border-radius: 14px; background: #eff6ff; display: flex; gap: 10px; color: #1e3a8a; font-size: 14px; }
.compact-hero { text-align: center; padding: 48px 0 30px; max-width: 860px; margin: 0 auto; }
.compact-hero h1 { font-size: clamp(38px, 5vw, 58px); }
.compact-hero p { font-size: 17px; }
.format-line { display: inline-flex; margin-top: 16px; color: #475569; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; font-size: 12px; font-weight: 650; }
.tool-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.dropzone { margin: 24px; min-height: 270px; border: 2px dashed #cbd5e1; border-radius: 16px; background: #fbfdff; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; transition: .18s ease; outline: none; }
.dropzone:hover, .dropzone:focus, .dropzone.is-dragging { border-color: #818cf8; background: #f5f7ff; }
.dropzone strong { font-size: 19px; }
.dropzone span { color: #475569; font-size: 14px; }
.dropzone small { color: #94a3b8; margin-top: 5px; text-align: center; padding: 0 18px; }
.drop-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; background: var(--accent-2); color: var(--accent); font-size: 28px; margin-bottom: 6px; }
.is-hidden { display: none !important; }
.viewer-app { min-height: 620px; display: grid; grid-template-columns: 190px minmax(0,1fr); }
.thumbnail-panel, .merge-source-panel { background: var(--surface-2); border-right: 1px solid var(--line); min-width: 0; }
.panel-heading { height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 750; }
.text-button { border: 0; background: transparent; color: var(--accent); font-weight: 750; padding: 6px; }
.thumbnail-list { padding: 10px; display: flex; flex-direction: column; gap: 8px; max-height: 620px; overflow: auto; }
.thumbnail { width: 100%; display: grid; grid-template-columns: 58px minmax(0,1fr); align-items: center; gap: 9px; border: 1px solid transparent; border-radius: 10px; background: transparent; padding: 6px; text-align: left; }
.thumbnail:hover { background: white; }
.thumbnail.is-active { border-color: #c7d2fe; background: #eef2ff; }
.thumbnail img { width: 58px; height: 48px; object-fit: cover; border-radius: 7px; background: #fff; }
.thumbnail-copy { min-width: 0; }
.thumbnail-copy strong, .thumbnail-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumbnail-copy strong { font-size: 11px; }
.thumbnail-copy small { color: var(--muted); font-size: 10px; margin-top: 3px; }
.thumbnail-placeholder { width: 58px; height: 48px; border-radius: 7px; background: linear-gradient(135deg,#e2e8f0,#f8fafc); }
.viewer-main { min-width: 0; display: grid; grid-template-rows: 54px minmax(500px, 1fr) auto; }
.viewer-toolbar { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.viewer-toolbar button { min-width: 36px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #334155; font-weight: 700; }
.viewer-toolbar button:hover { border-color: #a5b4fc; color: var(--accent); }
.viewer-toolbar .zoom-label { min-width: 60px; font-size: 12px; }
.toolbar-divider { width: 1px; height: 24px; background: var(--line); margin: 0 2px; }
.viewer-stage { position: relative; overflow: auto; display: grid; place-items: center; min-height: 500px; }
.bg-checker { background-color: #fff; background-image: linear-gradient(45deg,#edf0f4 25%,transparent 25%),linear-gradient(-45deg,#edf0f4 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#edf0f4 75%),linear-gradient(-45deg,transparent 75%,#edf0f4 75%); background-size: 20px 20px; background-position: 0 0,0 10px,10px -10px,-10px 0; }
.viewer-stage.bg-dark { background: #111827; }
.viewer-stage.bg-light { background: #f8fafc; }
#viewer-image { max-width: 100%; max-height: 500px; object-fit: contain; transform-origin: center center; user-select: none; transition: transform .08s linear; }
.viewer-info { min-height: 52px; border-top: 1px solid var(--line); padding: 10px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; color: #475569; font-size: 12px; }
.viewer-info strong { color: #1e293b; }
.loading-state { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 9px; background: rgba(255,255,255,.82); z-index: 5; color: #475569; font-size: 13px; }
.spinner { width: 18px; height: 18px; border: 2px solid #cbd5e1; border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-state { color: var(--danger); background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; padding: 12px 14px; font-size: 13px; }
.viewer-stage .error-state { position: absolute; width: min(440px, calc(100% - 32px)); text-align: center; }
.content-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; margin: 32px 0; }
.content-grid article { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.content-grid h2 { font-size: 17px; margin: 0 0 8px; letter-spacing: -.015em; }
.content-grid p { color: var(--muted); font-size: 13px; line-height: 1.7; margin: 0; }
.related-tools { margin: 42px 0 58px; }
.related-tools h2 { font-size: 20px; margin-bottom: 14px; }
.tool-link-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; }
.tool-link-grid a { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.tool-link-grid strong, .tool-link-grid span { display: block; }
.tool-link-grid strong { font-size: 13px; }
.tool-link-grid span { color: var(--muted); font-size: 11px; margin-top: 5px; }
.merge-editor { display: grid; grid-template-columns: 220px 280px minmax(0,1fr); min-height: 640px; }
.merge-source-panel { display: flex; flex-direction: column; }
.merge-items { padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow: auto; max-height: 540px; }
.merge-item { display: grid; grid-template-columns: 28px 58px minmax(0,1fr) 28px; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 6px; }
.merge-item.is-dragging { opacity: .45; }
.drag-handle { color: #94a3b8; text-align: center; cursor: grab; }
.merge-item img { width: 58px; height: 48px; object-fit: cover; border-radius: 7px; }
.merge-item strong { font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.remove-image { width: 26px; height: 26px; border: 0; background: #f8fafc; border-radius: 7px; color: #64748b; }
.reorder-hint { color: #94a3b8; padding: 0 12px 12px; font-size: 10px; }
.merge-controls { padding: 18px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 20px; background: #fff; }
.control-group, .control-row { display: flex; flex-direction: column; gap: 8px; }
.control-group > label, .control-row > label { font-size: 12px; font-weight: 750; color: #334155; }
.control-row label { display: flex; justify-content: space-between; }
.control-row output { color: var(--muted); font-weight: 600; }
.segmented-control { display: grid; grid-template-columns: repeat(3,1fr); padding: 3px; border: 1px solid var(--line); background: #f8fafc; border-radius: 10px; }
.segmented-control button { border: 0; background: transparent; padding: 8px 4px; border-radius: 7px; font-size: 10px; font-weight: 750; color: #64748b; }
.segmented-control button.is-active { color: #312e81; background: #fff; box-shadow: 0 1px 3px rgba(15,23,42,.08); }
.inline-controls { flex-direction: row; align-items: center; flex-wrap: wrap; }
.inline-controls label { margin-right: 4px; }
.inline-controls input[type="color"] { width: 34px; height: 30px; border: 1px solid var(--line); padding: 2px; border-radius: 7px; background: white; }
.inline-controls select { border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; background: white; }
.checkbox-label { display: inline-flex !important; align-items: center; gap: 5px; font-weight: 600 !important; }
#merge-quality { width: 92px; }
.merge-preview-wrap { min-width: 0; display: grid; grid-template-rows: 48px minmax(480px,1fr) auto auto; }
.preview-heading { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 0 14px; font-size: 12px; font-weight: 750; }
.preview-heading span:last-child { color: var(--muted); font-weight: 600; }
.merge-preview { position: relative; display: grid; place-items: center; overflow: auto; min-height: 480px; padding: 22px; }
#merge-canvas { display: block; max-width: 100%; max-height: 470px; object-fit: contain; box-shadow: 0 8px 28px rgba(15,23,42,.12); background: transparent; }
.merge-actions { display: flex; gap: 9px; justify-content: flex-end; padding: 14px; border-top: 1px solid var(--line); }
.primary-button, .secondary-button { border-radius: 9px; padding: 10px 14px; font-weight: 750; font-size: 12px; }
.primary-button { background: #111827; color: white; border: 1px solid #111827; }
.secondary-button { background: white; color: #334155; border: 1px solid var(--line); }
.merge-preview-wrap > .error-state { margin: 0 14px 14px; }
.site-footer { min-height: 80px; border-top: 1px solid #dbe2ea; display: flex; align-items: center; justify-content: space-between; color: #64748b; font-size: 12px; }
.footer-links { display: flex; gap: 16px; }
.footer-links a:hover { color: #111827; }
@media (max-width: 900px) {
  .primary-tool-grid, .format-section, .content-grid { grid-template-columns: 1fr; }
  .format-section { gap: 24px; }
  .tool-link-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .viewer-app { grid-template-columns: 1fr; }
  .thumbnail-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .thumbnail-list { flex-direction: row; max-height: none; overflow-x: auto; }
  .thumbnail { min-width: 150px; }
  .merge-editor { grid-template-columns: 1fr; }
  .merge-source-panel, .merge-controls { border-right: 0; border-bottom: 1px solid var(--line); }
  .merge-items { flex-direction: row; overflow-x: auto; max-height: none; }
  .merge-item { min-width: 190px; }
  .merge-controls { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 620px) {
  .page-shell { width: min(100% - 20px, 1180px); }
  .site-header { height: 62px; }
  .main-nav a { padding: 8px; font-size: 12px; }
  .home-hero { padding-top: 48px; }
  .home-hero h1 { font-size: 46px; }
  .tool-visual { height: 190px; }
  .merge-visual { grid-template-columns: repeat(3,90px); }
  .compact-hero { padding-top: 34px; }
  .compact-hero h1 { font-size: 38px; }
  .dropzone { margin: 12px; min-height: 220px; }
  .viewer-toolbar { justify-content: flex-start; overflow-x: auto; }
  .viewer-stage, .viewer-main { min-height: 420px; }
  #viewer-image { max-height: 410px; }
  .content-grid { gap: 10px; }
  .tool-link-grid { grid-template-columns: 1fr 1fr; }
  .merge-controls { grid-template-columns: 1fr; }
  .merge-preview { min-height: 380px; }
  .merge-actions { flex-direction: column; }
  .primary-button, .secondary-button { width: 100%; }
  .site-footer { flex-direction: column; align-items: flex-start; justify-content: center; gap: 8px; }
}
