:root {
  --cream: #f7f0df;
  --paper: #fffdf6;
  --ink: #213a34;
  --ink-soft: #5d6e68;
  --green: #176b58;
  --green-deep: #0e5748;
  --green-pale: #e4f1e9;
  --coral: #e5674d;
  --coral-pale: #fff0e8;
  --gold: #e4aa36;
  --line: #d9d1bb;
  --shadow: 0 20px 55px rgba(49, 58, 45, 0.16);
  --radius: 28px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html,
body {
  min-height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(241, 190, 82, 0.24), transparent 25%),
    radial-gradient(circle at 88% 90%, rgba(53, 145, 112, 0.17), transparent 26%),
    var(--cream);
  font-family: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.23;
  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='.75' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

button,
a { font: inherit; }

button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 4px solid rgba(229, 103, 77, 0.35);
  outline-offset: 3px;
}

.page-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 5px minmax(0, 1fr) auto;
  width: min(100%, 680px);
  height: 100dvh;
  min-height: 560px;
  margin: 0 auto;
  background: rgba(255, 253, 246, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.app-header {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 11px;
  padding: max(12px, env(safe-area-inset-top)) 18px 11px;
  background: rgba(255, 253, 246, 0.96);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 15px 15px 15px 5px;
  color: #fff;
  background: var(--green);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -0.04em;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.08);
}

.brand-copy p,
.brand-copy strong { margin: 0; }
.brand-copy p { color: var(--ink-soft); font-size: 10px; font-weight: 700; letter-spacing: 0.06em; }
.brand-copy strong { display: block; margin-top: 1px; font-size: 14px; }

.page-count {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 64px;
  color: var(--ink-soft);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.page-count strong { color: var(--green); font-size: 24px; line-height: 1; }

.progress-track { overflow: hidden; background: #e8e0cc; }
.progress-track span {
  display: block;
  width: 10%;
  height: 100%;
  border-radius: 0 8px 8px 0;
  background: linear-gradient(90deg, var(--green), #48a778);
  transition: width 0.3s ease;
}

.step-deck { position: relative; min-height: 0; }

.step-card {
  position: absolute;
  inset: 0;
  overflow: hidden auto;
  padding: 22px 22px 14px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #c4bca8 transparent;
}

.step-card[hidden] { display: none; }
.step-card[data-active="true"] { animation: card-in 0.36s cubic-bezier(.2,.75,.2,1) both; }

@keyframes card-in {
  from { opacity: 0; transform: translateX(20px) scale(.99); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

.step-inner { width: min(100%, 510px); min-height: 100%; margin: 0 auto; }
.step-inner.centered { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding-bottom: 8px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 12px;
  border: 1px solid #bcd6c9;
  border-radius: 999px;
  color: var(--green-deep);
  background: var(--green-pale);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

h1,
h2 { margin: 12px 0 9px; color: var(--ink); font-weight: 900; letter-spacing: -0.035em; line-height: 1.36; }
h1 { font-size: clamp(29px, 8.4vw, 44px); }
h2 { font-size: clamp(25px, 7.2vw, 36px); }
h1 em { color: var(--coral); font-style: normal; text-decoration: underline; text-decoration-color: rgba(229,103,77,.24); text-decoration-thickness: 8px; text-underline-offset: -3px; }

.lead { max-width: 400px; margin: 0; color: var(--ink-soft); font-size: 14px; font-weight: 500; line-height: 1.8; }
.time-chip { margin-top: 16px; padding: 7px 16px; border-radius: 999px; color: #8a5d09; background: #fff3cc; font-size: 12px; font-weight: 900; }

.hero-illustration { position: relative; width: 250px; height: 164px; margin: 0 auto 2px; }
.sun { position: absolute; top: 10px; right: 20px; width: 64px; height: 64px; border-radius: 50%; background: #f7c451; box-shadow: 0 0 0 10px rgba(247,196,81,.16); }
.cloud { position: absolute; height: 25px; border-radius: 999px; background: #fff; box-shadow: 0 5px 13px rgba(63,70,57,.08); }
.cloud::before, .cloud::after { content: ""; position: absolute; bottom: 0; border-radius: 50%; background: inherit; }
.cloud::before { left: 15px; width: 34px; height: 34px; }
.cloud::after { right: 14px; width: 27px; height: 27px; }
.cloud-a { top: 28px; left: 8px; width: 93px; }
.cloud-b { top: 76px; right: 0; width: 75px; transform: scale(.75); opacity: .75; }
.paper-sheet { position: absolute; left: 68px; top: 34px; display: grid; place-items: center; width: 112px; height: 126px; transform: rotate(-3deg); border: 3px solid #1b77a7; border-radius: 3px; color: #2f873a; background: #fffef8; font-size: 42px; font-weight: 900; box-shadow: 8px 10px 0 rgba(23,107,88,.12); }
.paper-sheet::after { content: "おたより"; position: absolute; bottom: 16px; color: var(--coral); font-size: 12px; letter-spacing: .08em; }
.leaf { position: absolute; width: 44px; height: 22px; border-radius: 100% 0 100% 0; background: #66a85b; }
.leaf-a { left: 16px; bottom: 11px; transform: rotate(24deg); }
.leaf-b { right: 13px; bottom: 4px; transform: rotate(142deg); background: #e29843; }

.image-frame { position: relative; width: min(100%, 360px); margin: 13px auto 12px; padding: 9px; border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: 0 13px 35px rgba(46,63,50,.13); }
.image-frame img { display: block; width: 100%; max-height: 45dvh; object-fit: contain; border-radius: 14px; }
.image-label { position: absolute; top: 18px; left: 18px; padding: 5px 10px; border-radius: 999px; color: #fff; background: rgba(33,58,52,.83); font-size: 10px; font-weight: 900; backdrop-filter: blur(5px); }

.care-note { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 10px; max-width: 460px; margin: 12px auto 0; padding: 12px 14px; border: 1px solid #efc59f; border-radius: 16px; background: var(--coral-pale); }
.care-note strong { color: #a2472f; font-size: 11px; white-space: nowrap; }
.care-note p { margin: 0; color: #6d574f; font-size: 11px; line-height: 1.65; }

.phone-mock { width: min(100%, 335px); height: min(42dvh, 360px); min-height: 260px; margin: 16px auto 12px; overflow: hidden; border: 8px solid #283b36; border-radius: 30px; background: #f7f7f5; box-shadow: 0 16px 38px rgba(35,49,43,.2); }
.phone-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 44px; padding: 0 14px; border-bottom: 1px solid #ddd; background: #fff; font-size: 12px; }
.phone-top span { width: 7px; height: 7px; border-radius: 50%; background: #c8cec9; }
.phone-top i { justify-self: end; width: 24px; height: 4px; border-radius: 4px; background: #c8cec9; }
.mock-space { position: relative; height: calc(100% - 44px); padding: 20px 13px; }
.mock-help { width: fit-content; margin: 30px auto 0; padding: 9px 13px; border-radius: 12px; color: #fff; background: var(--coral); font-size: 12px; font-weight: 900; line-height: 1.55; text-align: center; box-shadow: 0 8px 20px rgba(229,103,77,.25); }
.mock-help::after { content: ""; position: absolute; left: 35px; bottom: 65px; width: 35px; height: 40px; border-left: 3px dashed var(--coral); border-bottom: 3px dashed var(--coral); border-radius: 0 0 0 14px; }
.composer { position: absolute; left: 13px; right: 13px; bottom: 13px; display: grid; grid-template-columns: 34px 1fr 30px; align-items: center; gap: 7px; min-height: 58px; padding: 8px; border: 2px solid #d7dad6; border-radius: 24px; background: #fff; }
.attach-focus { box-shadow: 0 0 0 4px rgba(229,103,77,.22); border-color: var(--coral); }
.plus, .send { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-weight: 900; }
.plus { color: #283b36; background: #eef0ed; font-size: 21px; }
.send { color: #fff; background: #20372f; font-size: 17px; }
.placeholder { color: #919893; font-size: 11px; }
.instruction { max-width: 420px; margin: 11px auto; color: var(--ink-soft); font-size: 13px; font-weight: 600; line-height: 1.7; text-align: center; }
.instruction b { color: var(--coral); }
.open-ai-link, .primary-link { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 45px; margin: 10px auto 0; border-radius: 14px; color: var(--green-deep); background: var(--green-pale); font-size: 13px; font-weight: 900; text-decoration: none; }
.open-ai-link { width: min(100%, 335px); }

.attachment-chip { width: fit-content; margin: 4px auto; padding: 7px 10px; border: 1px solid #cfd5d0; border-radius: 9px; color: #53605a; background: #fff; font-size: 10px; }
.paste-mock .mock-help { margin-top: 20px; }
.paste-mock .mock-help::after { left: 50%; bottom: 72px; height: 30px; }
.paste-focus { box-shadow: 0 0 0 4px rgba(229,103,77,.22); border-color: var(--coral); }
.tiny-steps { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; max-width: 430px; margin: 12px auto 0; padding: 0; list-style: none; }
.tiny-steps li { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: 12px; color: var(--ink-soft); background: #f2eee2; font-size: 10px; font-weight: 700; text-align: center; }
.tiny-steps span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; background: var(--green); font-size: 11px; }

.prompt-box { position: relative; width: 100%; margin: 18px auto 14px; border: 2px solid #b9cfc4; border-radius: 20px; color: #253b35; background: #fff; box-shadow: inset 0 0 0 5px #eef5f0, 0 10px 28px rgba(35,62,52,.1); font-size: 15px; font-weight: 600; line-height: 1.9; white-space: pre-wrap; }
.prompt-box::before { content: "AIへのお願い文"; position: absolute; top: -13px; left: 16px; padding: 3px 10px; border-radius: 999px; color: #fff; background: var(--green); font-size: 10px; font-weight: 900; letter-spacing: .04em; }
.prompt-box.compact { min-height: 145px; padding: 26px 20px 18px; }
.copy-button { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 58px; border: 0; border-radius: 18px; color: #fff; background: linear-gradient(180deg, #238069, var(--green)); font-size: 15px; font-weight: 900; box-shadow: 0 8px 0 var(--green-deep), 0 15px 30px rgba(23,107,88,.24); cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.copy-button:active { transform: translateY(5px); box-shadow: 0 3px 0 var(--green-deep), 0 8px 18px rgba(23,107,88,.18); }
.copy-button.is-copied { background: linear-gradient(180deg, #e7775f, var(--coral)); box-shadow: 0 8px 0 #ad4733, 0 15px 30px rgba(229,103,77,.2); }
.copy-icon { font-size: 19px; }
.micro-copy { margin: 14px 0 0; color: var(--ink-soft); font-size: 11px; line-height: 1.65; text-align: center; }

.result-card { background: linear-gradient(180deg, rgba(231,244,235,.72), transparent 52%); }
.result-frame { width: min(100%, 330px); }
.result-frame img { max-height: 48dvh; }
.success-note { margin: 8px auto 0; color: var(--green-deep); font-size: 13px; font-weight: 900; text-align: center; }
.spark { position: absolute; color: var(--gold); font-size: 30px; text-shadow: 0 3px 0 #fff; animation: twinkle 1.8s ease-in-out infinite alternate; }
.spark-a { top: 18px; right: -13px; }
.spark-b { left: -11px; bottom: 40px; animation-delay: .5s; }
@keyframes twinkle { to { transform: rotate(18deg) scale(1.2); } }
.autumn-card { background: radial-gradient(circle at 85% 10%, rgba(241,190,82,.23), transparent 30%); }

.long-preview { max-height: 150px; overflow: hidden; padding: 25px 20px 46px; }
.long-preview::before { top: 8px; }
.long-preview::after { content: "この続きもまとめてコピーされます"; position: absolute; left: 0; right: 0; bottom: 0; padding: 29px 10px 12px; color: var(--green-deep); background: linear-gradient(transparent, #fff 38%); font-size: 10px; font-weight: 900; text-align: center; }
.full-prompt { margin-top: 16px; border: 1px solid var(--line); border-radius: 16px; background: #fffaf0; }
.full-prompt summary { padding: 12px 15px; color: var(--green-deep); font-size: 12px; font-weight: 900; cursor: pointer; }
.full-prompt pre { max-height: 28dvh; margin: 0; overflow: auto; padding: 15px; border-top: 1px solid var(--line); color: #3e514b; background: #fff; font-family: inherit; font-size: 11px; line-height: 1.75; white-space: pre-wrap; }

.finish-card { background: radial-gradient(circle at 14% 14%, rgba(241,190,82,.18), transparent 31%); }
.final-image img { max-height: 38dvh; }
.finish-actions { display: grid; gap: 9px; margin-top: 12px; }
.primary-link { min-height: 49px; margin: 0; color: #fff; background: var(--green); }
.restart-button { min-height: 43px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: #fff; font-size: 12px; font-weight: 900; cursor: pointer; }
.official-note { margin: 10px 0 0; color: var(--ink-soft); font-size: 10px; line-height: 1.6; text-align: center; }

.toast { position: absolute; left: 22px; right: 22px; bottom: calc(92px + var(--safe-bottom)); z-index: 10; display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 10px; width: min(calc(100% - 44px), 460px); margin: 0 auto; padding: 12px 15px; border-radius: 16px; color: #fff; background: rgba(27,60,50,.96); box-shadow: 0 14px 35px rgba(24,49,42,.32); animation: toast-in .25s ease both; }
.toast[hidden] { display: none; }
.toast > span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--green-deep); background: #d8f5e7; font-weight: 900; }
.toast strong, .toast small { display: block; }
.toast strong { font-size: 13px; }
.toast small { margin-top: 2px; color: #dce8e3; font-size: 10px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

.step-nav { display: grid; grid-template-columns: minmax(94px,.6fr) minmax(180px,1.4fr); gap: 10px; padding: 12px 18px calc(12px + var(--safe-bottom)); border-top: 1px solid rgba(203,194,172,.75); background: rgba(255,253,246,.96); box-shadow: 0 -10px 25px rgba(52,60,46,.07); }
.step-nav.is-last { grid-template-columns: 1fr; }
.step-nav.is-last .next-button { display: none; }
.step-nav button { min-height: 54px; border-radius: 17px; font-size: 15px; font-weight: 900; cursor: pointer; }
.back-button { border: 1px solid var(--line); color: var(--ink-soft); background: #fff; }
.back-button:disabled { opacity: .35; cursor: default; }
.next-button { display: flex; align-items: center; justify-content: center; gap: 12px; border: 0; color: #fff; background: var(--coral); box-shadow: inset 0 -4px 0 rgba(124,48,33,.18); }
.next-button span { font-size: 22px; }

noscript { position: fixed; inset: 20px; z-index: 50; padding: 20px; color: #fff; background: #273b34; }

@media (min-width: 681px) {
  body { padding: 20px 0; }
  .page-shell { height: calc(100dvh - 40px); border-radius: 30px; overflow: hidden; }
}

@media (max-height: 680px) {
  .step-card { padding-top: 14px; }
  h1, h2 { margin-top: 8px; }
  h1 { font-size: 30px; }
  h2 { font-size: 26px; }
  .hero-illustration { height: 120px; transform: scale(.78); margin-top: -10px; margin-bottom: -14px; }
  .phone-mock { height: 230px; min-height: 230px; margin-top: 8px; margin-bottom: 7px; }
  .mock-help { margin-top: 14px; }
  .paste-mock .mock-help { margin-top: 8px; }
  .image-frame { margin-top: 8px; margin-bottom: 7px; }
  .image-frame img { max-height: 34dvh; }
  .final-image img { max-height: 25dvh; }
  .care-note { margin-top: 7px; padding-top: 8px; padding-bottom: 8px; }
  .instruction { margin-top: 6px; margin-bottom: 6px; }
  .open-ai-link { min-height: 39px; margin-top: 5px; }
  .tiny-steps { margin-top: 7px; }
  .finish-actions { margin-top: 7px; }
  .primary-link { min-height: 43px; }
  .restart-button { min-height: 39px; }
  .official-note { margin-top: 5px; }
  .prompt-box.compact { min-height: 120px; padding-top: 22px; }
}

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