/* ========== DIY LAB (paper detail card, same language as wiki detail) ========== */

.diy-lab {
    /* enter via shared .view-enter */
    width: 100%;
    max-width: 880px;
    margin: 0 auto 40px auto;
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-sizing: border-box;
    box-shadow: var(--shadow-card);
}

.diy-shell {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
}

/* Header row: same pattern as section-card-header + back link */
.diy-topbar {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    flex-shrink: 0;
    width: 100%;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.diy-back-btn {
    background: none;
    border: none;
    padding: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.15s ease;
}

.diy-back-btn:hover {
    opacity: 0.8;
    color: var(--primary-color);
}

.diy-identity {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    width: 100%;
}

.diy-thumb {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    box-shadow: none; /* display only — shadows for pressable controls only */
    flex-shrink: 0;
}

.diy-identity-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Category badge hidden — product name only */
.diy-identity-text .badge,
#lab-category-badge {
    display: none !important;
}

.diy-identity-text h2 {
    font-family: var(--font-heading);
    font-size: clamp(20px, 1.6vw, 24px);
    font-weight: 800;
    margin: 0;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    line-height: 1.25;
}

.diy-desc-hidden {
    display: none !important;
}

.badge {
    background-color: rgba(255, 126, 103, 0.15);
    color: var(--primary-color);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
    margin-bottom: 6px;
}

/* Content flows naturally with the page — no inner scroll, no fade */
.diy-scroll-wrap {
    display: flex;
    flex-direction: column;
}

.diy-scroll {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.diy-scroll-fade {
    display: none;
}

.diy-preset-section h5 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 10px 0;
}

/* Horizontal row of vertical cards (like category grid language) */
.diy-preset-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 14px;
}

.preset-card {
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    color: inherit;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 0 0 12px 0;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.25, 0.8, 0.25, 1),
                box-shadow 0.25s cubic-bezier(0.25, 0.8, 0.25, 1),
                border-color 0.15s ease,
                background-color 0.15s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    user-select: none;
    position: relative;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    width: 100%;
}

.preset-card-thumb,
.preset-card .preset-card-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 0;
    flex-shrink: 0;
    box-shadow: none;
    border: none;
    border-bottom: 1px solid var(--border-color);
    transition: transform 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: block;
}

.preset-card-emoji {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    background: linear-gradient(145deg, rgba(255, 126, 103, 0.1), rgba(247, 208, 112, 0.08));
    border-bottom: 1px solid var(--border-color);
}

.preset-card:hover:not(.selected) {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: var(--shadow-hover);
}

.preset-card:hover:not(.selected) .preset-card-thumb {
    transform: scale(1.04);
}

.preset-card.selected:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 0 1px rgba(255, 126, 103, 0.35), var(--shadow-hover);
}

.preset-card.selected:hover .preset-card-thumb {
    transform: scale(1.04);
}

.preset-card:active,
.preset-card.card-press-down,
.preset-card.selected:active,
.preset-card.selected.card-press-down,
:root .preset-card.selected:active,
:root .preset-card.selected.card-press-down,
.theme-light .preset-card.selected:active,
.theme-light .preset-card.selected.card-press-down {
    transform: translateY(1px) !important;
    box-shadow: var(--shadow-press) !important;
    transition: transform 0.04s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.04s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
}

.preset-card.card-bounce-up,
.preset-card.selected.card-bounce-up,
:root .preset-card.selected.card-bounce-up,
.theme-light .preset-card.selected.card-bounce-up {
    transform: translateY(-2px) !important;
    box-shadow: var(--shadow-hover) !important;
    transition: transform 0.09s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.09s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
}

/* Selected — flat coral tint + selection ring (same language as pantry) */
.preset-card.selected {
    background: rgba(255, 126, 103, 0.08) !important;
    border-color: rgba(255, 126, 103, 0.55) !important;
    box-shadow: 0 0 0 1px rgba(255, 126, 103, 0.35), var(--shadow-card);
}

.preset-card-permanent {
    cursor: pointer;
}

/* Selected = border + lift only (no checkmark badge) */

.preset-card-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 10px 0;
    width: 100%;
    box-sizing: border-box;
}

.preset-card-text span {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.25;
}

.preset-card-text p {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.35;
    margin: 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

/* No presets banner */
.no-presets-card,
.diy-no-presets {
    background: linear-gradient(135deg, rgba(255, 126, 103, 0.06), rgba(247, 208, 112, 0.02));
    border: 1.5px solid rgba(255, 126, 103, 0.3);
    border-radius: 16px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.no-presets-card.hidden {
    display: none !important;
}

.no-presets-card .preset-card-thumb {
    width: 48px;
    height: 48px;
    aspect-ratio: auto;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.no-presets-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.no-presets-title {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-color);
}

.no-presets-content p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0;
}

/* Dough stepper inside summary modal — flat controls, no clay 3D stack */
.diy-dough-block {
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(120, 120, 140, 0.04);
    overflow: hidden;
    box-shadow: none;
}

.theme-dark .diy-dough-block {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
}

.diy-dough-in-modal {
    border-radius: 14px;
}

/* Summary modal: no nested card — controls sit on the sheet paper */
.diy-dough-flat.diy-dough-in-modal,
.diy-dough-block.diy-dough-flat {
    border: none;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
}

.diy-dough-flat .diy-dough-panel {
    padding: 0;
    align-items: stretch;
    gap: 12px;
}

.diy-dough-flat .diy-dough-stepper {
    justify-content: flex-start;
    gap: 14px;
}

.diy-dough-flat .diy-dough-hint {
    text-align: left;
}

.diy-dough-flat .diy-dough-chips {
    justify-content: flex-start;
}

.diy-dough-panel {
    padding: 14px 12px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.diy-dough-panel.hidden {
    display: none !important;
}

/* (dough section title spacing handled in summary continuous layout below) */

.diy-dough-stepper {
    display: flex;
    align-items: center;
    gap: 18px;
}

.diy-dough-step-btn {
    appearance: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #ffffff;
    color: var(--text-primary);
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}

.theme-dark .diy-dough-step-btn {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
}

.diy-dough-step-btn:hover {
    border-color: rgba(255, 126, 103, 0.45);
    background: rgba(255, 126, 103, 0.06);
}

.diy-dough-step-btn:active {
    transform: scale(0.96);
    background: rgba(255, 126, 103, 0.1);
}

.diy-dough-readout {
    display: flex;
    align-items: baseline;
    gap: 4px;
    min-width: 100px;
    justify-content: center;
}

.diy-dough-number {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1;
    display: inline-block;
    transition: transform 0.28s cubic-bezier(0.25, 0.8, 0.25, 1);
    will-change: transform;
}

.diy-dough-number.is-pressing {
    transform: scale(0.72) !important;
    transition: transform 0.08s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.diy-dough-unit {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
}

.diy-dough-hint {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

.diy-dough-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.diy-dough-chip {
    appearance: none;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-secondary);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 7px 13px;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.12s ease, border-color 0.15s ease, color 0.15s ease;
}

.theme-dark .diy-dough-chip {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.diy-dough-chip:hover {
    border-color: rgba(255, 126, 103, 0.35);
    color: var(--text-primary);
}

.diy-dough-chip:active {
    transform: scale(0.97);
}

.diy-dough-chip.is-active {
    border-color: rgba(255, 126, 103, 0.4);
    color: var(--primary-color);
    background: rgba(255, 126, 103, 0.1);
    box-shadow: none;
    font-weight: 700;
}

.diy-dough-done {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-color);
    padding: 4px 8px;
}

/* Modal scroll containment (also locked in JS via body fixed) */
html.diy-modal-open,
body.diy-modal-open {
    overflow: hidden !important;
    overscroll-behavior: none;
}

.diy-summary-modal {
    overscroll-behavior: none;
}

.diy-summary-backdrop {
    overscroll-behavior: none;
    touch-action: none;
}

.diy-summary-sheet {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* diy-lab surfaces set under .theme-light / .theme-dark above */

/* Footer CTA row — no bar chrome/shadow; only the button is elevated */
.diy-footer-cta {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 0 2px;
}

.diy-confirm-btn {
    min-width: 200px;
    max-width: 280px;
    width: auto;
    min-height: 48px;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 14px;
    /* Tactile bottom edge comes from .btn-primary */
    box-shadow: none !important;
}

.diy-confirm-btn:hover {
    transform: none;
    box-shadow: none !important;
}

.diy-confirm-btn:active {
    transform: translateY(2px);
    border-bottom-width: 2px !important;
    box-shadow: none !important;
}

