:root {
  --bg: #070a12;
  --panel: rgba(17, 23, 39, 0.68);
  --panel-strong: rgba(11, 16, 28, 0.92);
  --line: rgba(166, 184, 255, 0.14);
  --line-strong: rgba(166, 184, 255, 0.3);
  --text: #eef1fb;
  --muted: #98a2bd;
  --accent: #8ea2ff;
  --accent-2: #c2a8ff;
  --gold: #e7cf9c;
  --stamp: #c8555f;
  --radius: 22px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 12% -8%, rgba(88, 106, 190, 0.17), transparent 62%),
    radial-gradient(900px 520px at 92% 4%, rgba(132, 86, 180, 0.13), transparent 60%),
    linear-gradient(180deg, #090d17 0%, var(--bg) 48%, #05070d 100%);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Hiragino Sans", "Noto Sans JP", "PingFang TC", "Microsoft JhengHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.ambient {
  position: fixed;
  width: 46vw;
  height: 46vw;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.22;
  pointer-events: none;
  z-index: 0;
}
.ambient-a { top: -18vw; left: -12vw; background: #4c66c8; }
.ambient-b { top: 38vh; right: -20vw; background: #7b4ea8; opacity: 0.16; }

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.page-shell {
  position: relative;
  z-index: 2;
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 30px 0 56px;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 4px 26px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 58px;
}

.brand { display: inline-flex; align-items: center; gap: 13px; }

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(145deg, rgba(142, 162, 255, 0.2), rgba(194, 168, 255, 0.04));
  color: #dce4ff;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 23px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 21px;
  letter-spacing: 0.01em;
}
.brand-sub {
  margin-top: 5px;
  font-size: 9px;
  letter-spacing: 0.24em;
  color: var(--muted);
}

.lang-switch {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 12, 22, 0.6);
  backdrop-filter: blur(12px);
}

.lang-switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.25s ease, background 0.25s ease;
}
.lang-switch button:hover { color: var(--text); }
.lang-switch button.is-active {
  color: #0b1020;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 18px rgba(142, 162, 255, 0.28);
}

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 6px 0 64px; }

.eyebrow {
  margin: 0 0 20px;
  font-size: 11px;
  letter-spacing: 0.34em;
  color: var(--gold);
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Hiragino Mincho ProN", Georgia, serif;
  font-size: clamp(2.35rem, 6.2vw, 4.6rem);
  line-height: 1.18;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.hero h1 em {
  font-style: italic;
  background: linear-gradient(100deg, #b9c8ff 0%, #d8c4ff 48%, #f0d9a8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-copy {
  max-width: 620px;
  margin: 22px auto 0;
  color: var(--muted);
  font-size: 15px;
}

.hero-chips {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 28px;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: rgba(152, 162, 189, 0.62);
}
.chip-dot { color: var(--accent); opacity: 0.7; }

/* ---------- Panels ---------- */
.panel {
  position: relative;
  margin-bottom: 30px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(23, 30, 49, 0.82), rgba(11, 16, 28, 0.72));
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}
.panel::before {
  content: "";
  position: absolute;
  inset: 0 18% auto 18%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(181, 197, 255, 0.35), transparent);
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.section-title-wrap { display: flex; align-items: flex-start; gap: 16px; }
.section-index {
  flex: none;
  margin-top: 4px;
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--accent);
  padding: 4px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: rgba(142, 162, 255, 0.06);
}
.section-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: 0.01em;
}
.section-sub {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}
.section-badge {
  flex: none;
  margin-top: 4px;
  border: 1px solid rgba(231, 207, 156, 0.28);
  color: var(--gold);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 9px;
  letter-spacing: 0.2em;
}
.section-badge-soft {
  border-color: var(--line-strong);
  color: var(--accent);
}

/* ---------- Carousel ---------- */
.carousel {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 15px;
  border: 1px solid rgba(180, 196, 255, 0.16);
  background: #05070d;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
  outline: none;
}
.carousel:focus-visible { box-shadow: 0 0 0 3px rgba(142, 162, 255, 0.42); }

.slides, .slide { position: absolute; inset: 0; }
.slide {
  opacity: 0;
  transform: scale(1.045);
  transition: opacity 0.85s ease, transform 1.5s var(--ease);
  pointer-events: none;
}
.slide.is-active { opacity: 1; transform: scale(1); pointer-events: auto; }
.slide img { width: 100%; height: 100%; display: block; object-fit: cover; }

.carousel-shade {
  position: absolute;
  inset: auto 0 0 0;
  height: 34%;
  background: linear-gradient(180deg, transparent, rgba(4, 6, 12, 0.78));
  pointer-events: none;
}

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(8, 12, 22, 0.46);
  backdrop-filter: blur(10px);
  color: #fff;
  opacity: 0;
  transition: opacity 0.25s ease, background 0.25s ease, transform 0.25s ease;
  z-index: 3;
}
.carousel:hover .carousel-nav,
.carousel:focus-within .carousel-nav { opacity: 1; }
.carousel-nav:hover { background: rgba(142, 162, 255, 0.32); transform: translateY(-50%) scale(1.06); }
.carousel-nav.prev { left: 18px; }
.carousel-nav.next { right: 18px; }
.carousel-nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.carousel-footer {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 18px;
  z-index: 4;
}
.counter {
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.86);
  white-space: nowrap;
}
.dots { display: flex; align-items: center; gap: 7px; flex: 1; }
.dots button {
  width: 18px;
  height: 4px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.3);
  transition: width 0.35s var(--ease), background 0.3s ease;
}
.dots button:hover { background: rgba(255, 255, 255, 0.62); }
.dots button.is-active { width: 38px; background: linear-gradient(90deg, var(--accent), #e2d3ff); }

.play-toggle {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: rgba(8, 12, 22, 0.42);
  color: #fff;
}
.play-toggle svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.play-toggle .icon-play { display: none; fill: currentColor; stroke: none; }
.play-toggle.is-paused .icon-pause { display: none; }
.play-toggle.is-paused .icon-play { display: block; }

.progress-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  z-index: 5;
}
.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* ---------- Template ---------- */
.template-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(220px, 0.75fr);
  gap: 26px;
  align-items: stretch;
}
.template-preview {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #05070d;
}
.template-preview img { width: 100%; display: block; transition: transform 0.7s var(--ease); }
.template-preview:hover img { transform: scale(1.025); }
.zoom-hint {
  position: absolute;
  right: 14px;
  bottom: 14px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(7, 10, 18, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.82);
}

.template-side {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: rgba(6, 10, 18, 0.4);
  overflow: hidden;
}
.template-side::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -90px;
  bottom: -90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(142, 162, 255, 0.18), transparent 70%);
  pointer-events: none;
}
.template-stamp {
  position: absolute;
  top: 14px;
  right: 16px;
  transform: rotate(-10deg);
  color: var(--stamp);
  border: 2px solid var(--stamp);
  border-radius: 4px;
  padding: 3px 7px;
  font-family: "Hiragino Mincho ProN", serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0.82;
}
.template-desc { margin: 0; color: var(--muted); font-size: 13px; }
.template-meta { margin: -6px 0 0; font-size: 10px; letter-spacing: 0.16em; color: rgba(152, 162, 189, 0.6); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 12px 19px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.02em;
  transition: transform 0.25s var(--ease), box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  color: #0a0e19;
  background: linear-gradient(115deg, #a6b6ff, #d0b6ff 62%, #e7d3b0);
  box-shadow: 0 10px 30px rgba(142, 162, 255, 0.24);
}
.btn-primary:hover { box-shadow: 0 14px 38px rgba(142, 162, 255, 0.36); }
.btn-ghost { color: var(--muted); border-color: var(--line-strong); background: rgba(255, 255, 255, 0.02); }
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.btn-download { width: 100%; }

/* ---------- Form ---------- */
.form-note {
  margin-bottom: 18px;
  padding: 12px 16px;
  border-left: 2px solid var(--gold);
  border-radius: 0 10px 10px 0;
  background: rgba(231, 207, 156, 0.055);
  color: #d8cfb8;
  font-size: 12.5px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.field {
  display: block;
  padding: 13px 15px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.022);
  transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}
.field:focus-within {
  border-color: rgba(142, 162, 255, 0.55);
  background: rgba(142, 162, 255, 0.05);
  box-shadow: 0 0 0 3px rgba(142, 162, 255, 0.09);
}
.field.wide { grid-column: 1 / -1; }
.field-label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 7px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: #c8d0e8;
}
.field-num { font-family: "SF Mono", ui-monospace, Menlo, monospace; font-size: 9px; color: var(--accent); opacity: 0.75; }
.field input, .field textarea {
  width: 100%;
  border: 0;
  outline: 0;
  padding: 2px 0;
  color: var(--text);
  background: transparent;
  font-size: 14.5px;
  line-height: 1.6;
}
.field textarea { min-height: 58px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: rgba(152, 162, 189, 0.42); }

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.btn-copy { min-width: 210px; }

/* ---------- Footer ---------- */
.footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 6px 0;
  color: rgba(152, 162, 189, 0.55);
  font-size: 11px;
  letter-spacing: 0.08em;
}
.footer-line { flex: 1; height: 1px; background: var(--line); }

/* ---------- Lightbox & toast ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 6vw;
  background: rgba(3, 5, 10, 0.93);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.25s ease;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%;
  max-height: 86vh;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
}
.lightbox-close {
  position: absolute;
  top: 24px;
  right: 26px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.lightbox-close svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 200;
  transform: translate(-50%, 18px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 22px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(13, 18, 31, 0.94);
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.45);
  color: var(--text);
  font-size: 13px;
  transition: opacity 0.3s ease, transform 0.3s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { border-color: rgba(200, 85, 95, 0.6); color: #ffc9cd; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .page-shell { width: min(100% - 30px, 720px); padding-top: 20px; }
  .topbar { flex-direction: column; align-items: stretch; margin-bottom: 42px; gap: 18px; }
  .lang-switch { justify-content: space-between; width: 100%; }
  .lang-switch button { flex: 1; padding: 9px 6px; }
  .hero { padding-bottom: 44px; }
  .panel { padding: 20px; border-radius: 18px; }
  .template-layout { grid-template-columns: 1fr; }
  .template-side { min-height: 190px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.wide { grid-column: auto; }
  .section-badge { display: none; }
}

@media (max-width: 560px) {
  body { font-size: 14px; }
  .page-shell { width: calc(100% - 22px); }
  .brand-sub { letter-spacing: 0.16em; }
  .hero h1 { font-size: clamp(2rem, 9vw, 2.8rem); }
  .hero-chips { gap: 8px; font-size: 8px; letter-spacing: 0.14em; }
  .section-head h2 { font-size: 17px; }
  .carousel-footer { left: 14px; right: 14px; bottom: 13px; gap: 10px; }
  .dots { gap: 5px; }
  .dots button { width: 12px; }
  .dots button.is-active { width: 26px; }
  .carousel-nav { width: 34px; height: 34px; opacity: 1; }
  .carousel-nav.prev { left: 8px; }
  .carousel-nav.next { right: 8px; }
  .form-actions { flex-direction: column-reverse; align-items: stretch; }
  .form-actions .btn { width: 100%; }
  .footer { flex-wrap: wrap; }
  .footer-line { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
