@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700;900&family=Noto+Sans+JP:wght@400;500;700;900&display=swap');

:root {
    --bg-main:     #f7f1e6;
    --bg-panel:    #ffffff;
    --panel-inner: #faf5ea;
    --border-color:#ece0cd;
    --text-main:   #5b4a42;
    --text-muted:  #a08d80;
    --accent:      #e0922e;
    --accent-hover:#c87a18;
    --accent-bg:   rgba(224, 146, 46, 0.10);
    --sakura:      #e89aa6;
    --sakura-bg:   rgba(232, 154, 166, 0.12);
    --radial-desk: radial-gradient(ellipse at 55% 35%, #fdf8ef 0%, #f0e6d3 70%, #e9dcc4 100%);
    --grid-size:   20px;
    --grid-line:   rgba(160, 125, 80, 0.16);
    --shadow-desk: inset 0 0 50px rgba(150, 110, 50, 0.10);
}

body {
    font-family: 'Noto Sans JP', 'Montserrat', sans-serif;
    color: var(--text-main);
    background-color: var(--bg-main);
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: var(--grid-size) var(--grid-size);
    background-attachment: fixed;
}

.theme-bg-main   { background-color: var(--bg-main); }
.theme-bg-panel  { background-color: var(--bg-panel); }
.theme-bg-inner  { background-color: var(--panel-inner); }
.theme-border    { border-color: var(--border-color); }
.theme-text-main { color: var(--text-main); }
.theme-text-muted{ color: var(--text-muted); }
.text-accent     { color: var(--accent); }

.bg-radial-desk {
    background: var(--radial-desk);
    box-shadow: var(--shadow-desk);
}

#wizard-scroll {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
}
#wizard-scroll::-webkit-scrollbar { width: 8px; }
#wizard-scroll::-webkit-scrollbar-thumb {
    background: #e3cfa8; border-radius: 8px;
}
#wizard-scroll::-webkit-scrollbar-track { background: transparent; }

.step-dot {
    width: 30px; height: 30px; border-radius: 9999px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 13px;
    background: #fff; color: var(--text-muted);
    border: 2px solid var(--border-color);
    transition: all .25s ease;
}
.step-dot.active {
    background: var(--accent); color: #fff; border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(224, 146, 46, 0.35);
    transform: scale(1.08);
}
.step-dot.done {
    background: var(--sakura); color: #fff; border-color: var(--sakura);
}
.step-line { flex: 1; height: 2px; background: var(--border-color); border-radius: 2px; }

.seg-btn {
    cursor: pointer; user-select: none;
    border: 2px solid var(--border-color);
    background: #fff; color: var(--text-muted);
    border-radius: 14px; padding: 10px 8px;
    font-weight: 700; font-size: 12px;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    transition: all .15s ease; line-height: 1.3; text-align: center;
}
.seg-btn:hover { border-color: var(--accent); color: var(--text-main); }
.seg-btn.on {
    border-color: var(--accent);
    background: var(--accent-bg);
    color: var(--text-main);
    box-shadow: 0 3px 10px rgba(224, 146, 46, 0.18);
}
.seg-btn .seg-emoji { font-size: 18px; }
.seg-btn .seg-sub { font-size: 9.5px; font-weight: 500; color: var(--text-muted); }
.seg-btn .seg-brand {
    font-size: 9px; font-weight: 700; letter-spacing: .02em;
    color: var(--text-muted); margin-bottom: -3px;
}
.seg-btn.on .seg-brand { color: var(--accent); }
.seg-btn .seg-brand-other { opacity: .8; }

.panel-off .seg-btn {
    opacity: .45; cursor: not-allowed; pointer-events: none;
    background: var(--panel-inner, #faf6ee); border-color: var(--border-color); box-shadow: none;
}
.panel-off .seg-btn.on { background: var(--panel-inner, #faf6ee); color: var(--text-muted); }
.panel-off .panel-lede { opacity: .5; }

.style-card {
    cursor: pointer; user-select: none; text-align: left;
    border: 2px solid var(--border-color);
    background: #fff; border-radius: 18px; padding: 14px;
    transition: all .18s ease; position: relative; overflow: hidden;
}
.style-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.style-card.sel {
    border-color: var(--accent);
    background: var(--accent-bg);
    box-shadow: 0 6px 18px rgba(224, 146, 46, 0.18);
}
.style-card.sel::after {
    content: '✓'; position: absolute; top: 10px; right: 12px;
    width: 22px; height: 22px; border-radius: 9999px;
    background: var(--accent); color: #fff; font-size: 13px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
}

.tag-chip {
    cursor: pointer; user-select: none;
    font-size: 11px; font-weight: 700; line-height: 1;
    padding: 6px 11px; border-radius: 9999px;
    border: 1.5px solid var(--border-color);
    background: #fff; color: var(--text-muted);
    transition: all .15s ease;
}
.tag-chip:hover { border-color: var(--accent); color: var(--text-main); }

.view-toggle-btn {
    cursor: pointer; user-select: none;
    font-size: 11px; font-weight: 700; line-height: 1;
    padding: 6px 10px; border-radius: 9999px;
    border: 1.5px solid var(--border-color);
    background: #fff; color: var(--text-muted);
    transition: all .15s ease;
}
.view-toggle-btn:hover { border-color: var(--accent); color: var(--text-main); }
.view-toggle-btn.on { border-color: var(--accent); background: var(--accent-bg); color: var(--text-main); }

.size-chip {
    cursor: pointer; user-select: none;
    font-size: 11px; font-weight: 700; line-height: 1;
    padding: 6px 12px; border-radius: 9999px;
    border: 1.5px solid var(--border-color);
    background: #fff; color: var(--text-muted);
    transition: all .15s ease;
}
.size-chip:hover { border-color: var(--accent); color: var(--text-main); }
.size-chip.on { border-color: var(--accent); background: var(--accent); color: #fff; }

#grid-styles.gallery-grid {
    display: grid; grid-template-columns: 1fr; gap: 10px;
}
.gallery-card {
    cursor: pointer; user-select: none; text-align: left;
    border: 2px solid var(--border-color);
    background: #fff; border-radius: 14px; overflow: hidden;
    transition: all .18s ease; position: relative;
    display: flex; flex-direction: column;
}
.gallery-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.gallery-card.sel { border-color: var(--accent); box-shadow: 0 6px 18px rgba(224, 146, 46, 0.18); }
.gallery-card.sel::after {
    content: '✓'; position: absolute; top: 8px; right: 8px;
    width: 20px; height: 20px; border-radius: 9999px;
    background: var(--accent); color: #fff; font-size: 12px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
}
.gallery-card-thumb {
    aspect-ratio: 3 / 4; background: var(--panel-inner, #faf6ee);
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.gallery-card-thumb.horizontal { aspect-ratio: 4 / 3; }
.gallery-card-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.gallery-card.no-thumb .gallery-card-thumb::before { content: '📄'; font-size: 32px; opacity: .4; }
.gallery-card-label { padding: 8px 10px; }
.tag-chip.on {
    border-color: var(--accent);
    background: var(--accent); color: #fff;
}

.ink-swatch {
    cursor: pointer; border: 2px solid var(--border-color); background: #fff;
    border-radius: 14px; padding: 8px 4px;
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    transition: all .15s ease;
}
.ink-swatch:hover { border-color: var(--accent); }
.ink-swatch.sel { border-color: var(--accent); background: var(--accent-bg); }


.success-panel {
    width: 100%; max-width: 28rem;
    max-height: 90vh; overflow-y: auto; overscroll-behavior: contain;
}
.success-close-bar {
    position: sticky; bottom: -1rem;
    background: #fff; padding-top: 8px; padding-bottom: 4px;
}

.site-pr-band {
    background: #efece8; color: #6a6a6a;
    border-bottom: 1px solid #e3ded7;
    line-height: 1.5; padding-top: 3px; padding-bottom: 3px;
}

.monetize-pr-disclosure {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; line-height: 1.5; color: var(--text-main, #4a3f3a);
    margin: 0 0 10px;
}
.monetize-pr-badge {
    flex: 0 0 auto; padding: 1px 6px; border-radius: 3px;
    font-size: 11px; font-weight: 800; letter-spacing: .02em;
    color: #fff; background: #666;
}

.monetize-grid {
    display: grid; grid-template-columns: minmax(0, 1fr);
    gap: 16px; justify-items: center; align-items: start;
}
.monetize-grid [hidden] { display: none !important; }

.monetize-card { box-sizing: border-box; }
.monetize-card--product {
    width: 100%; max-width: 340px;
    padding: 12px; border: 1.5px solid var(--border-color); border-radius: 12px;
    background: var(--panel-inner, #faf6ee);
}
.monetize-card-head {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    font-size: 12px; font-weight: 700; color: var(--text-muted);
    margin-bottom: 8px;
}
.monetize-card-note {
    font-size: 11px; line-height: 1.4; text-align: center;
    color: var(--text-muted); margin-bottom: 8px;
}

.monetize-card--ad { width: 300px; max-width: 100%; }
.ad-slot {
    position: relative; width: 300px; height: 250px; margin: 0 auto;
    overflow: hidden;
}
.ad-slot-placeholder {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    border: 1px dashed var(--border-color); border-radius: 8px;
    background: var(--panel-inner, #faf6ee);
    font-size: 11px; letter-spacing: .12em; color: var(--text-muted);
}
.ad-slot ins.adsbygoogle { display: none; width: 100%; height: 100%; margin: 0; }

.monetize-amazon-disclosure {
    margin-top: 12px; font-size: 11px; line-height: 1.5; color: var(--text-muted);
}

@media (min-width: 768px) {
    .success-panel { max-width: 48rem; }
    .monetize-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
    .monetize-grid[data-products="2"] .monetize-card--ad,
    .monetize-grid[data-products="0"] .monetize-card--ad { grid-column: 1 / -1; }
    .monetize-grid[data-ad="off"][data-products="1"] .monetize-card--product { grid-column: 1 / -1; }
    .monetize-card--ad { width: 336px; }
    .ad-slot { width: 336px; height: 280px; }
}

.affiliate-combo-tag {
    display: inline-block; padding: 1px 6px; border-radius: 3px;
    font-size: 10px; font-weight: 800; letter-spacing: .02em;
    color: #fff; background: #666;
}
.affiliate-combo-banner {
    display: flex; align-items: center; justify-content: center;
    width: 132px; height: 132px; margin: 0 auto 16px;
}
.affiliate-combo-buttons {
    display: flex; flex-direction: column; gap: 12px;
}
.affiliate-btn {
    display: flex; align-items: center; justify-content: center;
    min-height: 44px; padding: 10px 16px; border-radius: 8px;
    font-size: 13px; font-weight: 800; letter-spacing: .01em;
    text-decoration: none; box-sizing: border-box; transition: opacity .15s ease;
}
.affiliate-btn:hover { opacity: .85; }
.affiliate-btn:active { opacity: .7; }
.affiliate-btn--rakuten { color: #fff; background: #bf0000; }
.affiliate-btn--amazon { color: #111; background: #ffa41c; }
.affiliate-btn--yahoo { color: #fff; background: #ff0033; }

.btn-primary {
    background: var(--accent); color: #fff; font-weight: 800;
    border-radius: 14px; transition: all .15s ease;
    box-shadow: 0 4px 14px rgba(224, 146, 46, 0.3);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(.97); }
.btn-ghost {
    background: #fff; color: var(--text-muted); font-weight: 700;
    border: 2px solid var(--border-color); border-radius: 14px;
    transition: all .15s ease;
}
.btn-ghost:hover { color: var(--text-main); border-color: var(--accent); }
.btn-primary:disabled,
.btn-primary[disabled] {
    background: var(--border-color); color: #fff;
    box-shadow: none; cursor: not-allowed; opacity: .75;
}
.btn-primary:disabled:hover { background: var(--border-color); }

.toggle-track {
    position: relative; width: 44px; height: 24px; border-radius: 9999px;
    border: 2px solid var(--border-color); background: #f0e8da; transition: all .2s ease;
    cursor: pointer; flex-shrink: 0;
}
.toggle-track.on { border-color: var(--accent); background: var(--accent-bg); }
.toggle-knob {
    position: absolute; left: 2px; top: 2px; width: 16px; height: 16px;
    border-radius: 9999px; background: #c9b89c; transition: all .2s ease;
}
.toggle-track.on .toggle-knob { left: 22px; background: var(--accent); }

#notebook-body {
    flex-shrink: 0;
    transition: width 0.4s cubic-bezier(.4, 0, .2, 1),
                height 0.4s cubic-bezier(.4, 0, .2, 1),
                border-radius 0.4s cubic-bezier(.4, 0, .2, 1);
}

#preview-viewport {
    user-select: none;
    isolation: isolate;
}

#preview-interaction-layer {
    touch-action: pan-y;
}

#preview-interaction-layer.is-zoomed {
    touch-action: none;
}

#preview-interaction-layer.dragging {
    cursor: grabbing;
}

#notebook-container {
    will-change: transform;
}

.hdr-logo {
    letter-spacing: 0.08em;
}

.hdr-logo-tag ruby {
    ruby-position: over;
}
.hdr-logo-tag rt {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1;
}

.hdr-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

@media (max-width: 640px) {
    .hdr-icon {
        width: 36px;
        height: 36px;
    }
    .hdr-logo {
        font-size: 0.8125rem;
        padding: 0.25rem 0.625rem;
    }
    .hdr-brand h1 {
        font-size: 0.9375rem;
    }
    .hdr-sub {
        display: none;
    }
}

.usage-image-overlay {
    background-color: var(--bg-main);
}

#preview-loading {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
#preview-loading.is-visible {
    opacity: 1;
    visibility: visible;
}
.preview-loading-badge {
    background: rgba(255, 255, 255, 0.72);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    box-shadow: 0 6px 18px rgba(91, 74, 66, 0.18);
}
.preview-loading-spinner {
    width: 34px;
    height: 34px;
    border: 4px solid var(--accent);
    border-top-color: transparent;
    border-radius: 9999px;
    animation: preview-spin 0.8s linear infinite;
}
@keyframes preview-spin {
    to { transform: rotate(360deg); }
}

.release-section-head {
    grid-column: 1 / -1;
    display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
    padding: 6px 2px 0; margin-top: 4px;
    border-top: 1px dashed var(--border-color);
}
.release-section-head:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.release-section-title { font-size: 12px; font-weight: 800; color: var(--text-main); }
.release-section-sub { font-size: 10px; color: var(--text-muted); }
.release-toggle {
    width: 100%; min-height: 40px; align-items: center;
    background: none; border-left: 0; border-right: 0; border-bottom: 0;
    padding: 10px 2px 4px; text-align: left; cursor: pointer;
    font: inherit; color: inherit;
}
.release-toggle .release-section-sub { display: inline-flex; align-items: center; gap: 6px; }
.release-toggle-label {
    font-size: 11px; font-weight: 800; color: var(--accent);
    padding: 3px 9px; border: 1px solid var(--border-color); border-radius: 9999px; background: #fff;
}
.release-toggle:hover .release-toggle-label { border-color: var(--accent); }
.release-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.style-card.soon, .gallery-card.soon { background: #f6f4f1; }
.style-card.soon > :not(.soon-badge), .gallery-card.soon > :not(.soon-badge) {
    opacity: .55; filter: grayscale(.6); transition: opacity .18s ease;
}
.style-card.soon:hover > :not(.soon-badge), .gallery-card.soon:hover > :not(.soon-badge) { opacity: .8; }
.style-card.soon.sel > :not(.soon-badge), .gallery-card.soon.sel > :not(.soon-badge) { opacity: .9; filter: grayscale(.3); }
.soon-badge {
    position: absolute; top: 8px; right: 8px; z-index: 1;
    font-size: 10px; font-weight: 800; line-height: 1;
    padding: 5px 8px; border-radius: 9999px;
    background: #fff; color: var(--text-muted);
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
.soon-badge.status-upcoming { background: #eaf5ea; color: #3f7a45; border-color: #c5e2c7; }
.soon-badge.status-maintenance { background: #fbecea; color: #9c4a3f; border-color: #eccac4; }
.release-section-note {
    grid-column: 1 / -1;
    margin: -2px 2px 2px; font-size: 10.5px; line-height: 1.6; color: var(--text-muted);
}
.style-card.soon.sel::after, .gallery-card.soon.sel::after { display: none; }
.style-card.soon .text-sm { padding-right: 104px; }
#wiz-next.is-locked {
    cursor: not-allowed; box-shadow: none; transform: none;
    background: #efe9e1; color: var(--text-muted);
}

.usage-off { display: none !important; }

.wizard-panel { max-height: calc(100vh - 7rem); }
#preview-viewport { min-height: 560px; }
.preview-dock-open, .preview-dock-close { display: none; }

@media (max-width: 1023px) {
    :root { --dock-h: clamp(170px, 28vh, 260px); }

        .wizard-panel { max-height: none; }
    #wizard-scroll { overflow-y: visible; }

        .wizard-actions {
        position: sticky; bottom: 0; z-index: 30;
        background: var(--bg-panel); border-radius: 0 0 16px 16px;
        box-shadow: 0 -4px 12px rgba(91, 74, 66, 0.08);
    }
    body.dock-active .wizard-actions { bottom: calc(var(--dock-h) + env(safe-area-inset-bottom, 0px)); }

    body.dock-active #preview-section { touch-action: none; }

    body.dock-active { padding-bottom: calc(var(--dock-h) + env(safe-area-inset-bottom, 0px)); }

    body.dock-active #preview-section {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
        height: calc(var(--dock-h) + env(safe-area-inset-bottom, 0px));
        padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px));
        gap: 4px;
        background: var(--bg-main);
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -6px 18px rgba(91, 74, 66, 0.14);
    }
    body.dock-active #preview-section #preview-head { padding: 2px 10px; font-size: 11px; border: 0; background: transparent; }
    body.dock-active #preview-section #grid-expectation-note { display: none; }
    body.dock-active #preview-section #preview-viewport {
        flex: 1 1 auto; min-height: 0; padding: 4px; border-radius: 14px;
    }
    body.dock-active #preview-section .preview-dock-open {
        display: block; position: absolute; inset: 0; z-index: 45;
        background: transparent; border: 0; cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .preview-dock-hint {
        position: absolute; right: 8px; bottom: 6px;
        font-size: 10px; font-weight: 700; line-height: 1;
        padding: 5px 9px; border-radius: 9999px;
        background: rgba(255, 255, 255, 0.9); color: var(--text-muted);
        border: 1px solid var(--border-color);
    }

        body.dock-expanded { overflow: hidden; }
    body.dock-expanded #preview-section {
        inset: 0; height: auto; z-index: 45;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); gap: 8px;
    }
    body.dock-expanded #preview-section #preview-viewport { padding: 16px; }
    body.dock-expanded #preview-section .preview-dock-open { display: none; }
    body.dock-expanded #preview-section .preview-dock-close {
        display: block; flex: 0 0 auto; width: 100%; min-height: 48px; font-size: 14px;
    }
    body.dock-expanded #preview-section #grid-expectation-note:not(.hidden) { display: block; }
}
.items-entry { display: block; text-decoration: none; color: inherit; }
.items-entry-title { font-size: 14px; font-weight: 700; margin: 0 0 4px; }
.items-entry-sub { font-size: 11px; color: var(--text-muted); margin: 0 0 8px; }
.items-entry-cta { font-size: 12px; font-weight: 700; color: var(--accent); }

.hdr-home {
    text-decoration: none;
    border-radius: 0.75rem;
    transition: opacity 0.15s;
}
.hdr-home:hover {
    opacity: 0.85;
}
.hdr-home:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}
