:root {
  --ink: #121417;
  --muted: #66727e;
  --soft: #f5f8fb;
  --panel: #ffffff;
  --line: #dbe4ec;
  --aqua: #22b8cf;
  --blue: #2f7df6;
  --brand-primary: linear-gradient(135deg, #28e0d4 0%, #20c6c4 42%, #2f7df6 100%);
  --brand-primary-shadow: 0 18px 42px rgba(34, 184, 207, .24);
  --green: #27ae60;
  --amber: #f59f00;
  --rose: #e64980;
  --shadow: 0 24px 70px rgba(31, 45, 61, .12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    radial-gradient(circle at 18% 8%, rgba(34, 184, 207, .18), transparent 28%),
    radial-gradient(circle at 86% 20%, rgba(245, 159, 0, .15), transparent 24%),
    linear-gradient(180deg, #fbfdff 0%, #eef5f8 44%, #ffffff 100%);
  padding-top: 94px;
}

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

button,
input,
select {
  font: inherit;
}

img {
  max-width: 100%;
}

.page-shell,
.site-header,
.tool-header,
.tool-page {
  width: min(1380px, calc(100% - 44px));
  margin-inline: auto;
}

.site-header,
.tool-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 0;
  padding: 0 22px;
  border: 1px solid rgba(18, 20, 23, .08);
  border-radius: 16px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(18px);
  box-shadow: 0 20px 60px rgba(31, 45, 61, .08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 28px;
  font-weight: 850;
  min-height: 56px;
}

.h5-logo-mark {
  width: 205px;
  height: 52px;
  flex: 0 0 205px;
  display: inline-grid;
  place-items: center;
  overflow: visible;
}

.brand .h5-logo-mark > .brand-logo-image {
  width: 205px !important;
  height: 52px !important;
  max-width: 205px !important;
  max-height: 52px !important;
  object-fit: contain;
  display: block;
  position: static !important;
}

.brand-logo-image {
  filter: none;
}

.logo-depth {
  fill: rgba(1, 9, 19, .72);
}

.logo-h-core {
  fill: var(--aqua);
}

.logo-five-core {
  fill: #111827;
}

.logo-accent {
  fill: var(--amber);
}

.logo-flow {
  fill: none;
  stroke: #228be6;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  color: #253141;
  font-size: 18px;
  font-weight: 780;
  line-height: 1;
  white-space: nowrap;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: conic-gradient(from 210deg, var(--aqua), var(--green), var(--amber), var(--rose), var(--aqua));
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, .7);
}

.language-switcher {
  position: relative;
  z-index: 20;
  margin-left: auto;
}

.language-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #253141;
  background: rgba(255, 255, 255, .76);
  cursor: pointer;
  font-size: 14px;
  font-weight: 820;
}

.language-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.language-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 132px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 20px 48px rgba(31, 45, 61, .14);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity .18s ease, transform .18s ease;
}

.language-switcher.open .language-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.language-menu button {
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-weight: 760;
}

.language-menu button:hover,
.language-menu button.active {
  color: #087f5b;
  background: #e6fcf5;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--muted);
  font-size: 14px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 780;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: .45;
  transform: none;
}

.button.dark {
  color: #04111f;
  border-color: rgba(32, 198, 196, .9);
  background: var(--brand-primary);
  box-shadow: var(--brand-primary-shadow), inset 0 0 0 1px rgba(255, 255, 255, .2);
}

.button.dark:hover:not(:disabled) {
  border-color: rgba(135, 245, 238, .96);
  box-shadow: 0 22px 48px rgba(34, 184, 207, .3), inset 0 0 0 1px rgba(255, 255, 255, .28);
}

.button.dark:disabled {
  color: #8fa0b2;
  border-color: #dbe4ec;
  background: #edf2f7;
  box-shadow: none;
  opacity: .82;
}

.button.light {
  color: #253141;
  background: rgba(255, 255, 255, .78);
  border-color: var(--line);
}

.button.small {
  min-height: 40px;
  padding-inline: 14px;
  font-size: 14px;
}

.hero {
  min-height: 760px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 72px 0 42px;
  text-align: center;
}

.hero-copy h1 {
  max-width: 860px;
  margin: 0 auto 22px;
  font-size: clamp(46px, 6vw, 88px);
  line-height: 1.12;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 760px;
  margin: 0 auto;
  color: #40505f;
  font-size: 19px;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.metrics {
  width: min(760px, 100%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 28px auto 30px;
}

.metrics div {
  padding: 16px;
  border: 1px solid rgba(18, 20, 23, .08);
  border-radius: 14px;
  background: rgba(255, 255, 255, .74);
  box-shadow: 0 16px 36px rgba(31, 45, 61, .07);
}

.metrics strong {
  display: block;
  font-size: 28px;
}

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

.hero-uploader,
.drop-zone label {
  position: relative;
  display: grid;
  place-items: center;
  width: min(780px, 100%);
  min-height: 172px;
  padding: 28px;
  overflow: hidden;
  border: 2px dashed #8ad9e4;
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(34, 184, 207, .24), transparent 42%),
    linear-gradient(135deg, #f4fdff, #f9fff6);
}

.hero-uploader strong,
.drop-zone strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.hero-uploader small,
.drop-zone small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.upload-icon {
  width: 42px;
  height: 42px;
  border: 2px solid #111827;
  border-radius: 14px;
  background:
    linear-gradient(#111827, #111827) center 11px / 16px 2px no-repeat,
    linear-gradient(#111827, #111827) center / 2px 18px no-repeat;
}

.mini-workbench {
  width: min(1120px, 100%);
  margin-top: 18px;
  padding: 16px;
  text-align: left;
  border: 1px solid rgba(18, 20, 23, .08);
  border-radius: 28px;
  background: rgba(255, 255, 255, .88);
  box-shadow: var(--shadow);
}

.mini-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px 16px;
}

.tab,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 780;
  background: #edf4f7;
}

.tab.active,
.chip.selected {
  color: white;
  background: #111827;
}

.route {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}

.ad-slot {
  min-height: 56px;
  display: grid;
  place-items: center;
  border: 1px dashed #b5c3d1;
  border-radius: 12px;
  color: #7c8996;
  background: #f7fafc;
  font-size: 13px;
}

.ad-slot.large {
  min-height: 92px;
}

.mini-grid,
.tool-layout {
  display: grid;
  grid-template-columns: minmax(230px, 280px) minmax(0, 1fr) minmax(230px, 280px);
  gap: 14px;
  margin-top: 14px;
}

.queue-card,
.preview-card,
.settings-card,
.panel,
.case-card,
.seo-grid article {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.queue-card,
.preview-card,
.settings-card {
  padding: 12px;
}

.card-title,
.panel-head,
.preview-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title small,
.panel-head span,
.preview-foot,
.file-row small {
  color: var(--muted);
}

.file-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: 66px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
  cursor: pointer;
}

.file-row > span:not(.thumb) {
  min-width: 0;
  overflow: hidden;
}

.file-row.active {
  border-color: #8ad9e4;
  background: #f4fdff;
  box-shadow: inset 4px 0 0 var(--aqua);
}

.file-row b,
.file-row small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row b {
  font-size: 13px;
}

.file-row em {
  color: var(--green);
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.thumb {
  width: 42px;
  height: 42px;
  overflow: hidden;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
}

.thumb.warm,
.case-image.warm {
  background-image: url("../images/shop-banner.png");
}

.thumb.cool,
.case-image.cool {
  background-image: url("../images/hero-background.png");
}

.thumb.mint,
.case-image.mint {
  background-image:
    url("../images/icon-set-transparent.png"),
    linear-gradient(45deg, rgba(206, 217, 226, .75) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(206, 217, 226, .75) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(206, 217, 226, .75) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(206, 217, 226, .75) 75%);
  background-size: cover, 18px 18px, 18px 18px, 18px 18px, 18px 18px;
  background-position: center, 0 0, 0 9px, 9px -9px, -9px 0;
}

.compare-art,
.compare-view {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background-color: #f8fbfd;
}

.compare-art {
  height: 214px;
}

.before-art,
.after-art {
  position: absolute;
  inset: 0;
  background-image: url("../images/shop-banner.png");
  background-size: cover;
  background-position: center;
}

.before-art {
  filter: saturate(1.08) contrast(1.03);
}

.after-art {
  width: 54%;
  border-right: 3px solid #111827;
  filter: saturate(.94) contrast(.98);
  overflow: hidden;
  background-image: none;
}

.after-art::before {
  content: "";
  position: absolute;
  inset: 0;
  width: calc(100% / .54);
  background-image: url("../images/shop-banner.png");
  background-size: cover;
  background-position: center;
  filter: saturate(.94) contrast(.98);
}

.compare-handle {
  position: absolute;
  top: 50%;
  left: 54%;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #111827;
  transform: translate(-50%, -50%);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .22);
}

.settings-card {
  display: grid;
  gap: 10px;
  align-content: start;
}

.section {
  padding: 64px 0;
}

.section-head h2 {
  margin: 0 0 12px;
  font-size: 40px;
}

.section-head p {
  max-width: 780px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.case-grid,
.seo-grid {
  display: grid;
  gap: 16px;
  margin-top: 26px;
}

.case-grid {
  grid-template-columns: repeat(3, 1fr);
}

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

.case-card,
.seo-grid article {
  padding: 20px;
}

.case-image {
  display: block;
  height: 150px;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 -34px 60px rgba(17, 24, 39, .18);
}

.case-card h3,
.seo-grid h3 {
  margin: 18px 0 8px;
}

.case-card p,
.seo-grid p,
.note-box p {
  color: #41505f;
  line-height: 1.65;
}

.save-bar {
  height: 9px;
  overflow: hidden;
  border-radius: 99px;
  background: #edf2f7;
}

.save-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--aqua));
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 36px 0 48px;
  color: var(--muted);
}

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

.tool-page {
  padding: 24px 0 48px;
}

.tool-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
}

.tool-ad {
  margin-bottom: 16px;
}

.drop-zone {
  margin-bottom: 16px;
}

.drop-zone.dragging label {
  border-color: var(--green);
  box-shadow: 0 20px 60px rgba(39, 174, 96, .16);
}

.drop-zone input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.drop-zone label {
  width: 100%;
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.drop-zone label:hover {
  transform: translateY(-1px);
}

.panel {
  min-height: 300px;
  padding: 16px;
}

.panel-head {
  margin-bottom: 14px;
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
}

.queue-list {
  min-height: 260px;
}

.empty-state {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.preview-panel {
  display: flex;
  flex-direction: column;
}

.compare-view {
  height: clamp(320px, 45vw, 520px);
  cursor: default;
  touch-action: none;
}

.compare-view.is-panning {
  cursor: grabbing;
}

.checkerboard {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(45deg, #dce8ee 25%, transparent 25%),
    linear-gradient(-45deg, #dce8ee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #dce8ee 75%),
    linear-gradient(-45deg, transparent 75%, #dce8ee 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

.compare-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  display: none;
}

.compare-view.has-image .compare-layer {
  display: block;
}

.before-layer {
  clip-path: inset(0 45% 0 0);
}

.after-layer {
  clip-path: inset(0 0 0 55%);
}

.compare-view img {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: none;
  max-height: none;
  transform: translate(-50%, -50%);
  transform-origin: center;
  user-select: none;
  pointer-events: none;
}

.compare-view.has-image .preview-empty {
  display: none;
}

.compare-badge {
  position: absolute;
  z-index: 3;
  top: 14px;
  padding: 7px 10px;
  border-radius: 999px;
  color: #111827;
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 8px 20px rgba(17, 24, 39, .12);
  font-size: 12px;
  font-weight: 850;
  pointer-events: none;
}

.before-badge {
  left: 14px;
}

.after-badge {
  right: 14px;
}

.compare-view:not(.has-image) .compare-badge {
  display: none;
}

.compare-view input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
}

.compare-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 55%;
  width: 3px;
  background: #111827;
  pointer-events: none;
}

.compare-line span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #111827;
  transform: translate(-50%, -50%);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .22);
}

.preview-empty {
  position: absolute;
  inset: auto 20px 20px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .86);
}

.preview-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
  color: var(--muted);
}

.preview-meta strong {
  color: var(--green);
}

.result-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: auto;
}

.result-tile {
  min-height: 84px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  text-align: center;
}

.result-tile.active {
  border-color: #8ad9e4;
  background: #f4fdff;
}

.result-tile img {
  display: block;
  width: 100%;
  height: 46px;
  object-fit: cover;
  margin-bottom: 6px;
  border-radius: 8px;
}

.tool-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.settings-panel {
  display: grid;
  align-content: start;
  gap: 16px;
}

fieldset {
  padding: 0;
  margin: 0;
  border: 0;
}

legend,
label > span,
.note-box strong {
  display: block;
  margin-bottom: 8px;
  font-weight: 820;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.segmented button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdff;
  cursor: pointer;
  font-weight: 760;
}

.segmented button.active {
  color: #087f5b;
  border-color: #96f2d7;
  background: #e6fcf5;
}

select,
input[type="number"] {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

[hidden] {
  display: none !important;
}

input[type="range"] {
  width: 100%;
}

.size-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

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

.note-box {
  padding: 12px;
  border: 1px solid #ffd8a8;
  border-radius: 12px;
  background: #fff9db;
}

.note-box p {
  margin: 0;
  font-size: 13px;
}

.legacy-note {
  display: none;
}

.ad-dialog {
  width: min(460px, calc(100% - 32px));
  border: 0;
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.ad-dialog::backdrop {
  background: rgba(17, 24, 39, .42);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.reveal {
  animation: rise .6s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

@media (max-width: 1060px) {
  .mini-grid,
  .tool-layout,
  .seo-grid {
    grid-template-columns: 1fr;
  }

  .settings-panel {
    order: 2;
  }
}

@media (max-width: 760px) {
  .page-shell,
  .site-header,
  .tool-header,
  .tool-page {
    width: min(100% - 24px, 1380px);
  }

  .site-header,
  .tool-header {
    position: fixed;
    flex-wrap: wrap;
    padding: 14px;
  }

  .site-nav {
    display: none;
  }

  .hero {
    min-height: auto;
    padding-top: 46px;
  }

  .hero-copy h1 {
    font-size: 36px;
    line-height: 1.06;
  }

  .metrics,
  .case-grid,
  .result-strip,
  .size-grid {
    grid-template-columns: 1fr;
  }

  .mini-toolbar {
    flex-wrap: wrap;
  }

  .route {
    width: 100%;
    margin-left: 0;
  }

  .footer,
  .preview-meta {
    flex-direction: column;
  }
}
