:root {
  --lm-primary: #bd4a78;
  --lm-primary-dark: #9f315b;
  --lm-primary-deep: #8f2e56;
  --lm-bg: #fff6fa;
  --lm-bg-soft: #fff0f6;
  --lm-surface: #ffffff;
  --lm-text: #332d2f;
  --lm-text-sub: #6d6669;
  --lm-line: #e8dde1;
  --lm-line-strong: #d9d2ce;
  --lm-disabled-bg: #efe7ea;
  --lm-disabled-text: #a79ca1;
  --lm-gold: #f2b705;
  --lm-bounce: cubic-bezier(.34, 1.56, .64, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: "Noto Sans JP", system-ui, sans-serif; color: var(--lm-text); background: #fff; }
button, textarea { font: inherit; }
button { color: inherit; }
.lm button, .lm a, .lm .stage.tappable { -webkit-tap-highlight-color: transparent; }
.lm button:focus:not(:focus-visible), .lm a:focus:not(:focus-visible), .lm .stage:focus:not(:focus-visible) { outline: none; }
[hidden] { display: none !important; }
.ms { font-family: "Material Symbols Rounded"; font-weight: normal; font-style: normal; font-size: 24px; line-height: 1; letter-spacing: normal; display: inline-block; white-space: nowrap; direction: ltr; -webkit-font-smoothing: antialiased; font-feature-settings: "liga"; }

/* /create トップの再現 */
.top { max-width: 760px; margin: 0 auto; padding: 16px; }
.top-input-wrap { background: #f6f6f7; margin: 0 -16px; padding: 16px; }
.top-input { width: 100%; min-height: 72px; border: 1px solid var(--lm-line-strong); border-radius: 10px; font-size: 22px; font-weight: 700; padding: 18px 16px; font-family: inherit; color: var(--lm-text); resize: none; background: #fff; }
.top-help { font-size: 13px; color: var(--lm-text-sub); margin: 8px 0 0; }
.entry { margin-top: 16px; width: 100%; min-height: 64px; border: 0; border-radius: 999px; background: var(--lm-primary); color: #fff; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 18px; font-weight: 700; cursor: pointer; box-shadow: 0 4px 0 var(--lm-primary-deep); transition: transform .12s, box-shadow .12s; }
.entry small { display: block; font-size: 12px; font-weight: 500; opacity: .9; }
.entry .ms { font-size: 30px; }
.entry:hover { transform: translateY(-1px); box-shadow: 0 5px 0 var(--lm-primary-deep); }
.entry:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--lm-primary-deep); }
.entry:disabled { background: var(--lm-disabled-bg); color: var(--lm-disabled-text); box-shadow: none; cursor: not-allowed; transform: none; }
.entry-hint { font-size: 13px; color: var(--lm-primary-dark); margin: 8px 0 0; text-align: center; display: flex; align-items: center; justify-content: center; gap: 4px; }
.entry-hint .ms { font-size: 18px; }
.top-note { margin-top: 24px; font-size: 13px; color: var(--lm-text-sub); border-top: 1px dashed var(--lm-line); padding-top: 12px; }

/* テーマ */
.lm.theme-dark {
  --bg: #161214;
  --surface: #221c1f;
  --surface2: #2d2529;
  --line: #3a3035;
  --text: #f6eef2;
  --sub: #b7aab0;
  --stage: #1f191c;
  --stage-dot: rgba(255,255,255,.07);
  --accent: #bd4a78;
  --accent-deep: #8f2e56;
  --accent-hi: #ff7aa8;
  --step-done-text: #2a1420;
  --gold: #f2b705;
  --praise-stroke: #1c1719;
}
.lm.theme-light {
  --bg: #fff6fa;
  --surface: #ffffff;
  --surface2: #fbeef4;
  --line: #efd9e3;
  --text: #332d2f;
  --sub: #6d6669;
  --stage: #ffffff;
  --stage-dot: rgba(189,74,120,.12);
  --accent: #bd4a78;
  --accent-deep: #8f2e56;
  --accent-hi: #bd4a78;
  --step-done-text: #ffffff;
  --gold: #f2b705;
  --praise-stroke: #ffffff;
}

/* オーバーレイと上部 */
.lm { --lm-guide: 30px; --lm-head-extra: calc(40px + var(--lm-guide)); position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); color: var(--text); }
.lm-top { flex: none; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "close actions" "steps steps"; align-items: center; padding: 0 8px; }
.close-btn { grid-area: close; justify-self: start; }
.top-actions { grid-area: actions; justify-self: end; }
.lm.no-guide { --lm-guide: 0px; }
.step-guide { flex: none; padding: 0 16px 8px; text-align: center; }
.step-guide[hidden] { display: none; }
.step-guide-title { display: block; font-size: 18px; font-weight: 800; line-height: 22px; color: var(--text); }
.step-guide-sub { display: none; margin-top: 2px; font-size: 12px; line-height: 16px; color: var(--sub); }
@media (min-height: 760px) { .lm { --lm-guide: 48px; } .step-guide-sub { display: block; } }
@media (min-width: 720px) { .lm .step-guide { padding-bottom: 12px; } .step-guide-sub { display: block; } .lm { --lm-guide: 52px; } }
.icon-btn { position: relative; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 999px; display: grid; place-items: center; background: transparent; color: var(--text); cursor: pointer; }
.top-actions { display: flex; align-items: center; gap: 0; }
.icon-btn.small-icon { width: 36px; height: 36px; }
#undoBtn:disabled { opacity: .35; cursor: not-allowed; }
@media (min-width: 720px) {
  .lm { --lm-head-extra: calc(12px + var(--lm-guide)); }
  .lm-top { grid-template-columns: 1fr auto 1fr; grid-template-areas: "close steps actions"; height: 60px; padding: 0 12px; }
}
.sound-tip { position: absolute; top: 44px; right: 0; z-index: 10; width: 184px; padding: 8px 10px; border-radius: 8px; background: #332d2f; color: #fff; font-size: 12px; font-weight: 500; line-height: 1.5; text-align: left; animation: tipIn .3s var(--lm-bounce); pointer-events: none; }
.sound-tip::before { content: ""; position: absolute; top: -6px; right: 14px; border: 6px solid transparent; border-top: 0; border-bottom-color: #332d2f; }
.icon-btn:focus-visible, .tool:focus-visible, .prop:focus-visible, .thumb:focus-visible, .round:focus-visible, .btn-main:focus-visible, .footer-btn:focus-visible, .pm:focus-visible, .color-dot:focus-visible, .done-link:focus-visible, .stage:focus-visible { outline: 3px solid rgba(189,74,120,.55); outline-offset: 2px; }


/* ステージ */
.workspace { position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.stage { position: relative; height: calc(min(46vh, 420px) - var(--lm-head-extra)); margin: 0 12px; border-radius: 20px; overflow: hidden; display: grid; place-items: center; background-color: var(--stage); background-image: radial-gradient(var(--stage-dot) 1px, transparent 1px); background-size: 16px 16px; }
.stage.stage-deco { height: calc(min(36vh, 340px) - var(--lm-head-extra)); }
.stage.stage-done { height: min(50vh, 460px); }
.stage-art { width: 100%; height: 100%; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); place-items: center; }
.stage canvas { display: block; width: auto; height: auto; max-width: calc(100% - 40px); max-height: calc(100% - 40px); }
.stage-label { position: absolute; z-index: 2; top: 12px; left: 12px; padding: 3px 10px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; line-height: 1.4; }
.tap-hint { position: absolute; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 4px; color: var(--sub); font-size: 11px; pointer-events: none; }
.tap-hint .ms { font-size: 16px; }
.stage.tappable { cursor: pointer; user-select: none; }
@media (min-width: 720px) { .stage { width: min(720px, calc(100% - 24px)); margin-left: auto; margin-right: auto; } }

/* 操作パネル */
/* 再編集の書体画面だけに表示する注意。明暗テーマのどちらでも読める配色にする。 */
.lm-reedit-notice { display: flex; align-items: flex-start; gap: 7px; margin: 0 0 12px; padding: 4px 0; color: var(--sub); text-align: left; }
.lm-reedit-notice .ms { flex: none; margin-top: 2px; font-size: 17px; color: var(--accent-hi); }
.lm-reedit-notice p { margin: 0; font-size: 12px; line-height: 1.7; }
.panel { width: min(100%, 560px); margin: 12px auto 0; padding: 0 12px 12px; }
textarea { color: var(--text); }
.text-field { margin-top: 0; }
.text-field textarea { display: block; width: 100%; height: auto; min-height: 82px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); font-size: 20px; font-weight: 700; line-height: 1.4; resize: none; }
.text-field textarea:focus { outline: none; border-color: var(--accent); }
.text-meta { display: flex; justify-content: space-between; margin-top: 6px; color: var(--sub); font-size: 11px; }
.text-meta .warn { color: var(--accent-hi); }
.text-empty { margin-top: 8px; color: var(--accent-hi); font-size: 12px; font-weight: 700; }
.btn-main { display: flex; width: 100%; height: 52px; margin-top: 12px; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font-size: 16px; font-weight: 900; cursor: pointer; box-shadow: 0 4px 0 var(--accent-deep); transition: transform .1s, box-shadow .1s, background .15s; }
.btn-main .ms { font-size: 20px; }
.btn-main:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--accent-deep); }
.btn-main:disabled { background: var(--surface2); color: var(--sub); box-shadow: none; cursor: not-allowed; transform: none; }

/* 書体・色 */
.flip-row { display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; gap: 8px; margin-top: 12px; }
.round { width: 48px; height: 48px; padding: 0; border: 0; border-radius: 999px; display: grid; place-items: center; background: var(--surface2); color: var(--text); cursor: pointer; }
.flip-name { text-align: center; }
.flip-name b { display: block; color: var(--text); font-size: 20px; font-weight: 900; }
.flip-name small { display: block; margin-top: 2px; color: var(--sub); font-size: 12px; }
.strip { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; scroll-snap-type: x mandatory; }
.thumb { flex: none; width: 92px; height: 72px; padding: 4px; border: 2px solid transparent; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--stage); color: var(--text); cursor: pointer; scroll-snap-align: center; }
.thumb[aria-pressed="true"] { border-color: var(--accent-hi); }
.thumb-canvas { flex: 1 1 auto; min-height: 0; width: 100%; display: grid; place-items: center; }
.thumb canvas { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.thumb-name { flex: none; max-width: 100%; overflow: hidden; color: var(--text); font-size: 10px; line-height: 12px; white-space: nowrap; text-overflow: ellipsis; }
.decide { margin-top: 12px; }

/* かざり */
.tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.tool { min-width: 0; height: 76px; padding: 6px 2px; border: 2px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: var(--surface); color: var(--text); cursor: pointer; }
.tool .ms { font-size: 24px; }
.tool-name { max-width: 100%; overflow: hidden; font-size: 11px; font-weight: 700; line-height: 14px; white-space: nowrap; text-overflow: ellipsis; }
.tool[aria-pressed="true"] { border-color: var(--accent); background: var(--surface2); }
.tool:disabled { opacity: .45; cursor: not-allowed; }
.tool-pending { color: var(--sub); font-size: 9px; line-height: 10px; }
.tool-dots { height: 4px; display: flex; gap: 3px; margin-top: 2px; }
.tool-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--line); }
.tool-dots i.on { background: var(--accent-hi); }
.props { display: flex; gap: 6px; margin-top: 10px; }
.prop { flex: 1 1 0; min-width: 0; height: 52px; padding: 3px 2px; border: 2px solid transparent; border-radius: 12px; display: flex; flex-direction: column; justify-content: center; align-items: center; background: var(--surface); color: var(--text); cursor: pointer; }
.prop[aria-pressed="true"] { border-color: var(--accent-hi); }
.prop.inactive { opacity: .5; }
.prop-name { max-width: 100%; overflow: hidden; color: var(--sub); font-size: 10px; line-height: 13px; white-space: nowrap; text-overflow: ellipsis; }
.prop-value { max-width: 100%; overflow: hidden; color: var(--text); font-size: 14px; font-weight: 900; line-height: 19px; white-space: nowrap; text-overflow: ellipsis; }
.tuner { display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: center; gap: 10px; margin-top: 12px; }
.pm { width: 64px; height: 64px; padding: 0; border: 0; border-radius: 999px; display: grid; place-items: center; background: var(--surface2); color: var(--text); font-size: 30px; font-weight: 900; cursor: pointer; user-select: none; touch-action: manipulation; }
.pm.minus { background: var(--surface2); }
.pm.plus { background: var(--accent); color: #fff; box-shadow: 0 4px 0 var(--accent-deep); }
.pm.plus:active { transform: translateY(3px) scale(.95); box-shadow: 0 1px 0 var(--accent-deep); }
.pm:disabled { opacity: .35; cursor: not-allowed; }
.meter { min-width: 0; text-align: center; }
.meter-colors { min-height: 30px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.color-dot { flex: none; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 999px; cursor: pointer; }
.color-dot[aria-pressed="true"] { outline: 2px solid var(--text); outline-offset: 2px; }
.meter-bars { min-height: 8px; display: flex; align-items: center; justify-content: center; gap: 4px; }
.meter-bars i { width: 18px; height: 8px; border-radius: 4px; background: var(--line); }
.meter-bars i.on { background: var(--accent-hi); }
.meter-name { display: block; margin-top: 6px; color: var(--text); font-size: 16px; font-weight: 900; }
.finish-btn { margin-top: 14px; }
.finish-btn .ms { font-size: 20px; }

/* 完成 */
.recipe { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }
.recipe-chip { padding: 4px 10px; border-radius: 999px; background: var(--surface); color: var(--text); font-size: 11px; }
.done-actions { display: grid; gap: 8px; margin-top: 14px; }
.done-edit { width: 100%; height: 48px; border: 1.5px solid var(--line); border-radius: 999px; background: transparent; color: var(--text); font-size: 14px; font-weight: 700; cursor: pointer; }
.done-edit .ms { margin-right: 6px; font-size: 20px; vertical-align: middle; }
.done-links { display: flex; justify-content: center; gap: 8px; margin-top: 8px; }
.decor-reset { display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; margin-top: 10px; }
.decor-reset .ms { font-size: 18px; }
.done-link { min-height: 36px; padding: 0 8px; border: 0; background: transparent; color: var(--sub); font-size: 13px; cursor: pointer; }

/* 下部バー */
.lm-bottom { flex: none; min-height: calc(64px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); padding: 8px 12px env(safe-area-inset-bottom); background: var(--surface); }
.lm-bottom-inner { width: min(100%, 560px); min-height: 44px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 8px; }
.lm.is-done .lm-bottom { display: none; }

/* 動きと演出 */
.bump { animation: bump .3s var(--lm-bounce); }
.shrink { animation: shrink .22s ease-out; }
.flip-next { animation: flipNext .26s var(--lm-bounce); }
.flip-prev { animation: flipPrev .26s var(--lm-bounce); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 70% { transform: scale(.985); } 100% { transform: scale(1); } }
@keyframes shrink { 0% { transform: scale(1); } 45% { transform: scale(.94); } 100% { transform: scale(1); } }
@keyframes flipNext { 0% { transform: translateX(28px) scale(.96); opacity: .3; } 100% { transform: none; opacity: 1; } }
@keyframes flipPrev { 0% { transform: translateX(-28px) scale(.96); opacity: .3; } 100% { transform: none; opacity: 1; } }
@keyframes tipIn { from { transform: translateY(-4px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.particle { position: fixed; z-index: 300; pointer-events: none; font-size: 22px; animation: fly .75s ease-out forwards; }
@keyframes fly { 0% { transform: translate(-50%, -50%) scale(.4); opacity: 1; } 100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.1) rotate(var(--r)); opacity: 0; } }
.praise { position: fixed; z-index: 300; top: 38%; left: 50%; transform: translate(-50%, -50%); color: var(--accent-hi); font-size: 40px; font-weight: 900; white-space: nowrap; pointer-events: none; -webkit-text-stroke: 6px var(--praise-stroke); paint-order: stroke fill; animation: praise .95s var(--lm-bounce) forwards; }
@keyframes praise { 0% { transform: translate(-50%, -50%) scale(.4); opacity: 0; } 25% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; } 45% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { transform: translate(-50%, -62%) scale(1); opacity: 0; } }
/* 完成の演出（背景なし。文字がバラバラの向きでポンと入って、少し残って、消える） */
.complete-banner { position: absolute; inset: 0; z-index: 5; pointer-events: none; display: flex; justify-content: center; padding-top: 17%; animation: completeLife 2.3s ease-out forwards; }
.complete-band { display: block; }
.complete-word { display: flex; align-items: center; font-size: clamp(38px, 12vw, 52px); font-weight: 900; letter-spacing: .02em; color: var(--complete-color, var(--accent-hi)); }
.complete-word span { display: inline-block; opacity: 0; transform: translateY(-40px) rotate(-40deg) scale(.2); animation: completeLetter .6s cubic-bezier(.2,.9,.3,1.4) forwards; }
@keyframes completeLife { 0%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-10px); } }
@keyframes completeLetter { 0% { opacity: 0; transform: translateY(-40px) rotate(-40deg) scale(.2); } 55% { opacity: 1; transform: translateY(calc(var(--lift) + 6px)) rotate(calc(var(--tilt) * -.5)) scale(calc(var(--size) * 1.25)); } 100% { opacity: 1; transform: translateY(var(--lift)) rotate(var(--tilt)) scale(var(--size)); } }
#confetti { position: fixed; inset: 0; z-index: 250; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .bump, .shrink, .flip-next, .flip-prev, .sound-tip { animation: none !important; }
  .particle, .praise, .complete-banner { display: none !important; }
}

@media (min-width: 720px) {
  .panel {
    width: 100%;
    max-width: min(720px, calc(100% - 24px));
    padding-left: 0;
    padding-right: 0;
  }
  .round .ms { font-size: 28px; }
  .flip-name b { font-size: 22px; }
  .flip-name small { font-size: 13px; }
  .strip { scrollbar-width: none; }
  .strip::-webkit-scrollbar { display: none; }
  .thumb { width: 128px; height: 96px; border-radius: 14px; }
  .thumb-name { font-size: 12px; }
  .btn-main { height: 60px; font-size: 18px; }
  .tool { height: 96px; }
  .tool .ms { font-size: 30px; }
  .tool-name { font-size: 13px; }
  .tool-dots { height: 5px; }
  .tool-dots i { width: 5px; height: 5px; }
  .prop { height: 64px; }
  .prop-name { font-size: 12px; }
  .prop-value { font-size: 17px; }
  .tuner { grid-template-columns: 80px 1fr 80px; }
  .pm { width: 80px; height: 80px; font-size: 36px; }
  .meter-bars { min-height: 10px; }
  .meter-bars i { width: 24px; height: 10px; }
  .meter-colors { min-height: 38px; gap: 10px; }
  .color-dot { width: 38px; height: 38px; }
  .meter-name { font-size: 18px; }
}

/* 保存・追加と Pro 案内 */
.sample-action-label { display: inline-flex; align-items: center; gap: 6px; }
.sample-sheet-layer, .sample-pro-layer { position: fixed; inset: 0; }
.sample-sheet-layer { z-index: 120; }
.sample-sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.sample-sheet {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  color: var(--text);
  transform: translateY(100%);
  transition: transform .22s ease-out;
}
.sample-sheet.is-open { transform: translateY(0); }
.sample-sheet-handle { width: 36px; height: 4px; margin: 0 auto 12px; border-radius: 2px; background: var(--line); }
.sample-sheet-title { margin: 0 0 12px; font-size: 16px; font-weight: 900; }
.sample-sheet-options { display: grid; gap: 8px; }
.sample-sheet-option {
  display: grid;
  width: 100%;
  height: 64px;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border: 2px solid transparent;
  border-radius: 14px;
  background: var(--surface2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.sample-sheet-option:focus-visible { outline: 3px solid rgba(189,74,120,.55); outline-offset: 2px; }
.sample-sheet-preview { position: relative; display: grid; width: 40px; height: 40px; place-items: center; overflow: hidden; border-radius: 8px; }
.sample-sheet-preview.is-white { background: #ffffff; }
.sample-sheet-preview.is-transparent { background: repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 0 / 10px 10px; }
.sample-sheet-preview.is-text { background: var(--surface2); color: var(--text); font-size: 18px; font-weight: 900; }
.sample-sheet-preview canvas { display: block; max-width: 100%; max-height: 100%; }
.sample-sheet-preview-svg-label { position: absolute; right: 0; bottom: 0; font-size: 9px; font-weight: 900; }
.sample-sheet-option-content { display: grid; min-width: 0; gap: 2px; }
.sample-sheet-option-name { display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 700; }
.sample-sheet-option-description { overflow: hidden; color: var(--sub); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.sample-pro-layer { z-index: 130; display: grid; place-items: center; background: rgba(0,0,0,.55); }
.sample-pro-dialog { width: min(360px, calc(100% - 32px)); padding: 20px; border-radius: 16px; background: var(--surface); color: var(--text); }
.sample-pro-title { margin: 0 0 8px; font-size: 16px; font-weight: 900; }
.sample-pro-body { margin: 0 0 16px; font-size: 14px; line-height: 1.6; }
.sample-pro-actions { display: grid; gap: 8px; }
.sample-pro-actions > button { width: 100%; }
.sample-pro-actions .btn-main { margin-top: 0; }
.sample-pro-actions .done-edit { height: 48px; }
.sample-pro-cancel { padding: 0; border: 0; background: transparent; color: var(--sub); font: inherit; cursor: pointer; }
.sample-toast {
  position: fixed;
  z-index: 140;
  bottom: 12px;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 10px 16px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .sample-sheet { transition: none; }
}

.strip-wrap { position: relative; min-width: 0; margin-top: 10px; }
.strip-wrap .strip { margin-top: 0; padding-left: 0; padding-right: 0; }
.strip-arrow.round { position: absolute; z-index: 2; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; background: rgba(28,23,25,.96); border: 2px solid rgba(255,255,255,.75); box-shadow: 0 2px 10px rgba(0,0,0,.65); color: #fff; font-size: 28px; }
.strip-prev { left: 4px; }
.strip-next { right: 4px; }
.lm.theme-light .strip-arrow { background: rgba(255,255,255,.97); border-color: rgba(0,0,0,.55); box-shadow: 0 2px 10px rgba(0,0,0,.25); color: #1c1719; }
/* Keep the selected item clear of the edge arrows when it is scrolled into view. */
.strip-wrap .strip { scroll-padding-inline: 52px; }

.strip.dragging { cursor: grabbing; scroll-snap-type: none; scroll-behavior: auto; user-select: none; }
.strip-wrap .strip { cursor: grab; }
.decor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.tool.decor-card { position: relative; height: auto; padding: 10px; gap: 6px; border-radius: 14px; }
.decor-card-art { height: 96px; width: 100%; display: grid; grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); place-items: center; min-height: 0; overflow: hidden; }
.decor-card-art canvas { width: 100%; height: 100%; min-height: 0; max-height: 100%; object-fit: contain; }
.decor-card b { font-size: 14px; }
.decor-card small { font-size: 11px; color: var(--sub); }
.tool.decor-card { transition: border-color .12s, transform .12s, box-shadow .12s; }
.tool.decor-card:focus-visible { border-color: var(--accent-hi); transform: translateY(-2px); box-shadow: 0 0 0 2px var(--accent-hi), 0 8px 18px rgba(0,0,0,.25); outline: none; }
@media (hover: hover) and (pointer: fine) {
  .tool.decor-card:hover { border-color: var(--accent-hi); transform: translateY(-2px); box-shadow: 0 0 0 2px var(--accent-hi), 0 8px 18px rgba(0,0,0,.25); outline: none; }
}
.finish-btn:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 3px; }
.decor-card:active { border-color: var(--accent); background: var(--surface2); }
.decor-color-label { font-size: 11px; color: var(--sub); line-height: 16px; }
.decor-color-label { margin-top: 8px; text-align: center; }
.decor-colors { justify-content: center; margin-top: 4px; }

.decor-list-panel { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }

.decor-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; margin-top: 14px; }
.decor-actions .decide { margin-top: 0; }
.decor-actions > button { height: 52px; }
.decor-detail-panel .strip { scroll-snap-type: none; }
.decor-detail-panel .thumb-name { white-space: normal; text-overflow: clip; font-size: 11px; line-height: 13px; max-height: 26px; overflow-wrap: anywhere; }
.stage.stage-deco { flex: 1 1 auto; min-height: 186px; max-height: calc(44vh - var(--lm-head-extra)); }
.decor-list-panel { flex: 1 0 auto; display: flex; flex-direction: column; }
.decor-list-panel .decor-grid { flex: none; }
.decor-list-panel .decor-card-art { flex: none; height: 84px; }
.stage.stage-hub { flex: none; height: calc(min(30vh, 260px) - var(--lm-head-extra)); min-height: 106px; }
@media (max-width: 719px) {
  .stage.stage-deco:not(.stage-hub) { max-height: calc(42vh - var(--lm-head-extra)); min-height: 146px; }
  .decor-detail-panel .thumb { flex: none; width: 128px; height: 112px; }
  .decor-detail-panel { margin-top: 8px; }
  .decor-detail-panel .flip-row { margin-top: 8px; }
  .decor-detail-panel .strip { margin-top: 8px; }
  .decor-detail-panel .decor-actions { margin-top: 8px; }
}

.decor-workspace { display: flex; flex-direction: column; }
.decor-workspace > .panel { flex-shrink: 0; }
/* Detail controls keep their height; the stage yields remaining vertical space. */
.decor-workspace .stage.stage-deco:not(.stage-hub) { min-height: 0; }
.decor-workspace .stage-art { min-height: 0; overflow: hidden; }

.decor-detail-panel .strip { flex: none; }
.decor-style-colors { flex-wrap: nowrap; gap: 8px; }
.decor-style-colors .color-dot { width: 38px; height: 38px; }
.decor-style-colors.disabled { opacity: .4; }
.decor-style-colors .color-dot:disabled { cursor: not-allowed; }
.decor-color-hint { font-size: 11px; color: var(--sub); line-height: 16px; text-align: center; margin-top: 4px; }

.strip-grouped .thumb-cell { flex: none; }
.strip-grouped .thumb-group-start { margin-left: 4px; }
.strip-grouped .thumb-group-heading { height: 16px; line-height: 16px; font-size: 11px; font-weight: 700; color: var(--sub); }
.decor-detail-panel .strip-grouped .thumb { width: 128px; height: 112px; }

.each-colors { margin-top: 4px; gap: 8px; padding-bottom: 4px; }
.each-colors > :first-child { margin-left: auto; }
.each-colors > :last-child { margin-right: auto; }
.each-colors .thumb-group-start { margin-left: 12px; }
.each-colors .color-dot { width: 38px; height: 38px; display: block; }
.decor-colors.strip { justify-content: safe center; padding-top: 4px; padding-bottom: 4px; }
.stage.stage-deco.stage-each-detail { max-height: calc(36vh - var(--lm-head-extra)); }

.decor-detail-panel .strip-wrap .strip { margin-top: 0; }
.decor-detail-panel .color-strip-wrap { margin-top: 4px; }
@media (max-width: 719px) {
  .decor-detail-panel .strip-wrap { margin-top: 8px; }
  .decor-detail-panel .color-strip-wrap { margin-top: 4px; }
}
/* The selection ring (outline + offset) is clipped by the scrolling strip without this room. */
.strip-wrap .strip.each-colors { padding: 6px 10px; box-sizing: content-box; }

/* 使い道（キャンバスの大きさ）を選ぶページ */
.target-layer { position: fixed; inset: 0; z-index: 110; display: flex; flex-direction: column; background: var(--bg); outline: none; }
.target-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 8px; }
.target-heading { display: grid; gap: 2px; }
.target-heading b { font-size: 20px; font-weight: 900; }
.target-heading small { color: var(--sub); font-size: 12px; }
.target-body { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 12px 12px; }
.target-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 720px; margin: 0 auto; }
.target-custom { max-width: 720px; margin: 12px auto 0; padding: 12px; border-radius: 14px; background: var(--surface); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.target-custom[hidden] { display: none; }
.target-custom-field { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 13px; font-weight: 700; color: var(--text); }
.target-custom-field span, .target-custom-field small { flex: none; white-space: nowrap; }
.target-custom-field input { flex: 1 1 auto; min-width: 0; width: 100%; height: 44px; padding: 0 10px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg, transparent); color: var(--text); font-size: 16px; font-weight: 700; text-align: right; }
.target-custom-field input:focus { outline: none; border-color: var(--accent-hi); box-shadow: 0 0 0 3px rgba(255,122,168,.2); }
.target-custom-field small { color: var(--sub); font-size: 11px; }
.target-custom-hint { grid-column: 1 / -1; margin: 0; font-size: 11px; color: var(--sub); }
.tool.target-card { height: auto; padding: 10px; gap: 6px; border-radius: 14px; transition: border-color .12s, transform .12s, box-shadow .12s; }
.target-art { width: 100%; height: 124px; display: grid; place-items: center; align-content: center; }
.target-frame { position: relative; box-sizing: border-box; border-radius: 6px; border: 1px solid color-mix(in srgb, var(--sub) 60%, transparent); box-shadow: 0 4px 10px rgba(0,0,0,.18); overflow: hidden; display: grid; }
.target-logo { position: absolute; inset: 12%; display: grid; place-items: center; min-height: 0; }
.target-logo canvas { width: 100%; height: 100%; object-fit: contain; }
.target-card b { font-size: 14px; }
.target-card small { font-size: 11px; color: var(--sub); }
.tool.target-card:focus-visible { border-color: var(--accent-hi); transform: translateY(-2px); outline: none; }
@media (hover: hover) and (pointer: fine) {
  .tool.target-card:hover { border-color: var(--accent-hi); transform: translateY(-2px); outline: none; }
}
.tool.target-card[aria-pressed="true"] { border-color: var(--accent-hi); box-shadow: 0 0 0 2px var(--accent-hi), 0 8px 18px rgba(0,0,0,.25); background: var(--surface2); }
.target-note { margin: 0 auto; padding: 8px 16px 0; max-width: 720px; width: 100%; box-sizing: border-box; text-align: center; color: var(--sub); font-size: 12px; line-height: 1.5; }
.target-note[hidden] { display: none; }
.target-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; align-items: center; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); max-width: 720px; width: 100%; margin: 0 auto; box-sizing: border-box; }
.target-actions .btn-main { margin-top: 0; }
@media (min-width: 720px) { .target-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

#pngBtn:disabled, #editBtn:disabled { opacity: .45; cursor: not-allowed; }

/* Shared decision/back row; decoration detail keeps its existing actions. */
.step-actions { display: flex; gap: 10px; margin-top: 12px; }
.step-actions > .btn-main, .step-actions > .hint-wrap { flex: 1.4; }
.step-actions > .step-back { flex: 1; }
.step-actions > button, .decor-actions > button, .target-actions > button { font-size: 15px; font-weight: 800; white-space: nowrap; gap: 4px; padding-left: 8px; padding-right: 8px; }
.step-actions .ms, .decor-actions .ms, .target-actions .ms, .btn-main .ms { font-size: 18px; flex: none; }
.step-actions > button { height: 52px; min-width: 0; margin-top: 0; }

/* 操作説明: 使い方ダイアログ、「？」、吹き出し(tubudeco-maker 11章) */
.lm-help-layer { position: fixed; inset: 0; z-index: 140; display: grid; place-items: center; background: rgba(0,0,0,.55); }
.lm-help-layer[hidden] { display: none; }
.lm-help-dialog { width: min(360px, calc(100% - 32px)); max-height: calc(100% - 48px); overflow-y: auto; padding: 20px; border-radius: 16px; background: var(--surface); color: var(--text); }
.lm-help-title { margin: 0 0 12px; font-size: 16px; font-weight: 900; color: var(--accent-hi); }
.lm-help-list { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; line-height: 1.6; }
.lm-help-keys { margin: 0 0 16px; font-size: 12px; line-height: 1.5; color: var(--sub); }
.lm-help-close { width: 100%; margin-top: 0; }
.hint-wrap { position: relative; display: block; min-width: 0; }
.hint-wrap > .btn-main, .hint-wrap > .done-edit { width: 100%; }
.step-actions > .hint-wrap > .btn-main { height: 52px; margin-top: 0; font-size: 15px; font-weight: 800; white-space: nowrap; gap: 4px; padding-left: 8px; padding-right: 8px; }
.hint-btn { position: absolute; top: -8px; right: -4px; width: 26px; height: 26px; padding: 0; border: 2px solid var(--accent-hi); border-radius: 50%; background: var(--surface); color: var(--accent-hi); font-size: 14px; font-weight: 900; line-height: 1; cursor: pointer; z-index: 2; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.hint-btn.is-bottom { top: auto; bottom: -8px; }
.hint-btn:hover, .hint-btn:focus-visible, .hint-btn[aria-expanded="true"] { background: var(--accent-hi); color: var(--surface); outline: none; }
.lm-bubble { position: absolute; z-index: 150; box-sizing: border-box; padding: 10px 12px; border: 1.5px solid var(--accent-hi); border-radius: 14px; background: var(--surface2); color: var(--text); font-size: 13px; font-weight: 700; line-height: 1.55; box-shadow: 0 8px 22px rgba(0,0,0,.35); animation: lmBubbleIn .16s ease-out; }
.lm-bubble::after { content: ''; position: absolute; left: var(--arrow-x, 50%); bottom: -7px; width: 12px; height: 12px; margin-left: -6px; background: var(--surface2); border-right: 1.5px solid var(--accent-hi); border-bottom: 1.5px solid var(--accent-hi); transform: rotate(45deg); }
.lm-bubble.is-below::after { bottom: auto; top: -7px; border: 0; border-left: 1.5px solid var(--accent-hi); border-top: 1.5px solid var(--accent-hi); }
@keyframes lmBubbleIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .lm-bubble { animation: none; } }

/* 最初の文字入力画面では、次へ進む前に効果音を選べる。 */

/* エディターからの新規作成は、現在の作品への反映だけを主操作にする。 */
.lm.lm-editor-context .lm-bottom { display:block; }
.lm-editor-context .lm-bottom-inner { grid-template-columns:1.4fr 1fr; }
.lm-editor-context .done-actions { display:none; }
