[hidden] { display: none !important; }
:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --line: #e1e6ef;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #ff8a3d;
  --primary-ink: #ffffff;
  --sky: #5db7ef;
  --danger: #e5484d;
  --font: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: #e9eef5; color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; }
.app { max-width: 480px; min-height: 100dvh; margin: 0 auto; background: var(--bg); position: relative; display: flex; flex-direction: column; }
.view { display: none; flex: 1; }
.view.is-active { display: block; }
.view.center.is-active { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px 24px; gap: 14px; }
.pad { padding: 24px 20px 32px; }

.eyebrow { letter-spacing: .3em; font-size: 12px; font-weight: 700; color: var(--primary); margin: 0; }
h1 { font-weight: 900; font-size: 28px; line-height: 1.4; margin: 6px 0; }
h2 { font-weight: 900; font-size: 22px; margin: 6px 0; }
.section-title { font-size: 18px; margin: 0 0 16px; }

/* ---- scene (SVG) ---- */
.scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.blade { transform-box: fill-box; transform-origin: center; animation: spin .08s linear infinite alternate; }
.blade-2 { animation-delay: -.04s; }
.led { animation: blink 1s steps(2) infinite; }
.cloud { animation: drift linear infinite; }
.star { animation: twinkle 2.6s ease-in-out infinite alternate; }
.flake { animation: fall linear infinite; }
.pkg .pkg-inner { transform-box: fill-box; transform-origin: 50% 100%; }
.pkg.landed .pkg-inner { animation: land .5s ease-out; }
.pkg.waiting .pkg-inner { animation: wiggle 1.4s ease-in-out infinite; }
.pkg-lid { transform-box: fill-box; transform-origin: center; transition: transform .55s cubic-bezier(.2,.9,.3,1.3), opacity .55s; }
.pkg.is-open .pkg-lid { transform: translate(34px, -80px) rotate(32deg); opacity: 0; }
.hint { opacity: 0; transition: opacity .3s; pointer-events: none; }
.show-hint .hint { opacity: 1; animation: bob 1.2s ease-in-out infinite; }
.show-hint { cursor: pointer; }

@keyframes spin { from { transform: scaleX(1); } to { transform: scaleX(.12); } }
@keyframes blink { 50% { opacity: .15; } }
@keyframes drift { from { transform: translate(-90px, var(--y)); } to { transform: translate(470px, var(--y)); } }
@keyframes twinkle { from { opacity: .25; } to { opacity: 1; } }
@keyframes fall { from { transform: translateY(0); } to { transform: translateY(720px); } }
@keyframes land { 0% { transform: scale(1.06, .86); } 60% { transform: scale(.97, 1.04); } 100% { transform: none; } }
@keyframes wiggle { 0%, 70%, 100% { transform: rotate(0); } 76% { transform: rotate(-5deg); } 84% { transform: rotate(5deg); } 92% { transform: rotate(-3deg); } }
@keyframes bob { 50% { transform: translateY(-5px); } }

/* ---- hero ---- */
.hero { position: relative; height: 70dvh; min-height: 480px; overflow: hidden; }
.hero-copy { position: absolute; left: 0; right: 0; top: 0; padding: 36px 24px; z-index: 1; }
.hero-copy h1 { color: #0f2a44; }
.hero-copy p:last-child { color: #23425f; font-size: 14px; line-height: 1.8; margin: 0; }

/* ---- cards ---- */
.card-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.card { width: 100%; padding: 0; background: var(--panel); border: 2px solid var(--line); border-radius: 14px; color: var(--text); cursor: pointer; overflow: hidden; text-align: left; transition: transform .15s, border-color .15s; }
.card:hover { transform: translateY(-2px); border-color: var(--primary); }
.thumb { display: block; width: 100%; aspect-ratio: 1; }
.thumb-svg { display: block; width: 100%; height: 100%; }
.card-title { display: block; padding: 8px 10px 10px; font-weight: 700; font-size: 12px; line-height: 1.4; }

/* ---- form ---- */
.link-back { background: none; border: 0; color: var(--muted); padding: 0; cursor: pointer; font-size: 14px; }
.selected { display: flex; align-items: center; gap: 14px; margin: 16px 0 20px; }
.selected .thumb { width: 84px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.selected-title { font-weight: 900; font-size: 18px; margin: 0; }
.field { display: block; margin-bottom: 18px; }
.field-label { display: flex; justify-content: space-between; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.count { color: var(--muted); font-weight: 500; }
.count.over { color: var(--danger); }
.field input, .field textarea { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 16px; resize: none; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.field-hint { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.field-error, .form-error { display: block; color: var(--danger); font-size: 13px; margin-top: 4px; min-height: 1em; }
.turnstile { margin: 8px 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent; font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer; width: 100%; }
.btn:disabled { opacity: .5; cursor: wait; }
.btn-primary { background: var(--primary); color: var(--primary-ink); box-shadow: 0 4px 0 #d96a22; }
.btn-primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #d96a22; }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--line); }
.btn-line { background: #06c755; color: #fff; }
.row { display: flex; gap: 10px; }

/* ---- stage ---- */
.view-stage.is-active { position: fixed; inset: 0; z-index: 10; display: block; background: #000; }
.stage { position: absolute; inset: 0; max-width: 480px; margin: 0 auto; overflow: hidden; }
.stage-actions { position: absolute; left: 0; right: 0; bottom: 0; max-width: 480px; margin: 0 auto; padding: 16px 20px calc(18px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(255,255,255,.92) 35%); display: flex; flex-direction: column; gap: 10px; z-index: 3; }
.stage-note { margin: 0; text-align: center; color: var(--muted); font-size: 12px; }
.end-actions { animation: fade .8s both; }
.text-link { color: var(--muted); text-align: center; font-size: 13px; }

/* letter */
.letter { position: absolute; left: 0; right: 0; top: 9%; display: flex; justify-content: center; padding: 0 22px; z-index: 2; pointer-events: none; }
.letter-paper { position: relative; width: 100%; max-width: 360px; background: #fffdf8; border-radius: 6px; padding: 26px 24px 22px; box-shadow: 0 18px 40px rgba(0,0,0,.25); border-top: 6px solid var(--accent, #ff8a3d); animation: pop .7s cubic-bezier(.2,.9,.3,1.15) both; transform-origin: 60% 120%; }
.letter-stamp { position: absolute; right: 14px; top: 12px; width: 54px; height: 32px; border: 2px dashed var(--accent, #ff8a3d); border-radius: 4px; padding: 2px; opacity: .8; }
.letter-stamp svg { width: 100%; height: 100%; }
.letter-dear { font-weight: 700; color: var(--accent); margin: 0 0 14px; font-size: 16px; }
.letter-msg { font-weight: 700; font-size: 19px; line-height: 1.85; margin: 0 0 16px; min-height: 3.6em; }
.letter-msg span { display: inline-block; white-space: pre; animation: ink .5s both; }
.letter-from { text-align: right; font-weight: 700; color: var(--accent); margin: 0; animation: fade .8s both; }
@keyframes pop { from { opacity: 0; transform: translateY(48vh) scale(.12) rotate(-8deg); } to { opacity: 1; transform: none; } }
@keyframes ink { from { opacity: 0; transform: translateY(5px); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---- receive: arrive panel ---- */
.arrive { position: absolute; left: 0; right: 0; top: 0; max-width: 480px; margin: 0 auto; padding: 40px 24px 0; display: flex; flex-direction: column; align-items: center; text-align: center; z-index: 3; animation: fade .6s both; }
.arrive h1 { font-size: 24px; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.35); }
.slip { width: 100%; max-width: 300px; margin: 14px 0 18px; padding: 16px 20px; border-radius: 12px; background: rgba(255,255,255,.94); display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; text-align: left; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.slip dt { color: var(--muted); font-size: 12px; padding-top: 4px; }
.slip dd { margin: 0; font-weight: 700; font-size: 17px; word-break: break-all; }
.arrive .btn { max-width: 300px; }
.loading { letter-spacing: .3em; color: var(--muted); }
.loading span { animation: fade 1s infinite alternate; }
.loading span:nth-child(2) { animation-delay: .3s; }
.loading span:nth-child(3) { animation-delay: .6s; }

/* ---- done ---- */
.done-scene { position: relative; height: 300px; overflow: hidden; }
.done { text-align: center; padding-top: 20px; }
.share-url input { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 13px; margin: 16px 0; }
.share-buttons { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.copied { color: var(--primary); font-size: 13px; }

.footer { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.footer a { color: var(--muted); text-align: center; }
.credit { margin: 0; text-align: center; line-height: 1.7; }
.text-link-sub { display: block; font-size: 11px; opacity: .8; margin-bottom: 2px; }
