addLayer("sp", {
    name: "super progress", // This is optional, only used in a few places, If absent it just uses the layer id.
    symbol: "‰", // This appears on the layer's node. Default is the id with the first letter capitalized
    position: 1, // Horizontal position within a row. By default it uses the layer id and sorts in alphabetical order
    startData() { return {
        unlocked: false,
		points: new Decimal(0)
    }},
    color: "#107f76",
    requires: 15000, // Can be a function that takes requirement increases into account
    resource: "super progress points", // Name of prestige currency
    baseResource: "points", // Name of resource prestige is based on
    baseAmount() {return player.points}, // Get the current amount of baseResource
    type: "normal", // normal: cost to gain currency depends on amount gained. static: cost depends on how much you already have
    exponent: 0.5, // Prestige currency exponent
    gainMult() { // Calculate the multiplier for main currency from bonuses
        let mult = new Decimal(1)
	    if (hasMilestone('f', 1)) mult = mult.mul(3)
        return mult
    },
    gainExp() { // Calculate the exponent on main currency from bonuses
        return new Decimal(1)
    },
    row: 1, // Row the layer is in on the tree (0 is the first row)
    displayRow: 0,
    hotkeys: [
        {key: "s", description: "S: Reset for super progress points", onPress(){if (canReset(this.layer)) doReset(this.layer)}},
    ],
    onPrestige(gain) {
        if (player.p.points.eq(0)) { player.ach.has45 = true }
    },
    bars: {
        eta: {
            direction: RIGHT,
            width: 300,
            height: 50,
            progress() { return player[this.layer].points.div(getEtaCost()) },
            display() {
                return "Eta - Level " + format(getEtaLevel()) + " (" + format(player[this.layer].points) + "/" + format(getEtaCost())
                    + ")<br>Effect: +" + format(getEtaEffect()) + " to point gen."
            },
            fillStyle: {backgroundColor: "#107f76"}
        },
        theta: {
            direction: RIGHT,
            width: 300,
            height: 50,
            progress() { return player[this.layer].points.div(getThetaCost()) },
            display() {
                return "Theta - Level " + format(getThetaLevel()) + " (" + format(player[this.layer].points) + "/" + format(getThetaCost())
                    + ")<br>Effect: x" + format(getThetaEffect()) + " to PP."
            },
            fillStyle: {backgroundColor: "#107f76"},
            unlocked() { return getEtaLevel().gt(0) }
        },
        iota: {
            direction: RIGHT,
            width: 300,
            height: 50,
            progress() { return player[this.layer].points.div(getIotaCost()) },
            display() {
                return "Iota - Level " + format(getIotaLevel()) + " (" + format(player[this.layer].points) + "/" + format(getIotaCost())
                    + ")<br>Effect: ^" + format(getIotaEffect()) + " to point gen."
            },
            fillStyle: {backgroundColor: "#107f76"},
            unlocked() { return getThetaLevel().gt(0) }
        },
        kappa: {
            direction: RIGHT,
            width: 300,
            height: 50,
            progress() { return player[this.layer].points.div(getKappaCost()) },
            display() {
                return "Kappa - Level " + format(getKappaLevel()) + " (" + format(player[this.layer].points) + "/" + format(getKappaCost())
                    + ")<br>Effect: x" + format(getKappaEffect()) + " to softcap."
            },
            fillStyle: {backgroundColor: "#107f76"},
            unlocked() { return getIotaLevel().gt(0) }
        },
        lambda: {
            direction: RIGHT,
            width: 300,
            height: 50,
            progress() { return player[this.layer].points.div(getLambdaCost()) },
            display() {
                return "Lambda - Level " + format(getLambdaLevel()) + " (" + format(player[this.layer].points) + "/" + format(getLambdaCost())
                    + ")<br>Effect: x" + format(getLambdaEffect()) + " to point gen."
            },
            fillStyle: {backgroundColor: "#107f76"},
            unlocked() { return getKappaLevel().gt(0) }
        },
    },
    buyables: {
        11: {
            title: "Much more progress",
            effect() { return Decimal.div(getBuyableAmount(this.layer, this.id), 20).add(1) },
            cost() { return Decimal.pow(getBuyableAmount(this.layer, this.id), 1.2).mul(3).add(20) },
            display() {
                return "Increase PP gain.<br><br>Amount: " + format(getBuyableAmount(this.layer, this.id))
                    + ".<br>Effect: ^" + format(this.effect(getBuyableAmount(this.layer, this.id))) + ".<br>Cost: "
                    + format(this.cost(getBuyableAmount(this.layer, this.id))) + " total super levels."
            },
            canAfford() { return Decimal.gte(getTotalSuperLevel(), this.cost()) },
            buy() { addBuyables(this.layer, this.id, 1) }
        },
        12: {
            title: "Super point booster",
            effect() { return Decimal.pow(getBuyableAmount(this.layer, this.id), 1.3).add(1) },
            cost() { return Decimal.pow(getBuyableAmount(this.layer, this.id), 1.2).mul(5).add(25) },
            display() {
                return "Increase point gen.<br><br>Amount: " + format(getBuyableAmount(this.layer, this.id))
                    + ".<br>Effect: ^" + format(this.effect(getBuyableAmount(this.layer, this.id))) + ".<br>Cost: "
                    + format(this.cost(getBuyableAmount(this.layer, this.id))) + " total super levels."
            },
            canAfford() { return Decimal.gte(getTotalSuperLevel(), this.cost()) },
            buy() { addBuyables(this.layer, this.id, 1) }
        },
    },
    clickables: {
        11: {
            display() { return "Hold to gain SPP" },
            canClick() { return true },
            onClick() { if (canReset(this.layer)) doReset(this.layer) },
            onHold() { if (canReset(this.layer)) doReset(this.layer) }
        }
    },
    tabFormat: {
        "super levels": {
            content: [
                "main-display",
                ["row", ["prestige-button", ["clickable", 11]]],
                "resource-display",
                ["raw-html", () => "You have " + format(getTotalSuperLevel()) + " super level" + (getTotalSuperLevel().eq(1) ? "" : "s") + "."],
                "blank",
                "blank",
                ["bar", "eta"],
                ["bar", "theta"],
                ["bar", "iota"],
                ["bar", "kappa"],
                ["bar", "lambda"],
            ]
        },
        "super buyables": {
            content: [
                "main-display",
                ["row", ["prestige-button", ["clickable", 11]]],
                "resource-display",
                ["raw-html", () => "You have " + format(getTotalSuperLevel()) + " super level" + (getTotalSuperLevel().eq(1) ? "" : "s") + "."],
                "blank",
                "blank",
                "buyables",
            ],
            unlocked() { return getTotalSuperLevel().gte(18) }
        },
    },
    layerShown(){ return player.points.gte(10000) || player[this.layer].unlocked },
    branches: ['p'],
})