/* BGResize — light utility editor (avoid neon / gradient “AI SaaS” look) */
/* System font stack only. Do not @import Google Fonts — it delays first paint until the font CSS returns. */

:root {
    --br-bg: #e6e4df;
    --br-surface: #f7f6f3;
    --br-panel: #ffffff;
    --br-ink: #1c1c1c;
    --br-muted: #5a5a5a;
    --br-line: #c8c4bc;
    --br-accent: #1f3d36;
    --br-accent-soft: #2d564c;
    --br-warn: #8a3b12;
    --br-danger: #9b1c1c;
    --br-radius: 6px;
    --br-font: 'IBM Plex Sans', 'Segoe UI', sans-serif;
    --br-display: 'IBM Plex Serif', Georgia, serif;
}

body.br-page {
    margin: 0;
    min-height: 100vh;
    font-family: var(--br-font);
    color: var(--br-ink);
    background-color: var(--br-bg);
    background-image:
        linear-gradient(180deg, #ebe9e4 0%, var(--br-bg) 180px);
}

/* Override deepimager dark generate-page shell on this product page */
body.br-page.generate-page {
    background-color: var(--br-bg) !important;
    color: var(--br-ink);
}

body.br-page #site-nav-container .top-nav {
    background: #171717 !important;
    border-bottom: 1px solid #000;
}

body.br-page #site-nav-container .nav-link,
body.br-page #site-nav-container .nav-logo-link {
    color: #f2f2f2 !important;
}

/* Fixed .top-nav from style.css — keep hero clear of the bar */
.br-main {
    width: min(1100px, calc(100% - 2rem));
    margin: 0 auto;
    padding: calc(4.25rem + env(safe-area-inset-top, 0px)) 0 3.5rem;
}

@media (max-width: 768px) {
    .br-main {
        padding-top: calc(4.75rem + env(safe-area-inset-top, 0px));
    }
}

/* block + margin auto：避免 Chrome 翻译把文案拆成 <font> 后变成 grid 子项逐字竖排 */
.br-hero {
    display: block;
    padding: 0.75rem 0 1.35rem;
    margin-bottom: 0.35rem;
    text-align: center;
}

.br-hero > * {
    margin-left: auto;
    margin-right: auto;
}

.br-brand {
    margin: 0 auto;
    font-family: var(--br-display);
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 2.75rem);
    letter-spacing: -0.02em;
    color: var(--br-ink);
    line-height: 1.05;
}

.br-brand span {
    color: var(--br-accent);
}

.br-hero h1 {
    margin: 0.55rem auto 0;
    font-family: var(--br-font);
    font-weight: 600;
    font-size: clamp(1.05rem, 2vw, 1.2rem);
    line-height: 1.4;
    max-width: 28rem; /* 勿用 ch：翻译插入 <font> 后 ch 宽度会塌成一字列 */
    color: var(--br-ink);
}

.br-hero-lead {
    margin: 0.55rem auto 0;
    max-width: 32rem;
    color: var(--br-muted);
    font-size: 1rem;
    line-height: 1.5;
}

.br-quota {
    margin: 0.45rem auto 0;
    padding: 0.45rem 0.85rem;
    background: transparent;
    border: 0;
    font-size: 0.88rem;
    color: var(--br-muted);
    max-width: 36rem;
}

/* Chrome 翻译包裹节点保持行内，避免竖排 */
.br-hero font,
.br-hero-lead font {
    display: inline !important;
}

.br-quota strong {
    font-weight: 600;
    color: var(--br-ink);
}

.br-stage {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
    min-height: 0;
}

.br-dropzone {
    min-height: 0;
    display: grid;
    place-items: stretch;
    padding: 0;
}

.br-dropzone.is-dragover .br-upload-panel {
    border-color: var(--br-accent);
    background: #d5e0e8;
}

.br-empty {
    text-align: center;
    display: grid;
    justify-items: center;
    padding: 0;
    min-height: 0;
}

/* Reference-style upload card: dashed panel + icon + CTA + hints */
.br-upload-panel {
    width: min(100%, 720px);
    min-height: 280px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 1.35rem;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 1rem;
    border: 2px dashed #8aa3b5;
    border-radius: 4px;
    background: #d9e6ef;
    color: #3d5566;
    box-sizing: border-box;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.br-upload-icon {
    color: #f4f8fb;
    filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.08));
    line-height: 0;
}

.br-upload-icon svg {
    display: block;
}

/* Keep file input in layout so label[for] / .click() work (avoid [hidden]/display:none) */
.br-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.br-upload-btn,
.br-btn {
    appearance: none;
    border: 0;
    cursor: pointer;
    font-family: var(--br-font);
    font-weight: 600;
    font-size: 1rem;
    border-radius: 6px;
    padding: 0.85rem 1.35rem;
    box-sizing: border-box;
}

.br-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 200px;
    justify-content: center;
    background: #ffffff;
    color: #1c1c1c;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.br-upload-btn:hover {
    background: #f7f7f7;
}

.br-upload-btn-icon {
    flex-shrink: 0;
    color: #3d5566;
}

.br-btn-primary {
    background: var(--br-accent);
    color: #f7f6f3;
}

.br-btn-primary:hover {
    background: var(--br-accent-soft);
}

.br-btn-ghost {
    background: var(--br-surface);
    color: var(--br-ink);
    border: 1px solid var(--br-line);
}

.br-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.br-upload-or {
    margin: 0;
    color: #2f4554;
    font-size: 0.98rem;
}

.br-upload-limits {
    margin: 0.35rem 0 0;
    color: #3d5566;
    font-size: 0.82rem;
}

.br-hint {
    margin: 0;
    color: var(--br-muted);
    font-size: 0.88rem;
}

.br-status {
    min-height: 0;
    margin: 0.65rem auto 0;
    padding: 0;
    max-width: 720px;
    font-size: 0.88rem;
    color: var(--br-muted);
    text-align: center;
    border-top: 0;
    background: transparent;
}

.br-status:empty {
    display: none;
}

.br-status.is-error {
    color: var(--br-danger);
}

.br-empty[hidden],
.br-workspace[hidden] {
    display: none !important;
}

.br-workspace {
    display: grid;
    gap: 0;
    padding: 0;
    border: 1px solid var(--br-line);
    border-radius: var(--br-radius);
    background: var(--br-panel);
    overflow: hidden;
}

@media (min-width: 900px) {
    .br-workspace {
        grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.85fr);
    }
}

.br-preview-wrap {
    display: grid;
    gap: 0.65rem;
    padding: 1rem;
    background: #2a2a2a;
}

.br-canvas-frame {
    border: 1px solid #111;
    background: #111;
    display: grid;
    place-items: center;
    min-height: 260px;
}

#brCanvas {
    display: block;
    width: 100%;
    max-height: 52vh;
    height: auto;
    cursor: grab;
    touch-action: none;
}

#brCanvas.is-dragging {
    cursor: grabbing;
}

.br-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1.1rem;
    font-size: 0.82rem;
    color: #c9c9c9;
}

.br-meta strong {
    color: #fff;
    font-weight: 600;
}

.br-controls {
    display: grid;
    gap: 1rem;
    padding: 1rem;
    border-top: 1px solid var(--br-line);
    background: var(--br-panel);
}

@media (min-width: 900px) {
    .br-controls {
        border-top: 0;
        border-left: 1px solid var(--br-line);
    }
}

.br-control-block h2 {
    font-family: var(--br-font);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 0.5rem;
    color: var(--br-muted);
}

.br-seg {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.br-seg button {
    appearance: none;
    border: 1px solid var(--br-line);
    background: var(--br-surface);
    color: var(--br-ink);
    border-radius: 4px;
    padding: 0.4rem 0.7rem;
    font-size: 0.84rem;
    font-family: var(--br-font);
    cursor: pointer;
}

.br-seg button.is-active {
    background: var(--br-accent);
    border-color: var(--br-accent);
    color: #f7f6f3;
    font-weight: 600;
}

.br-slider-row {
    display: grid;
    gap: 0.35rem;
}

.br-slider-row input[type='range'] {
    width: 100%;
    accent-color: var(--br-accent);
}

.br-custom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
}

.br-custom label {
    display: grid;
    gap: 0.25rem;
    font-size: 0.78rem;
    color: var(--br-muted);
}

.br-custom input {
    width: 100%;
    border-radius: 4px;
    border: 1px solid var(--br-line);
    background: #fff;
    color: var(--br-ink);
    padding: 0.45rem 0.55rem;
    font-family: var(--br-font);
}

.br-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.br-section {
    margin-top: 2.75rem;
}

.br-section h2 {
    font-family: var(--br-display);
    font-size: 1.35rem;
    margin: 0 0 0.4rem;
    color: var(--br-ink);
}

.br-howto {
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--br-line);
}

.br-howto-title {
    text-align: center;
    font-size: clamp(1.45rem, 3vw, 1.85rem) !important;
    margin-bottom: 1.35rem !important;
}

.br-howto-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1rem;
}

@media (min-width: 800px) {
    .br-howto-steps {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.15rem;
    }
}

.br-howto-card {
    border: 1px solid rgba(28, 28, 28, 0.06);
    border-radius: 14px;
    padding: 1.25rem 1.2rem 1.35rem;
    background: #fff;
    box-shadow: 0 1px 0 rgba(28, 28, 28, 0.03);
    display: grid;
    gap: 0.65rem;
    align-content: start;
}

.br-howto-head {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.br-howto-icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: #d7e3de;
    color: var(--br-accent);
}

.br-howto-card h3 {
    margin: 0;
    font-family: var(--br-font);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--br-ink);
    line-height: 1.25;
}

.br-howto-card p {
    margin: 0;
    color: var(--br-muted);
    font-size: 0.92rem;
    line-height: 1.55;
}

/* —— Feature grid (below howto) —— */
.br-features {
    margin-top: 2.75rem;
    padding-top: 0.5rem;
}

.br-features-title {
    text-align: center;
    font-family: var(--br-display);
    font-size: clamp(1.45rem, 3vw, 1.85rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 1.75rem;
    color: var(--br-ink);
}

.br-features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem 1.75rem;
}

@media (max-width: 800px) {
    .br-features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

.br-feature {
    text-align: left;
}

.br-feature-icon {
    width: 44px;
    height: 44px;
    margin-bottom: 0.7rem;
    color: var(--br-accent);
    display: block;
}

.br-feature h3 {
    margin: 0 0 0.45rem;
    font-family: var(--br-font);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--br-ink);
}

.br-feature p {
    margin: 0;
    color: var(--br-muted);
    font-size: 0.92rem;
    line-height: 1.55;
}

/* —— Illustrated guide —— */
.br-guide {
    margin-top: 3rem;
}

.br-guide-inner {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(240px, 1.05fr);
    gap: 2.5rem 3rem;
    align-items: center;
    padding: 2.25rem 1.75rem;
    background: #ebe9e4;
    border-radius: 12px;
    border: 1px solid var(--br-line);
}

@media (max-width: 800px) {
    .br-guide-inner {
        grid-template-columns: 1fr;
        gap: 1.75rem;
    }
}

.br-guide-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b6b6b;
    min-height: 150px;
}

.br-guide-illo {
    width: min(100%, 340px);
    height: auto;
    display: block;
}

.br-guide-copy h2 {
    margin: 0 0 1rem;
    font-family: var(--br-display);
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--br-ink);
}

.br-guide-steps {
    margin: 0;
    padding: 0 0 0 1.25rem;
    color: var(--br-muted);
    font-size: 1rem;
    line-height: 1.7;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.br-guide-steps strong {
    color: var(--br-ink);
    font-weight: 700;
}

.br-faq details {
    border-bottom: 1px solid var(--br-line);
    padding: 0.8rem 0;
}

.br-faq summary {
    cursor: pointer;
    font-weight: 600;
}

.br-faq p {
    margin: 0.5rem 0 0;
    color: var(--br-muted);
    line-height: 1.55;
    max-width: 65ch;
}

.br-notes {
    display: grid;
    gap: 0.85rem;
    max-width: 68ch;
    padding-bottom: 0.5rem;
}

.br-notes p {
    margin: 0;
    color: var(--br-muted);
    line-height: 1.65;
}

body.br-page .site-footer {
    color: var(--br-muted);
    border-top: 1px solid var(--br-line);
    background: transparent;
}

/* —— Size picker modal (after upload) —— */
.br-size-modal[hidden] {
    display: none !important;
}

.br-size-modal {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: grid;
    place-items: center;
    padding: 1.25rem;
}

.br-size-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(28, 28, 28, 0.45);
}

.br-size-modal-dialog {
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    width: min(920px, calc(100vw - 2rem));
    height: min(640px, calc(100vh - 2.5rem));
    max-width: 920px;
    max-height: min(640px, calc(100vh - 2.5rem));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
    padding: 1.25rem 1.35rem 1.15rem;
}

.br-size-modal-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        'title close'
        'filters filters';
    align-items: start;
    gap: 0.65rem 1rem;
    margin-bottom: 0.95rem;
    flex: 0 0 auto;
}

.br-size-modal-header h2 {
    grid-area: title;
    margin: 0;
    font-family: var(--br-font);
    font-size: 1.35rem;
    font-weight: 700;
    color: #1c1c1c;
    white-space: nowrap;
}

.br-size-filters {
    grid-area: filters;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    overflow: visible;
    padding: 0.15rem 0;
    min-width: 0;
    align-content: flex-start;
}

.br-size-filter {
    appearance: none;
    flex: 0 0 auto;
    border: 1px solid #d5d5d5;
    background: #fff;
    color: #444;
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-family: var(--br-font);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.br-size-filter:hover {
    border-color: #aaa;
}

.br-size-filter.is-active {
    background: var(--br-accent);
    border-color: var(--br-accent);
    color: #f7f6f3;
    font-weight: 600;
}

.br-size-empty {
    grid-column: 1 / -1;
    margin: 1rem 0;
    text-align: center;
    color: #777;
    font-size: 0.95rem;
}

.br-size-modal-close {
    grid-area: close;
    appearance: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.br-size-modal-close:hover {
    background: #f3f3f3;
}

.br-size-modal-grid {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: max-content;
    align-content: start;
    gap: 1rem 0.85rem;
    padding-right: 0.25rem;
    scrollbar-width: thin;
}

.br-size-card {
    appearance: none;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: center;
    padding: 0;
    font-family: var(--br-font);
    color: #1c1c1c;
}

.br-size-card-thumb {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    width: 100%;
    border-radius: 12px;
    background: #ececec;
    margin-bottom: 0.55rem;
    transition: box-shadow 0.15s ease, background 0.15s ease;
}

.br-size-card:hover .br-size-card-thumb,
.br-size-card.is-active .br-size-card-thumb {
    background: #e4ebe8;
    box-shadow: inset 0 0 0 2px var(--br-accent);
}

.br-size-card-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.25;
}

.br-size-card-dim {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.78rem;
    color: #6b6b6b;
}

/* Aspect glyphs inside thumbs */
.br-size-glyph {
    display: block;
    background: #c45c5c;
    border-radius: 3px;
    box-shadow: 0 0 0 3px #f2d6d6;
}

.br-size-glyph--custom {
    width: 34%;
    height: 34%;
    background: var(--br-accent);
    box-shadow: none;
    position: relative;
}
.br-size-glyph--custom::before,
.br-size-glyph--custom::after {
    content: '';
    position: absolute;
    background: #fff;
}
.br-size-glyph--custom::before {
    width: 55%;
    height: 2px;
    left: 22%;
    top: 48%;
}
.br-size-glyph--custom::after {
    width: 2px;
    height: 55%;
    left: 48%;
    top: 22%;
}

.br-size-glyph--portrait { width: 34%; height: 48%; }
.br-size-glyph--feed { width: 38%; height: 44%; }
.br-size-glyph--wide { width: 58%; height: 26%; }
.br-size-glyph--landscape { width: 52%; height: 32%; }
.br-size-glyph--ultrawide { width: 62%; height: 26%; }
.br-size-glyph--banner { width: 64%; height: 20%; }
.br-size-glyph--square { width: 40%; height: 40%; }
.br-size-glyph--tall { width: 30%; height: 52%; }

.br-size-modal-custom {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid #e5e5e5;
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 0.65rem;
    align-items: end;
    flex: 0 0 auto;
}

.br-size-modal-custom[hidden] {
    display: none !important;
}

.br-size-modal-custom label {
    display: grid;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: #666;
    text-align: left;
}

.br-size-modal-custom input {
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 0.5rem 0.6rem;
    font-family: var(--br-font);
    font-size: 0.95rem;
}

body.br-size-modal-open {
    overflow: hidden;
}

@media (max-width: 800px) {
    .br-size-modal-dialog {
        width: min(920px, calc(100vw - 1.25rem));
        height: min(640px, calc(100vh - 1.75rem));
    }
    .br-size-modal-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .br-size-modal-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .br-size-modal-custom {
        grid-template-columns: 1fr 1fr;
    }
    .br-size-modal-custom .br-btn {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .br-main {
        width: calc(100% - 1.1rem);
    }
}
