:root {
    --bg: #f3eadc;
    --bg-deep: #e7dbc8;
    --panel: rgba(255, 250, 243, 0.9);
    --panel-solid: #fffaf2;
    --panel-strong: #f7efe2;
    --line: rgba(108, 92, 74, 0.16);
    --text: #2d241d;
    --muted: #746659;
    --accent: #d96a3a;
    --accent-strong: #b74b21;
    --accent-soft: #f7d5be;
    --teal: #2c746d;
    --teal-soft: #d5ece8;
    --shadow: 0 20px 40px rgba(85, 60, 31, 0.12);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --font-sans: "Avenir Next", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: var(--font-sans);
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(217, 106, 58, 0.18), transparent 28%),
        radial-gradient(circle at 85% 20%, rgba(44, 116, 109, 0.15), transparent 24%),
        linear-gradient(180deg, #f7efe4 0%, #efe4d4 48%, #eadcca 100%);
}

img {
    display: block;
    max-width: 100%;
}

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

.page-shell {
    position: relative;
    overflow: hidden;
    padding: 32px 18px 48px;
}

.ambient {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.ambient-sun {
    background:
        radial-gradient(circle at 10% 8%, rgba(255, 255, 255, 0.65), transparent 20%),
        radial-gradient(circle at 75% 15%, rgba(255, 221, 188, 0.38), transparent 18%);
}

.ambient-grid {
    opacity: 0.35;
    background-image:
        linear-gradient(rgba(124, 104, 82, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(124, 104, 82, 0.04) 1px, transparent 1px);
    background-size: 28px 28px;
}

.app-shell {
    position: relative;
    max-width: 1240px;
    margin: 0 auto;
    display: grid;
    gap: 24px;
}

.hero,
.panel,
.loading-section,
.result-section {
    position: relative;
    background: var(--panel);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.75);
    box-shadow: var(--shadow);
}

.hero {
    border-radius: 36px;
    padding: 36px;
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(280px, 360px);
    gap: 24px;
    animation: rise-in 0.7s ease both;
}

.hero-copy {
    display: grid;
    gap: 18px;
    align-content: start;
}

.eyebrow,
.panel-kicker {
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-size: 12px;
    color: var(--accent-strong);
    font-weight: 700;
}

.hero h1 {
    max-width: 11ch;
    font-size: clamp(2.5rem, 4vw, 4.4rem);
    line-height: 0.96;
}

.hero-text {
    max-width: 52ch;
    font-size: 1.05rem;
    color: var(--muted);
    line-height: 1.8;
}

.hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hero-badges span {
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(217, 106, 58, 0.16);
    color: var(--text);
    font-size: 0.94rem;
}

.hero-card {
    align-self: stretch;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 244, 232, 0.96));
    border-radius: 28px;
    padding: 24px;
    border: 1px solid rgba(217, 106, 58, 0.12);
    display: grid;
    gap: 18px;
}

.hero-card-title,
.tips-title,
.palette-head h3,
.materials-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.hero-steps {
    list-style: none;
    display: grid;
    gap: 12px;
    counter-reset: step;
}

.hero-steps li {
    counter-increment: step;
    display: grid;
    grid-template-columns: 32px 1fr;
    gap: 12px;
    align-items: start;
    color: var(--text);
}

.hero-steps li::before {
    content: counter(step);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-weight: 700;
}

.hero-note {
    padding: 14px 16px;
    background: var(--teal-soft);
    color: #215650;
    border-radius: var(--radius-sm);
    line-height: 1.7;
}

.studio-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
    gap: 24px;
}

.panel,
.result-section {
    border-radius: var(--radius-lg);
    padding: 28px;
}

.panel-head,
.result-header,
.materials-header,
.palette-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
}

.panel-head {
    margin-bottom: 22px;
}

.panel-head h2,
.result-header h2 {
    font-size: 1.7rem;
    margin-top: 6px;
}

.panel-meta,
.palette-head p,
.materials-header p {
    color: var(--muted);
    line-height: 1.7;
}

.upload-area {
    min-height: 280px;
    border-radius: 26px;
    border: 2px dashed rgba(44, 116, 109, 0.26);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(238, 245, 243, 0.9));
    display: grid;
    place-items: center;
    padding: 28px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.upload-area:hover,
.upload-area.dragover {
    transform: translateY(-2px);
    border-color: var(--teal);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(213, 236, 232, 0.86));
}

.upload-content {
    display: grid;
    gap: 12px;
}

.upload-icon {
    width: 78px;
    height: 78px;
    margin: 0 auto;
    border-radius: 22px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 2.25rem;
    display: grid;
    place-items: center;
}

.upload-title {
    font-size: 1.12rem;
    font-weight: 700;
}

.upload-subtitle,
.helper-text {
    color: var(--muted);
    line-height: 1.7;
}

.upload-guidance {
    margin-top: 18px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid rgba(44, 116, 109, 0.18);
    background: linear-gradient(180deg, rgba(235, 246, 244, 0.95), rgba(255, 253, 249, 0.96));
}

.upload-guidance-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.upload-guidance-list {
    margin-top: 10px;
    list-style: none;
    display: grid;
    gap: 8px;
}

.upload-guidance-list li {
    position: relative;
    padding-left: 16px;
    color: var(--muted);
    line-height: 1.65;
}

.upload-guidance-list li::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-strong);
    position: absolute;
    left: 0;
    top: 11px;
}

.image-preview {
    margin-top: 20px;
    background: var(--panel-solid);
    border-radius: 24px;
    padding: 16px;
    border: 1px solid var(--line);
    position: relative;
    overflow: hidden;
}

.image-preview img {
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    border-radius: 18px;
    background: linear-gradient(135deg, #f6f1e7, #fffdf9);
}

.file-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.file-meta-card,
.control-card,
.tips-card,
.summary-card,
.layout-info,
.total-beads,
.compare-panel,
.palette-section {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    border-radius: 20px;
}

.file-meta-card {
    padding: 16px 18px;
    display: grid;
    gap: 8px;
}

.file-meta-card span,
.summary-card span,
.material-content span,
.palette-chip small {
    color: var(--muted);
}

.file-meta-card strong,
.summary-card strong {
    font-size: 1.04rem;
}

.control-stack {
    display: grid;
    gap: 16px;
}

.control-card,
.tips-card,
.palette-section,
.layout-info {
    padding: 18px;
}

.control-topline {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 12px;
}

.control-topline label {
    font-weight: 700;
}

.toggle-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--text);
    line-height: 1.7;
}

.toggle-row input {
    width: 18px;
    height: 18px;
    margin-top: 4px;
    accent-color: var(--accent);
}

.value-pill {
    min-width: 78px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    text-align: center;
    font-weight: 700;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

select,
input[type="number"],
.layout-data {
    width: 100%;
    border: 1px solid rgba(108, 92, 74, 0.24);
    border-radius: 14px;
    padding: 14px 16px;
    background: #fffdf9;
    color: var(--text);
}

.tips-list {
    margin-top: 12px;
    list-style: none;
    display: grid;
    gap: 10px;
}

.tips-list li {
    position: relative;
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.7;
}

.tips-list li::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--teal);
    position: absolute;
    left: 0;
    top: 12px;
}

.board-custom-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.board-single-grid {
    grid-template-columns: minmax(0, 1fr);
}

.board-mini-field {
    display: grid;
    gap: 8px;
}

.board-mini-field span {
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 700;
}

.btn {
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

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

.btn-primary,
.btn-accent,
.btn-secondary {
    border-radius: 18px;
    padding: 15px 22px;
    font-weight: 700;
}

.process-btn {
    display: grid;
    gap: 4px;
    justify-items: start;
    background: linear-gradient(135deg, #d96a3a, #bc5327);
    color: #fff;
    box-shadow: 0 12px 24px rgba(185, 83, 39, 0.24);
}

.process-btn small {
    opacity: 0.84;
    font-weight: 500;
}

.btn-accent {
    background: linear-gradient(135deg, #2c746d, #225952);
    color: #fff;
    box-shadow: 0 10px 24px rgba(34, 89, 82, 0.22);
}

.btn-secondary {
    background: rgba(255, 250, 243, 0.92);
    color: var(--text);
    border: 1px solid rgba(108, 92, 74, 0.18);
}

.btn-small {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 10px 14px;
    border-radius: 999px;
}

.download-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.status-banner {
    padding: 14px 16px;
    border-radius: 16px;
    line-height: 1.7;
    border: 1px solid transparent;
}

.status-info {
    background: rgba(44, 116, 109, 0.1);
    color: #215650;
    border-color: rgba(44, 116, 109, 0.18);
}

.status-success {
    background: rgba(114, 164, 90, 0.14);
    color: #3b5f29;
    border-color: rgba(114, 164, 90, 0.18);
}

.status-error {
    background: rgba(210, 88, 72, 0.12);
    color: #8d3423;
    border-color: rgba(210, 88, 72, 0.18);
}

.loading-section {
    border-radius: var(--radius-lg);
    padding: 22px 28px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.spinner {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid rgba(44, 116, 109, 0.14);
    border-top-color: var(--teal);
    animation: spin 0.8s linear infinite;
}

.result-section {
    display: grid;
    gap: 22px;
    animation: rise-in 0.7s ease both;
}

.result-header {
    align-items: center;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
}

.summary-card {
    padding: 18px;
    display: grid;
    gap: 10px;
}

.summary-card strong {
    font-size: 1.12rem;
}

.palette-section {
    display: grid;
    gap: 18px;
}

.palette-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.palette-chip {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #fffdf9;
    border-radius: 14px;
    border: 1px solid rgba(108, 92, 74, 0.14);
}

.palette-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid rgba(45, 36, 29, 0.12);
}

.result-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tab-btn {
    padding: 12px 18px;
    border-radius: 999px;
    background: transparent;
    border: 1px solid rgba(108, 92, 74, 0.14);
    color: var(--muted);
}

.tab-btn.active {
    background: var(--text);
    color: #fff;
    border-color: var(--text);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.compare-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.compare-panel {
    padding: 16px;
    display: grid;
    gap: 14px;
}

.compare-panel h3 {
    font-size: 1.05rem;
}

.compare-image-wrap {
    min-height: 320px;
    border-radius: 18px;
    background:
        linear-gradient(45deg, rgba(108, 92, 74, 0.03) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(108, 92, 74, 0.03) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(108, 92, 74, 0.03) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(108, 92, 74, 0.03) 75%),
        #fcf8f2;
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    border: 1px solid rgba(108, 92, 74, 0.08);
    display: grid;
    place-items: center;
    padding: 18px;
}

.compare-image-wrap img {
    max-height: 560px;
    object-fit: contain;
    border-radius: 12px;
}

.materials-header {
    margin-bottom: 18px;
}

.trimmed-note {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(217, 106, 58, 0.1);
    border: 1px solid rgba(217, 106, 58, 0.16);
    color: #8c4526;
    line-height: 1.7;
}

.board-note {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(44, 116, 109, 0.1);
    border: 1px solid rgba(44, 116, 109, 0.16);
    color: #245b55;
    line-height: 1.7;
}

.materials-sheet {
    margin-bottom: 18px;
    padding: 18px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid var(--line);
    display: grid;
    gap: 14px;
}

.materials-sheet-copy h4 {
    font-size: 1rem;
    margin-bottom: 6px;
}

.materials-sheet-copy p {
    color: var(--muted);
    line-height: 1.7;
}

.materials-sheet-preview {
    border-radius: 18px;
    background: #fcf8f2;
    border: 1px solid rgba(108, 92, 74, 0.08);
    padding: 14px;
    overflow: auto;
}

.materials-sheet-preview img {
    width: 100%;
    height: auto;
    min-width: 280px;
    border-radius: 12px;
}

.total-beads {
    min-width: 140px;
    padding: 14px 18px;
    display: grid;
    gap: 4px;
    text-align: right;
    color: var(--muted);
}

.total-beads strong {
    font-size: 1.4rem;
    color: var(--text);
}

.materials-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

.material-card {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 18px;
    border: 1px solid var(--line);
}

.material-swatch {
    width: 18px;
    height: 58px;
    border-radius: 999px;
    border: 1px solid rgba(45, 36, 29, 0.12);
}

.material-content {
    display: grid;
    gap: 6px;
}

.material-count {
    font-weight: 700;
    color: var(--accent-strong);
}

.layout-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px 18px;
    margin-bottom: 16px;
}

.layout-info p {
    color: var(--muted);
}

.layout-info span {
    color: var(--text);
    font-weight: 700;
}

.layout-data {
    min-height: 280px;
    resize: vertical;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    line-height: 1.6;
}

.empty-state {
    width: 100%;
    padding: 18px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px dashed rgba(108, 92, 74, 0.18);
    color: var(--muted);
}

.hidden {
    display: none !important;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1100px) {
    .hero,
    .studio-grid,
    .compare-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .page-shell {
        padding: 18px 12px 28px;
    }

    .hero,
    .panel,
    .result-section {
        padding: 20px;
        border-radius: 22px;
    }

    .hero h1 {
        max-width: 100%;
    }

    .panel-head,
    .result-header,
    .materials-header,
    .palette-head {
        flex-direction: column;
    }

    .summary-grid,
    .file-meta-grid,
    .materials-list,
    .board-custom-grid {
        grid-template-columns: 1fr;
    }

    .result-tabs {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .tab-btn {
        text-align: center;
    }

    .total-beads {
        width: 100%;
        text-align: left;
    }

    .loading-section {
        padding: 18px 20px;
    }
}

/* Cute pixel-style visual overrides for the static GitHub Pages version. */
:root {
    --bg: #fff7f0;
    --bg-deep: #ffe3d1;
    --panel: rgba(255, 251, 247, 0.9);
    --panel-solid: #fffaf7;
    --panel-strong: #fff1e7;
    --line: rgba(170, 128, 104, 0.2);
    --line-strong: rgba(151, 107, 82, 0.3);
    --text: #5a3e31;
    --muted: #8d6d5d;
    --accent: #ff907c;
    --accent-strong: #de6a58;
    --accent-soft: #ffd9cd;
    --teal: #62a99a;
    --teal-soft: #dbf5ee;
    --peach: #ffc5af;
    --pink: #f9bfd1;
    --cream: #ffe9a7;
    --sky: #c9e9ff;
    --shadow: 0 16px 0 rgba(229, 187, 158, 0.22), 0 26px 54px rgba(145, 99, 72, 0.14);
    --radius-lg: 30px;
    --radius-md: 20px;
    --radius-sm: 14px;
    --font-sans: "Trebuchet MS", "Avenir Next", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
    --font-display: "Trebuchet MS", "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-pixel: "Consolas", "Courier New", monospace;
}

body {
    color: var(--text);
    background:
        radial-gradient(circle at 10% 12%, rgba(255, 255, 255, 0.9), transparent 18%),
        radial-gradient(circle at 82% 14%, rgba(201, 233, 255, 0.78), transparent 18%),
        radial-gradient(circle at 88% 78%, rgba(249, 191, 209, 0.35), transparent 22%),
        linear-gradient(180deg, #fff7f0 0%, #ffeede 48%, #ffe4d5 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.26;
    background-image:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.95) 0 2px, transparent 2.5px),
        radial-gradient(circle at center, rgba(222, 106, 88, 0.18) 0 1.5px, transparent 2px);
    background-size: 34px 34px, 68px 68px;
    background-position: 0 0, 14px 20px;
}

.page-shell {
    padding: 36px 20px 56px;
}

.ambient-sun {
    background:
        radial-gradient(circle at 11% 7%, rgba(255, 255, 255, 0.88), transparent 18%),
        radial-gradient(circle at 78% 12%, rgba(255, 230, 166, 0.36), transparent 16%);
}

.ambient-grid {
    opacity: 0.18;
    background-image:
        linear-gradient(rgba(194, 144, 117, 0.18) 1px, transparent 1px),
        linear-gradient(90deg, rgba(194, 144, 117, 0.18) 1px, transparent 1px);
    background-size: 24px 24px;
}

.ambient-confetti {
    opacity: 0.35;
    background:
        radial-gradient(circle at 12% 18%, rgba(255, 144, 124, 0.5) 0 7px, transparent 8px),
        radial-gradient(circle at 88% 30%, rgba(98, 169, 154, 0.44) 0 7px, transparent 8px),
        radial-gradient(circle at 72% 82%, rgba(249, 191, 209, 0.42) 0 8px, transparent 9px),
        radial-gradient(circle at 20% 76%, rgba(255, 233, 167, 0.45) 0 8px, transparent 9px);
}

.hero,
.panel,
.loading-section,
.result-section {
    background:
        linear-gradient(180deg, rgba(255, 253, 250, 0.97), rgba(255, 246, 239, 0.9));
    border: 2px solid rgba(255, 255, 255, 0.82);
    box-shadow: var(--shadow);
}

.hero,
.panel,
.result-section {
    overflow: hidden;
}

.hero {
    position: relative;
    gap: 28px;
    border-radius: 38px;
    padding: 40px;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 12px;
    border: 2px dashed rgba(255, 185, 164, 0.42);
    border-radius: 28px;
    pointer-events: none;
}

.hero::after {
    content: "";
    position: absolute;
    right: 36px;
    top: 28px;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    background: var(--accent);
    box-shadow:
        18px 0 0 var(--cream),
        36px 0 0 var(--sky),
        0 18px 0 var(--teal),
        18px 18px 0 var(--pink),
        36px 18px 0 #ffffff,
        18px 36px 0 var(--accent-soft);
    opacity: 0.72;
}

.hero-copy {
    gap: 20px;
}

.eyebrow,
.panel-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(222, 106, 88, 0.22);
    color: var(--accent-strong);
    font-size: 11px;
    letter-spacing: 0.16em;
    box-shadow: 0 8px 18px rgba(255, 194, 172, 0.28);
}

.hero-chip-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.hero-chip {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 2px solid rgba(111, 71, 48, 0.12);
    box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.55), 0 4px 8px rgba(121, 83, 56, 0.08);
}

.chip-peach { background: var(--peach); }
.chip-cream { background: var(--cream); }
.chip-mint { background: #c7edd9; }
.chip-pink { background: var(--pink); }
.chip-gold { background: #ffd37e; }

.hero h1 {
    max-width: 12ch;
    font-family: var(--font-display);
    font-size: clamp(2.7rem, 4.2vw, 4.8rem);
    line-height: 0.94;
    letter-spacing: -0.03em;
    text-shadow: 4px 4px 0 rgba(255, 222, 205, 0.9);
}

.hero-text {
    max-width: 54ch;
    color: var(--muted);
    font-size: 1.04rem;
}

.hero-badges span {
    padding: 11px 17px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 18px rgba(181, 126, 93, 0.12);
}

.hero-badges span:nth-child(1) {
    background: rgba(255, 217, 205, 0.95);
}

.hero-badges span:nth-child(2) {
    background: rgba(201, 233, 255, 0.95);
}

.hero-badges span:nth-child(3) {
    background: rgba(219, 245, 238, 0.95);
}

.hero-badges span:nth-child(4) {
    background: rgba(255, 233, 167, 0.96);
}

.hero-card {
    position: relative;
    background:
        linear-gradient(180deg, rgba(255, 251, 247, 0.98), rgba(255, 239, 229, 0.96));
    border: 2px solid rgba(255, 212, 191, 0.88);
    border-radius: 30px;
    padding: 24px;
    gap: 20px;
}

.hero-card-art {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.pixel-square {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    border: 2px solid rgba(95, 68, 52, 0.1);
    box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.58), 0 6px 10px rgba(126, 84, 58, 0.08);
}

.pixel-coral { background: var(--accent); }
.pixel-cream { background: var(--cream); }
.pixel-mint { background: #c5f0dd; }
.pixel-pink { background: var(--pink); }
.pixel-teal { background: #9cded2; }

.hero-card-title,
.tips-title,
.palette-head h3,
.materials-header h3 {
    font-family: var(--font-display);
    font-size: 1.12rem;
}

.hero-steps li::before {
    background: linear-gradient(180deg, #ffe6d8, #ffd0ba);
    border: 2px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 16px rgba(211, 120, 88, 0.12);
}

.hero-note {
    background: linear-gradient(180deg, rgba(219, 245, 238, 0.96), rgba(239, 252, 247, 0.94));
    border: 1px solid rgba(98, 169, 154, 0.18);
    color: #2e6f63;
}

.panel,
.result-section {
    border-radius: 32px;
    padding: 30px;
}

.panel-head h2,
.result-header h2 {
    font-family: var(--font-display);
    font-size: 1.75rem;
}

.panel-meta,
.palette-head p,
.materials-header p {
    color: var(--muted);
}

.upload-area {
    position: relative;
    min-height: 290px;
    border: 2px solid rgba(108, 162, 150, 0.28);
    border-radius: 28px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 255, 252, 0.9));
    box-shadow: inset 0 0 0 6px rgba(255, 255, 255, 0.58);
}

.upload-area::before {
    content: "";
    position: absolute;
    inset: 12px;
    border-radius: 22px;
    border: 2px dashed rgba(255, 169, 144, 0.38);
    pointer-events: none;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: rgba(98, 169, 154, 0.52);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(233, 251, 246, 0.92));
}

.upload-icon {
    border-radius: 24px;
    background: linear-gradient(180deg, #ffe7dc, #ffd3c1);
    border: 2px solid rgba(255, 255, 255, 0.92);
    box-shadow: 0 12px 20px rgba(215, 113, 80, 0.14);
}

.upload-guidance,
.materials-sheet,
.materials-sheet-preview,
.compare-image-wrap,
.palette-chip,
.material-card,
.summary-card,
.file-meta-card,
.control-card,
.tips-card,
.layout-info,
.total-beads,
.compare-panel,
.palette-section {
    border-color: rgba(222, 193, 175, 0.72);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.file-meta-card,
.control-card,
.tips-card,
.summary-card,
.layout-info,
.total-beads,
.compare-panel,
.palette-section {
    position: relative;
    background: rgba(255, 255, 255, 0.8);
}

.file-meta-card::before,
.control-card::before,
.tips-card::before,
.summary-card::before,
.compare-panel::before,
.palette-section::before {
    content: "";
    position: absolute;
    left: 14px;
    top: 0;
    width: 62px;
    height: 6px;
    border-radius: 0 0 8px 8px;
    background: linear-gradient(90deg, rgba(255, 144, 124, 0.9), rgba(98, 169, 154, 0.9));
}

select,
input[type="number"],
.layout-data {
    border: 2px solid rgba(222, 193, 175, 0.92);
    border-radius: 16px;
    background: #fffdfa;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

select:focus,
input[type="number"]:focus,
.layout-data:focus {
    outline: none;
    border-color: rgba(255, 144, 124, 0.64);
    box-shadow: 0 0 0 4px rgba(255, 217, 205, 0.6);
}

.value-pill {
    background: linear-gradient(180deg, rgba(255, 226, 213, 0.98), rgba(255, 209, 191, 0.96));
    border: 1px solid rgba(255, 255, 255, 0.95);
}

.toggle-row input {
    accent-color: var(--accent-strong);
}

.btn {
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.2s ease;
}

.btn-primary,
.btn-accent,
.btn-secondary {
    border: 2px solid rgba(255, 255, 255, 0.84);
    border-radius: 20px;
    box-shadow: 0 10px 0 rgba(188, 143, 114, 0.2), 0 16px 26px rgba(145, 99, 72, 0.12);
}

.btn:hover:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 7px 0 rgba(188, 143, 114, 0.2), 0 12px 18px rgba(145, 99, 72, 0.1);
}

.process-btn {
    background: linear-gradient(135deg, #ff9f86, #ff7f74);
    color: #fffdfc;
}

.btn-accent {
    background: linear-gradient(135deg, #75c7b5, #4ea291);
    color: #fff;
}

.btn-secondary {
    background: linear-gradient(135deg, #fff8ee, #ffefe3);
    color: var(--text);
}

.btn-small {
    top: 18px;
    right: 18px;
}

.status-info {
    background: rgba(98, 169, 154, 0.12);
}

.status-success {
    background: rgba(136, 190, 109, 0.14);
}

.status-error {
    background: rgba(255, 144, 124, 0.14);
}

.loading-section {
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(255, 241, 233, 0.92));
}

.spinner {
    border-color: rgba(98, 169, 154, 0.14);
    border-top-color: var(--accent);
}

.summary-card strong {
    font-family: var(--font-display);
}

.palette-chip {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 246, 239, 0.94));
}

.palette-dot {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.45);
}

.tab-btn {
    border: 2px solid rgba(222, 193, 175, 0.8);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
}

.tab-btn.active {
    background: linear-gradient(135deg, #ffefe5, #ffd9cd);
    color: var(--text);
    border-color: rgba(255, 206, 188, 0.9);
    box-shadow: 0 10px 18px rgba(255, 188, 168, 0.18);
}

.compare-image-wrap {
    background:
        linear-gradient(45deg, rgba(255, 214, 197, 0.22) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255, 214, 197, 0.22) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(219, 245, 238, 0.35) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(219, 245, 238, 0.35) 75%),
        #fffaf5;
    background-size: 22px 22px;
    background-position: 0 0, 0 11px, 11px -11px, -11px 0;
    border: 2px solid rgba(222, 193, 175, 0.6);
}

.compare-image-wrap img {
    border-radius: 14px;
}

#patternImage {
    image-rendering: pixelated;
}

.trimmed-note {
    background: rgba(255, 150, 127, 0.12);
}

.board-note {
    background: rgba(98, 169, 154, 0.12);
}

.materials-sheet {
    background: rgba(255, 255, 255, 0.84);
}

.materials-sheet-preview {
    background: linear-gradient(180deg, #fffaf5, #fff3e9);
}

.material-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 245, 238, 0.94));
}

.material-swatch {
    width: 20px;
    border-radius: 10px;
}

.material-count {
    color: var(--accent-strong);
}

.layout-data {
    font-family: var(--font-pixel);
}

.empty-state {
    background: rgba(255, 255, 255, 0.86);
    border: 2px dashed rgba(222, 193, 175, 0.7);
}

@media (max-width: 760px) {
    .page-shell {
        padding: 22px 14px 36px;
    }

    .hero,
    .panel,
    .result-section {
        padding: 22px;
        border-radius: 26px;
    }

    .hero::after {
        right: 22px;
        top: 22px;
        transform: scale(0.82);
        transform-origin: top right;
    }

    .hero-chip-row {
        gap: 8px;
    }

    .hero-chip,
    .pixel-square {
        width: 16px;
        height: 16px;
    }
}
