:root {
  --ink: #101827;
  --muted: #657589;
  --line: #dce8f0;
  --panel: rgba(255, 255, 255, .82);
  --cyan: #24d6c8;
  --blue: #2f7df6;
  --green: #30c781;
  --amber: #f5a524;
  --violet: #8b5cf6;
  --brand-primary: linear-gradient(135deg, #28e0d4 0%, #20c6c4 42%, #2f7df6 100%);
  --brand-primary-shadow: 0 18px 42px rgba(36, 214, 200, .28);
  --shadow: 0 24px 70px rgba(28, 42, 67, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  padding-top: 94px;
  color: var(--ink);
  font-family: Manrope, Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    radial-gradient(circle at 12% 0%, rgba(36, 214, 200, .16), transparent 24rem),
    radial-gradient(circle at 88% 6%, rgba(47, 125, 246, .12), transparent 26rem),
    linear-gradient(180deg, #effbfc 0%, #f8fbff 52%, #edf7fb 100%);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

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

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

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

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

.brand-logo-image {
  width: 205px !important;
  height: 52px !important;
  object-fit: contain;
  display: block;
}

.brand-tool,
.tool-status {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  white-space: nowrap;
}

.brand-tool {
  color: #253141;
  font-size: 18px;
  font-weight: 820;
}

.tool-status {
  flex: 1;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  border: 1px solid rgba(16, 23, 38, .12);
  border-radius: 12px;
  font-weight: 820;
  letter-spacing: -.02em;
  transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.button:hover { transform: translateY(-1px); }
.button.dark {
  color: #04111d;
  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.light {
  color: #142033;
  background: #fff;
  border: 1px solid rgba(148, 166, 190, .32);
}
.button.small { min-height: 40px; padding: 0 16px; font-size: 14px; }
.button:disabled {
  cursor: not-allowed;
  color: #748195;
  border-color: rgba(125, 147, 169, .24);
  background: #e8eef5;
  box-shadow: none;
  opacity: .75;
  transform: none;
}

.tool-page {
  display: flex;
  flex-direction: column;
  padding: 24px 0 56px;
}

body:not([data-tool]) .hero-panel {
  order: -1;
}
.ad-slot {
  min-height: 62px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border: 1px dashed rgba(70, 106, 132, .28);
  border-radius: 18px;
  color: #789;
  background: rgba(255, 255, 255, .64);
  font-size: 13px;
  font-weight: 760;
}

.hero-panel,
.drop-zone,
.panel,
.landing-card {
  border: 1px solid rgba(124, 148, 173, .22);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-panel {
  min-height: 760px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  margin-bottom: 22px;
  padding: 72px 0 42px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  text-align: center;
}

.hero-panel h1 {
  max-width: 1020px;
  margin: 0 auto;
  color: #07111f;
  font-size: clamp(46px, 6vw, 88px);
  line-height: 1.12;
  letter-spacing: -.06em;
}

.hero-panel p {
  max-width: 820px;
  margin: 20px auto 0;
  color: #5d6f83;
  font-size: 18px;
  line-height: 1.75;
}

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

.hero-visual {
  width: min(780px, 100%);
  min-height: 240px;
  display: grid;
  align-content: center;
  gap: 16px;
  margin: 0 auto;
  padding: 28px;
  border-radius: 28px;
  border: 2px dashed rgba(36, 214, 200, .42);
  background:
    radial-gradient(circle at 50% 0%, rgba(36, 214, 200, .2), transparent 42%),
    linear-gradient(135deg, rgba(244, 253, 255, .92), rgba(249, 255, 246, .88));
  box-shadow: 0 20px 60px rgba(31, 45, 61, .08);
}

.visual-row {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 16px;
  border-radius: 15px;
  color: #223047;
  background: rgba(255, 255, 255, .86);
  border: 1px solid rgba(125, 147, 169, .18);
  font-weight: 840;
}

.visual-row b { color: #138f96; }

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

.landing-card {
  border-radius: 28px;
  padding: 26px;
}

.landing-card h3 { margin: 0; font-size: 22px; letter-spacing: -.04em; }
.landing-card p { color: #617184; line-height: 1.75; }

.drop-zone {
  position: relative;
  min-height: 142px;
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 18px;
  padding: 28px;
  border-style: dashed;
  border-color: rgba(32, 198, 196, .42);
  border-radius: 28px;
  background:
    radial-gradient(circle at 18% 24%, rgba(36, 214, 200, .16), transparent 18rem),
    linear-gradient(135deg, rgba(255, 255, 255, .92), rgba(239, 250, 252, .88));
}

.start-icon {
  width: 84px;
  height: 84px;
  flex: 0 0 84px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  color: #07111f;
  background: var(--brand-primary);
  box-shadow: var(--brand-primary-shadow);
  font-size: 26px;
  font-weight: 950;
  letter-spacing: -.08em;
}

.drop-zone strong {
  display: block;
  color: #111827;
  font-size: clamp(24px, 3vw, 38px);
  font-weight: 950;
  letter-spacing: -.055em;
}

.drop-zone small {
  display: block;
  max-width: 780px;
  margin-top: 8px;
  color: #64748b;
  font-size: 15px;
  line-height: 1.65;
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(460px, 1fr) minmax(280px, 340px);
  gap: 18px;
  align-items: start;
}

.tool-layout.two-col { grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); }
.panel { border-radius: 28px; padding: 20px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.panel-head.compact { margin: 0 0 10px; }
.panel-head h2 { margin: 0; color: #111827; font-size: 22px; font-weight: 950; letter-spacing: -.04em; }
.panel-head span { color: #69798d; font-size: 13px; font-weight: 760; }

label {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  color: #263548;
  font-size: 14px;
  font-weight: 880;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(125, 147, 169, .32);
  border-radius: 16px;
  padding: 12px 14px;
  color: #111827;
  background: #f8fbff;
  outline: none;
}
input[type="file"] { padding: 10px; }
input[type="color"] { height: 46px; padding: 6px; }
textarea { min-height: 260px; resize: vertical; line-height: 1.6; font-family: "Cascadia Mono", Consolas, monospace; }

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

.preset-grid,
.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.preset-grid button,
.option-grid button {
  border: 1px solid rgba(125, 147, 169, .24);
  border-radius: 15px;
  padding: 12px 10px;
  color: #223047;
  background: #f3f8fb;
  font-weight: 880;
}

.preset-grid button:hover,
.preset-grid button.active,
.option-grid button:hover,
.option-grid button.active {
  color: #03121d;
  background: var(--brand-primary);
  border-color: rgba(32, 198, 196, .8);
}

.wide { grid-column: 1 / -1; }

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.result-grid div {
  padding: 14px;
  border-radius: 18px;
  background: #f4f9fb;
}
.result-grid span { display: block; color: #68788b; font-size: 12px; font-weight: 820; }
.result-grid strong { display: block; margin-top: 4px; color: #111827; font-size: 20px; font-weight: 950; }

.preview-stage {
  min-height: 360px;
  display: grid;
  place-items: center;
  margin-top: 18px;
  padding: 18px;
  overflow: auto;
  border-radius: 24px;
  background:
    linear-gradient(45deg, rgba(100, 116, 139, .08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(100, 116, 139, .08) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(100, 116, 139, .08) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(100, 116, 139, .08) 75%),
    #fff;
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

canvas,
.mock-frame,
.text-output,
.table-output {
  max-width: 100%;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(23, 42, 68, .12);
}

canvas { display: block; }

.text-output,
.table-output {
  width: 100%;
  min-height: 260px;
  padding: 16px;
  overflow: auto;
  white-space: pre-wrap;
  color: #172033;
  line-height: 1.65;
}

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

.item-card {
  padding: 12px;
  border: 1px solid rgba(125, 147, 169, .24);
  border-radius: 16px;
  background: #f8fbff;
}
.item-card strong { display: block; overflow-wrap: anywhere; }
.item-card small { color: #64748b; }

.range-panel,
.note-box,
.export-card {
  margin-top: 18px;
  padding: 16px;
  border-radius: 22px;
  background: #f4f9fb;
}

.note-box {
  color: #324258;
  background: linear-gradient(135deg, rgba(36, 214, 200, .13), rgba(47, 125, 246, .1));
}
.note-box p { margin: 8px 0 0; color: #5c6d80; line-height: 1.65; }

.export-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid rgba(36, 214, 200, .28);
  background:
    radial-gradient(circle at 0% 0%, rgba(36, 214, 200, .18), transparent 18rem),
    #f8fbff;
}
.export-card strong { display: block; color: #111827; font-size: 18px; font-weight: 950; }
.export-card small { display: block; margin-top: 6px; color: #64748b; line-height: 1.55; }

.mock-frame {
  position: relative;
  width: 390px;
  height: 720px;
  overflow: hidden;
  border: 10px solid #07111f;
  background: linear-gradient(180deg, #eefbfc, #fff);
}
.mock-frame::before {
  content: "";
  position: absolute;
  inset: 14px 88px auto;
  height: 5px;
  border-radius: 999px;
  background: #0f172a;
  opacity: .28;
}
.mock-content {
  position: absolute;
  inset: 42px 18px 18px;
  display: grid;
  align-content: start;
  gap: 12px;
}
.mock-bar { height: 42px; border-radius: 14px; background: var(--brand-primary); }
.mock-card { min-height: 86px; border-radius: 18px; background: rgba(15, 23, 42, .08); }

.debug-canvas {
  position: relative;
  width: min(100%, 720px);
  min-height: 420px;
  border-radius: 24px;
  background:
    linear-gradient(rgba(36, 214, 200, .11) 1px, transparent 1px),
    linear-gradient(90deg, rgba(36, 214, 200, .11) 1px, transparent 1px),
    #07111f;
  background-size: 24px 24px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.hitbox {
  position: absolute;
  border: 2px solid rgba(36, 214, 200, .9);
  border-radius: 16px;
  color: #eaffff;
  background: rgba(36, 214, 200, .08);
  font-size: 12px;
  font-weight: 850;
  display: grid;
  place-items: center;
}
.hitbox.warn { border-color: #f5a524; background: rgba(245, 165, 36, .1); }

@media (max-width: 1080px) {
  .tool-status { display: none; }
  .hero-panel,
  .tool-layout,
  .tool-layout.two-col,
  .landing-grid,
  .workflow-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  body { padding-top: 78px; }
  .tool-header { min-height: 68px; padding: 0 16px; }
  .h5-logo-mark,
  .brand-logo-image { width: 156px !important; height: auto !important; }
  .brand-tool,
  .button.small { display: none; }
  .tool-page { width: min(100% - 24px, 1180px); }
  .drop-zone { align-items: flex-start; padding: 20px; }
  .start-icon { width: 62px; height: 62px; flex-basis: 62px; border-radius: 18px; font-size: 22px; }
  .result-grid { grid-template-columns: 1fr 1fr; }
  .export-card { align-items: stretch; flex-direction: column; }
}
