:root {
  color-scheme: light;
  --teal: #9fd8d8;
  --orange: #ff9543;
  --red: #f54421;
  --ink: #101218;
  --paper: #f7f2ea;
  --card: rgba(255, 255, 255, 0.78);
  --line: rgba(16, 18, 24, 0.12);
  --success: #127955;
  --warning: #b04600;
  --info: #204dbf;
  --shadow: 0 22px 44px rgba(26, 34, 61, 0.16), 0 8px 20px rgba(16, 18, 24, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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 520px at 6% 4%, rgba(159, 216, 216, 0.5), transparent 72%),
    radial-gradient(820px 620px at 96% 10%, rgba(255, 149, 67, 0.4), transparent 68%),
    radial-gradient(840px 700px at 46% 105%, rgba(245, 68, 33, 0.2), transparent 72%),
    linear-gradient(125deg, rgba(255, 255, 255, 0.84) 0%, rgba(255, 255, 255, 0) 48%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  pointer-events: none;
  inset: -26% -18%;
  filter: blur(52px);
  opacity: 0.68;
}

body::before {
  background: conic-gradient(
    from 130deg,
    rgba(159, 216, 216, 0.3),
    rgba(255, 149, 67, 0.22),
    rgba(245, 68, 33, 0.2),
    rgba(159, 216, 216, 0.24)
  );
  animation: float 16s ease-in-out infinite;
}

body::after {
  background: radial-gradient(closest-side, rgba(255, 149, 67, 0.24), transparent 70%);
  animation: float 22s ease-in-out infinite reverse;
}

main {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: clamp(20px, 2.7vw, 40px) 0 80px;
}

.hero {
  display: grid;
  gap: 14px;
  margin-bottom: 24px;
  animation: rise 0.8s ease both;
}

.badge {
  width: fit-content;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(118deg, rgba(159, 216, 216, 0.88), rgba(255, 149, 67, 0.74));
  color: #1d1915;
}

h1 {
  margin: 0;
  font-size: clamp(31px, 4.3vw, 52px);
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.hero p {
  margin: 0;
  max-width: 760px;
  color: rgba(21, 24, 29, 0.72);
  line-height: 1.8;
}

.panel {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 24px;
  padding: clamp(16px, 2.4vw, 28px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  display: grid;
  gap: 16px;
  animation: rise 0.65s ease both;
}

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

.panel-head h2 {
  margin: 0;
  font-size: clamp(19px, 2.2vw, 26px);
}

.panel-head p {
  margin: 6px 0 0;
  color: rgba(21, 24, 29, 0.68);
  font-size: 14px;
  line-height: 1.7;
}

.toggle-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.toggle-group button,
.chip {
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  transition: 0.22s ease;
}

.toggle-group button:hover,
.chip:hover {
  transform: translateY(-1px);
  border-color: rgba(32, 77, 191, 0.36);
}

.toggle-group button.active,
.chip.active {
  color: #ffffff;
  border-color: transparent;
  background: linear-gradient(130deg, #1341af, #f54421);
  box-shadow: 0 10px 20px rgba(32, 77, 191, 0.24);
}

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

.upload-layout.single {
  grid-template-columns: 1fr;
}

.upload-zone {
  border-radius: 18px;
  border: 2px dashed rgba(16, 18, 24, 0.2);
  background: rgba(255, 255, 255, 0.72);
  min-height: 160px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  text-align: center;
  padding: 16px;
  position: relative;
  transition: 0.22s ease;
}

.upload-zone strong {
  font-size: 17px;
}

.upload-zone span {
  font-size: 13px;
  color: rgba(16, 18, 24, 0.62);
}

.upload-zone.blue {
  border-color: rgba(0, 86, 247, 0.46);
}

.upload-zone.pink {
  border-color: rgba(255, 0, 128, 0.42);
}

.upload-zone.couple {
  border-color: rgba(55, 74, 132, 0.4);
}

.upload-zone.dragover {
  transform: translateY(-2px);
  border-color: rgba(32, 77, 191, 0.72);
  box-shadow: 0 18px 26px rgba(32, 77, 191, 0.18);
}

.upload-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #2061ff, #f54421);
}

.status {
  margin: 0;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  background: rgba(32, 77, 191, 0.08);
  border: 1px solid rgba(32, 77, 191, 0.2);
  color: #1f4eb4;
}

.status[data-kind="success"] {
  color: #0f6f4f;
  border-color: rgba(18, 121, 85, 0.28);
  background: rgba(18, 121, 85, 0.08);
}

.status[data-kind="warning"] {
  color: #a33d00;
  border-color: rgba(176, 70, 0, 0.3);
  background: rgba(176, 70, 0, 0.08);
}

.security-check {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

#turnstile-widget {
  width: 1px;
  height: 1px;
}

.template-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

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

.custom-grid label {
  font-size: 13px;
  color: rgba(16, 18, 24, 0.72);
  display: grid;
  gap: 6px;
}

.custom-grid input[type="color"] {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.typography-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.typography-grid label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: rgba(16, 18, 24, 0.75);
}

.preview-wrap {
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  background: rgba(16, 18, 24, 0.08);
  overflow: hidden;
}

#preview-canvas {
  width: 100%;
  max-height: 70vh;
  display: block;
  touch-action: none;
  user-select: none;
}

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

.controls-grid label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: rgba(16, 18, 24, 0.75);
}

.controls-grid input[type="text"],
.typography-grid input[type="text"],
.format-field select {
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 40px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.84);
}

.controls-grid input[type="range"],
#split-range {
  accent-color: #2052d3;
}

.checkbox-line {
  align-items: center;
  grid-auto-flow: column;
  justify-content: start;
  gap: 8px;
  min-height: 40px;
}

.inline-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border: 1px solid rgba(16, 18, 24, 0.13);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.75);
  padding: 8px 12px;
}

.inline-controls label {
  font-size: 13px;
  color: rgba(16, 18, 24, 0.76);
}

.inline-controls span {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: rgba(16, 18, 24, 0.75);
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
}

.size-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.format-field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: rgba(16, 18, 24, 0.75);
}

.primary,
.secondary {
  min-height: 42px;
  border-radius: 12px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 700;
}

.primary {
  color: #ffffff;
  background: linear-gradient(130deg, #1a4cc9, #f54421);
  box-shadow: 0 11px 18px rgba(40, 70, 148, 0.24);
}

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

.secondary {
  color: #123ca5;
  border: 1px solid rgba(32, 77, 191, 0.28);
  background: rgba(255, 255, 255, 0.75);
}

.result-box {
  border-radius: 16px;
  border: 1px solid rgba(16, 18, 24, 0.12);
  background: rgba(15, 18, 24, 0.08);
  overflow: hidden;
}

.result-box img {
  width: 100%;
  display: block;
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.result-meta {
  font-size: 13px;
  color: rgba(16, 18, 24, 0.7);
  margin-right: auto;
}

.prose {
  line-height: 1.8;
}

.prose h2 {
  margin: 0;
}

.prose p {
  margin: 8px 0 0;
}

.prose ol,
.prose ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.prose li {
  margin-bottom: 4px;
}

.prose h3 {
  margin: 16px 0 0;
  font-size: clamp(15px, 1.6vw, 18px);
}

.doc-meta {
  margin: 0;
  font-size: 14px;
  color: rgba(16, 18, 24, 0.68);
}

.doc-meta + h2 {
  margin-top: 20px;
}

.site-footer {
  margin-top: 24px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid rgba(16, 18, 24, 0.1);
  background: rgba(255, 255, 255, 0.62);
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: rgba(16, 18, 24, 0.68);
}

.footer-brand {
  font-size: 14px;
  font-weight: 700;
  color: rgba(16, 18, 24, 0.9);
}

.site-footer p {
  margin: 0;
}

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

.footer-links a {
  color: #204dbf;
  text-decoration: none;
}

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

@media (max-width: 880px) {
  .controls-grid {
    grid-template-columns: 1fr;
  }

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

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

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

@media (max-width: 640px) {
  main {
    width: calc(100% - 18px);
    padding-bottom: 56px;
  }

  .upload-layout {
    grid-template-columns: 1fr;
  }

  .panel {
    border-radius: 20px;
    padding: 15px;
  }

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

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

  .status {
    font-size: 13px;
  }

  .secondary,
  .primary,
  .toggle-group button,
  .chip {
    min-height: 40px;
  }
}

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

@keyframes float {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(-4deg);
  }
  50% {
    transform: translate3d(0, -22px, 0) rotate(4deg);
  }
}
