* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: #111827;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  background: #f7f8fa;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 64px;
  flex: 1;
}

.tool-header {
  margin-bottom: 28px;
  text-align: center;
}

.brand {
  margin: 0 0 8px;
  color: #2563eb;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 6vw, 40px);
  line-height: 1.3;
}

.tool-intro {
  margin: 16px auto 0;
  max-width: 650px;
  color: #4b5563;
  line-height: 1.8;
}

.privacy-note {
  display: inline-block;
  margin: 18px 0 0;
  padding: 10px 14px;
  color: #166534;
  font-size: 14px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
}

.compressor,
.result-area,
.content-section {
  margin-top: 24px;
  padding: 28px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
}

h2 {
  margin: 0 0 20px;
  font-size: 21px;
}

.drop-area {
  min-height: 230px;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  color: #4b5563;
  text-align: center;
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease;
}

.drop-area:hover,
.drop-area.dragover {
  border-color: #2563eb;
  background: #eff6ff;
}

.drop-area strong {
  color: #111827;
  font-size: 18px;
}

.select-button {
  padding: 10px 18px;
  color: #fff;
  font-weight: 700;
  background: #2563eb;
  border-radius: 9px;
}

.drop-area small {
  color: #9ca3af;
}

.file-info {
  margin-top: 20px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 18px;
  background: #f9fafb;
  border-radius: 12px;
}

.file-info p {
  margin: 5px 0;
  overflow-wrap: anywhere;
}

.preview-image {
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.file-info .preview-image {
  width: 110px;
  height: 90px;
  border-radius: 8px;
}

.compressor h2:not(:first-child) {
  margin-top: 28px;
}

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

.preset-button {
  padding: 13px 10px;
  color: #374151;
  font-weight: 700;
  border: 1px solid #d1d5db;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
}

.preset-button:hover {
  border-color: #2563eb;
}

.preset-button.active {
  color: #fff;
  border-color: #2563eb;
  background: #2563eb;
}

.custom-size {
  margin-top: 18px;
  display: block;
}

.custom-size > span {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.custom-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.custom-input-wrap input {
  width: 160px;
  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: 9px;
}

.custom-input-wrap input:focus {
  outline: 2px solid #bfdbfe;
  border-color: #2563eb;
}

.compress-button,
.download-button {
  width: 100%;
  margin-top: 24px;
  padding: 15px;
  color: #fff;
  font-weight: 700;
  border: 0;
  border-radius: 10px;
  background: #2563eb;
  cursor: pointer;
}

.compress-button:hover,
.download-button:hover {
  background: #1d4ed8;
}

.compress-button:disabled {
  background: #9ca3af;
  cursor: wait;
}

.status-message {
  min-height: 24px;
  margin: 14px 0 0;
  color: #4b5563;
  font-size: 14px;
  text-align: center;
}

.status-message.error {
  color: #dc2626;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.result-card {
  padding: 20px;
  text-align: center;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

.result-card span {
  display: block;
  margin-bottom: 8px;
  color: #6b7280;
  font-size: 14px;
}

.result-card strong {
  font-size: 22px;
}

.result-card.highlight {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.result-card.highlight strong {
  color: #2563eb;
}

.result-preview {
  margin-top: 22px;
  padding: 16px;
  text-align: center;
  background: #f9fafb;
  border-radius: 12px;
}

.result-preview img {
  max-height: 500px;
}

.content-section p {
  margin: 12px 0;
  color: #4b5563;
  line-height: 1.9;
}

.faq h3 {
  margin: 26px 0 8px;
  font-size: 17px;
}

.hidden {
  display: none;
}

.site-footer {
  padding: 30px 20px;
  color: #6b7280;
  font-size: 14px;
  text-align: center;
  background: #fff;
  border-top: 1px solid #e5e7eb;
}

.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
}

.site-footer a {
  color: #4b5563;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  main {
    width: min(100% - 20px, 760px);
    padding-top: 32px;
  }

  .compressor,
  .result-area,
  .content-section {
    padding: 20px;
  }

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

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

  .file-info {
    align-items: flex-start;
    flex-direction: column;
  }

  .file-info .preview-image {
    width: 100%;
    height: 180px;
  }
}

button:focus-visible,
input:focus-visible,
.drop-area:focus-within {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}
