:root {
  --bg: #fff7fb;
  --bg2: #ffeaf3;
  --lilac: #efe6ff;
  --ink: #5a3d56;
  --mute: #8f7388;
  --pink: #ff7aa8;
  --pink2: #ffa3c3;
  --purple: #a98bff;
  --peach: #ffd0b0;
  --line: #ffd9e8;
  --card: rgba(255, 255, 255, 0.82);
  --night1: #3a2058;
  --night2: #170c2b;
  --shadow: 0 14px 40px rgba(255, 122, 168, 0.22);
  --font: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', 'Hiragino Sans', 'Yu Gothic', sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); line-height: 1.75;
  background:
    radial-gradient(700px 420px at 8% -5%, #ffe0ee 0%, transparent 70%),
    radial-gradient(700px 480px at 100% 0%, var(--lilac) 0%, transparent 70%),
    var(--bg);
  min-height: 100vh;
}
a { color: var(--pink); }
h1, h2, h3 { line-height: 1.35; }
.wrap { max-width: 1060px; margin: 0 auto; padding: 0 20px; }

/* nav */
header.nav { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; }
.logo { font-weight: 900; font-size: 18px; color: var(--ink); text-decoration: none; letter-spacing: 0.02em; }
.logo span { color: var(--pink); }
header.nav nav a { margin-left: 18px; color: var(--mute); text-decoration: none; font-size: 14px; font-weight: 700; }

/* buttons & chips */
.btn {
  display: inline-block; border: 0; cursor: pointer; font: inherit; font-weight: 900; text-decoration: none;
  padding: 15px 30px; border-radius: 999px; color: #fff;
  background: linear-gradient(135deg, var(--pink2), var(--pink) 55%, #ff8fb6);
  box-shadow: 0 10px 26px rgba(255, 122, 168, 0.45), inset 0 -3px 0 rgba(0, 0, 0, 0.06);
  transition: transform 0.15s;
}
.btn:hover { transform: translateY(-2px); }
.btn.ghost { background: #fff; color: var(--pink); border: 2px solid var(--line); box-shadow: none; }
.btn.sm { padding: 9px 18px; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 2px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: 7px 14px;
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: 0.15s;
}
.chip:hover { border-color: var(--pink2); }
.chip[aria-pressed=true] { background: linear-gradient(135deg, #ffe3ee, #f1e6ff); border-color: var(--pink); color: #c2406f; }

/* hero */
.hero { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: center; padding: 18px 0 56px; }
.badge { display: inline-block; background: #fff; border: 2px solid var(--line); color: var(--pink); font-weight: 900; font-size: 12.5px; padding: 4px 14px; border-radius: 999px; margin-bottom: 14px; }
.hero h1 { font-size: clamp(28px, 4.6vw, 46px); margin: 0 0 14px; font-weight: 900; }
.hero h1 em { font-style: normal; background: linear-gradient(135deg, var(--pink), var(--purple)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { color: var(--mute); font-size: 16.5px; margin: 0 0 24px; }
.stage {
  position: relative; aspect-ratio: 1 / 1.08; border-radius: 34px; overflow: hidden;
  background: radial-gradient(circle at 50% 35%, var(--night1), var(--night2) 78%);
  box-shadow: var(--shadow), inset 0 0 0 3px rgba(255, 255, 255, 0.6);
}
.stage canvas { width: 100%; height: 100%; display: block; }
.stage .hint { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; font-size: 13px; font-weight: 700; color: #f6d9ea; pointer-events: none; }
.stage-chips { margin-top: 14px; justify-content: center; }

/* sections */
section { padding: 44px 0; }
section h2 { font-size: 26px; margin: 0 0 6px; text-align: center; font-weight: 900; }
section h2::after { content: '✿'; display: block; font-size: 15px; color: var(--pink2); margin-top: 2px; }
section .sub { color: var(--mute); margin: 0 0 28px; text-align: center; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.card { background: var(--card); border: 2px solid var(--line); border-radius: 26px; padding: 22px; box-shadow: 0 8px 24px rgba(255, 122, 168, 0.1); }
.card .n { font-size: 12px; color: var(--purple); font-weight: 900; letter-spacing: 0.12em; }
.card .ico { font-size: 30px; }
.card h3 { margin: 4px 0 6px; font-size: 18px; font-weight: 900; }
.card p { margin: 0; color: var(--mute); font-size: 14.5px; }
.plan h3 { font-size: 20px; }
.plan .amt { font-size: 38px; font-weight: 900; color: var(--pink); margin: 4px 0; }
.plan ul { padding-left: 1.2em; margin: 10px 0 18px; color: var(--ink); font-size: 14.5px; }
.plan.main { border-color: var(--pink); box-shadow: var(--shadow); position: relative; }
.plan.main::before { content: 'おすすめ'; position: absolute; top: -13px; right: 22px; background: var(--pink); color: #fff; font-weight: 900; font-size: 12px; padding: 3px 12px; border-radius: 999px; }
details { border-bottom: 2px dashed var(--line); padding: 14px 4px; }
summary { cursor: pointer; font-weight: 900; }
details p { color: var(--mute); margin: 8px 0 0; }
footer { border-top: 2px dashed var(--line); padding: 28px 0 48px; color: var(--mute); font-size: 13px; text-align: center; }
footer a { color: var(--mute); margin: 0 8px; }

/* creator */
.create { display: grid; grid-template-columns: 440px 1fr; gap: 24px; padding-bottom: 60px; align-items: start; }
.panel { background: var(--card); border: 2px solid var(--line); border-radius: 28px; padding: 22px; box-shadow: 0 8px 24px rgba(255, 122, 168, 0.1); }
.panel h2 { margin: 0 0 4px; font-size: 21px; text-align: left; }
.panel h2::after { display: none; }
.step { margin-top: 18px; }
.step > .t { font-weight: 900; font-size: 14px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.step > .t b { background: var(--pink); color: #fff; width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; }
.panel label { display: block; font-size: 12.5px; color: var(--mute); margin: 10px 0 5px; font-weight: 700; }
.panel input[type=text], .panel input[type=url], .panel textarea, .panel select {
  width: 100%; border: 2px solid var(--line); background: #fff; color: var(--ink);
  padding: 11px 13px; border-radius: 14px; font: inherit; font-size: 15px;
}
.panel input:focus, .panel textarea:focus, .panel select:focus { outline: none; border-color: var(--pink2); }
.panel textarea { min-height: 96px; resize: vertical; }
.chips.shapes .chip { padding: 8px 12px; }
.sw { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line); cursor: pointer; padding: 0; }
.sw[aria-pressed=true] { box-shadow: 0 0 0 3px var(--pink); }
.colors { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.colors input { width: 44px; height: 34px; border: 0; background: none; padding: 0; }
.out { margin-top: 18px; display: none; background: #fff; border-radius: 20px; padding: 16px; border: 2px dashed var(--pink2); }
.out.show { display: block; }
.out code { display: block; word-break: break-all; background: var(--bg); padding: 10px 12px; border-radius: 12px; font-size: 12px; margin: 6px 0 8px; max-height: 84px; overflow: auto; }
.preview { position: sticky; top: 12px; }
.counter { text-align: right; font-size: 12px; color: var(--mute); }
.note { font-size: 12.5px; color: var(--mute); }
.warn { background: #fff4d9; border-radius: 12px; padding: 10px 12px; font-size: 12.5px; color: #8a6414; margin-top: 8px; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.photos .ph { aspect-ratio: 1; border-radius: 14px; background: var(--bg2) center/cover; border: 2px dashed var(--pink2); position: relative; display: grid; place-items: center; color: var(--pink); font-size: 26px; cursor: pointer; }
.photos .ph.has { border-style: solid; }
.photos .ph button { position: absolute; top: 4px; right: 4px; border: 0; background: rgba(0,0,0,.55); color: #fff; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; font-size: 12px; }
.disabled { opacity: 0.55; pointer-events: none; }

/* viewer (object screen = night, message screen = pastel) */
body.view { background: radial-gradient(900px 700px at 50% 35%, var(--night1), var(--night2)); color: #fff; overflow-x: hidden; }
body.view.msg { background: radial-gradient(700px 420px at 8% -5%, #ffe0ee 0%, transparent 70%), radial-gradient(700px 480px at 100% 0%, var(--lilac) 0%, transparent 70%), var(--bg); color: var(--ink); }
.view .full { position: fixed; inset: 0; }
.view canvas.bg { width: 100%; height: 100%; display: block; }
.view .top { position: fixed; top: 14px; left: 0; right: 0; text-align: center; font-size: 12px; font-weight: 700; color: #e9cfe2; pointer-events: none; letter-spacing: 0.08em; }
.view .cap { position: fixed; left: 0; right: 0; bottom: calc(26px + env(safe-area-inset-bottom)); text-align: center; padding: 0 20px; pointer-events: none; }
.view .cap .greet { font-size: 22px; font-weight: 900; letter-spacing: 0.04em; background: linear-gradient(135deg, #ffd6e6, #e6d4ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.view .cap.qr .greet, .view .cap.qr .to { display: none; }
.view .cap .to { font-size: 14px; color: #e9cfe2; }
.view .cap .tap { margin-top: 10px; font-size: 14px; font-weight: 700; display: inline-block; padding: 9px 20px; border-radius: 999px; border: 2px solid rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(6px); }
.view .cap a { pointer-events: auto; color: #ffd6e6; font-size: 12px; display: inline-block; margin-top: 8px; }
.music {
  position: fixed; top: 10px; right: 12px; z-index: 5; border: 0; width: 42px; height: 42px; border-radius: 50%; font-size: 19px; cursor: pointer;
  background: rgba(255, 255, 255, 0.85); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}
.music.msg { background: #fff; }
.rec .cap, .rec .top, .rec .music { display: none; }
.msg-page { display: flex; flex-direction: column; min-height: 100vh; }
.msg-page .hero3d { height: 42vh; min-height: 260px; position: relative; background: radial-gradient(circle at 50% 40%, var(--night1), var(--night2) 80%); border-radius: 0 0 44px 44px; box-shadow: var(--shadow); overflow: hidden; }
.msg-page .hero3d canvas { width: 100%; height: 100%; display: block; }
.hero3d .greet { position: absolute; left: 0; right: 0; bottom: 16px; text-align: center; font-size: 20px; font-weight: 900; letter-spacing: 0.05em; background: linear-gradient(135deg, #ffd6e6, #e6d4ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.letter {
  max-width: 580px; margin: 22px auto 24px; width: calc(100% - 32px); background: #fff; border: 2px solid var(--line); border-radius: 28px; padding: 28px 26px;
  box-shadow: var(--shadow); position: relative; animation: rise 0.9s cubic-bezier(.2, .8, .2, 1) both;
}
.letter::before { content: '💌'; position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 34px; background: #fff; border-radius: 50%; width: 52px; height: 52px; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(255, 122, 168, 0.25); }
@keyframes rise { from { transform: translateY(40px) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
.letter .to { font-size: 15px; color: var(--pink); font-weight: 900; margin-top: 6px; }
.letter .body { font-size: 17px; white-space: pre-wrap; margin: 12px 0 16px; line-height: 2; }
.letter .from { text-align: right; color: var(--mute); font-weight: 700; }
.gallery { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 14px 4px 22px; margin: 6px -4px 0; }
.gallery .pol { flex: 0 0 78%; max-width: 320px; scroll-snap-align: center; background: #fff; padding: 10px 10px 34px; border-radius: 6px; box-shadow: 0 8px 22px rgba(90, 61, 86, 0.22); transform: rotate(var(--r, -2deg)); cursor: zoom-in; }
.gallery .pol:nth-child(2n) { --r: 2.2deg; }
.gallery .pol img { width: 100%; display: block; border-radius: 3px; aspect-ratio: 4 / 5; object-fit: cover; }
.gift { margin-top: 18px; background: linear-gradient(135deg, #fff1f6, #f4ecff); border-radius: 20px; padding: 16px; }
.gift .label { font-weight: 900; }
.gift .code { font-family: ui-monospace, Menlo, monospace; font-size: 19px; letter-spacing: 0.08em; background: #fff; border: 2px dashed var(--pink2); border-radius: 12px; padding: 10px 14px; margin: 10px 0; word-break: break-all; text-align: center; }
.cta { text-align: center; max-width: 580px; margin: 0 auto 50px; padding: 0 16px; }
.cta p { color: var(--mute); font-size: 13.5px; margin: 0 0 10px; }
.open-overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; text-align: center; background: radial-gradient(circle at 50% 35%, #ffe9f2, #efe6ff); transition: opacity 0.7s, visibility 0.7s; padding: 20px; }
.open-overlay.gone { opacity: 0; visibility: hidden; }
.open-overlay .env { font-size: 76px; animation: bob 2.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-10px) rotate(-3deg); } }
.open-overlay h2 { margin: 6px 0 4px; font-size: 24px; }
.open-overlay h2::after { display: none; }
.open-overlay p { color: var(--mute); margin: 0 0 18px; }
.lightbox { position: fixed; inset: 0; background: rgba(40, 20, 50, 0.88); z-index: 20; display: none; place-items: center; padding: 16px; }
.lightbox.on { display: grid; }
.lightbox img { max-width: 100%; max-height: 92vh; border-radius: 10px; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .grid3, .grid4 { grid-template-columns: 1fr 1fr; }
  .create { grid-template-columns: 1fr; }
  .preview { position: static; order: -1; }
}
@media (max-width: 560px) { .grid3, .grid2 { grid-template-columns: 1fr; } header.nav nav a:nth-child(n+3) { display: none; } }
