:root {
  --bg: #f1f1f1;
  --surface: #ffffff;
  --text: #1f1f1f;
  --muted: #666666;
  --line: #dcdcdc;
  --line-soft: #e8e8e8;
  --primary: #4a63f3;
  --primary-hover: #3d54d1;
  --dark: #2f3136;
  --container: 860px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

img {
  max-width: 100%;
  display: block;
}

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

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.container {
  width: min(100% - 32px, var(--container));
  margin: 0 auto;
}

.site-header {
  background: var(--dark);
  color: #fff;
}

.header-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
}

.brand-logo {
  width: 34px;
  height: 34px;
  background: #11a8ff;
  color: #fff;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.main-nav a {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  border-radius: 4px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: #fff;
  border-radius: 999px;
}

.hero-section {
  padding: 32px 0 14px;
}

.hero-inner h1 {
  margin: 0 0 10px;
  font-size: 42px;
  line-height: 1.15;
}

.hero-text {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.eyebrow {
  display: none;
}

.tool-section {
  padding: 8px 0 26px;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--line);
}

.upload-area {
  margin: 22px;
  min-height: 250px;
  border: 3px dashed var(--line-soft);
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.upload-area.dragover {
  background: #f4f7ff;
  border-color: #bcc8ff;
}

.upload-icon {
  display: none;
}

.upload-content h2,
.preview-info h2,
.target-box h2,
.result-box h2,
.content-inner h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.upload-content p {
  margin: 8px 0;
  color: var(--muted);
  font-size: 14px;
}

.upload-note {
  max-width: 360px;
  margin: 12px auto 0;
  line-height: 1.5;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 28px;
  border: 0;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  border-radius: 4px;
}

.primary-btn:hover {
  background: var(--primary-hover);
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.secondary-btn {
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--line);
  background: #f4f4f4;
  color: var(--text);
  font-weight: 700;
  border-radius: 4px;
}

.preview-box,
.target-box,
.status-box,
.result-box {
  margin: 0 22px 22px;
}

.preview-box,
.result-card {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 18px;
}

.preview-image-wrap {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

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

.info-item {
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px;
}

.info-label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
}

.info-value {
  display: block;
  font-size: 14px;
  font-weight: 700;
  word-break: break-word;
}

.target-box {
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.target-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.target-btn {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-weight: 700;
  border-radius: 4px;
  min-width: 82px;
}

.target-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.tool-actions,
.result-actions,
.new-reduce-row {
  margin-top: 18px;
}

.status-box {
  padding: 16px;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.loader-line {
  width: 100%;
  height: 6px;
  background: #e6e8ef;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 12px;
}

.loader-bar {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #4f6df5, #6a82fb);
  border-radius: 6px;
  transition: width 0.35s ease;
}

.status-box p {
  margin: 0;
  color: #49556a;
  font-size: 14px;
  font-weight: 600;
}

.result-box {
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.format-tip {
  margin: 0 22px 22px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.format-tip p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.format-tip strong {
  color: var(--text);
}

.format-tip-actions {
  margin-top: 12px;
}

.tip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.tip-btn:hover {
  background: #f3f4f6;
}

.content-section {
  padding: 0 0 46px;
}

.content-inner {
  background: #fff;
  border: 1px solid var(--line);
  padding: 22px;
}

.content-inner h2 {
  margin-top: 24px;
  font-size: 24px;
}

.content-inner h2:first-child {
  margin-top: 0;
}

.content-inner p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.site-footer {
  background: #fff;
  border-top: 1px solid var(--line);
}

.footer-inner {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-inner p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.footer-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

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

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 18, 27, 0.68);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 99999;
}

.modal-box {
  width: min(100%, 460px);
  background: #fff;
  border: 1px solid #e6e8ef;
  border-radius: 10px;
  padding: 24px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}

.modal-box h2 {
  margin: 0 0 10px;
  font-size: 22px;
  line-height: 1.2;
}

.modal-box p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 15px;
}

.modal-actions {
  margin-top: 18px;
}

.modal-btn {
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  border-radius: 4px;
}

.modal-btn:hover {
  background: var(--primary-hover);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.modal-close:hover {
  background: #f5f6fa;
}

.hidden {
  display: none !important;
}

@media (max-width: 860px) {
  .preview-box,
  .result-card {
    grid-template-columns: 1fr;
  }

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

  .preview-image-wrap {
    max-width: 220px;
  }
}

@media (max-width: 700px) {
  .header-inner {
    min-height: auto;
    padding: 14px 0;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 14px;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .main-nav {
    display: none;
    grid-column: 1 / -1;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding-top: 6px;
  }

  .main-nav.is-open {
    display: flex;
  }

  .hero-inner h1 {
    font-size: 30px;
  }

  .upload-area {
    margin: 16px;
    padding: 32px 16px;
    min-height: 220px;
  }

  .preview-box,
  .target-box,
  .status-box,
  .result-box {
    margin-left: 16px;
    margin-right: 16px;
  }

  .format-tip {
    margin-left: 16px;
    margin-right: 16px;
  }

  .content-inner {
    padding: 18px;
  }

  .modal-box {
    padding: 20px;
  }
}

.site-footer{
  background:#2F3136;
  color:#cbd5f5;
  padding:50px 20px 30px;
  margin-top:60px;
}

.footer-container{
  max-width:1200px;
  margin:auto;
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:40px;
}

.footer-column h4{
  color:#ffffff;
  margin-bottom:15px;
  font-size:16px;
}

.footer-column p{
  font-size:14px;
  line-height:1.6;
}

.footer-column ul{
  list-style:none;
  padding:0;
  margin:0;
}

.footer-column li{
  margin-bottom:8px;
}

.footer-column a{
  color:#cbd5f5;
  text-decoration:none;
  font-size:14px;
}

.footer-column a:hover{
  color:#ffffff;
}

.footer-bottom{
  text-align:center;
  margin-top:40px;
  font-size:13px;
  border-top:1px solid rgba(255,255,255,0.08);
  padding-top:20px;
}

.content-inner a {
  color: #2f6fed;
  text-decoration: none;
  font-weight: 600;
}

.content-inner a:hover {
  color: #1d4ed8;
  text-decoration: underline;
}
