h2.recent-calculations+p {
    font-size: 0.9rem;
}

h2.recent-calculations {
    font-size: 1.5rem;
}

:root {
    --bg-1: #fff4d6;
    --bg-2: #f7df82;
    --card: rgba(255, 255, 255, 0.74);
    --ink: #1d1b16;
    --muted: #6d685c;
    --accent: #f4b400;
    --accent-strong: #df9300;
    --line: rgba(29, 27, 22, 0.14);
    --ok: #1f7a2f;
    --sticky-size: 182px;
    --shell-gap: clamp(0.35rem, 0.9vw, 0.65rem);
    --footer-gap: clamp(0.5rem, 1vw, 0.8rem);
    --header-h: 52px;
    --footer-h: 52px;
    --header-gap: clamp(0.25rem, 0.6vw, 0.4rem);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
}

.site-header {
    width: 100%;
    height: var(--header-h);
    flex-shrink: 0;
    background: var(--accent);
    border-bottom: 2px solid var(--accent-strong);
    margin-bottom: var(--header-gap);
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
}

.header-avatar {
    width: calc(var(--header-h) - 13px);
    height: calc(var(--header-h) - 13px);
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--ink);
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.auth-btn {
    margin-left: auto;
    padding: 0.28rem 0.9rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.85);
    border: 1.5px solid var(--accent-strong);
    color: var(--ink);
    cursor: pointer;
    white-space: nowrap;
    min-height: unset;
    max-height: unset;
}

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 3500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-modal.open {
    display: flex;
}

.auth-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(255, 244, 186, 0.72);
}

.auth-card {
    position: relative;
    z-index: 1;
    width: min(420px, 100%);
    padding: 1.15rem;
    border-radius: 16px;
    display: grid;
    gap: 0.6rem;
    background: #fff3bf;
}

.auth-close {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    width: 1.6rem;
    min-height: 1.6rem;
    max-height: 1.6rem;
    border-radius: 999px;
    padding: 0;
    background: #ffe287;
    border: 1.5px solid #00000040;
}

.auth-subtitle {
    font-size: 0.9rem;
    margin-top: -0.1rem;
}

.auth-form {
    display: grid;
    gap: 0.35rem;
}

.auth-form label {
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 700;
}

.auth-form input+label {
    margin-top: 0.6rem;
}

.auth-form input {
    width: 100%;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    padding: 0.55rem 0.62rem;
    color: var(--ink);
    background: #ffffff;
    outline: none;
}

.auth-form input:focus {
    border-color: var(--accent-strong);
}

.auth-submit,
.auth-google,
.auth-switch {
    width: 100%;
}

.auth-submit {
    background: rgba(255, 230, 159, 0.85);
    border: 1.5px solid rgba(29, 27, 22, 0.12);
    color: var(--ink);
    margin-top: 0.65rem;
}

.auth-google {
    background: var(--accent);
    border-color: var(--accent-strong);
    color: var(--ink);
}

.auth-switch {
    background: transparent;
    border: 0;
    color: var(--ink);
    text-decoration: underline;
    padding: 0;
    min-height: 28px;
    max-height: none;
}

.site-footer {
    width: 100%;
    height: var(--footer-h);
    flex-shrink: 0;
    margin-top: var(--footer-gap);
    background: var(--accent);
    border-top: 2px solid var(--accent-strong);
    position: relative;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 0.9rem;
}

.footer-left-text {
    color: var(--ink);
    font-size: 0.85rem;
    font-weight: 700;
}

.footer-copyright-symbol {
    font-weight: 900;
}

body {
    min-height: 100dvh;
    color: var(--ink);
    background: #fff6bf;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow-x: hidden;
    overflow-y: hidden;
}

.shell {
    width: min(1700px, 100%);
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: var(--shell-gap);
    margin-bottom: 0;
    height: calc(100dvh - var(--header-h) - var(--header-gap) - var(--footer-h) - var(--footer-gap));
    max-height: calc(100dvh - var(--header-h) - var(--header-gap) - var(--footer-h) - var(--footer-gap));
    display: grid;
    grid-template-columns: minmax(0, 280px) minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "history center board";
    align-items: stretch;
    gap: 0.5rem;
}

.center-column {
    grid-area: center;
    display: grid;
    gap: 0.55rem;
    grid-template-rows: auto 1fr;
    align-content: stretch;
    min-height: 0;
}

.panel {
    background: var(--card);
    backdrop-filter: blur(10px);
    border: 2px solid var(--line);
    border-radius: 18px;
}

.calculator {
    padding: 0.55rem;
    width: 100%;
    max-width: 680px;
    min-width: 0;
    justify-self: center;
}

.headline {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.45rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: Arial, Helvetica, sans-serif !important;
    font-weight: bold;
}

h1 {
    font-size: 1.5rem;
    letter-spacing: 0.4px;
}

/* Unified subtext color for consistency */
.tag,
p,
small,
.muted,
.subtext {
    color: var(--muted) !important;
}

.tag {
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.display {
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    padding: 0.45rem 0.65rem;
    margin-bottom: 0.55rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.expression {
    flex: 1;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-size: clamp(1rem, 2.6vw, 0.9rem);
    font-family: inherit;
    outline: none;
}

.result {
    text-align: right;
    font-size: clamp(1rem, 3vw, 1.35rem);
    font-weight: 700;
    word-break: break-word;
    white-space: nowrap;
}

.grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

button {
    border: 0;
    border-radius: 10px;
    min-height: 34px;
    max-height: 50px;
    padding: 0.3rem 0.5rem;
    font: inherit;
    font-size: clamp(0.74rem, 0.95vw, 0.88rem);
    font-weight: 600;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.85);
    border: 1.5px solid rgba(29, 27, 22, 0.12);
    cursor: pointer;
    transition: transform 0.08s ease, background-color 0.16s ease;
}

button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: translateY(1px);
}

.op {
    background: rgba(255, 230, 159, 0.85);
}

.major {
    background: var(--accent);
    color: #251f0f;
    font-weight: 700;
}

.wide {
    grid-column: span 2;
}

.board {
    padding: 0.55rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    grid-area: board;
    overflow: hidden;
    min-height: 0;
}

.history-panel {
    padding: 0.55rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    grid-area: history;
    overflow: hidden;
    align-self: stretch;
    min-height: 0;
}

.notes-space {
    position: relative;
    min-height: 120px;
    display: grid;
    align-content: start;
    padding: 0.55rem;
    padding-bottom: 0.75rem;
    overflow: visible;
    align-self: stretch;
}

.notes-space h2 {
    font-size: 1.5rem;
    margin-top: -0.5rem;
}

.notes-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.add-sticky-btn {
    width: 40px;
    min-height: 40px;
    height: 40px;
    border-radius: 999px;
    font-size: 1.35rem;
    line-height: 1;
    font-weight: 700;
    background: #ffe287;
    border: 1.5px solid rgba(29, 27, 22, 0.2);
}

.notes-slots {
    position: static;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: flex-start;
    gap: 0.4rem;
    width: min(calc(var(--sticky-size) * 3 + 0.8rem), 100%);
    margin: 0.5rem auto 0.8rem;
    z-index: 1;
    pointer-events: none;
}

.note-slot {
    flex: 0 0 var(--sticky-size);
    width: var(--sticky-size);
    height: var(--sticky-size);
    border-radius: 10px;
}

.note-slot::before {
    content: "";
    display: block;
    width: 100%;
    height: 100%;
    border: 2px solid transparent;
    border-radius: 16px;
    opacity: 0;
}

.sticky-layer {
    position: absolute;
    inset: 0 0 auto 0;
    overflow: visible;
    z-index: 2000;
    pointer-events: none;
}

.sticky-note {
    position: absolute;
    width: var(--sticky-size);
    height: var(--sticky-size);
    background: #ffe084;
    border: 1.5px solid rgba(74, 64, 36, 0.24);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    touch-action: none;
    pointer-events: auto;
    margin: 0;
    cursor: pointer;
}

.sticky-note.pop-in {
    animation: sticky-pop 0.24s ease-out;
}

@keyframes sticky-pop {
    from {
        opacity: 0;
        transform: translateY(-12px) scale(0.62);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.sticky-note.dragging {
    cursor: move;
}

.sticky-remove {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    width: 1.2rem;
    height: 1.2rem;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    display: grid;
    place-items: center;
    padding: 0;
    z-index: 2;
}

.sticky-note.color-yellow {
    background: #ffe17b;
}

.sticky-drag-zone {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2rem;
    cursor: pointer;
}

.sticky-input {
    flex: 1;
    border: 0;
    resize: none;
    padding: 2.3rem 0.68rem 0.68rem;
    font: 600 0.9rem/1.4 Arial, Helvetica, sans-serif;
    color: var(--ink);
    background: transparent;
    outline: none;
}

.notes-space p {
    color: var(--muted);
    font-size: 0.9rem;
    max-width: 65ch;
    margin-top: -0.3rem;
}

.board h2 {
    font-family: "Fraunces", serif;
    font-size: 1.5rem;
}

.board p {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.3rem;
}

.tools label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--muted);
}

.tools input[type="color"] {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1.5px solid var(--line);
    background: #fff;
    cursor: pointer;
}

.tools input[type="range"] {
    width: 100px;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
}

.tools input[type="range"]::-webkit-slider-runnable-track {
    height: 8px;
    background: #ffffff;
    border: 1.5px solid var(--line);
    border-radius: 999px;
}

.tools input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    margin-top: -5px;
    border-radius: 999px;
    border: 1.5px solid rgba(106, 79, 10, 0.35);
    background: var(--accent-strong);
}

.tools input[type="range"]::-moz-range-track {
    height: 8px;
    background: #ffffff;
    border: 1.5px solid var(--line);
    border-radius: 999px;
}

.tools input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 1.5px solid rgba(106, 79, 10, 0.35);
    background: var(--accent-strong);
}

.tool-btn {
    min-height: 36px;
    padding: 0.45rem 0.8rem;
    font-size: 0.9rem;
    border: 1.5px solid var(--line);
    background: rgba(255, 255, 255, 0.9);
}

.tool-btn.active {
    background: var(--accent);
    border-color: var(--accent-strong);
}

.board-wrap {
    flex: 1;
    border: 1.5px solid var(--line);
    border-radius: 14px;
    padding: 0.35rem;
    background: rgba(255, 255, 255, 0.82);
    min-height: 90px;
}

.whiteboard {
    width: 100%;
    height: 100%;
    min-height: 70px;
    display: block;
    background: #ffffff;
    border-radius: 10px;
    touch-action: none;
    cursor: crosshair;
}

.shape-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    padding-top: 0.3rem;
}

.history-list {
    list-style: none;
    display: grid;
    gap: 0.24rem;
    max-height: clamp(170px, 32vh, 320px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.2rem;
}

.history-list li {
    position: relative;
    border: 1.5px solid var(--line);
    border-radius: 7px;
    padding: 0.20rem 1.4rem 0.14rem 0.35rem;
    background: rgba(255, 255, 255, 0.75);
}

.history-remove {
    position: absolute;
    top: 50%;
    right: 0.25rem;
    transform: translateY(-50%);
    width: 1rem;
    min-height: 1rem;
    max-height: 1rem;
    padding: 0;
    border-radius: 999px;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-size: 0.85rem;
    line-height: 1;
    transition: none;
}

.history-remove:hover {
    color: var(--ink);
    transform: translateY(-50%);
}

.item-exp {
    font-size: 0.66rem;
    color: var(--muted);
    display: block;
    overflow-wrap: anywhere;
    line-height: 1.15;
}

.item-res {
    margin-top: 0;
    font-size: 0.76rem;
    font-weight: 700;
    display: block;
    overflow-wrap: anywhere;
    line-height: 1.15;
}

@media (max-width: 1280px) {
    .shell {
        gap: 0.5rem;
    }
}

@media (max-width: 1360px) {
    :root {
        --sticky-size: 148px;
    }

    .shell {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) minmax(0, 0.72fr);
        grid-template-areas:
            "center board"
            "history history";
    }

    .history-list {
        max-height: clamp(120px, 20vh, 170px);
    }

    .board-wrap {
        min-height: clamp(150px, 28vh, 220px);
    }

    .whiteboard {
        min-height: clamp(130px, 24vh, 190px);
    }
}

@media (max-width: 1120px) {
    body {
        height: auto;
        min-height: 100dvh;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .shell {
        flex: none;
        height: auto;
        max-height: none;
        grid-template-columns: 1fr;
        grid-template-areas:
            "center"
            "history"
            "board";
        padding-bottom: clamp(0.45rem, 1.2vw, 0.9rem);
        margin-bottom: 0;
    }

    .center-column {
        grid-template-rows: auto auto;
    }

    .calculator {
        max-width: 100%;
    }

    .notes-space {
        min-height: calc(var(--sticky-size) + 5.6rem);
        overflow: visible;
        align-self: auto;
    }

    .history-list {
        max-height: clamp(170px, 32vh, 240px);
    }

    .board-wrap {
        min-height: clamp(220px, 44vh, 320px);
    }

    .whiteboard {
        min-height: clamp(190px, 40vh, 290px);
    }
}

@media (max-width: 920px) {
    .board-wrap {
        min-height: clamp(220px, 44vh, 320px);
    }

    .whiteboard {
        min-height: clamp(190px, 40vh, 290px);
    }

    .history-list {
        max-height: clamp(170px, 32vh, 240px);
    }
}

@media (max-width: 640px) {
    :root {
        --sticky-size: 142px;
    }

    .panel,
    .board-wrap {
        border-radius: 16px;
    }

    .calculator,
    .history-panel,
    .board,
    .notes-space {
        padding: 0.6rem;
    }

    .notes-space {
        min-height: calc(var(--sticky-size) + 5rem);
    }

    .grid {
        gap: 0.38rem;
    }

    button {
        min-height: 36px;
        font-size: 0.82rem;
    }

    .tools input[type="range"] {
        width: 90px;
    }

    .board-wrap {
        min-height: clamp(190px, 40vh, 260px);
        padding: 0.4rem;
    }

    .auth-card {
        padding: 0.95rem;
    }

    .whiteboard {
        min-height: clamp(170px, 36vh, 240px);
    }

    .notes-slots {
        bottom: -3rem;
        gap: 0.3rem;
    }

    .note-slot,
    .sticky-note {
        height: var(--sticky-size);
    }
}

@media (max-height: 860px) {
    :root {
        --shell-gap: clamp(0.25rem, 0.6vw, 0.45rem);
        --footer-gap: clamp(0.35rem, 0.7vw, 0.45rem);
        --sticky-size: 164px;
    }

    .board-wrap {
        min-height: 80px;
    }

    .whiteboard {
        min-height: 64px;
    }

    .history-list {
        max-height: clamp(130px, 26vh, 240px);
    }

    button {
        min-height: 32px;
        font-size: clamp(0.7rem, 0.9vw, 0.84rem);
    }
}

@media (max-height: 720px) {
    :root {
        --sticky-size: 146px;
        --header-h: 46px;
        --footer-h: 46px;
    }

    .shell {
        max-height: calc(100dvh - var(--header-h) - var(--footer-h) - var(--footer-gap));
    }

    .history-list {
        max-height: clamp(110px, 22vh, 180px);
    }

    .notes-space {
        min-height: calc(var(--sticky-size) + 3.6rem);
    }
}