:root {
  color-scheme: light;
  --teal: #a0d3d9;
  --orange: #f29441;
  --red: #f2380f;
  --ink: #1f1f1f;
  --muted: #55514f;
  --paper: #f6f2ec;
  --card: rgba(255, 255, 255, 0.76);
  --line: rgba(27, 24, 20, 0.12);
  --shadow: 0 30px 70px rgba(242, 56, 15, 0.18),
    0 10px 30px rgba(31, 31, 31, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Meiryo",
    sans-serif;
  color: var(--ink);
  background: var(--paper);
}

body {
  position: relative;
  overflow-x: hidden;
  background-image:
    radial-gradient(900px 500px at 8% 2%, rgba(160, 211, 217, 0.6), transparent 70%),
    radial-gradient(700px 600px at 95% 12%, rgba(242, 148, 65, 0.4), transparent 65%),
    radial-gradient(800px 600px at 50% 100%, rgba(242, 56, 15, 0.2), transparent 70%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0) 45%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: -30% -20%;
  z-index: -1;
  pointer-events: none;
  filter: blur(60px);
  opacity: 0.7;
  transform: rotate(-3deg);
}

body::before {
  background: conic-gradient(
    from 120deg,
    rgba(160, 211, 217, 0.35),
    rgba(242, 148, 65, 0.25),
    rgba(242, 56, 15, 0.2),
    rgba(160, 211, 217, 0.2)
  );
  animation: float 16s ease-in-out infinite;
}

body::after {
  background: radial-gradient(
    closest-side,
    rgba(242, 148, 65, 0.18),
    transparent 65%
  );
  animation: float 22s ease-in-out infinite reverse;
}

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(24px, 3vw, 40px) clamp(18px, 4vw, 48px) 96px;
}

main.document {
  max-width: 920px;
}

.hero {
  display: grid;
  gap: 18px;
  margin-bottom: 32px;
  animation: rise 0.8s ease forwards;
}

.badge {
  width: fit-content;
  padding: 6px 16px;
  border-radius: 999px;
  background: linear-gradient(
    120deg,
    rgba(160, 211, 217, 0.8),
    rgba(242, 148, 65, 0.7)
  );
  color: #231f1d;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 12px;
}

h1 {
  margin: 0;
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Meiryo",
    sans-serif;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.2;
  color: #1a1918;
}

.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 640px;
  font-size: clamp(14px, 2vw, 18px);
}

.panel {
  background: var(--card);
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 32px);
  backdrop-filter: blur(18px);
  display: grid;
  gap: 20px;
}

.panel + .panel {
  margin-top: 28px;
}

.doc-body {
  display: grid;
  gap: 14px;
  line-height: 1.8;
}

.doc-body h2 {
  margin: 0;
  font-size: clamp(16px, 2vw, 20px);
}

.doc-body p {
  margin: 0;
}

.doc-body ul {
  margin: 0;
  padding-left: 20px;
}

.doc-body li {
  margin-bottom: 6px;
}

.doc-body ol {
  margin: 0;
  padding-left: 20px;
}

.doc-body ol li {
  margin-bottom: 6px;
}

.doc-meta {
  color: var(--muted);
  font-size: 13px;
}

.doc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.profile-layout {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  align-items: start;
}

.profile-image {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 8px 24px rgba(242, 56, 15, 0.15);
}

.profile-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-info {
  display: grid;
  gap: 16px;
}

.profile-header {
  display: grid;
  gap: 4px;
}

.profile-name {
  margin: 0;
  font-size: clamp(18px, 2.5vw, 22px);
  font-weight: 700;
  color: var(--ink);
}

.profile-title {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

.profile-content {
  display: grid;
  gap: 12px;
}

.profile-content p {
  margin: 0;
  line-height: 1.8;
}

.profile-content strong {
  color: var(--ink);
  font-size: 14px;
}

@media (max-width: 600px) {
  .profile-layout {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .profile-image {
    width: 120px;
    height: 120px;
  }

  .profile-header {
    text-align: center;
  }

  .profile-content {
    text-align: left;
  }
}

.upload-zone {
  position: relative;
  border-radius: 24px;
  padding: clamp(24px, 6vw, 46px);
  border: 1.5px dashed rgba(31, 31, 31, 0.25);
  background: linear-gradient(
    135deg,
    rgba(160, 211, 217, 0.28),
    rgba(255, 255, 255, 0.6)
  );
  display: grid;
  place-items: center;
  text-align: center;
  gap: 12px;
  transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  min-height: 220px;
}

.upload-zone.dragover {
  border-color: var(--orange);
  box-shadow: 0 18px 40px rgba(242, 148, 65, 0.18);
  transform: translateY(-2px);
}

.upload-icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: linear-gradient(
    160deg,
    rgba(242, 56, 15, 0.85),
    rgba(242, 148, 65, 0.9)
  );
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 30px;
  box-shadow: 0 12px 26px rgba(242, 56, 15, 0.25);
}

.upload-zone p {
  margin: 0;
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 600;
}

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

.security-check {
  margin-top: 12px;
  display: flex;
  justify-content: center;
}

#file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.control-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.toggle {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  gap: 4px;
}

.toggle button {
  border: none;
  background: transparent;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.25s ease;
}

.toggle button.active {
  background: linear-gradient(
    120deg,
    rgba(160, 211, 217, 0.85),
    rgba(242, 148, 65, 0.8)
  );
  color: #1f1b19;
  box-shadow: 0 10px 20px rgba(160, 211, 217, 0.4);
}

.primary-btn {
  border: none;
  padding: 12px 26px;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--red), var(--orange));
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
  box-shadow: 0 16px 30px rgba(242, 56, 15, 0.35);
}

.primary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

.primary-btn:not(:disabled):active {
  transform: scale(0.98);
}

.btn-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.primary-btn.loading .btn-text {
  opacity: 0.5;
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: spin 1s linear infinite;
  display: none;
}

.primary-btn.loading .spinner {
  display: inline-block;
}

.secondary-btn {
  border: 1px solid rgba(31, 31, 31, 0.12);
  padding: 10px 22px;
  border-radius: 999px;
  background: linear-gradient(
    120deg,
    rgba(160, 211, 217, 0.6),
    rgba(255, 255, 255, 0.9)
  );
  color: #1f1b19;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
  box-shadow: 0 12px 24px rgba(160, 211, 217, 0.35);
}

.secondary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

.secondary-btn:not(:disabled):active {
  transform: scale(0.98);
}

.no-underline {
  text-decoration: none;
}

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

.status[data-kind="warning"] {
  color: #9b4d12;
}

.workspace {
  gap: 24px;
  display: flex;
  flex-direction: column;
}

.panel-head {
  display: grid;
  gap: 6px;
}

.panel-head h2 {
  margin: 0;
  font-size: clamp(18px, 2.4vw, 24px);
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Meiryo",
    sans-serif;
}

.panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.preview-layout {
  display: grid;
  gap: 20px;
}

.preview-stage {
  display: grid;
  gap: 12px;
}

.preview-wrap {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
  margin: 0 auto;
  touch-action: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.preview-wrap canvas {
  display: block;
}

.preview-wrap .overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.preview-hint {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.crop-controls {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
}

.crop-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.crop-range {
  width: 100%;
  accent-color: var(--red);
}

.crop-value {
  font-size: 13px;
  font-weight: 600;
  color: #1d3c3e;
  min-width: 44px;
  text-align: right;
}

.thumbs {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.thumb {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  display: grid;
  gap: 8px;
}

.thumb-label {
  font-weight: 600;
  color: var(--muted);
}

.thumb canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  background: #eee7df;
}

.results-grid {
  display: grid;
  gap: 16px;
}

.results-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.result-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
}

.result-card img {
  width: 100%;
  border-radius: 14px;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.result-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}

.download-link {
  text-decoration: none;
  color: #1d3c3e;
  font-weight: 600;
  background: rgba(160, 211, 217, 0.4);
  padding: 6px 12px;
  border-radius: 999px;
}

.seo-content {
  line-height: 1.8;
}

.seo-content h2 {
  margin: 0;
  font-size: clamp(16px, 2vw, 18px);
}

.seo-content h2:not(:first-child) {
  margin-top: 8px;
}

.seo-content p {
  margin: 0;
  color: var(--muted);
}

.split-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px 0;
}

.split-source {
  width: 54px;
  height: 120px;
  background: linear-gradient(180deg, var(--orange) 0%, var(--red) 100%);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(242, 56, 15, 0.25);
}

.split-arrow {
  color: var(--muted);
}

.split-arrow svg {
  width: 28px;
  height: 28px;
}

.split-output {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 4px;
  width: 108px;
  height: 61px;
}

.split-cell {
  background: linear-gradient(180deg, var(--orange) 0%, var(--red) 100%);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(242, 56, 15, 0.2);
}

.split-cell:nth-child(1) { opacity: 1; }
.split-cell:nth-child(2) { opacity: 0.85; }
.split-cell:nth-child(3) { opacity: 0.7; }
.split-cell:nth-child(4) { opacity: 0.55; }

.spec-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.spec-list li {
  margin-bottom: 4px;
}

.site-footer {
  margin-top: 40px;
  display: grid;
  gap: 10px;
  text-align: center;
}

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

.footer-link {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.footer-link:hover {
  color: #1d3c3e;
  border-color: rgba(29, 60, 62, 0.4);
}

.footer-copy {
  color: var(--muted);
  font-size: 12px;
}

@media (min-width: 900px) {
  .preview-layout {
    grid-template-columns: 1.1fr 1fr;
    align-items: start;
  }

  .results-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

@media (max-width: 600px) {
  .control-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .primary-btn {
    justify-content: center;
    padding: 16px 28px;
    font-size: 16px;
  }

  .secondary-btn {
    padding: 14px 24px;
    font-size: 15px;
  }

  .toggle {
    width: 100%;
    justify-content: center;
  }

  .toggle button {
    flex: 1;
    padding: 14px 20px;
    font-size: 15px;
  }

  .results-actions {
    display: none;
  }

  .crop-controls {
    grid-template-columns: 1fr;
    gap: 8px;
    order: -1;
    padding: 14px 18px;
  }

  .crop-label {
    font-size: 14px;
  }

  .crop-range {
    height: 32px;
  }

  .crop-value {
    justify-self: end;
    font-size: 14px;
  }

  .workspace .panel-head {
    order: -2;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

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

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(-3deg);
  }
  50% {
    transform: translate3d(20px, -10px, 0) rotate(2deg);
  }
}
