:root {
    --green-deep: #0B2E1E;
    --green-mid: #146B45;
    --pink: #E31C6F;
    --yellow: #F5D91A;
    --cream: #FBF3DC;
    --ink: #0B2E1E;
    --tan: #FFDEB0;
    --gold: #B8860D;
    --label-red: #E8442E;
    --val-green: #2ECC71;
    --val-purple: #6C5CE7;
    --dash-pink: #FF1493;
    --banner-purple: #DF6DFE;
    --banner-pink: #E2A9F1;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--green-deep);
    color: var(--cream);
    font-family: 'DM Sans', sans-serif;
}

body {
    background: #E8D8C3
}

.wrap {
    max-width: 1150px;
    margin: 0 auto;
}

.wordmark {
    font-family: 'Big Shoulders Display', sans-serif;
    font-weight: 900;
    color: var(--yellow);
    font-size: clamp(34px, 6vw, 58px);
    line-height: 0.9;
    text-transform: uppercase;
    -webkit-text-stroke: 1.5px var(--ink);
    text-shadow: 2px 2px 0 var(--ink);
    margin: 0 0 2px;
    text-align: center;
}

.subline {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--pink);
    margin-bottom: 22px;
    text-align: center;
}

.grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
}

@media (max-width:820px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

.panel {
    background: var(--cream);
    color: var(--ink);
    border-radius: 16px;
    padding: 22px;
    border: 2px solid var(--ink);
    max-height: 86vh;
    overflow-y: auto;
}

.field-label {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--green-mid);
    margin: 16px 0 6px;
    display: block;
}

.field-label:first-child {
    margin-top: 0;
}

.dropzone {
    border: 2px dashed var(--green-mid);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    font-size: 13px;
    background: rgba(255,255,255,0.6);
    transition: all 0.2s ease;
}

.dropzone:hover {
    background: #fff;
    border-color: var(--pink);
}

.dropzone.filled {
    border-style: solid;
    border-color: var(--green-mid);
    background: #E8F5E9;
    color: var(--green-deep);
    font-weight: 600;
}

input[type=file] {
    display: none;
}

input[type=text] {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 2px solid var(--green-mid);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    background: #fff;
    color: var(--ink);
    outline: none;
}

input[type=text]:focus {
    border-color: var(--pink);
    box-shadow: 0 0 0 3px rgba(227, 28, 111, 0.15);
}

.archetype-box {
    margin-top: 10px;
    padding: 10px 12px;
    background: var(--yellow);
    border-radius: 8px;
    font-family: 'Space Mono', monospace;
    font-size: 12.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    border: 1.5px solid var(--ink);
    font-weight: 700;
    color: var(--ink);
}

.reroll {
    background: var(--ink);
    color: var(--yellow);
    border: none;
    border-radius: 6px;
    width: 26px;
    height: 26px;
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reroll:hover {
    background: var(--pink);
    color: #fff;
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 12px 16px;
    border-radius: 10px;
    border: 2px solid var(--ink);
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-generate {
    background: var(--yellow);
    color: var(--ink);
}

.btn-generate:hover {
    background: #ffe600;
    box-shadow: 0 4px 12px rgba(245, 217, 26, 0.3);
}

.btn-primary {
    background: var(--pink);
    color: #fff;
    border-color: var(--pink);
}

.btn-primary:hover {
    background: #d01560;
}

.btn-secondary {
    background: var(--ink);
    color: var(--cream);
}

.btn-secondary:hover {
    background: #14452e;
}

.btn-ghost {
    background: transparent;
    color: var(--ink);
}

.btn-ghost:hover {
    background: rgba(11, 46, 30, 0.08);
}

.caption-note {
    font-size: 11.5px;
    color: var(--green-mid);
    margin-top: 6px;
    line-height: 1.5;
}

/* ===== preview stage ===== */
.stage {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bamboo {
    width: 100%;
    max-width: 420px;
    height: 22px;
    background: repeating-linear-gradient(90deg, var(--yellow) 0 26px, #E0C315 26px 30px);
    border-radius: 11px;
    border: 2px solid var(--ink);
}

.ropes {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 300px;
    margin-top: -4px;
}

.rope {
    width: 2px;
    height: 26px;
    background: var(--ink);
}

#posterViewport {
    width: 100%;
    max-width: 420px;
}

#posterScaler {
    transform-origin: top left;
    filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.35));
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ink);
    color: var(--cream);
    padding: 10px 18px;
    border-radius: 999px;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    z-index: 50;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.toast.show {
    opacity: 1;
}

/* =========================================================
   THE POSTER — 100% pixel-matched to the Canva 1000x1500 art
   ========================================================= */
#poster {
    width: 1000px;
    height: 1500px;
    position: relative;
    background: #0B2E1E;
    overflow: hidden;
    font-family: 'DM Sans', sans-serif;
    color: var(--ink);
}

#poster .layer {
    position: absolute;
    left: 0;
    pointer-events: none;
    user-select: none;
}

#poster .layer-top {
    top: 0;
    width: 1000px;
    z-index: 1;
}

#poster .layer-mid {
    top: 270px;
    width: 1000px;
    z-index: 1;
}

#poster .layer-bot {
    top: 1140px;
    width: 1000px;
    z-index: 1;
}

/* Photo circle: measured center (500, 458), radius 140 -> 280x280 */
#poster .photo-wrap {
    position: absolute;
    left: 360px;
    top: 318px;
    width: 280px;
    height: 280px;
    z-index: 3;
}

#poster .photo-ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background: #0B2E1E;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #E2A9F1;
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border: 3px dashed rgba(255,255,255,0.35);
}

#poster .photo-ring img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Name banner: bbox x159-840 y652-739 (width 681px, height 87px) */
#poster .name-banner {
    position: absolute;
    left: 159px;
    top: 652px;
    width: 681px;
    height: 87px;
    background: var(--banner-pink);
    border: 4px dashed var(--dash-pink);
    border-radius: 12px;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Big Shoulders Display', sans-serif;
    font-weight: 900;
    font-size: 46px;
    letter-spacing: 1.5px;
    color: #111;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 20px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}

/* Role banner: bbox x192-809 y749-799 (width 617px, height 50px) */
#poster .role-banner {
    position: absolute;
    left: 192px;
    top: 749px;
    width: 617px;
    height: 50px;
    background: var(--banner-purple);
    border-radius: 8px;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 21px;
    letter-spacing: 1px;
    color: #111;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 16px;
}

#poster .role-banner .star {
    color: var(--yellow);
    font-size: 22px;
    font-weight: 900;
}

/* Tan stats section: bbox x11-988 y896-1349 (width 977px, height 453px) */
#poster .stats {
    position: absolute;
    left: 11px;
    top: 896px;
    width: 977px;
    height: 453px;
    z-index: 2;
    display: grid;
    grid-template-columns: 339px 333px 305px;
    background: transparent;
}

#poster .stat-col {
    position: relative;
    padding: 35px 20px 0;
    border-left: 3px dashed #000000;
}

#poster .stat-col1 {
    border-left: none;
}

#poster .stat-label {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 19px;
    color: var(--label-red);
    text-align: center;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    text-transform: uppercase;
}

#poster .stat-val-2tone {
    font-family: 'Big Shoulders Display', sans-serif;
    font-weight: 900;
    font-size: 48px;
    line-height: 1.05;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#poster .stat-val-2tone span {
    display: block;
}

#poster #archWord1 {
    color: var(--val-green);
}

#poster #archWord2 {
    color: var(--val-purple);
}

#poster .stat-val-green {
    font-family: 'Big Shoulders Display', sans-serif;
    font-weight: 900;
    font-size: 32px;
    color: var(--val-green);
    text-align: center;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#poster .col2-divider {
    border-top: 3px dashed #000000;
    margin: 20px -20px 18px;
}

#poster .verified {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 13px;
    color: var(--val-green);
    text-align: center;
    letter-spacing: 1px;
    margin-bottom: 6px;
    text-transform: uppercase;
}

#poster .id-num {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 22px;
    color: #0B2E1E;
    text-align: center;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

#poster #barcodeCanvas {
    display: block;
    margin: 0 auto;
    background: #ffffff;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

#poster .connect-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 14px;
    color: var(--val-green);
    margin-bottom: 12px;
    word-break: break-all;
}

#poster .icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 10px;
    flex-shrink: 0;
}

#poster .icon-gh {
    background: #171515;
}

#poster .icon-ig {
    background: radial-gradient(circle at 30% 110%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
}


#poster .qr-block {
    position: absolute;
    left: 44px;
    top: 235px;
    text-align: center;
}

#poster #qrCanvas {
    display: block;
    background: #ffffff;
    border: 3px solid #ffffff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

#poster .scan-lbl {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 11px;
    color: var(--gold);
    margin-top: 8px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* =========================================================
   ASSEMBLY ANIMATION
   ========================================================= */
#poster .layer,
#poster .layer-anim {
    transition: transform 0.7s cubic-bezier(.2, .8, .25, 1), opacity 0.6s ease;
}

#poster.jump .layer,
#poster.jump .layer-anim {
    transition: none !important;
}

#poster.assembling .layer-top {
    transform: translateY(-260px);
    opacity: 0;
}

#poster.assembling .layer-mid {
    transform: scale(0.85);
    opacity: 0;
}

#poster.assembling .layer-bot {
    transform: translateY(260px);
    opacity: 0;
}

#poster.assembling .photo-wrap {
    transform: scale(0.2);
    opacity: 0;
}

#poster.assembling .name-banner {
    transform: translateX(-500px);
    opacity: 0;
}

#poster.assembling .role-banner {
    transform: translateX(500px);
    opacity: 0;
}

#poster.assembling .stats {
    transform: translateY(200px);
    opacity: 0;
}

#poster .layer-top {
    transition-delay: 0s;
}

#poster .layer-mid {
    transition-delay: 0.15s;
}

#poster .photo-wrap {
    transition-delay: 0.4s;
}

#poster .name-banner {
    transition-delay: 0.6s;
}

#poster .role-banner {
    transition-delay: 0.72s;
}

#poster .stats {
    transition-delay: 0.5s;
}

#poster .layer-bot {
    transition-delay: 0.3s;
}
/* =========================================================
   HH GOA 2026 — final repair / asset pass
   ========================================================= */

/* Keep the stage shell transparent; the poster itself is the designed card. */
.stage-panel {
    background: transparent;
    border: none;
    padding: 0;
    max-height: none;
    overflow: visible;
}

/* Taller role/tech-stack control. */
.stack-field {
    min-height: 72px;
    padding-top: 20px !important;
    padding-bottom: 20px !important;
}

/* Rounded poster corners must also clip the raster layers. */
#poster {
    border-radius: 24px;
    isolation: isolate;
}

#poster .layer {
    z-index: 1;
}

#poster .layer-top,
#poster .layer-mid,
#poster .layer-bot {
    z-index: 1;
    max-width: none;
    border-radius: 24px;
}

.layer-overlay {
    position: absolute;
    pointer-events: none;
    user-select: none;
    z-index: 8;
}

/* Use the supplied date artwork instead of recreating it in CSS.
   It sits above the top artwork so the old left-top layering bug is gone. */
.poster-date {
    left: 14px;
    top: 12px;
    width: 78px;
    height: auto;
    display: block;
    border-radius: 18px;
    object-fit: contain;
    box-shadow: 0 2px 0 rgba(11, 46, 30, .25);
}

/* Missing header-bottom triangle restored as an export-safe vector layer. */
.header-triangle {
    left: 50%;
    top: 258px;
    width: 0;
    height: 0;
    transform: translateX(-50%);
    border-left: 72px solid transparent;
    border-right: 72px solid transparent;
    border-top: 72px solid var(--green-deep);
    filter: drop-shadow(0 3px 0 rgba(0,0,0,.18));
}

/* Name banner: dashed border is inset from the pink edge. */
#poster .name-banner {
    border: none;
    padding-left: 28px;
    padding-right: 28px;
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
}

#poster .name-banner::after {
    content: '';
    position: absolute;
    inset: 10px;
    border: 4px dashed var(--dash-pink);
    border-radius: 7px;
    pointer-events: none;
}

/* Stats/background layer was missing from the original composition. */
#poster .stats {
    background: var(--tan);
    border: 3px solid var(--ink);
    border-radius: 18px;
    overflow: hidden;
}

#poster .stat-col {
    border-left: 3px dashed var(--ink);
    min-width: 0;
}

#poster .stat-col1 {
    background: var(--tan);
    border-left: none;
}

#poster .stat-label {
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    white-space: nowrap;
}

#poster .stat-label img {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    object-fit: contain;
}

#poster .stat-label span {
    display: inline-block;
}

/* Role stars now use the supplied artwork too. */
#poster .role-star {
    width: 26px;
    height: 26px;
    object-fit: contain;
    flex: 0 0 26px;
}

/* No decorative builder-class barcode: it was the source of the overflow.
   The actual ID barcode remains generated dynamically below. */
#poster .stat-val-2tone {
    position: relative;
    z-index: 2;
}

/* Keep the real ID barcode inside its column. */
#poster #barcodeCanvas {
    display: block;
    width: 270px;
    max-width: calc(100% - 8px);
    height: auto;
    margin: 0 auto;
    background: #fff;
    border: 2px solid #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

/* Use supplied social artwork instead of CSS-drawn placeholder icons. */
#poster .connect-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

#poster .social-icon {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    object-fit: contain;
    border-radius: 50%;
}

#poster .social-icon-x {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
}

#poster .connect-row span {
    min-width: 0;
}

/* QR is contained within the Connect column. */
#poster .qr-block {
    max-width: calc(100% - 20px);
}

#poster #qrCanvas {
    width: 180px;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

/* Footer dashed lines: explicit, export-safe and aligned to the bottom artwork. */
#poster .footer-dashed-line {
    left: 42px;
    right: 42px;
    bottom: 126px;
    height: 0;
    border-top: 3px dashed var(--ink);
    opacity: .95;
}

#poster .footer-dashed-line::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 11px;
    border-top: 1px dashed rgba(11,46,30,.55);
}

/* All corners remain rounded in both preview and exported poster. */
#poster,
#poster > img.layer {
    border-radius: 24px;
}

/* Better small-screen handling without changing the 1000x1500 export geometry. */
@media (max-width: 820px) {
    .poster-date {
        width: 64px;
        left: 10px;
        top: 10px;
    }

    .stack-field {
        min-height: 64px;
    }
}
