:root {
    --page-bg: #f1f2f6;
    --card: #fff;
    --border: #d4d4d8;
    --shadow: rgba(0,0,0,.1);
    --green: #05c46b;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Roboto, system-ui, -apple-system, Segoe UI, Ubuntu, Cantarell, Noto Sans, sans-serif;
    background: var(--page-bg);
    color: #000;
}
.container { max-width: 800px; margin: 24px auto 48px; padding: 0 16px; }
.title {
    background: var(--card); font-size: 32px; font-weight: 700; text-align: center;
    padding: 30px 20px; margin-bottom: 10px; border-radius: 6px; box-shadow: 0 6px 18px var(--shadow);
}
.instruction {
    background: var(--card); padding: 16px 20px; text-align: center;
    margin-bottom: 18px; border-radius: 6px; box-shadow: 0 6px 18px var(--shadow);
}
.card {
    background: var(--card); border-radius: 6px; box-shadow: 0 12px 28px var(--shadow); overflow: hidden;
}
.header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-bottom: 1px solid #eee; gap: 8px;
}
.header .btn.subtle { background: #f8f8f8; border-color: #e5e7eb; }

.header-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
    text-align: center;
    margin-bottom: 10px;
}

.header-grid .left  { justify-self: start; }
.header-grid .right { justify-self: end; }
.header-grid .center { justify-self: center; }

.prompt-bubble {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fff;
    border: 2px solid var(--border);
    border-radius: 18px;
    padding: 14px 18px;
    color: #111;
    box-shadow: 0 6px 14px rgba(0,0,0,0.08);
    width: fit-content;
    margin: 0 auto;
}

.prompt-text {
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    line-height: 1.4;
}




/* Prompt bubble */
.prompt-bubble {
    position: relative;
    background: #fff;
    border: 2px solid var(--border);
    border-radius: 18px;
    padding: 14px 18px;
    font-size: 16px;
    line-height: 1.4;
    color: #111;
    margin: 20px auto;
    width: fit-content;
    max-width: 100%;
    box-shadow: 0 6px 14px rgba(0,0,0,0.08);
    animation: bubblePop 0.25s ease;
}
.prompt-bubble::after {
    content: "";
    position: absolute;
    bottom: -12px;
    left: 40px;
    width: 0;
    height: 0;
    border: 12px solid transparent;
    border-top-color: #fff;
    filter: drop-shadow(0 -2px 2px rgba(0,0,0,0.05));
}
@keyframes bubblePop {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
.canvas-wrapper {
    display: flex; justify-content: center; align-items: center; margin: 18px auto 8px;
    background: var(--page-bg); border-radius: 8px;
    box-shadow: 0 0 0 3px var(--border), 0 2px 10px rgba(0,0,0,.05);
}
#drawingCanvas,
    .logo-preview {
        width: 320px;
        height: 320px;
        border: 2px solid var(--border);
        border-radius: 10px;
        background: #fff;
        position: relative;
        display: inline-block;
        overflow: visible !important;
        box-shadow: inset 0 0 6px rgba(0,0,0,0.08);
    }

.toolbar {
    background: var(--card); padding: 15px; border-top: 1px solid #eee;
    display: grid; grid-template-columns: 1fr auto; gap: 12px;
}
.tools { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.tool { font-size: 14px; display: flex; align-items: center; gap: 8px; }
.colors { display: flex; gap: 10px; align-items: center; }
.color {
    width: 32px; height: 32px; border-radius: 50%; cursor: pointer; border: 1.5px solid rgba(0, 0, 0, 0.6);

}
.color.white { border: 1px solid #ccc; }
.color.custom { border: 1px solid #bbb; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.color:hover {
    transform: scale(1.15);
}

.color.active {
    outline: 3px solid var(--green, #30c05a);
    outline-offset: 2px;
    box-shadow: 0 0 8px rgba(0, 200, 120, 0.6);
}
#customColor,
.pcr-button:hover {
    transform: scale(1.15);
}
@keyframes pulseActive {
    0% { transform: scale(1); box-shadow: 0 0 0 rgba(0, 200, 120, 0); }
50% { transform: scale(1.15); box-shadow: 0 0 10px rgba(0, 200, 120, 0.5); }
100% { transform: scale(1.1); box-shadow: 0 0 6px rgba(0, 200, 120, 0.3); }
}

    .actions { display: flex; gap: 8px; align-items: center; }
.btn {
    appearance: none; border: 1px solid #ddd; background: #fff;
    padding: 8px 12px; border-radius: 4px; cursor: pointer; font-weight: 700;
}
.btn.primary { background-color: var(--green); border-color: var(--green); color: #fff; }
.btn:hover { filter: brightness(0.98); }

.signature-box {
    border-top: 1px solid #eee; padding: 12px 16px;
    display: flex; align-items: center; gap: 12px;
    justify-content: space-between; background: #fafafa;
}
.signature-box label { font-weight: 600; font-size: 14px; min-width: 120px; }
#signatureCanvas {
    width: 220px; height: 60px; background: #fff;
    border: 1px solid #ccc; border-radius: 4px;
    cursor: crosshair; touch-action: none;
}

/* Overlay for final poster */
.overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.7);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    transition: opacity .35s ease; z-index: 9999;
}
.overlay.hidden { opacity: 0; pointer-events: none; }
#finalCanvas {
    max-width: 92vw; max-height: 85vh;
    border: 4px solid #fff; border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,.5); background: #fff;
}
.reveal-download { margin-top: 16px; font-size: 18px; padding: 10px 16px; }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.6);
    display: flex; align-items: center; justify-content: center;
    opacity: 1; transition: opacity .25s ease; z-index: 10000;
}
.modal-overlay.hidden { opacity: 0; pointer-events: none; }
.modal-card {
    width: min(92vw, 460px); background: #fff;
    border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.25);
    padding: 18px;
}
.modal-body h3 { margin: 0 0 6px; font-size: 20px; }
.modal-body p { margin: 0; color: #444; }
.modal-actions {
    margin-top: 16px; display: flex; justify-content: flex-end; gap: 10px;
}
.prompt-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 10px 0 20px;
}
.icon-btn.active {
    background: #bae6fd;
    border-color: #0ea5e9;
    animation: pulse 1s infinite alternate;
}
@keyframes pulse {
    from { box-shadow: 0 0 0 rgba(14,165,233,0.4); }
    to { box-shadow: 0 0 10px rgba(14,165,233,0.6); }
}
.icon-btn.active svg { color: #0369a1; }
.header-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.header-grid .left  { justify-self: start; }
.header-grid .center{ justify-self: center; }
.header-grid .right { justify-self: end; }

@keyframes wiggle {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(-8deg); }
    50% { transform: rotate(8deg); }
    75% { transform: rotate(-4deg); }
    100% { transform: rotate(0deg); }
}
.prompt-text {
    text-align: center;
    font-weight: 600;
}

.reroll-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
    margin-bottom: 20px;
}

.reroll-btn {
    background: #fff;
    border: 1px solid var(--border);
    color: #111;
    font-weight: 500;
    border-radius: 8px;
    padding: 6px 14px;
    transition: all 0.2s ease;
}

.reroll-btn:hover {
    background: #f0f0f0;
    transform: scale(1.03);
}

.reroll-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
@keyframes diceRoll {
    0%   { transform: rotate(0deg) scale(1); }
25%  { transform: rotate(-15deg) scale(1.05); }
50%  { transform: rotate(15deg) scale(1.05); }
75%  { transform: rotate(-10deg) scale(1.02); }
100% { transform: rotate(0deg) scale(1); }
}

    .reroll-btn.roll {
        animation: diceRoll 0.45s ease;
    }
.mode-toggle {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.mode-toggle input[type="checkbox"] {
    transform: scale(1.2);
    cursor: pointer;
}

.canvas-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    margin: 20px auto;
    transition: all 0.3s ease;
}

/* Default layout (no Easy Mode): only canvas centered */
.canvas-container.single {
    flex-direction: column;
    justify-content: center;
}

.canvas-container.single .logo-preview {
    display: none;
}

/* Easy Mode layout: side by side */
.canvas-container.easy-mode {
    flex-direction: row;
    justify-content: center;
}

.canvas-container.easy-mode .logo-preview {
    display: flex;
    width: 300px;
    height: 300px;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transform: scale(1);
}

.logo-preview {
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
    transform: scale(0.95);
}



.logo-preview {
    display: inline-block;
    overflow: visible !important;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
    transform: scale(0.95);
    position: relative;
}

.logo-preview.visible {
    display: flex;
    opacity: 1;
    transform: scale(1);
}

.logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.easy-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
    animation: fadeIn 0.2s ease;
}

.easy-popup .popup-box {
    background: #fff;
    border-radius: 12px;
    padding: 20px 26px;
    text-align: center;
    box-shadow: 0 6px 14px rgba(0,0,0,0.15);
    animation: popIn 0.25s ease;
}

.easy-popup button {
    margin-top: 12px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #f8f8f8;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.easy-popup button:hover {
    background: #e0e0e0;
}
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@keyframes fadeIn {
    from {opacity: 0;}
    to {opacity: 1;}
}
@keyframes popIn {
    from {transform: scale(0.9); opacity: 0;}
    to {transform: scale(1); opacity: 1;}
}

.easy-mode-btn.active {
    background: #eaf3ff;
    border-color: #0078ff;
    box-shadow: 0 0 10px rgba(0,120,255,0.4);
}

.easy-indicator {
    position: absolute;
    top: 14px;
    right: 50px;
    font-size: 13px;
    font-weight: 600;
    color: #0078ff;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.easy-indicator.visible {
    opacity: 1;
}

.easy-popup.fadeout { opacity: 0; transition: opacity 0.2s ease; }

.color-btn.selected {
    outline: 3px solid #000;
    outline-offset: 2px;
    transform: scale(1.1);
    transition: transform 0.15s ease, outline 0.15s ease;
}
#colorPicker.selected {
    outline: 3px solid #000;
    outline-offset: 2px;
    border-radius: 4px;
    transform: scale(1.1);
}

.color.active,
    #customColor.active {
        outline: 3px solid var(--green);
        outline-offset: 2px;
        transform: scale(1.1);
        border-radius: 50%;
        transition: all 0.25s ease;
    }
.color-preview {
    position: fixed;
    pointer-events: none;
    width: 28px;
    height: 28px;
    border: 2px solid #fff;
    border-radius: 50%;
    z-index: 9999;
    transform: translate(-50%, -50%);
    display: none;
}
.eyedropper-hint {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 6px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1000;
}
.eyedropper-hint.visible {
    opacity: 1;
}
.canvas-container.easy-mode .logo-preview {
    animation: fadeIn 0.35s ease;
}
.logo-preview {
    display: none;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
    transform: scale(0.95);
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
.current-color-indicator {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #000;
    margin-left: 8px;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
}
button, .color {
    min-width: 30px;
    min-height: 30px;
}
input[type="range"] {
    touch-action: none;
}
.mobile-eyedropper-hint {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
                          background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 9999;
}
.mobile-eyedropper-hint.visible {
    opacity: 1;
}
