:root {
  --cream: #fff7dc;
  --paper: #fffdf8;
  --paper-soft: #fff9e9;
  --orange: #f28c28;
  --orange-line: #efb35f;
  --brown: #957e63;
  --brown-dark: #705846;
  --green: #35aa62;
  --green-dark: #19743c;
  --coral: #e75b55;
  --coral-soft: #f7b2b2;
  --text: #33261c;
  --muted: #705f50;
  --line: #efb35f;
  --soft: #fff0c6;
  --ok: #19743c;
  --warn: #a64a00;
  --danger: #a63b3b;
  --shadow: 0 7px 22px rgba(109, 72, 39, 0.18);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  margin: 0;
  font-family: "BIZ UDPGothic", "Yu Gothic UI", "Meiryo UI", "Meiryo", sans-serif;
  color: var(--text);
  background-color: var(--cream);
  background-image: linear-gradient(#f28c281f 1px, transparent 1px), linear-gradient(90deg, #f28c281f 1px, transparent 1px);
  background-size: 20px 20px;
}

button, input, textarea, select { font: inherit; }

button {
  border: 1px solid var(--orange-line);
  border-radius: 8px;
  padding: .58rem .9rem;
  background: #fff;
  color: var(--brown-dark);
  box-shadow: inset 0 1px 0 #fff, 0 1px 0 #c9873f33;
  cursor: pointer;
  font-weight: 700;
}

button:not(:disabled) { transition: transform .08s ease, background-color .08s ease, border-color .08s ease; }
button:not(:disabled):hover { background: #fff0c6; border-color: var(--orange); }
button:not(:disabled):active { transform: translateY(1px); box-shadow: inset 0 1px 3px #70421a33; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid #f1be5b; outline-offset: 2px; }
button:disabled { cursor: not-allowed; opacity: .55; }
button.subtle { background: #fff4da; color: var(--brown-dark); }
button.danger { border-color: #dd8f8a; background: var(--coral-soft); color: #8e3338; }
button.primary { border-color: var(--green-dark); background: var(--green); color: #fff; box-shadow: 0 2px 0 #19743c66; }
button.primary:hover { background: #4abb75; border-color: var(--green-dark); }
button.full { width: 100%; margin-top: 1rem; }

.site-header {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.3rem 1rem 1rem;
  display: grid;
  grid-template-columns: 1fr minmax(300px, 420px);
  gap: 1rem;
  align-items: end;
}

h1 { margin: 0; color: var(--brown-dark); font-size: clamp(1.8rem, 3vw, 3rem); }
h2, h3 { margin-top: 0; color: var(--brown); }
.lead { color: var(--muted); max-width: 48rem; }
.eyebrow { margin: 0 0 .25rem; color: var(--brown); font-size: .8rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

.layout {
  max-width: 1200px;
  margin: 0 auto 3rem;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1rem;
}

.panel, .login-card {
  background: var(--paper);
  border: 1px solid var(--orange-line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.login-card, .nav-panel, .app-panel { padding: 1rem; }
.nav-panel { position: sticky; top: 1rem; align-self: start; background: var(--paper-soft); }
.nav-btn { width: 100%; margin-bottom: .5rem; background: #fff; color: var(--brown-dark); text-align: left; }
.nav-btn.active { border-color: var(--brown); background: var(--brown); color: #fff; }

.section-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }

fieldset {
  border: 1px solid var(--orange-line);
  border-radius: 10px;
  padding: 1rem;
  background: var(--paper-soft);
}

legend { padding: 0 .3rem; color: var(--brown); font-weight: 800; }
label { display: block; margin: .75rem 0; font-weight: 700; }
input[type="text"], input[type="url"], textarea, select {
  display: block;
  width: 100%;
  border: 1px solid var(--orange-line);
  border-radius: 6px;
  padding: .7rem;
  margin-top: .35rem;
  background: #fff;
  color: var(--text);
}

input[type="file"] { display: block; width: 100%; margin-top: .5rem; }
input[type="color"] { display: block; width: 100%; min-height: 44px; margin-top: .35rem; border: 1px solid var(--orange-line); border-radius: 6px; background: #fff; cursor: pointer; }

input[type="checkbox"], input[type="radio"] { accent-color: var(--brown); }
textarea { resize: vertical; }
.wide { grid-column: 1 / -1; }
.note { color: var(--muted); font-size: .92rem; }
.button-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.button-link { display: inline-block; border: 1px solid var(--brown); border-radius: 8px; padding: .58rem .9rem; background: var(--brown); color: #fff; box-shadow: 0 2px 0 #5f4d3d66; font-weight: 700; text-decoration: none; }
.button-link:hover { background: #ad967d; }
.button-row.end { justify-content: flex-end; }
.radio-row { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.hidden { display: none !important; }

.mall-footer { padding: 1.25rem 1rem calc(5.5rem + env(safe-area-inset-bottom)); text-align: center; }
.mall-footer a { color: var(--brown); font-size: .9rem; text-decoration: underline; }
.maker-login-dialog { width: min(92vw, 440px); border: 1px solid var(--orange-line); border-radius: 12px; padding: 1.2rem; color: var(--text); background: var(--paper-soft); }
.maker-login-dialog::backdrop { background: #2b201a99; }
.maker-dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.maker-dialog-heading h2 { margin: 0; font-size: 1.15rem; }
.maker-dialog-heading button { border: 0; background: transparent; font-size: 1.5rem; color: var(--text); }
.maker-dialog-actions { display: flex; justify-content: flex-end; margin-top: 1rem; }

.category-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem; padding-top: 1rem; }
.category-group { border: 1px solid #f0d48f; border-radius: 8px; padding: .75rem; background: #fff; }
.category-group strong { display: block; margin-bottom: .4rem; color: var(--brown); }
.status.ok { color: var(--ok); font-weight: 800; }
.status.warn { color: var(--warn); font-weight: 800; }
.status.bad { color: var(--danger); font-weight: 800; }

.cards { display: grid; gap: 1rem; }
.card { border: 1px solid var(--orange-line); border-radius: 10px; padding: 1rem; background: var(--paper-soft); box-shadow: 0 2px 7px #70421a14; }
.card-head { display: flex; gap: 1rem; justify-content: space-between; align-items: start; }
.badge { display: inline-block; border: 1px solid #e7b26c; border-radius: 6px; padding: .25rem .6rem; background: #fff4da; color: var(--brown-dark); font-size: .85rem; font-weight: 800; }
.meta { color: var(--muted); font-size: .92rem; }
.image-row { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; }
.thumb { width: 96px; height: 96px; object-fit: cover; border: 1px solid var(--orange-line); border-radius: 8px; background: #fff; }
.size-buttons { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.size-buttons button { padding: .4rem .7rem; background: #fff; color: var(--brown-dark); }

pre { white-space: pre-wrap; word-break: break-word; background: #49372a; color: #fffdf8; padding: 1rem; border: 1px solid #6d4e38; border-radius: 8px; max-height: 50vh; overflow: auto; }
dialog { width: min(700px, 92vw); border: 1px solid var(--orange-line); border-radius: 16px; padding: 1rem; background: var(--paper); color: var(--text); box-shadow: 0 14px 36px #70421a55; }
dialog::backdrop { background: rgba(43, 32, 20, .45); }
.received-pattern { border-color: #d9a45b; background: #fff4da; }
.paid-guide { border: 1px solid #d9a45b; border-radius: 10px; background: #fff4da; }
.paid-guide[hidden] { display: none; }
.paid-guide > summary { padding: .7rem 1rem; color: var(--brown-dark); font-weight: 700; cursor: pointer; }
.paid-guide-body { padding: 0 1rem 1rem; line-height: 1.7; }
.paid-guide-body p { margin: 0 0 .7rem; }
.paid-guide-body a { color: #255ba3; }
.paid-guide-hide { display: inline-flex; gap: .4rem; align-items: center; font-weight: 700; cursor: pointer; }
.received-summary { border: 1px solid #f0d48f; border-radius: 8px; padding: .8rem; background: #fff; color: var(--brown-dark); font-weight: 700; }
.mode-dialog label { margin-top: 1rem; }
.publisher-terms-dialog { max-width: 620px; }
.publisher-terms-dialog form { display: grid; gap: .8rem; }
.publisher-terms-dialog p { margin: 0; }
.publisher-terms-dialog label { display: flex; gap: .55rem; align-items: flex-start; }
.social-post-preview { grid-column: 1 / -1; border: 1px solid var(--orange-line); border-radius: 8px; padding: .8rem; background: #fffaf0; }
.social-post-content { display: grid; gap: .65rem; }
.social-post-content iframe { width: min(100%, 550px); min-height: 420px; border: 0; background: #fff; }
.social-post-slot { margin-top: .8rem; }
.card .social-post-content iframe { min-height: 360px; }
/* 複数のSNS投稿URL */
.social-post-inputs, .size-image-inputs { grid-column: 1 / -1; display: grid; gap: .5rem; }
.social-post-inputs .field-title { margin: 0; font-weight: 700; }
.social-post-rows { display: grid; gap: .75rem; }
.social-post-row { display: grid; gap: .45rem; padding: .7rem; border: 1px dashed var(--orange-line); border-radius: 8px; }
.social-post-row .social-post-preview { grid-column: auto; }
.social-post-remove { justify-self: start; }
.social-post-slot { display: grid; gap: .75rem; }
/* サイズ画像：複数枚はサムネイルを横並び、押すと拡大表示 */
.size-image-thumbs { display: flex; flex-wrap: wrap; gap: .6rem; margin: .4rem 0; }
.size-image-tile { display: grid; gap: .3rem; justify-items: center; }
.size-image-open { display: block; padding: 0; border: 1px solid var(--orange-line); border-radius: 8px; background: #fff; cursor: zoom-in; overflow: hidden; }
.size-image-open img { display: block; width: 120px; height: 120px; object-fit: cover; }
.size-image-thumbs.single .size-image-open img { width: min(100%, 420px); height: auto; max-height: 420px; object-fit: contain; }
.size-image-remove { padding: .25rem .7rem; font-size: .85rem; }
.my-pattern-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .8rem; align-items: center; padding: 1rem; border: 1px solid var(--orange-line); border-radius: 10px; background: #fffdf8; }
.my-pattern-title { color: var(--brown-dark); font-size: 1.1rem; font-weight: 700; text-decoration: none; }
.my-pattern-title:hover { text-decoration: underline; }
.my-pattern-table-wrap { overflow-x: auto; }
.my-pattern-table { width: 100%; border-collapse: collapse; background: #fffdf8; }
.my-pattern-table th, .my-pattern-table td { padding: .6rem .8rem; border: 1px solid var(--orange-line); text-align: left; vertical-align: middle; }
.my-pattern-table th { background: #fff7e2; color: var(--brown-dark); white-space: nowrap; }
.my-pattern-table .my-pattern-title { font-size: 1rem; overflow-wrap: anywhere; }
.my-pattern-table .my-pattern-number { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.my-pattern-table .my-pattern-actions { white-space: nowrap; }
.my-pattern-table .my-pattern-actions button { padding: .4rem .8rem; }
.my-pattern-table .my-pattern-actions button + button { margin-left: .4rem; }
.my-pattern-table details { margin-top: .3rem; font-size: .9rem; }
.my-pattern-table details p { margin: .3rem 0 0; white-space: pre-wrap; }
.my-pattern-table .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.site-footer { margin-top: 2rem; padding: 1.2rem; text-align: center; color: var(--brown-dark); font-size: .9rem; }
.site-footer a { color: inherit; }
.fabric-layout-inputs { display: grid; gap: .75rem; }
.fabric-layout-input-row { display: grid; grid-template-columns: minmax(9rem, .7fr) minmax(13rem, 1.2fr) auto; gap: .75rem; align-items: end; padding: .8rem; border: 1px solid var(--orange-line); border-radius: 10px; background: #fffdf8; }
.fabric-layout-input-row label { margin: 0; }
.fabric-layout-input-row .fabric-layout-remove { min-height: 42px; white-space: nowrap; }
.fabric-layout-input-row .note { grid-column: 1 / -1; margin: -.2rem 0 0; }
.fabric-layout-gallery { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .8rem; margin: .9rem 0; }
.my-pattern-row .fabric-layout-gallery { grid-column: 1 / -1; }
.fabric-layout-gallery h4 { width: 100%; margin: 0; color: var(--brown); font-size: 1rem; }
.fabric-layout-tile { display: grid; justify-items: center; gap: .4rem; padding: 0; border: 0; background: transparent; color: var(--brown-dark); text-align: center; cursor: zoom-in; }
.fabric-layout-tile img { display: block; border: 1px solid var(--orange-line); border-radius: 8px; background: #fff; object-fit: contain; }
.fabric-layout-tile.primary { width: min(100%, 360px); }
.fabric-layout-tile.primary img { width: 100%; max-height: 260px; }
.fabric-layout-tile.thumbnail { width: 126px; }
.fabric-layout-tile.thumbnail img { width: 126px; height: 94px; }
.fabric-layout-tile span { font-size: .82rem; font-weight: 700; }
.fabric-layout-tile:focus-visible { outline: 3px solid #f1be5b; outline-offset: 3px; }
.fabric-layout-preview-dialog { width: min(94vw, 980px); max-height: 92dvh; padding: 1rem; border: 1px solid var(--orange-line); border-radius: 12px; background: #fffdf8; }
.fabric-layout-preview-dialog::backdrop { background: #2b201aaa; }
.fabric-layout-preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.fabric-layout-preview-heading h3 { margin: 0; }
.fabric-layout-preview-heading button { border: 0; background: transparent; color: var(--brown-dark); font-size: 1.6rem; }
.fabric-layout-preview-dialog img { display: block; width: 100%; max-height: calc(92dvh - 5rem); object-fit: contain; }
.footer-links { border-top: 1px solid var(--orange-line); }
.footer-links nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .45rem .9rem; max-width: 1000px; margin: auto; }
.footer-links a { color: var(--brown-dark); font-size: .86rem; line-height: 1.5; text-decoration: underline; text-underline-offset: .15em; }
.mall-footer.footer-links, .detail-footer.footer-links { padding: 1.25rem 1rem calc(5.5rem + env(safe-area-inset-bottom)); }
.detail-footer { max-width: 1100px; margin: 0 auto; text-align: center; }
.pattern-detail-image { display: block; width: min(100%, 680px); max-height: 560px; margin: 1rem auto; object-fit: contain; border-radius: 8px; }
.size-table { width: 100%; border-collapse: collapse; background: #fff; }
.size-table th, .size-table td { padding: .65rem; border: 1px solid var(--orange-line); text-align: center; }
.size-table th { background: #fff0d0; }
.social-post-frame { width: min(100%, 550px); min-height: 430px; border: 0; background: #fff; }
@media (max-width: 700px) { .my-pattern-row { grid-template-columns: 1fr; } }
.registration-choices { margin-top: 1rem; }

.settings-form { max-width: 760px; }
.settings-form > label { margin-bottom: 1.2rem; }
.color-settings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.page-style-preview {
  --preview-background: #fff7dc;
  --preview-line: #efb35f;
  --preview-text: #33261c;
  display: flex;
  gap: 1rem;
  align-items: center;
  min-height: 140px;
  margin: 1rem 0;
  padding: 1.2rem;
  border: 3px solid var(--preview-line);
  border-radius: 10px;
  background: var(--preview-background);
  color: var(--preview-text);
}
.page-style-preview strong { display: block; margin-bottom: .5rem; font-size: 1.25rem; }
.page-style-preview p { margin: 0; }
.brand-icon-preview, .card-brand-icon { width: 72px; height: 72px; flex: 0 0 auto; border: 1px solid var(--preview-line, var(--orange-line)); border-radius: 50%; background: #fff; object-fit: cover; }
.card-brand-icon { width: 52px; height: 52px; }
.brand-summary { min-height: 5rem; padding: .8rem; border: 1px solid #f0d48f; border-radius: 8px; background: #fff; }
.brand-summary p { margin: .45rem 0 0; }
.brand-summary a { color: var(--brown-dark); overflow-wrap: anywhere; }
.card-title-with-icon { display: flex; gap: .75rem; align-items: center; }

@media (max-width: 820px) {
  .site-header, .layout { grid-template-columns: 1fr; }
  .nav-panel { position: static; }
  .form-grid { grid-template-columns: 1fr; }
  .color-settings { grid-template-columns: 1fr; }
  .fabric-layout-input-row { grid-template-columns: 1fr; }
  .fabric-layout-input-row .fabric-layout-remove { width: 100%; }
}

.mall-header, .mall-main, .mall-mini-header {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}
.mall-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding: 2.4rem 1rem 1.4rem;
}
.mall-header .lead { margin-bottom: 0; }
.mall-main { padding: 0 1rem 3rem; }
.mall-mini-header {
  display: flex;
  justify-content: space-between;
  padding: 1rem;
}
.mall-mini-header a, .mall-detail-link { color: var(--brown-dark); font-weight: 700; }
.mall-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
  gap: .7rem 1rem;
  align-items: end;
  padding: 1rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--orange-line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.mall-search label { margin: 0; }
.mall-search #mallCount { grid-column: 1 / -1; margin: 0; }
.mall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.mall-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--orange-line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.mall-card-image { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-bottom: 1px solid var(--orange-line); background: #fff; }
.mall-card-content { display: flex; flex: 1; flex-direction: column; gap: .65rem; padding: 1rem; }
.mall-card-labels, .mall-size-list, .mall-actions { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.mall-price { border-radius: 999px; padding: .25rem .65rem; font-size: .82rem; font-weight: 800; }
.mall-price.free { background: #e8f7ed; color: var(--green-dark); }
.mall-price.paid { background: #f8e9f4; color: #7b386f; }
.mall-card-title { color: var(--brown-dark); font-size: 1.18rem; font-weight: 800; text-decoration: none; }
.mall-card-title:hover, .mall-detail-link:hover { text-decoration: underline; }
.mall-maker { margin: -.35rem 0 0; color: var(--brown); font-size: .9rem; font-weight: 700; }
.mall-description { display: -webkit-box; overflow: hidden; margin: 0; color: var(--muted); -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.mall-actions { margin-top: auto; padding-top: .35rem; }
.mall-download { width: 100%; border-color: var(--green-dark); background: var(--green); color: #fff; }
.mall-download:hover { background: #4abb75; }
.gumroad-link { background: #8f3f86; border-color: #8f3f86; }
.mall-empty { padding: 2rem; border: 1px dashed var(--orange-line); border-radius: 12px; background: var(--paper); text-align: center; color: var(--muted); }
.download-login-dialog { width: min(560px, 92vw); border: 1px solid var(--orange-line); border-radius: 16px; padding: 1.25rem; background: var(--paper); color: var(--text); box-shadow: var(--shadow); }
.download-login-dialog::backdrop { background: rgba(43, 32, 20, .52); }
.download-login-dialog form { display: grid; gap: .9rem; }
.download-login-dialog h2, .download-login-dialog p { margin: 0; }
.download-login-consent { display: flex; gap: .55rem; align-items: flex-start; margin: 0; }
.download-login-consent input { flex: 0 0 auto; margin-top: .25rem; }
.download-login-links { display: flex; flex-wrap: wrap; gap: .8rem; }
.download-login-links a { color: var(--brown-dark); font-weight: 700; }
#downloadGoogleButton:empty { display: none; }

.size-details { max-height: none; margin: .75rem 0 0; border-color: var(--orange-line); background: #fff; color: var(--text); font-family: inherit; line-height: 1.7; }
.making-instructions { display: grid; gap: .45rem; padding-left: 1.4rem; }

.panel-inset { margin-top: 1.5rem; padding: 1rem; border: 1px solid var(--orange-line); border-radius: 12px; background: rgba(255,255,255,.55); }
.backup-list { display: grid; gap: .5rem; margin-top: .75rem; }
.backup-row { display: flex; justify-content: space-between; gap: .75rem; align-items: center; padding: .6rem .75rem; border: 1px solid rgba(51,38,28,.15); border-radius: 8px; }
@media (max-width: 640px) { .backup-row { align-items: flex-start; flex-direction: column; } }

@media (max-width: 600px) {
  .mall-header { align-items: start; flex-direction: column; padding-top: 1.5rem; }
  .mall-search { grid-template-columns: 1fr; }
}

/* 公開ページ */
.public-site { --pink: #eb527b; --pale-pink: #fff0f3; --public-text: #22252b; color: var(--public-text); background: #fcf9f8; background-image: none; font-family: "BIZ UDPGothic", "Yu Gothic UI", Meiryo, sans-serif; }
.public-site button { box-shadow: none; }
.public-site a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.public-header { max-width: 1200px; height: 82px; margin: auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; background: #fff; }
.public-logo { display: flex; gap: 12px; align-items: center; text-decoration: none; }
.public-logo strong, .public-logo small { display: block; }
.public-logo strong { font-size: 1.12rem; }
.public-logo small { font-size: .72rem; }
.bunny-mark { display: grid; place-items: center; width: 42px; height: 42px; border: 2px solid #d85955; border-radius: 50%; color: #d85955; font-size: 1.6rem; }
.public-menu { color: #1d5d93 !important; font-size: .9rem; font-weight: 700; }
.public-main { max-width: 1200px; margin: 0 auto; padding: 0 24px 100px; background: #fff; min-height: calc(100vh - 82px); }
.public-hero { min-height: 300px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 20px; padding: 44px clamp(24px, 7vw, 90px); border-radius: 0 0 20px 20px; background: radial-gradient(circle at 85% 25%, #f6d5df 0 12%, transparent 13%), radial-gradient(circle at 75% 65%, #f5e5d2 0 18%, transparent 19%), linear-gradient(135deg, #f8f1e9, #fff5f7 65%, #f6e1e7); }
.hero-copy p { margin: 0 0 4px; font-size: 1.3rem; }
.hero-copy h1 { color: var(--public-text); font-size: clamp(1.55rem, 3vw, 2.7rem); line-height: 1.3; }
.hero-search { width: min(100%, 600px); display: flex; padding: 5px; border-radius: 999px; background: white; box-shadow: 0 4px 16px #2f202024; }
.hero-search input { width: 100%; min-width: 0; padding: 8px 14px; border: 0; outline: 0; background: transparent; }
.hero-search button { width: 46px; height: 42px; flex: 0 0 auto; border: 0; border-radius: 50%; background: #30343a; color: white; font-size: 1.7rem; line-height: 1; }
.category-section, .new-section { padding: 32px 0 8px; }
.category-tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.category-tile { display: grid; justify-items: center; gap: 8px; padding: 20px 5px; border: 1px solid #f4ecec; border-radius: 22px; background: #fff; box-shadow: 0 3px 12px #4d343412; text-decoration: none; font-size: .93rem; }
.category-tile:hover { border-color: var(--pink); }
.category-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 17px; background: var(--pale-pink); color: #51517f; font-size: 1.8rem; }
.category-tile:nth-child(2) .category-icon { color: #575389; }.category-tile:nth-child(3) .category-icon { color: #3972ac; }.category-tile:nth-child(4) .category-icon { color: #9c5f9d; }.category-tile:nth-child(5) .category-icon { color: #437c9a; }.category-tile:nth-child(6) .category-icon { color: #4e9d56; }
.more-link { display: block; margin-top: 18px; text-align: center; color: #17638d !important; text-decoration: none; font-size: .9rem; }
.public-section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.public-section-title h2, .brand-gallery-title { margin: 0; padding-left: 12px; border-left: 4px solid var(--pink); color: var(--public-text); font-size: 1.25rem; }
.public-section-title a { color: #17638d !important; font-size: .9rem; text-decoration: none; }
.latest-patterns { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.public-pattern-card { overflow: hidden; min-width: 0; border: 1px solid #ededed; border-radius: 13px; background: #fff; box-shadow: 0 3px 12px #33333314; }
.public-pattern-picture { display: block; aspect-ratio: 1 / .9; background: #f5f3f1; }
.public-pattern-picture img { display: block; width: 100%; height: 100%; object-fit: cover; }
.picture-placeholder { display: grid; place-items: center; height: 100%; color: #aaa; }
.public-pattern-info { display: grid; gap: 6px; padding: 10px 12px 13px; }
.public-pattern-labels { display: flex; flex-wrap: wrap; gap: 4px; }
.category-pill, .price-pill { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: .73rem; }
.category-pill { background: #e3f1fc; color: #1c4c71; }.price-pill.free { background: #e8f4e8; color: #317646; }.price-pill.paid { background: #ffe3ea; color: #9b435b; }
.public-pattern-title { font-size: 1rem; font-weight: 800; text-decoration: none; }.public-pattern-brand { font-size: .82rem; color: #5b5d66 !important; text-decoration: none; }.public-pattern-brand:hover, .public-pattern-title:hover { text-decoration: underline; }
.public-pattern-size { margin: 0; font-size: .82rem; color: #545862; }
.public-bottom-nav { position: fixed; z-index: 20; bottom: 0; left: 50%; transform: translateX(-50%); display: flex; justify-content: space-around; width: min(100%, 1200px); padding: 6px 8px max(8px, env(safe-area-inset-bottom)); border-top: 1px solid #eee; background: #fff; box-shadow: 0 -3px 16px #33333312; }
.public-bottom-nav a { display: grid; justify-items: center; gap: 2px; min-width: 70px; color: #35363b; text-decoration: none; font-size: .73rem; }.public-bottom-nav a span { font-size: 1.4rem; line-height: 1.2; }.public-bottom-nav a.active { color: var(--pink); }
.search-head { padding: 24px 0 12px; text-align: center; }.search-head h1 { color: var(--public-text); font-size: 1.5rem; }
.search-intro { margin: 0 0 16px; color: #4d3728; line-height: 1.8; }.search-intro a { color: #17638d; font-weight: 700; text-decoration: underline; text-underline-offset: .15em; }
.category-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid #eee; }.category-tabs button { flex: 0 0 auto; padding: 10px 12px; border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; color: #5c5d62; font-size: .9rem; }.category-tabs button.active { border-color: var(--pink); color: #111; }
.search-tools { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; }.sort-label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; font-size: .88rem; }.sort-label select { width: auto; margin: 0; padding: 5px; border: 0; }.filter-open { border: 0; background: transparent; color: #222; font-size: .9rem; }
.search-keyword { margin: 0 0 10px; }.search-keyword input { width: 100%; padding: 10px 14px; border: 1px solid #ddd; border-radius: 999px; }.search-count { color: #777; font-size: .82rem; }.mall-grid, .brand-gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.filter-dialog { position: fixed; inset: auto 0 0; width: min(100%, 700px); max-height: 90vh; margin: auto auto 0; padding: 16px 18px 24px; border: 0; border-radius: 22px 22px 0 0; background: #fff; color: #222; }.filter-dialog::backdrop { background: #0006; }.filter-heading { display: flex; justify-content: space-between; align-items: center; }.filter-heading h2 { margin: 0; color: #222; font-size: 1.1rem; }.filter-heading button { border: 0; font-size: 1.5rem; }.filter-dialog fieldset { margin-top: 20px; border: 0; border-top: 1px solid #eee; border-radius: 0; background: #fff; }.filter-dialog legend { color: #222; }.filter-categories { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }.filter-dialog label { margin: 4px 0; font-weight: 400; }.filter-dialog input { accent-color: var(--pink); }.filter-actions { display: flex; gap: 10px; margin-top: 24px; }.filter-actions button { flex: 1; padding: 12px; }.filter-actions button:last-child { border-color: var(--pink); background: var(--pink); color: #fff; }
.brand-public-header { display: flex; align-items: flex-start; gap: 18px; min-height: 160px; padding: 30px 8px; }.brand-public-logo { width: 80px; height: 80px; flex: 0 0 auto; border-radius: 50%; object-fit: cover; }.brand-public-header h1 { color: #222; font-size: 1.4rem; }.brand-public-description { white-space: pre-line; font-size: .9rem; line-height: 1.6; }.brand-public-header a { color: #255ba3; }.brand-gallery-title { margin-bottom: 16px; }
.brand-rules { margin: 0 0 1.2rem; }.brand-rules p { margin: .3rem 0 .8rem; font-size: .9rem; }.brand-rule-options { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .3rem .8rem; }.brand-rule-options label { display: flex; align-items: start; gap: .4rem; margin: 0; font-weight: 400; }.brand-rule-options input { margin-top: .2rem; flex: 0 0 auto; }
.detail-header { display: flex; align-items: center; justify-content: space-between; max-width: 1100px; margin: auto; padding: 14px 20px; background: #fff; }.detail-header a:first-child { font-size: 1.5rem; text-decoration: none; }.detail-header a:last-child { color: #255ba3; font-size: .9rem; }.detail-page .pattern-shell { max-width: 1100px; margin: auto; padding: 0 20px 100px; }.detail-page .pattern-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .9fr); gap: 22px 32px; padding: 20px 0; border: 0; border-radius: 0; background: #fff; box-shadow: none; }.detail-main-image { background: #f7f6f4; border-radius: 12px; overflow: hidden; }.detail-main-image .pattern-detail-image { width: 100%; height: 100%; max-height: 550px; margin: 0; object-fit: contain; }.detail-image-placeholder { display: grid; place-items: center; min-height: 400px; color: #aaa; }.detail-intro h1 { color: #222; font-size: clamp(1.5rem, 3vw, 2rem); }.detail-difficulty { margin: 8px 0; color: #f5ae00; font-size: 1.5rem; }.detail-tags { display: flex; gap: 6px; margin: 10px 0; }.detail-tags span { padding: 5px 12px; border-radius: 999px; background: #e3f0ff; font-size: .85rem; }.detail-tags span:last-child { background: #fde0e9; }.detail-description { white-space: pre-line; line-height: 1.7; }.detail-brand { display: flex; align-items: center; gap: 10px; margin-top: 18px; text-decoration: none; }.detail-brand-logo { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }.detail-meta { color: #777; font-size: .78rem; }.detail-action { margin-top: 22px; padding: 14px; border-radius: 10px; background: #fff0f3; }.detail-action h2 { margin: 0 0 8px; color: #222; font-size: 1rem; }.detail-action .size-buttons { margin: 0; }.detail-action .size-buttons button, .detail-action .button-link { border: 0; background: var(--pink); color: #fff; padding: 12px 18px; }.detail-lower { grid-column: 1 / -1; display: grid; gap: 24px; }.detail-section { padding-top: 12px; border-top: 1px solid #eee; }.detail-section h2, .detail-lower section h2 { padding-left: 12px; border-left: 4px solid #20acc8; color: #222; font-size: 1.12rem; }.detail-section dl { display: grid; gap: 4px; }.detail-section dl div { display: grid; grid-template-columns: minmax(120px, 1fr) 2fr; gap: 10px; padding: 12px; border-radius: 8px; background: #f8f8f8; }.detail-section dt { font-weight: 700; }.detail-section dd { margin: 0; }.detail-lower .size-details { max-height: none; background: #fff; color: #222; border-color: #ddd; }.detail-lower .size-table th, .detail-lower .size-table td { border-color: #ddd; }.detail-lower .size-table th { background: #f4f7f8; }.fabric-layout-image { max-width: 100%; }.fabric-layout-public-list { display: flex; flex-wrap: wrap; gap: 1rem; }.fabric-layout-public-list figure { width: min(100%, 420px); margin: 0; }.fabric-layout-public-list figcaption { margin-top: .4rem; font-weight: 700; text-align: center; }.usage-rules ul { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; }.usage-rules li { padding: 7px 12px; border-radius: 999px; background: #f7edf1; font-size: .86rem; }
@media (max-width: 760px) { .public-header { height: 68px; padding: 0 16px; }.public-main { padding: 0 16px 90px; }.public-hero { min-height: 245px; padding: 28px 20px; }.category-tiles { grid-template-columns: repeat(3, 1fr); gap: 10px; }.category-tile { padding: 12px 4px; }.latest-patterns { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 12px; }.latest-patterns .public-pattern-card { flex: 0 0 min(45vw, 200px); scroll-snap-align: start; }.mall-grid, .brand-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }.detail-page .pattern-shell { padding: 0 14px 90px; }.detail-page .pattern-card { display: block; padding-top: 0; }.detail-main-image { margin: 0 -14px 18px; border-radius: 0; }.detail-main-image .pattern-detail-image { max-height: 440px; }.detail-image-placeholder { min-height: 270px; }.detail-lower { margin-top: 25px; }.brand-rule-options { grid-template-columns: 1fr; } }

/* スマホ用の絞り込みシート */
.filter-dialog { width: min(100%, 560px); max-height: 88dvh; padding: 0 18px max(16px, env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; }
.filter-dialog form { max-height: calc(88dvh - 16px); overflow-y: auto; overscroll-behavior: contain; }
.filter-handle { width: 36px; height: 5px; margin: 9px auto 8px; border-radius: 99px; background: #d6d6d6; }
.filter-heading { position: relative; justify-content: center; padding: 3px 0 12px; border-bottom: 1px solid #ededed; }
.filter-heading h2 { font-size: 1rem; font-weight: 800; }
.filter-heading button { position: absolute; right: 0; top: -4px; padding: 4px 7px; color: #17191d; background: transparent; }
.filter-dialog fieldset { margin: 20px 0 0; padding: 10px 0 4px; border-top: 1px solid #eee; }
.filter-dialog fieldset:first-of-type { margin-top: 8px; }
.filter-dialog legend { padding: 0 4px 0 0; font-size: .94rem; font-weight: 800; }
.filter-categories, .filter-check-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.filter-categories button { min-width: 0; min-height: 34px; padding: 7px 4px; border: 1px solid transparent; border-radius: 8px; background: #f2f2f2; color: #2d3034; font-size: .82rem; font-weight: 400; }
.filter-categories button.active { border-color: var(--pink); background: var(--pink); color: #fff; }
.filter-check-grid label { display: flex; align-items: center; gap: 4px; min-height: 28px; margin: 0; font-size: .78rem; white-space: nowrap; }
.filter-check-grid input { width: 16px; height: 16px; flex: 0 0 auto; margin: 0; accent-color: var(--pink); }
.filter-actions { position: sticky; bottom: 0; display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; margin: 24px -18px -1px; padding: 12px 18px 2px; background: #fff; }
.filter-actions button { min-height: 44px; padding: 8px; font-size: .88rem; }
.filter-actions button:first-child { border: 1px solid #a3a3a3; background: #fff; color: #222; }
.filter-actions button:last-child { border: 1px solid var(--pink); border-radius: 8px; background: var(--pink); color: #fff; }
@media (max-width: 400px) { .filter-dialog { padding-left: 14px; padding-right: 14px; }.filter-categories, .filter-check-grid { gap: 6px; }.filter-categories button { font-size: .76rem; }.filter-check-grid label { font-size: .72rem; }.filter-actions { margin-left: -14px; margin-right: -14px; padding-left: 14px; padding-right: 14px; } }

@media (max-width: 760px) {
  .filter-dialog {
    inset: auto 0 0;
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    height: min(80dvh, 700px);
    max-height: 100dvh;
    margin: 0;
    padding: 0 18px max(16px, env(safe-area-inset-bottom));
  }
  .filter-dialog[open] { animation: filter-sheet-in .22s ease-out; }
  .filter-dialog form {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
  }
  .filter-dialog form::-webkit-scrollbar { display: none; }
  body:has(.filter-dialog[open]) { overflow: hidden; }
  .filter-actions {
    flex: 0 0 auto;
    margin-top: auto;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
  }
}
@keyframes filter-sheet-in {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .filter-dialog[open] { animation: none; }
}

/* 型紙CADと同じクリーム色の格子を公開ページにも使う */
.mall-page.public-site {
  background-color: #fff7dc;
  background-image: linear-gradient(#f28c2818 1px, transparent 1px), linear-gradient(90deg, #f28c2818 1px, transparent 1px);
  background-size: 20px 20px;
}
.mall-page .public-header { background: #fff9e9; }
.mall-page .public-main { background: transparent; }
.mall-page .public-hero { background: #fff9e9e8; }
.public-logo-image { display: block; width: min(220px, 52vw); height: 48px; object-fit: contain; object-position: left center; }
.mall-page .public-hero { min-height: 0; align-items: center; gap: 15px; padding: 42px clamp(24px, 7vw, 90px); }
.mall-page .hero-intro { width: min(100%, 600px); margin: 0; color: #4d3728; font-size: clamp(.9rem, 1.5vw, 1rem); line-height: 1.8; }

/* トップも検索画面と同じ、格子が見える軽い検索レイアウトにする */
.mall-page .home-view .public-hero { align-items: stretch; padding: 24px 0 10px; background: transparent; }
.mall-page .home-view .search-head { padding: 0; }
.mall-page .home-view .hero-intro { width: 100%; max-width: none; }
.mall-page .hero-intro a { color: #17638d; font-weight: 700; text-decoration: underline; text-underline-offset: .15em; }
.mall-page .home-view .hero-search { width: 100%; padding: 0; border-radius: 999px; background: transparent; box-shadow: none; }
.mall-page .home-view .hero-search input { min-height: 44px; padding: 10px 14px; border: 1px solid #ddd; border-radius: 999px 0 0 999px; background: #fffdf7; }
.mall-page .home-view .hero-search button { width: auto; min-width: 70px; height: 44px; margin-left: -1px; border: 1px solid #e5ae58; border-radius: 0 999px 999px 0; background: #fff9e9; color: #4d3728; font-size: .9rem; font-weight: 700; }
.mall-page .home-view .category-section { padding-top: 18px; }

/* 画像を使わないカテゴリのアコーディオン */
.mall-page .category-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.category-accordion { min-width: 0; border: 1px solid #e5ae58; border-radius: 12px; background: #fffdf7; box-shadow: 0 3px 10px #9d816526; }
.category-accordion summary { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; color: #4d3728; font-weight: 700; cursor: pointer; list-style: none; }
.category-accordion summary::-webkit-details-marker { display: none; }
.category-accordion summary::after { content: '⌄'; color: #9d8165; font-size: 1.35rem; line-height: 1; transition: transform .15s ease; }
.category-accordion[open] summary::after { transform: rotate(180deg); }
.category-accordion summary:focus-visible { outline: 3px solid #f1be5b; outline-offset: 2px; }
.category-subcategories { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 0 16px 16px; }
.category-subcategories a { display: block; min-width: 0; padding: 9px 10px; border: 1px solid #f2cf91; border-radius: 7px; background: #fff7dc; color: #4d3728; text-decoration: none; font-size: .88rem; }
.category-subcategories a:hover { background: #fff0d0; border-color: #f28c28; }
.subcategory-selection { display: flex; align-items: center; gap: 14px; margin: 12px 0 0; color: #5a4230; font-size: .88rem; }
.subcategory-selection a { color: #17638d; }
.category-item { margin-top: .5rem; }
.category-suboptions { margin: .1rem 0 .8rem 1.1rem; padding-left: .7rem; border-left: 2px solid #f2cf91; }
.category-suboptions label { margin: .35rem 0; font-weight: 400; }
.brand-public-page { --brand-page-background: #fff7dc; --brand-page-line: #efb35f; --brand-page-text: #33261c; min-height: calc(100vh - 182px); margin: 18px 0 0; padding: clamp(18px, 3vw, 32px); border: 2px solid var(--brand-page-line); border-radius: 16px; background-color: var(--brand-page-background); background-image: linear-gradient(color-mix(in srgb, var(--brand-page-line) 20%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--brand-page-line) 20%, transparent) 1px, transparent 1px); background-size: 20px 20px; color: var(--brand-page-text); }
.brand-public-page .brand-public-header { min-height: 0; padding: 0 0 24px; border-bottom: 2px solid var(--brand-page-line); }
.brand-public-page .brand-public-header h1, .brand-public-page .brand-public-description, .brand-public-page .brand-gallery-title { color: var(--brand-page-text); }
.brand-public-page .brand-gallery-title { margin-top: 24px; border-left-color: var(--brand-page-line); }
.brand-public-page .brand-external-link { display: inline-block; margin: 10px 14px 0 0; color: var(--brand-page-text); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.brand-public-page .public-pattern-card { border-color: var(--brand-page-line); box-shadow: 0 3px 12px color-mix(in srgb, var(--brand-page-line) 20%, transparent); }
.brand-public-page .public-pattern-title, .brand-public-page .public-pattern-brand, .brand-public-page .public-pattern-size { color: var(--brand-page-text) !important; }
@media (max-width: 760px) {
  .public-logo-image { height: 40px; }
  .mall-page .public-hero { min-height: 0; padding: 28px 20px; }
  .mall-page .home-view .public-hero { padding: 20px 0 8px; }
  .mall-page .category-tiles { grid-template-columns: 1fr; }
  .brand-public-page { min-height: calc(100vh - 158px); margin-top: 12px; padding: 18px 14px; border-radius: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .category-accordion summary::after { transition: none; }
}

/* カテゴリ追加（管理画面） */
.category-form fieldset { margin-bottom: 1.2rem; }
.category-add-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; }
.category-add-fields select:disabled { opacity: .6; }
.category-overview p, .category-request p { margin: .3rem 0; }
.category-request { padding: .6rem 0; border-bottom: 1px dashed var(--orange-line); }
.category-request:last-child { border-bottom: 0; }
.category-request-note { color: var(--warn); font-weight: 700; }
@media (max-width: 640px) { .category-add-fields { grid-template-columns: 1fr; } }

/* 編集ページのヘッダー：型紙を探す・ログアウト・管理画面を開くを横並び */
.login-card { display: flex; flex-wrap: nowrap; gap: min(.5rem, 1.6cqi); align-items: center; justify-content: flex-end; container-type: inline-size; }
.login-card [hidden] { display: none; }
/* ヘッダーのボタンは常に1行。幅が足りないときは文字とボタンを縮める（3つ並べて約23文字分の幅）。 */
.login-card > a, .login-card > button { flex: 0 0 auto; white-space: nowrap; font-size: clamp(.6rem, calc((100cqi - 8px) / 22.5), 1rem); padding: .58em .75em; }
.social-post-list { display: flex; flex-wrap: wrap; gap: 1rem; }
.social-post-item { flex: 1 1 320px; max-width: 550px; }
.social-post-item p { margin: 0 0 .4rem; }
