/* 依頼表メーカー：朱色 × ステッカー */
.irai-app { display: grid; gap: 28px; margin: 8px 0 48px; align-items: start; min-height: 70vh; }
@media (min-width: 1024px) { .irai-app { grid-template-columns: minmax(0, 1fr) minmax(400px, 500px); gap: 32px; } }

/* ----- editor ----- */
.editor { display: grid; gap: 22px; min-width: 0; counter-reset: step; }
.irai-app:not(.ready) .editor::before { content: ""; display: block; height: 900px; border: 2px dashed var(--line); border-radius: var(--radius); }
.ed-section { padding: 0; }
.ed-section > header { display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 2px solid var(--line); background: var(--surface-2); border-radius: calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0 0; }
.ed-section > header h2 { font-size: 1.15rem; margin: 0; }
.ed-section > header .hint { margin: 2px 0 0; }
.step { flex: none; width: 42px; height: 42px; display: grid; place-items: center; font-family: var(--display); font-size: 1.25rem; background: var(--accent); color: var(--accent-ink); border: 2px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); transform: rotate(-4deg); }
.ed-section:nth-child(even) .step { transform: rotate(3deg); background: var(--yellow); color: #121212; }
.ed-body { display: grid; gap: 18px; padding: 18px; }
@media (min-width: 720px) { .ed-body { padding: 20px 24px 24px; } }
.ed-body .seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
.ed-body .seg label { text-align: center; line-height: 1.3; padding: 8px 6px; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: start; }
.bi { display: grid; gap: 10px; padding: 10px 0 10px 14px; border-left: 4px solid var(--accent); }
.check { display: flex; gap: 8px; align-items: center; font-size: .9rem; font-weight: 700; cursor: pointer; min-height: 32px; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); }

.genres { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.genre-card { position: relative; border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; cursor: pointer; font-weight: 700; font-size: .92rem; background: var(--surface); min-height: 52px; display: flex; align-items: center; transition: transform .08s, box-shadow .08s; }
.genre-card:hover { transform: translate(-1px, -1px); box-shadow: var(--shadow-sm); }
.genre-card input { position: absolute; opacity: 0; }
.genre-card.selected { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); transform: translate(-2px, -2px); }
.genre-card:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }

.items { display: grid; gap: 16px; }
.item { padding: 14px; box-shadow: var(--shadow-sm); background: var(--surface-2); }
.item-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .item-grid { grid-template-columns: 124px 1fr; } }
.item-fields { display: grid; gap: 12px; min-width: 0; }
.img-drop { position: relative; aspect-ratio: 1; border: 2px dashed var(--line); border-radius: var(--radius-sm); display: grid; place-items: center; align-content: center; gap: 8px; background: var(--surface); color: var(--ink-2); padding: 8px; max-width: 160px; }
.img-drop svg { width: 34px; height: 34px; }
.img-drop.has-img { border-style: solid; padding: 0; overflow: hidden; }
.img-drop.has-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.img-drop.has-img .img-btn { display: none; }
.img-drop .img-remove { position: absolute; bottom: 6px; left: 6px; right: 6px; background: var(--surface); border-color: var(--line); box-shadow: var(--shadow-sm); }
.img-btn { cursor: pointer; }
.img-btn:has(input:focus-visible) { outline: 3px solid var(--focus); }
.item-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; }
.btn.danger { color: var(--fee); }
.btn[disabled] { opacity: .3; pointer-events: none; }
.fee-line { margin: 0; font-size: .82rem; }
.fee-line strong { font-family: var(--mono); color: var(--ink); background: var(--yellow); padding: 0 4px; }
.fee-pick { max-width: 300px; }
.add-btn { justify-self: start; border-style: dashed; }
.amount-input { position: relative; }
.amount-input > span { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-weight: 700; color: var(--ink); pointer-events: none; }
.amount-input .input { padding-left: 32px; font-family: var(--mono); font-weight: 700; }

.addons { display: grid; gap: 12px; }
.addon-row { display: grid; gap: 10px; grid-template-columns: 1fr 120px 92px 44px; align-items: end; padding-bottom: 12px; border-bottom: 2px dashed var(--line-soft); }
@media (max-width: 560px) { .addon-row { grid-template-columns: 1fr 1fr 44px; } .addon-name { grid-column: 1 / -1; } }

/* ○ × タグ */
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 5px 12px; border-radius: var(--radius-sm); border: 2px solid var(--line-soft); background: var(--surface); color: var(--ink-2); font: inherit; font-size: .86rem; font-weight: 500; cursor: pointer; transition: transform .08s; }
.tag:hover { border-color: var(--line); }
.tag .tmark { font-family: var(--mono); font-weight: 700; width: 0; overflow: hidden; }
.tag.yes { background: var(--accent); border-color: var(--line); color: var(--accent-ink); font-weight: 700; box-shadow: var(--shadow-sm); transform: translate(-1px, -1px); }
.tag.no { border-color: var(--line); color: var(--ink-2); background: repeating-linear-gradient(-45deg, var(--surface) 0 5px, var(--surface-2) 5px 10px); text-decoration: line-through; text-decoration-thickness: 2px; font-weight: 700; }
.tag.yes .tmark, .tag.no .tmark { width: 1em; }
.tag.no .tmark { text-decoration: none; display: inline-block; color: var(--fee); }
.tag .x { margin-left: 2px; opacity: .7; }
.custom-tag { display: grid; gap: 8px; padding: 14px; border: 2px dashed var(--line-soft); border-radius: var(--radius-sm); }
.custom-tag .row { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.custom-tag .row:last-child { display: flex; flex-wrap: wrap; }

.switches { display: grid; gap: 12px; }
.extra-terms { display: grid; gap: 10px; justify-items: start; }
.extra-row { display: grid; grid-template-columns: 1fr 44px; gap: 8px; align-items: end; width: 100%; }
.term-preview { background: var(--surface-2); border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; position: relative; }
.term-preview::before { content: "PREVIEW"; position: absolute; top: -11px; left: 10px; font-family: var(--mono); font-size: .65rem; font-weight: 700; background: var(--ink); color: var(--paper); padding: 1px 6px; }
.term-preview ul { margin: 0; padding-left: 1.1em; }
.term-preview .sub { color: var(--ink-3); }

.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 12px; }
.theme-card { display: grid; gap: 6px; cursor: pointer; position: relative; }
.theme-card input { position: absolute; opacity: 0; }
.swatch { position: relative; display: block; aspect-ratio: 4 / 3; border-radius: var(--radius-sm); border: 2px solid var(--line) !important; overflow: hidden; transition: transform .08s, box-shadow .08s; }
.swatch i { position: absolute; left: 14%; right: 14%; top: 32%; bottom: 14%; border-radius: 4px; border: 1.5px solid; }
.swatch b { position: absolute; left: 14%; top: 12%; width: 40%; height: 11%; border-radius: 2px; }
.theme-card.selected .swatch { box-shadow: var(--shadow); transform: translate(-2px, -2px); }
.theme-card.selected .tname::before { content: "✓ "; font-family: var(--mono); }
.theme-card:has(input:focus-visible) .swatch { outline: 3px solid var(--focus); outline-offset: 2px; }
.tname { font-size: .85rem; font-weight: 700; text-align: center; }
.accents { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.accent-dot { width: 36px; height: 36px; border-radius: var(--radius-sm); border: 2px solid var(--line); background: var(--c); cursor: pointer; transition: transform .08s; }
.accent-dot.selected { box-shadow: var(--shadow-sm); transform: translate(-1px, -1px) rotate(-6deg); outline: 2px solid var(--line); outline-offset: 2px; }
.accent-custom { width: 36px; height: 36px; border-radius: var(--radius-sm); overflow: hidden; border: 2px solid var(--line); background: conic-gradient(#ff5b24, #ffd60a, #19c38e, #3d5afe, #ff8fc8, #ff5b24); position: relative; cursor: pointer; }
.accent-custom input { opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.import-btn { cursor: pointer; justify-self: start; }
.import-btn:has(input:focus-visible) { outline: 3px solid var(--focus); }
.autosave { margin: 0; }

/* ----- preview ----- */
.preview-pane { display: grid; gap: 12px; }
@media (min-width: 1024px) { .preview-pane { position: sticky; top: 84px; max-height: calc(100vh - 100px); grid-template-rows: auto auto auto auto 1fr auto auto; } }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.preview-head h2 { margin: 0; }
.preview-pane .seg { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); }
.preview-pane .seg label { padding: 8px 6px; font-size: .84rem; }
.fmt-hint { margin: -4px 0 0; }
.stage { overflow: auto; border-radius: var(--radius); border: 2px solid var(--line); padding: 16px; min-height: 260px; background: var(--ink); box-shadow: var(--shadow); }
:root[data-theme="dark"] .stage { background: #000; }
.stage canvas { width: 100%; height: auto; margin: 0 auto; border: 2px solid #000; }
.fit-warning { margin: 0; font-size: .82rem; font-weight: 700; color: #121212; background: var(--yellow); border: 2px solid var(--line); padding: 8px 12px; border-radius: var(--radius-sm); }
.export { display: grid; gap: 8px; }
.export .btn-primary { min-height: 52px; font-size: 1.02rem; }
.export-sub { display: flex; flex-wrap: wrap; gap: 6px; }
.export-sub .btn { flex: 1 1 auto; }
.more summary { cursor: pointer; font-size: .85rem; font-weight: 700; color: var(--ink-2); padding: 6px 0; }
.more div { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 6px; }
.preview-close { display: none; }

/* 完成度メーター */
.progress { border: 2px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 10px 12px; display: grid; gap: 8px; }
.progress-top { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; font-size: .85rem; }
.progress-top b { font-family: var(--display); font-weight: 400; font-size: 1.4rem; line-height: 1; }
.progress-bar { height: 14px; border: 2px solid var(--line); border-radius: 3px; background: repeating-linear-gradient(90deg, var(--surface-2) 0 10%, var(--surface) 10% 10.4%); overflow: hidden; }
.progress-bar i { display: block; height: 100%; background: var(--accent); border-right: 2px solid var(--line); transition: width .3s ease; }
.progress.done .progress-bar i { background: var(--mint); }
.progress-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.progress-list button { font: inherit; font-size: .76rem; font-weight: 700; padding: 3px 8px; border: 1.5px dashed var(--line); border-radius: 3px; background: none; color: var(--ink-2); cursor: pointer; }
.progress-list button:hover { background: var(--accent-soft); border-style: solid; }
.progress-done { font-size: .8rem; font-weight: 700; margin: 0; }
.flash { animation: flash 1s ease; }
@keyframes flash { 0%, 60% { box-shadow: 0 0 0 4px var(--yellow), var(--shadow); } 100% { box-shadow: var(--shadow); } }

/* mobile: preview as full-screen sheet */
.mobile-bar { display: none; }
@media (max-width: 1023px) {
  .preview-pane { position: fixed; inset: 0; z-index: 120; background-color: var(--paper); padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); overflow: auto; transform: translateY(100%); visibility: hidden; transition: transform .25s ease, visibility 0s .25s; align-content: start; }
  .preview-pane.open { transform: none; visibility: visible; transition: transform .25s ease; }
  .preview-close { display: inline-flex; }
  .stage { min-height: 0; }
  .mobile-bar { display: flex; gap: 10px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--paper); border-top: 2px solid var(--line); }
  .mobile-bar .btn { flex: 1; min-height: 48px; }
  .mobile-bar .pct { font-family: var(--mono); font-size: .8rem; background: var(--ink); color: var(--paper); padding: 1px 6px; border-radius: 3px; }
  body { padding-bottom: 76px; }
  body.no-scroll { overflow: hidden; }
}
