html {
            overflow: hidden;
        }

        :root {
            --scroll-width: 300px;
            --scroll-height-collapsed: 62px;
            --scroll-height-unrolled: 600px;
            --font-size: 1.2em;
            --header-height: 55px;
        }

        body {
            display: flex;
            flex-direction: column;
            align-items: center;
            min-height: 100vh;
            background-color: #f2e9d8;
            margin: 0;
            font-family: 'Times New Roman', serif;
            overflow: hidden;
        }

        .header-bar {
            width: 100%;
            background: linear-gradient(to bottom, #f9f0e1, #e9d5b7);
            border: 1px solid #7a5e3e;
            padding: 10px 0;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
            box-sizing: border-box; /* Make height calculation predictable */
            height: var(--header-height);
            display: flex;
            justify-content: center;
            align-items: center;
        }

        h1 {
            font-family: 'Gabriola', cursive;
            font-size: 2.1em;
            color: #4a3a2a;
            text-align: center;
            margin: 0;
        }

        .scroll-gallery {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 50px;
            height: calc(100vh - var(--header-height));
            overflow-y: auto;
            padding: 50px;
            box-sizing: border-box;
            scrollbar-width: none;
            /* Firefox */
            -ms-overflow-style: none;
            /* IE and Edge */
            width: 100%;
            max-width: 500px;
        }

        .scroll-gallery::-webkit-scrollbar {
            display: none;
            /* Chrome, Safari, and Opera */
        }

        .scroll-container {
            position: relative;
            width: var(--scroll-width);
            height: var(--scroll-height-collapsed);
            cursor: pointer;
            display: flex;
            justify-content: center;
            align-items: center;
            transition: all 0.8s ease-in-out;
            flex-shrink: 0;
        }

        /* Focus Mode: Other scrolls fade out */
        .scroll-gallery.gallery-focused .scroll-container:not(.selected):not(.is-animating) {
            opacity: 0;
            transform: scale(0.8);
            pointer-events: none;
        }

        /* Focus Mode: Selected scroll moves to center */
        .scroll-gallery.gallery-focused .scroll-container.selected {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 10;
        }

        .scroll-body {
            position: absolute;
            width: calc(var(--scroll-width) - 40px);
            height: 0;
            top: 0;
            background: linear-gradient(to bottom, #f9f0e1, #e9d5b7);
            border: 1px solid #c4a781;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
            border-radius: 5px;
            transform-origin: top center;
            z-index: 2;
            padding: 0 20px;
            box-sizing: border-box;
            overflow: hidden;
            opacity: 0;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .scroll-edge {
            position: absolute;
            width: var(--scroll-width);
            height: 25px;
            background-color: #a0815b;
            border: 2px solid #7a5e3e;
            border-radius: 5px;
            z-index: 3;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
        }

        .scroll-top {
            top: 0;
        }

        .scroll-bottom {
            bottom: 0;
        }

        .fortune-content {
            width: calc(100% - 40px);
            color: #4a3a2a;
            font-size: var(--font-size);
            text-align: center;
            line-height: 1.6;
            font-family: 'Gabriola', cursive;
            opacity: 0;
            transition: opacity 0.5s ease 0.8s;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }

        .author-placeholder {
            text-align: right;
            font-size: 1em;
            margin-top: 10px;
        }

        .text-placeholder {
            width: 100%;
            border: none;
            color: #414141;
            display: flex;
            justify-content: center;
            align-items: center;
            font-style: italic;
        }

        /* Animation states */
        .scroll-container.unrolled {
            height: var(--scroll-height-unrolled);
        }

        .scroll-container.closing {
            height: var(--scroll-height-collapsed);
        }

        .scroll-container.unrolled .scroll-body,
        .scroll-container.closing .scroll-body {
            transition: transform 2s ease-in-out, opacity 2s ease-in-out, padding 2s ease-in-out;
        }

        .scroll-container.unrolled .scroll-body {
            height: 100%;
            opacity: 1;
            transform: scaleY(1);
            padding-top: 20px;
            padding-bottom: 20px;
        }

        .scroll-container.unrolled .fortune-content {
            opacity: 1;
        }

        .scroll-container.unrolled .prompt {
            opacity: 0;
        }

        .scroll-container.closing .scroll-body {
            transform: scaleY(0);
            opacity: 0;
            padding-top: 0;
            padding-bottom: 0;
        }

        .scroll-container.closing .fortune-content {
            opacity: 0;
        }