:root {
  --tiffany: #7fd6cd;
  --teal: #0e7d78;
  --coral: #cc4f2e;
  --cream: #f7f4ee;
  --ink: #1c1a17;
  --sub: #6f665a;
  --line: #d9d2c4;
  --paper: #fffdf8;
  --warn-bg: #fff4e0;
  --warn-line: #e0a84a;
  --err-bg: #fde9e4;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', 'Hiragino Sans', sans-serif;
  font-weight: 500;
  color: var(--ink);
  background-color: var(--cream);
  background-image: repeating-linear-gradient(-6deg, rgba(127,214,205,0.22) 0px, rgba(127,214,205,0.22) 2px, transparent 2px, transparent 46px);
  line-height: 1.7;
}
a { color: var(--teal); }
[hidden] { display: none !important; }

.hero { background: var(--tiffany); border-bottom: 3px solid var(--ink); }
.hero-in { max-width: 560px; margin: 0 auto; padding: 28px 16px 22px; }
.hero-app { margin: 0 0 6px; font-weight: 800; letter-spacing: 0.06em; font-size: 14px; }
.hero h1 { margin: 0 0 10px; font-size: 26px; line-height: 1.4; font-weight: 800; }
.hero-lead { margin: 0 0 8px; }
.hero-safe { margin: 0; font-size: 14px; font-weight: 700; color: #0b5c58; }

main { max-width: 560px; margin: 0 auto; padding: 16px 16px 8px; }

.card {
  margin: 0 0 16px; padding: 18px 16px 12px;
  background: #fff; border: 2px solid var(--ink); border-radius: 16px;
  min-width: 0;
}
.card legend {
  padding: 2px 12px; margin-left: -4px;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 999px;
  font-weight: 800; font-size: 16px;
}
.num {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; margin-right: 6px;
  background: var(--teal); color: #fff; border-radius: 50%; font-size: 13px;
}
.field { margin: 0 0 14px; }
.field > label, .field > .label, .splits summary { display: block; font-weight: 700; margin-bottom: 6px; }
.req, .opt { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; vertical-align: 2px; margin-left: 4px; }
.req { background: var(--coral); color: #fff; }
.opt { background: #ebe6dc; color: var(--sub); }
.hint { margin: 6px 0 0; font-size: 13px; color: var(--sub); }

input[type=text], input[type=date], input[type=number] {
  width: 100%; font: inherit; font-size: 16px; font-weight: 700;
  padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); appearance: none; -webkit-appearance: none;
  min-height: 46px;
}
input:focus { outline: none; border-color: var(--teal); }
input.bad { border-color: var(--coral); background: #fff8f6; }
.time-input { font-size: 22px !important; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; margin-top: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-col { flex-direction: column; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: block; padding: 8px 16px; border: 2px solid var(--line); border-radius: 999px;
  font-weight: 700; background: #fff; transition: background .15s;
}
.chips-col .chip span { border-radius: 12px; }
.chip input:checked + span { background: var(--teal); border-color: var(--teal); color: #fff; }
.chip input:focus-visible + span { outline: 3px solid var(--tiffany); }
.chips-sm .chip span { padding: 4px 14px; font-size: 14px; }
.inline { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.inline input { max-width: 160px; }

.splits summary {
  cursor: pointer; list-style: none; margin-bottom: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; border: 2px dashed var(--teal); border-radius: 12px; background: #f2faf9;
}
.splits summary::-webkit-details-marker { display: none; }
.splits .sum-open, .splits .sum-close {
  font-size: 13px; font-weight: 800; color: #fff; background: var(--teal);
  padding: 3px 12px; border-radius: 999px; white-space: nowrap;
}
.splits .sum-close { display: none; background: #fff; color: var(--teal); border: 1.5px solid var(--teal); }
.splits[open] .sum-open { display: none; }
.splits[open] .sum-close { display: inline-block; }
.splits[open] summary { border-style: solid; margin-bottom: 8px; }
#splits { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
#splits label { display: block; font-size: 13px; font-weight: 700; color: var(--sub); }
#splits input { font-size: 17px; font-variant-numeric: tabular-nums; }
#splits .none { grid-column: 1 / -1; font-size: 13px; color: var(--sub); }

.photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #e8e3d8; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .no { position: absolute; left: 4px; top: 4px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 800; border-radius: 999px; padding: 0 7px; }
.photo .tools { position: absolute; right: 2px; bottom: 2px; left: 2px; display: flex; justify-content: space-between; }
.photo button {
  width: 30px; height: 30px; border: none; border-radius: 50%;
  background: rgba(28,26,23,0.75); color: #fff; font-size: 15px; line-height: 1; padding: 0; cursor: pointer;
}
.photo button:disabled { opacity: 0.25; }
.photo .del { position: absolute; right: 3px; top: 3px; width: 26px; height: 26px; font-size: 14px; }
.photos .loading { display: grid; place-items: center; font-size: 12px; color: var(--sub); }

.photo img { cursor: pointer; }
.photo .adj { position: absolute; left: 4px; bottom: 36px; background: rgba(255,255,255,0.9); color: var(--ink); font-size: 10px; font-weight: 800; border-radius: 999px; padding: 0 6px; pointer-events: none; }
.photo .adj.on { background: var(--teal); color: #fff; }
.crop { position: fixed; inset: 0; z-index: 50; background: rgba(28,26,23,0.6); display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; }
.crop-box { width: min(100%, 380px); background: var(--paper); border: 2px solid var(--ink); border-radius: 16px; padding: 16px; }
.crop-box h2 { margin: 0 0 4px; font-size: 18px; }
.crop-frame { margin: 12px auto; width: min(100%, 272px); padding: 10px 10px 34px; background: #fff; box-shadow: 0 8px 20px rgba(28,26,23,0.2); transform: rotate(2deg); }
.crop-frame canvas { display: block; width: 100%; height: auto; background: #d9d4c8; touch-action: none; cursor: grab; }
.crop-zoom { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; margin: 8px 0 12px; }
.crop-zoom input { flex: 1; accent-color: var(--teal); }
.crop-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.crop-actions .btn { margin: 0; min-height: 46px; font-size: 15px; }
.crop-actions #crop-ok { grid-column: 1 / -1; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }

.msg { display: flex; align-items: center; gap: 8px; }
.msg input { flex: 1; }
.msg .count { font-size: 12px; color: var(--sub); min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 52px; padding: 12px 18px; margin: 0 0 10px;
  font: inherit; font-size: 17px; font-weight: 800; text-decoration: none; text-align: center;
  border-radius: 999px; border: 2px solid var(--ink); cursor: pointer;
}
.btn-main { background: var(--coral); color: #fff; box-shadow: 0 4px 0 var(--ink); }
.btn-main:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.btn-main:disabled { background: #bdb5a6; box-shadow: none; cursor: default; }
.btn-sub { background: #fff; color: var(--ink); }
.file-btn.btn-sub { width: auto; display: inline-flex; min-height: 44px; font-size: 15px; margin: 0; }

.notice { margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; border: 2px solid; font-size: 14px; }
.notice p { margin: 0 0 6px; }
.notice p:last-child { margin: 0; }
.notice h3 { margin: 0 0 6px; font-size: 16px; }
.notice-warn { background: var(--warn-bg); border-color: var(--warn-line); }
.notice-err { background: var(--err-bg); border-color: var(--coral); color: #8a2c14; font-weight: 700; }
#inapp { max-width: 528px; margin: 16px auto 0; }
@media (max-width: 560px) { #inapp { margin: 16px 16px 0; } }
.notice .btn { margin-top: 8px; min-height: 44px; font-size: 15px; }

.stage { position: relative; width: min(100%, 340px); margin: 0 auto 16px; aspect-ratio: 9 / 16; border: 2px solid var(--ink); border-radius: 18px; overflow: hidden; background: var(--cream); }
.stage canvas { width: 100%; height: 100%; display: block; }
.play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 84px; height: 84px; border-radius: 50%; border: 3px solid var(--ink);
  background: var(--coral); color: #fff; display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 4px 0 var(--ink);
}
.play svg { margin-left: 4px; }
.actions { max-width: 400px; margin: 0 auto 16px; }
.preview-hint { max-width: 400px; margin: -4px auto 16px; }
.export-status { max-width: 400px; margin: 0 auto 16px; font-size: 14px; }
.export-status p { margin: 8px 0 0; }
.bar { height: 12px; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; background: #fff; }
#export-bar { height: 100%; width: 0; background: var(--teal); }

.done-title { text-align: center; font-size: 22px; margin: 4px 0 12px; }
#result { display: block; width: min(100%, 340px); aspect-ratio: 9 / 16; margin: 0 auto 16px; border: 2px solid var(--ink); border-radius: 18px; background: #000; }
.sns h3 { color: #8a5a0c; }

.goods { margin: 0 0 16px; padding: 16px; background: #fff; border: 2px solid var(--ink); border-radius: 16px; }
.goods h3 { margin: 0 0 4px; font-size: 17px; }
.goods-list { display: grid; gap: 10px; margin-top: 12px; }
.good { display: flex; gap: 12px; align-items: center; padding: 10px; border: 2px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); }
.good img { width: 72px; height: 72px; object-fit: contain; flex: none; background: #faf8f3; border-radius: 8px; }
.good strong { display: block; font-size: 15px; line-height: 1.4; }
.good span { display: block; font-size: 13px; color: var(--sub); line-height: 1.5; }
.goods-note { font-size: 12px; }

.foot { max-width: 560px; margin: 8px auto 0; padding: 16px 16px 40px; font-size: 13px; color: var(--sub); }
.foot summary { cursor: pointer; font-weight: 700; color: var(--ink); }
.credits { padding-left: 18px; margin: 8px 0; }
.credits li { margin-bottom: 4px; }
.foot-note { margin: 12px 0 4px; }
.foot-site { margin: 0; }
.gift-link { margin: 12px 0 0; }
