* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Garamond', 'Cormorant Garamond', 'Iowan Old Style', 'Palatino Linotype', 'Baskerville', 'Libre Baskerville', serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background-color 1s ease;
    position: relative;
    overflow-x: hidden;
    padding: 1.5rem 2rem 2rem;
    background-image:
        radial-gradient(ellipse at top, rgba(0,0,0,0) 0%, rgba(0,0,0,0.03) 100%),
        radial-gradient(ellipse at bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.05) 100%);
}

/* Film-like grain texture overlay */
.grain-overlay {
    position: fixed;
    top: -5%;
    left: -5%;
    width: 110%;
    height: 110%;
    pointer-events: none;
    opacity: 0.18;
    z-index: 1000;
    background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 400 400" xmlns="http://www.w3.org/2000/svg"><filter id="noiseFilter"><feTurbulence type="fractalNoise" baseFrequency="3.5" numOctaves="4" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noiseFilter)"/></svg>');
    animation: grain 0.4s steps(4) infinite;
    mix-blend-mode: multiply;
}

@keyframes grain {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-2%, -2%); }
    20% { transform: translate(2%, 2%); }
    30% { transform: translate(-2%, 2%); }
    40% { transform: translate(2%, -2%); }
    50% { transform: translate(-1%, 1%); }
    60% { transform: translate(1%, -1%); }
    70% { transform: translate(-1%, -1%); }
    80% { transform: translate(1%, 1%); }
    90% { transform: translate(0, -1%); }
}

/* Header */
header {
    text-align: center;
    margin-bottom: 1.5rem;
    z-index: 1;
    position: relative;
    max-width: 800px;
}

.site-title {
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: 0.2em;
    color: rgba(60, 45, 30, 0.75);
    margin-bottom: 0.5rem;
    font-style: normal;
    text-transform: uppercase;
    font-family: 'Cormorant Garamond', 'Garamond', serif;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.tagline {
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    color: rgba(100, 80, 60, 0.5);
    font-weight: 300;
    font-style: italic;
    text-transform: lowercase;
}

/* Matrix Wrapper and Alphabet Border */
.matrix-wrapper {
    position: relative;
    z-index: 1;
}

.alphabet-border {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-family: 'Century Schoolbook', 'Georgia', 'Palatino Linotype', 'Palatino', 'Baskerville', serif;
    font-size: 1.1rem;
    font-weight: 500;
    color: rgba(60, 45, 30, 0.20);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.4);
    pointer-events: none;
    user-select: none;
}

.alphabet-top {
    margin-bottom: 0.25rem;
}

.alphabet-bottom {
    margin-top: 0.25rem;
}

/* Footer */
footer {
    margin-top: 2.5rem;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    align-items: center;
    justify-content: center;
}

.footer-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.credit {
    font-size: 0.75rem;
    color: rgba(100, 80, 60, 0.5);
    font-style: italic;
    letter-spacing: 0.05em;
    margin: 0;
}

.credit a {
    color: rgba(100, 80, 60, 0.7);
    text-decoration: none;
    transition: color 0.3s ease;
    border-bottom: 1px solid rgba(100, 80, 60, 0.2);
}

.credit a:hover {
    color: rgba(60, 45, 30, 0.9);
    border-bottom-color: rgba(60, 45, 30, 0.5);
}

.reload-button,
.info-button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1.5px solid rgba(139, 115, 85, 0.25);
    background: rgba(232, 227, 214, 0.5);
    color: rgba(100, 80, 60, 0.7);
    font-size: 1.3rem;
    font-family: 'Garamond', serif;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(12px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.reload-button:hover,
.info-button:hover {
    background: rgba(232, 227, 214, 0.8);
    color: rgba(60, 45, 30, 0.9);
    transform: scale(1.08);
    border-color: rgba(139, 115, 85, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.reload-button:active {
    transform: scale(0.95);
}

.reload-icon {
    display: inline-block;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reload-button:hover .reload-icon {
    transform: rotate(180deg);
}

.reload-button.spinning .reload-icon {
    animation: spin 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Info Popover */
.info-popover {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    max-width: 540px;
    width: 90%;
    background: linear-gradient(135deg, rgba(244, 241, 234, 0.98), rgba(238, 234, 225, 0.98));
    backdrop-filter: blur(25px);
    padding: 3rem 2.5rem 2.5rem;
    border-radius: 8px;
    border: 1px solid rgba(139, 115, 85, 0.15);
    box-shadow:
        0 20px 60px rgba(60, 45, 30, 0.25),
        0 8px 20px rgba(60, 45, 30, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.info-popover.active {
    opacity: 1;
    pointer-events: all;
    transform: translate(-50%, -50%) scale(1);
}

.info-popover h3 {
    font-size: 1.75rem;
    font-weight: 300;
    margin-bottom: 1.75rem;
    color: rgba(60, 45, 30, 0.85);
    font-family: 'Cormorant Garamond', 'Garamond', serif;
    letter-spacing: 0.05em;
}

.info-popover p {
    font-size: 1.05rem;
    line-height: 1.8;
    color: rgba(80, 65, 50, 0.8);
    margin-bottom: 1.25rem;
}

.info-popover .refresh-hint {
    font-size: 0.95rem;
    font-style: italic;
    color: rgba(100, 80, 60, 0.6);
    margin-top: 2rem;
    margin-bottom: 0;
    text-align: center;
}

.close-button {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    font-size: 2rem;
    line-height: 1;
    color: rgba(100, 80, 60, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-button:hover {
    color: rgba(60, 45, 30, 0.8);
    transform: scale(1.15);
}

.container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3rem;
    padding: 3rem;
    z-index: 1;
    max-width: 1200px;
    width: 90vw;
}

.word-column {
    display: flex;
    justify-content: center;
    align-items: center;
}

.word-box {
    padding: 4.5rem 3.5rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 12px 35px rgba(60, 45, 30, 0.15),
        0 4px 12px rgba(60, 45, 30, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05);
    width: 100%;
    min-height: 300px;
    position: relative;
    backdrop-filter: blur(2px);
    background-image:
        linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(0, 0, 0, 0.02) 100%);
    cursor: pointer;
    user-select: none;
}

.word-box::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 4px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(0, 0, 0, 0.1));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.4;
    pointer-events: none;
}

.word-box:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow:
        0 18px 50px rgba(60, 45, 30, 0.22),
        0 8px 20px rgba(60, 45, 30, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -1px 0 rgba(0, 0, 0, 0.08);
}

.word-box:active {
    transform: translateY(-3px) scale(0.99);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.word-box.updating {
    animation: pulse 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pulse {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-3px) scale(0.98);
    }
}

.word-label {
    display: none;
}

.word {
    font-size: 2.75rem;
    font-weight: 300;
    text-align: center;
    letter-spacing: 0.04em;
    line-height: 1.3;
    word-wrap: break-word;
    max-width: 100%;
    font-family: 'Cormorant Garamond', 'Garamond', serif;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

@media (max-width: 1024px) {
    body {
        padding: 1rem 1.5rem 1.5rem;
    }

    header {
        margin-bottom: 1.5rem;
    }

    .site-title {
        font-size: 1.85rem;
    }

    .tagline {
        font-size: 0.75rem;
    }

    .alphabet-border {
        font-size: 1rem;
    }

    .alphabet-top {
        margin-bottom: 0.25rem;
    }

    .alphabet-bottom {
        margin-top: 0.25rem;
    }

    .container {
        gap: 2.5rem;
        padding: 0;
        width: 95vw;
    }

    .word-box {
        padding: 3.5rem 2.5rem;
        min-height: 260px;
    }

    .word {
        font-size: 2.25rem;
    }

    .reload-button,
    .info-button {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }
}

@media (max-width: 768px) {
    body {
        padding: 0.75rem 1rem 1.25rem;
    }

    header {
        margin-bottom: 1.25rem;
    }

    .site-title {
        font-size: 1.65rem;
        letter-spacing: 0.15em;
    }

    .tagline {
        font-size: 0.7rem;
    }

    .alphabet-border {
        font-size: 0.9rem;
    }

    .alphabet-top {
        margin-bottom: 0.2rem;
    }

    .alphabet-bottom {
        margin-top: 0.2rem;
    }

    .container {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 0;
    }

    .word-box {
        padding: 3.5rem 2.5rem;
        min-height: 240px;
    }

    .word {
        font-size: 2rem;
    }

    footer {
        margin-top: 2rem;
        gap: 1rem;
    }

    .reload-button,
    .info-button {
        width: 42px;
        height: 42px;
        font-size: 1.15rem;
    }

    .credit {
        font-size: 0.7rem;
    }

    .info-popover {
        padding: 2.5rem 2rem 2rem;
    }

    .info-popover h3 {
        font-size: 1.5rem;
    }

    .info-popover p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.5rem 0.75rem 1rem;
    }

    header {
        margin-bottom: 1rem;
    }

    .site-title {
        font-size: 1.5rem;
        letter-spacing: 0.15em;
    }

    .tagline {
        font-size: 0.65rem;
        letter-spacing: 0.15em;
    }

    .alphabet-border {
        font-size: 0.75rem;
    }

    .alphabet-top {
        margin-bottom: 0.2rem;
    }

    .alphabet-bottom {
        margin-top: 0.2rem;
    }

    .container {
        padding: 0;
        gap: 1.5rem;
    }

    .word-box {
        padding: 3rem 2rem;
        min-height: 200px;
    }

    .word {
        font-size: 1.75rem;
    }

    footer {
        margin-top: 1.5rem;
        gap: 0.85rem;
    }

    .reload-button,
    .info-button {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .credit {
        font-size: 0.65rem;
    }

    .info-popover {
        padding: 2rem 1.5rem 1.5rem;
    }

    .info-popover h3 {
        font-size: 1.35rem;
    }

    .info-popover p {
        font-size: 0.95rem;
    }
}
