/* ============================================================
   Stickman Clicker — tema "cuaderno de dibujo"
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Kalam:wght@400;700&family=Space+Grotesk:wght@400;500;700&display=swap');

:root {
    --paper: #eaf0ee;
    --paper-edge: #dbe4e0;
    --grid-line: #c7d6d1;
    --ink: #21261f;
    --ink-soft: #4d554a;
    --accent-red: #e0522f;
    --accent-green: #2f9469;
    --accent-yellow: #f2b632;
    --paper-shadow: rgba(33, 38, 31, 0.18);

    --font-hand: 'Kalam', cursive;
    --font-ui: 'Space Grotesk', sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px 80px;
    font-family: var(--font-ui);
    color: var(--ink);
    background-color: var(--paper);
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 28px 28px;
    transition: background-color 0.6s ease;
}

/* -------------------- notebook card -------------------- */

.page {
    width: 100%;
    max-width: 460px;
}

.notebook {
    position: relative;
    background: #fbfdfc;
    border: 2px solid var(--ink);
    border-radius: 3px;
    padding: 28px 26px 24px;
    box-shadow: 8px 8px 0 var(--paper-shadow);
    transform: rotate(-0.4deg);
}

.notebook::before {
    /* spiral binding holes, left margin */
    content: "";
    position: absolute;
    top: 18px;
    bottom: 18px;
    left: 10px;
    width: 6px;
    background-image: radial-gradient(circle, var(--ink) 2px, transparent 2.5px);
    background-size: 6px 22px;
    background-repeat: repeat-y;
    opacity: 0.55;
}

header {
    text-align: center;
    margin-bottom: 18px;
    padding-left: 10px;
}

h1 {
    font-family: var(--font-hand);
    font-weight: 700;
    font-size: 2.3rem;
    margin: 4px 0 0;
    line-height: 1;
}

.squiggle {
    display: block;
    width: 150px;
    height: 14px;
    margin: 6px auto 2px;
}

.subtitle {
    font-family: var(--font-hand);
    font-size: 1.05rem;
    color: var(--ink-soft);
    margin: 2px 0 0;
}

/* -------------------- sticky-note stats -------------------- */

.stats-row {
    display: flex;
    gap: 14px;
    justify-content: center;
    margin: 20px 0 6px;
    padding-left: 10px;
}

.sticky {
    flex: 1;
    max-width: 150px;
    padding: 10px 8px 8px;
    text-align: center;
    font-family: var(--font-ui);
    border-radius: 2px;
    box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.08);
    transform: rotate(-1.5deg);
}

.sticky:nth-child(2) {
    transform: rotate(1.5deg);
}

.sticky .sticky-label {
    display: block;
    font-size: 0.72rem;
    color: var(--ink-soft);
    margin-bottom: 2px;
}

.sticky .sticky-value {
    font-size: 1.35rem;
    font-weight: 700;
}

.sticky-stage {
    background: var(--accent-yellow);
}

.sticky-score {
    background: #cdeadd;
}

/* -------------------- stickman stage -------------------- */

.stage-wrap {
    position: relative;
    display: flex;
    justify-content: center;
    margin: 14px auto 6px;
    padding-left: 10px;
}

.click-target {
    position: relative;
    width: 190px;
    height: 190px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

.target-ring {
    position: absolute;
    inset: 0;
    border: 2px dashed var(--ink-soft);
    border-radius: 50%;
    opacity: 0.5;
}

#stickman {
    position: relative;
    width: 100%;
    height: 100%;
    color: var(--ink);
    transition: color 0.5s ease;
}

#stickman .accessory {
    display: none;
}

.stage-2 #stickman { color: var(--accent-green); }
.stage-2 #stickman .accessory-2 { display: inline; }

.stage-3 #stickman { color: var(--accent-red); }
.stage-3 #stickman .accessory-3 { display: inline; }

.stage-4 #stickman,
.stage-5 #stickman { color: #8a4fd1; }
.stage-4 #stickman .accessory-4,
.stage-5 #stickman .accessory-4 { display: inline; }

.click-animation #stickman {
    animation: bounce 0.28s ease;
}

@keyframes bounce {
    0% { transform: translateY(0) scale(1); }
    45% { transform: translateY(-14px) scale(1.06); }
    100% { transform: translateY(0) scale(1); }
}

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

.ink-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-red);
    transform: translate(-50%, -50%);
    animation: burst 0.5s ease-out forwards;
}

@keyframes burst {
    to {
        transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.3);
        opacity: 0;
    }
}

.click-hint {
    text-align: center;
    font-family: var(--font-hand);
    color: var(--ink-soft);
    font-size: 0.95rem;
    margin: 0 0 6px;
    padding-left: 10px;
}

.click-value-line {
    text-align: center;
    font-size: 1.05rem;
    margin: 4px 0 22px;
    padding-left: 10px;
}

.click-value-line strong {
    font-size: 1.3rem;
    color: var(--accent-red);
}

/* -------------------- upgrades list -------------------- */

.section-label {
    font-family: var(--font-hand);
    font-size: 1.3rem;
    margin: 0 0 10px 10px;
    position: relative;
}

.upgrades {
    list-style: none;
    margin: 0 0 18px;
    padding: 0 0 0 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ticket {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #fff;
    border: 1.5px solid var(--ink);
    border-radius: 2px;
    padding: 12px 14px;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    position: relative;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 3px 3px 0 var(--ink);
}

.ticket::before {
    content: "";
    position: absolute;
    left: -1.5px;
    top: 50%;
    width: 10px;
    height: 10px;
    background: var(--paper);
    border: 1.5px solid var(--ink);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.ticket:hover {
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 var(--ink);
}

.ticket:active {
    transform: translate(0, 0);
    box-shadow: 1px 1px 0 var(--ink);
}

.ticket-title {
    font-weight: 500;
}

.ticket-cost {
    font-family: var(--font-ui);
    font-weight: 700;
    white-space: nowrap;
    color: var(--ink-soft);
    border-left: 1.5px dashed var(--ink);
    padding-left: 10px;
}

.autoclicker-count {
    margin: 2px 0 0 10px;
    font-size: 0.85rem;
    color: var(--ink-soft);
}

.stage-button {
    display: block;
    width: calc(100% - 10px);
    margin: 4px 0 22px 10px;
    padding: 13px 16px;
    background: var(--ink);
    color: var(--paper);
    border: none;
    border-radius: 2px;
    font-family: var(--font-hand);
    font-size: 1.15rem;
    cursor: pointer;
    box-shadow: 3px 3px 0 var(--accent-yellow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stage-button:hover {
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 var(--accent-yellow);
}

.stage-button:active {
    transform: translate(0, 0);
    box-shadow: 1px 1px 0 var(--accent-yellow);
}

/* -------------------- footer controls -------------------- */

.save-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding-left: 10px;
    flex-wrap: wrap;
}

.save-row button {
    flex: 1;
    min-width: 92px;
    padding: 9px 10px;
    font-family: var(--font-ui);
    font-size: 0.82rem;
    background: transparent;
    border: 1.5px solid var(--ink-soft);
    border-radius: 20px;
    color: var(--ink-soft);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.save-row button:hover {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
}

.changelog-tab {
    display: block;
    width: fit-content;
    margin: 18px auto 0;
    padding: 6px 14px;
    font-family: var(--font-hand);
    font-size: 0.95rem;
    color: var(--ink-soft);
    text-decoration: none;
    border-bottom: 1.5px dashed var(--ink-soft);
}

.changelog-tab:hover {
    color: var(--accent-red);
    border-color: var(--accent-red);
}

.version-tag {
    text-align: center;
    font-family: var(--font-ui);
    font-size: 0.72rem;
    color: var(--ink-soft);
    margin-top: 10px;
    letter-spacing: 0.02em;
}

/* -------------------- accessibility -------------------- */

button:focus-visible,
a:focus-visible {
    outline: 3px solid var(--accent-red);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .click-animation #stickman,
    .ink-dot {
        animation: none !important;
    }
    .ticket,
    .stage-button {
        transition: none;
    }
}

/* -------------------- responsive -------------------- */

@media (max-width: 420px) {
    .notebook {
        padding: 24px 18px 20px;
    }
    h1 {
        font-size: 1.9rem;
    }
    .click-target {
        width: 160px;
        height: 160px;
    }
}
