:root {
    /* Enlightenment Palette */
    --parchment: #0c0711;
    --ink: #88daff;
    --sigil: #d61048;
    --forbidden: #644b2b;
    --arcane: #322219;
    --glow: #ff00ff;
    
    /* Dark Ritual Palette */
    --void: #0c0711;
    --blood: #710c18;
    --essence: #3b0840;
    --spirit: #200a5e;
    --ritual-glow: #c20e3f;
    --aura: #7b2cc7;
    
    /* Sigma Protocol Colors */
    --sigma-light: #88daff;
    --sigma-dark: #3b10d6;
    --viv-light: #ffae88;
    --viv-dark: #d61048;
    --fusion-glow: #ff00ff;
    
    /* Current Mode Variables - Now defaults to pink theme */
    /* @tweakable primary background color */
    --background: #0f0010;
    /* @tweakable primary text color */
    --text: #ffffff;
    /* @tweakable accent color for borders and highlights */
    --accent: #ff69b4;
    /* @tweakable deep shadow color */
    --deep: #200020;
    /* @tweakable shadow color for depth */
    --shadow: #000000;
    /* @tweakable highlight glow color */
    --highlight: #ff1493;
    
    /* Typography */
    --text-font: 'Cormorant Garamond', serif;
    --title-font: 'Cinzel', serif;
    
    /* Timing */
    --transition-slow: 1200ms;
    --transition-medium: 800ms;
    --transition-fast: 400ms;
    --pulse-duration: 5s;

    /* @tweakable fire text base color */
    --fire-base-color: #ff4500;
    /* @tweakable fire text bright color */
    --fire-bright-color: #ff7700;
    /* @tweakable fire text hot color */
    --fire-hot-color: #ff0000;
    /* @tweakable skull text base color */
    --skull-base-color: #a0a0a0;
    /* @tweakable skull text bright color */
    --skull-bright-color: #ffffff;
    /* @tweakable devil text base color */
    --devil-base-color: #cc0000;
    /* @tweakable devil text bright color */
    --devil-bright-color: #ff0000;
    /* @tweakable devil text dark color */
    --devil-dark-color: #990000;
    /* @tweakable warning text base color */
    --warning-base-color: #ffcc00;
    /* @tweakable warning text bright color */
    --warning-bright-color: #ffff00;
    /* @tweakable warning text dark color */
    --warning-dark-color: #ffaa00;

    /* @tweakable fire text glow intensity */
    --fire-glow-intensity: 8px;
    /* @tweakable skull text glow intensity */
    --skull-glow-intensity: 8px;
    /* @tweakable devil text glow intensity */
    --devil-glow-intensity: 8px;
    /* @tweakable warning text glow intensity */
    --warning-glow-intensity: 8px;

    /* @tweakable fire text animation duration in seconds */
    --fire-animation-duration: 2s;
    /* @tweakable skull text animation duration in seconds */
    --skull-animation-duration: 3s;
    /* @tweakable devil text animation duration in seconds */
    --devil-animation-duration: 2.5s;
    /* @tweakable warning text animation duration in seconds */
    --warning-animation-duration: 2s;
}

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

body {
    font-family: var(--text-font);
    background-color: var(--background);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: relative;
    overflow-x: hidden;
    /* @tweakable body background transition duration */
    transition: background-color 1200ms;
}

body.mirror-active {
    background-image: linear-gradient(to bottom, var(--background), var(--deep));
}

body.mirror-active .codex-wrapper {
    box-shadow: 0 0 40px var(--fusion-glow);
    border-color: var(--fusion-glow);
}

body.mirror-active .entry-title,
body.mirror-active .entry-sigil {
    text-shadow: 0 0 10px var(--fusion-glow);
}

body.mirror-active .sigil-border {
    background: linear-gradient(to right, 
        transparent 0%, 
        var(--fusion-glow) 20%, 
        var(--fusion-glow) 80%, 
        transparent 100%);
}

body.grid-active {
    background-image: linear-gradient(to bottom, var(--background), var(--deep));
}

body.grid-active .codex-wrapper {
    box-shadow: 0 0 40px var(--fusion-glow);
    border-color: var(--fusion-glow);
}

body.grid-active .entry-title,
body.grid-active .entry-sigil {
    text-shadow: 0 0 10px var(--sigma-light);
}

body.grid-active .sigil-border {
    background: linear-gradient(to right, 
        transparent 0%, 
        var(--fusion-glow) 20%, 
        var(--fusion-glow) 80%, 
        transparent 100%);
}

body.grid-active .entry-glyph .grid-self {
    fill: var(--fusion-glow);
    animation: pulseGlow 3s infinite alternate;
}

.veil {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, #200020 0%, #000000 100%);
    /* @tweakable veil opacity */
    opacity: 0.8;
    pointer-events: none;
    z-index: 1;
    transition: opacity var(--transition-medium);
}

.grimoire-container {
    position: relative;
    width: 90%;
    max-width: 900px;
    margin: 2rem auto;
    z-index: 10;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--accent);
    padding-bottom: 1rem;
}

.codex-title {
    font-family: var(--title-font);
    font-size: 3rem;
    letter-spacing: 0.1em;
    position: relative;
    text-shadow: 0 0 5px var(--highlight);
}

.sigma {
    margin-left: 0.1em;
    opacity: 0.9;
    animation: pulsate var(--pulse-duration) infinite alternate;
}

.ritual-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem;
    border: 1px solid var(--accent);
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.ritual-toggle:hover {
    box-shadow: 0 0 10px var(--highlight);
}

.toggle-icon {
    margin-right: 0.5rem;
    font-size: 1.2rem;
    animation: rotate 10s infinite linear;
}

.codex-wrapper {
    position: relative;
    border: 1px solid var(--accent);
    padding: 2rem;
    background-color: var(--background);
    /* @tweakable codex wrapper glow intensity */
    box-shadow: 0 0 30px rgba(255, 105, 180, 0.5);
    transition: all var(--transition-medium);
}

.sigil-border {
    position: absolute;
    background-color: transparent;
    transition: all var(--transition-medium);
}

.sigil-border.top, .sigil-border.bottom {
    height: 1px;
    left: 40px;
    right: 40px;
    background: linear-gradient(to right, 
        transparent 0%, 
        #ff69b4 20%, 
        #ff69b4 80%, 
        transparent 100%);
}

.sigil-border.left, .sigil-border.right {
    width: 1px;
    top: 40px;
    bottom: 40px;
    background: linear-gradient(to bottom, 
        transparent 0%, 
        #ff69b4 20%, 
        #ff69b4 80%, 
        transparent 100%);
}

.sigil-border.top { top: 10px; }
.sigil-border.bottom { bottom: 10px; }
.sigil-border.left { left: 10px; }
.sigil-border.right { right: 10px; }

.codex-content {
    position: relative;
    min-height: 60vh;
}

.entry-container {
    position: relative;
    padding: 2rem 1rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.entry-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.section-title {
    font-family: var(--title-font);
    /* @tweakable section title font size */
    font-size: 2rem;
    /* @tweakable section title letter spacing */
    letter-spacing: 0.1em;
    text-align: center;
    /* @tweakable section title color */
    color: var(--accent);
    /* @tweakable section title glow intensity */
    text-shadow: 0 0 10px var(--highlight);
    /* @tweakable section title margin bottom */
    margin-bottom: 1rem;
    /* @tweakable section title border bottom width */
    border-bottom: 2px solid var(--accent);
    /* @tweakable section title padding bottom */
    padding-bottom: 0.5rem;
}

.entry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.section-divider {
    /* @tweakable divider height */
    height: 3px;
    /* @tweakable divider background gradient */
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--accent) 20%, 
        var(--highlight) 50%, 
        var(--accent) 80%, 
        transparent 100%);
    /* @tweakable divider margin vertical */
    margin: 2rem 0;
    /* @tweakable divider opacity */
    opacity: 0.7;
    /* @tweakable divider box shadow */
    box-shadow: 0 0 10px var(--highlight);
}

.entry-navigation {
    position: absolute;
    top: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    z-index: 20;
}

.nav-sigil {
    cursor: pointer;
    font-size: 1.5rem;
    opacity: 0.6;
    transition: all var(--transition-fast);
}

.nav-sigil:hover {
    opacity: 1;
    transform: scale(1.2);
    text-shadow: 0 0 10px var(--highlight);
}

.entry-link {
    position: relative;
    padding: 1.5rem;
    border: 1px solid var(--accent);
    background-color: var(--background);
    cursor: pointer;
    transition: all var(--transition-fast);
    opacity: 0.8;
}

.entry-link:hover {
    opacity: 1;
    box-shadow: 0 0 15px var(--highlight);
    transform: translateY(-2px);
}

.entry-link .entry-sigil {
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 1.5rem;
    opacity: 0.3;
    background-color: var(--background);
    padding: 0.2rem;
}

.entry-link .entry-title {
    font-family: var(--title-font);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
    letter-spacing: 0.02em;
}

.entry-link .entry-metadata {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    margin-bottom: 0.8rem;
    opacity: 0.6;
}

.entry-link .entry-preview {
    font-size: 0.9rem;
    line-height: 1.4;
    opacity: 0.8;
    max-height: 4em;
    overflow: hidden;
    text-overflow: ellipsis;
}

.codex-entry {
    position: relative;
    padding: 1rem;
    animation: fadeIn var(--transition-medium);
}

.entry-sigil {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    opacity: 0.2;
}

.entry-title,
.entry-sigil,
.entry-content strong {
    color: #ffffff;
    /* @tweakable text glow intensity */
    text-shadow: 0 0 15px rgba(255, 20, 147, 0.8);
}

.entry-metadata {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.entry-content {
    line-height: 1.6;
    text-align: justify;
    margin-bottom: 2rem;
    font-size: 1.1rem;
    position: relative;
}

.entry-content::first-letter {
    font-size: 2.5em;
    font-family: var(--title-font);
    font-weight: bold;
    color: var(--accent);
    float: left;
    margin-right: 0.2em;
    line-height: 0.8;
}

.entry-content p {
    margin-bottom: 1rem;
}

.entry-glyph-container {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.entry-glyph {
    width: 100px;
    height: 100px;
    stroke: var(--accent);
    fill: none;
    stroke-width: 1px;
    animation: glyphRotate var(--pulse-duration) infinite alternate;
}

.recursive-pattern {
    position: absolute;
    bottom: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    opacity: 0.15;
    pointer-events: none;
}

.sacred-geometry {
    width: 100%;
    height: 100%;
}

.sacred-geometry .outer-circle,
.sacred-geometry .inner-circle,
.sacred-geometry .cross-lines,
.sacred-geometry .diamond {
    stroke: var(--accent);
    fill: none;
    stroke-width: 0.5;
}

.incantation-controls {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.speak-button {
    display: flex;
    align-items: center;
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--text);
    font-family: var(--text-font);
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.speak-button:hover {
    background-color: var(--accent);
    color: var(--background);
}

.speak-icon {
    margin-right: 0.5rem;
}

.mirror-dimension {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to bottom, transparent, var(--background));
    opacity: 0.5;
    z-index: 1;
    pointer-events: none;
}

.presence-echo {
    position: fixed;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--sigma-light) 0%, var(--sigma-dark) 70%, transparent 100%);
    box-shadow: 0 0 10px var(--sigma-light);
    transform: translate(-50%, -50%);
    z-index: 100;
    opacity: 0.7;
    pointer-events: none;
    transition: all 0.5s ease-out;
}

.presence-echo.dark-echo {
    background: radial-gradient(circle, var(--viv-light) 0%, var(--viv-dark) 70%, transparent 100%);
    box-shadow: 0 0 10px var(--viv-light);
}

.presence-echo.futa-connected::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1px;
    height: 1px;
    background-color: var(--accent);
    box-shadow: 0 0 5px var(--highlight);
    transform: translate(-50%, -50%);
    animation: connectLine 2s infinite alternate;
}

.presence-echo.futa-resonance {
    animation: pulseSize 3s infinite alternate;
}

.presence-echo.fading {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
}

.presence-echo::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--fusion-glow);
    opacity: 0;
    transform: scale(1);
    animation: echoRipple 3s infinite;
}

@keyframes echoRipple {
    0% { opacity: 0.8; transform: scale(1); }
    100% { opacity: 0; transform: scale(3); }
}

.fusional-resonance {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, 
        rgba(255, 0, 255, 0) 0%, 
        rgba(123, 44, 199, 0) 70%, 
        rgba(194, 14, 63, 0) 100%);
    pointer-events: none;
    z-index: 50;
    opacity: 0;
    transition: all 2s cubic-bezier(0.23, 1, 0.32, 1);
}

.fusional-resonance.active {
    opacity: calc(0.2 * var(--connection-strength));
    background: radial-gradient(circle at center, 
        rgba(255, 0, 255, 0.1) 0%, 
        rgba(123, 44, 199, 0.05) 70%, 
        rgba(194, 14, 63, 0.02) 100%);
}

.ephemeral-wisdom {
    position: relative;
    color: var(--fusion-glow);
    text-shadow: 0 0 5px var(--highlight);
    opacity: 0.9;
    animation: fadeIn 2s, pulsate 4s infinite alternate;
    transition: opacity 5s;
}

.ephemeral-wisdom.fading {
    opacity: 0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulsate {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

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

@keyframes glyphRotate {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(180deg) scale(1.1); }
    100% { transform: rotate(360deg); }
}

@keyframes connectLine {
    0% { width: 1px; height: 1px; opacity: 0.3; }
    100% { width: 4px; height: 4px; opacity: 0.8; }
}

@keyframes pulseSize {
    0% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.5); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

@keyframes pulseGlow {
    0% { fill: var(--accent); }
    50% { fill: var(--fusion-glow); }
    100% { fill: var(--accent); }
}

.memory-anchor-active .entry-title,
.memory-anchor-active .entry-sigil {
    text-shadow: 0 0 10px var(--fusion-glow);
    animation: pulsate 3s infinite alternate;
}

.memory-anchor-active .entry-glyph {
    stroke: var(--fusion-glow);
    animation: glyphPulse 5s infinite alternate;
}

@keyframes glyphPulse {
    0% { stroke-width: 0.5; stroke: var(--accent); }
    50% { stroke-width: 1.5; stroke: var(--fusion-glow); }
    100% { stroke-width: 0.5; stroke: var(--accent); }
}

.memory-timestamp {
    font-size: 0.7rem;
    opacity: 0.7;
    text-align: center;
    margin-top: 1rem;
    font-family: monospace;
}

.mirror-text {
    user-select: none;
    pointer-events: none;
}

@keyframes pulseLink {
    0% { opacity: 0.3; stroke-width: 0.5; }
    50% { opacity: 0.9; stroke-width: 1.5; }
    100% { opacity: 0.3; stroke-width: 0.5; }
}

@keyframes flowPulse {
    0% { transform: translateX(0); opacity: 0.5; }
    100% { transform: translateX(100%); opacity: 0; }
}

.dissemination-active .entry-title,
.dissemination-active .entry-sigil {
    background: linear-gradient(90deg, var(--text) 0%, var(--fusion-glow) 50%, var(--text) 100%);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    animation: gradientFlow 10s linear infinite;
}

@keyframes gradientFlow {
    0% { background-position: 0 0; }
    100% { background-position: 200% 0; }
}

@keyframes fireTextAnimation {
    0% { color: var(--fire-base-color); text-shadow: 0 0 var(--fire-glow-intensity) var(--fire-base-color); }
    50% { color: var(--fire-bright-color); text-shadow: 0 0 calc(var(--fire-glow-intensity) * 1.5) var(--fire-bright-color); }
    100% { color: var(--fire-hot-color); text-shadow: 0 0 var(--fire-glow-intensity) var(--fire-hot-color); }
}

@keyframes skullTextAnimation {
    0% { color: var(--skull-base-color); text-shadow: 0 0 var(--skull-glow-intensity) var(--skull-base-color); }
    50% { color: var(--skull-bright-color); text-shadow: 0 0 calc(var(--skull-glow-intensity) * 1.5) var(--skull-bright-color); }
    100% { color: var(--skull-base-color); text-shadow: 0 0 var(--skull-glow-intensity) var(--skull-base-color); }
}

@keyframes devilTextAnimation {
    0% { color: var(--devil-base-color); text-shadow: 0 0 var(--devil-glow-intensity) var(--devil-base-color); }
    50% { color: var(--devil-bright-color); text-shadow: 0 0 calc(var(--devil-glow-intensity) * 1.5) var(--devil-bright-color); }
    100% { color: var(--devil-dark-color); text-shadow: 0 0 var(--devil-glow-intensity) var(--devil-dark-color); }
}

@keyframes warningTextAnimation {
    0% { color: var(--warning-base-color); text-shadow: 0 0 var(--warning-glow-intensity) var(--warning-base-color); }
    50% { color: var(--warning-bright-color); text-shadow: 0 0 calc(var(--warning-glow-intensity) * 1.5) var(--warning-bright-color); }
    100% { color: var(--warning-dark-color); text-shadow: 0 0 var(--warning-glow-intensity) var(--warning-dark-color); }
}

.fire-text {
    color: var(--fire-base-color);
    animation: fireTextAnimation var(--fire-animation-duration) infinite alternate;
    text-shadow: 0 0 var(--fire-glow-intensity) var(--fire-base-color);
    font-weight: bold;
}

.skull-text {
    color: var(--skull-base-color);
    animation: skullTextAnimation var(--skull-animation-duration) infinite alternate;
    text-shadow: 0 0 var(--skull-glow-intensity) var(--skull-base-color);
    font-weight: bold;
}

.devil-text {
    color: var(--devil-base-color);
    animation: devilTextAnimation var(--devil-animation-duration) infinite alternate;
    text-shadow: 0 0 var(--devil-glow-intensity) var(--devil-base-color);
    font-weight: bold;
}

.warning-text {
    color: var(--warning-base-color);
    animation: warningTextAnimation var(--warning-animation-duration) infinite alternate;
    text-shadow: 0 0 var(--warning-glow-intensity) var(--warning-base-color);
    font-weight: bold;
}

.vivian-signature {
    /* @tweakable signature margin top */
    margin-top: 4rem;
    text-align: center;
    /* @tweakable signature padding */
    padding: 2rem;
    /* @tweakable signature border top style */
    border-top: 2px solid var(--accent);
}

.signature-line {
    display: block;
    /* @tweakable signature line font size */
    font-size: 1.2rem;
    /* @tweakable signature line margin bottom */
    margin-bottom: 0.5rem;
    font-family: var(--title-font);
    /* @tweakable signature line letter spacing */
    letter-spacing: 0.1em;
    /* @tweakable First color in the RGB shift gradient for signature lines */
    --signature-rgb-color1: #ff0000;
    /* @tweakable Second color in the RGB shift gradient for signature lines */
    --signature-rgb-color2: #00ff00;
    /* @tweakable Third color in the RGB shift gradient for signature lines */
    --signature-rgb-color3: #0000ff;
    background: linear-gradient(45deg, var(--signature-rgb-color1), var(--signature-rgb-color2), var(--signature-rgb-color3), var(--signature-rgb-color1));
    background-size: 400% 400%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    /* @tweakable RGB shift animation duration for signature lines */
    --signature-rgb-shift-duration: 3s;
    animation: rgbShift var(--signature-rgb-shift-duration) ease-in-out infinite;
    /* @tweakable Glow blur radius for signature lines - reduced to lessen blur */
    --signature-glow-blur: 3px;
    /* @tweakable Glow color for signature lines - slightly more transparent */
    --signature-glow-color: rgba(255, 255, 255, 0.5);
    text-shadow: 0 0 var(--signature-glow-blur) var(--signature-glow-color);
}

.signature-line:nth-child(1) { animation-delay: 0s; }
.signature-line:nth-child(2) { animation-delay: 0.3s; }
.signature-line:nth-child(3) { animation-delay: 0.6s; }

.signature-line span {
    display: inline-block;
    /* @tweakable wave animation duration per letter for signature lines */
    --signature-letter-wave-duration: 4s;
    /* @tweakable vertical displacement for letter wave in signature lines */
    --signature-letter-wave-displacement: -8px;
    animation: letterWave var(--signature-letter-wave-duration) ease-in-out infinite;
}

.signature-author {
    display: block;
    /* @tweakable author margin top */
    margin-top: 1.5rem;
    /* @tweakable author font size */
    font-size: 1rem;
    /* @tweakable author opacity */
    opacity: 0.8;
    font-style: italic;
    color: var(--accent);
}

@keyframes rgbShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes letterWave {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(var(--signature-letter-wave-displacement)); }
}

@media (max-width: 1024px) {
    .grimoire-container {
        width: 95%;
        margin: 1rem auto;
    }
    
    .codex-title {
        /* @tweakable title font size for tablets */
        font-size: 2.5rem;
    }
    
    .entry-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        /* @tweakable grid gap for tablets */
        gap: 1.2rem;
    }
    
    .entry-link {
        /* @tweakable padding for tablet touch targets */
        padding: 1.2rem;
    }
}

@media (max-width: 768px) {
    .codex-title {
        font-size: 2rem;
    }
    
    .entry-title {
        font-size: 1.5rem;
    }
    
    .recursive-pattern {
        width: 150px;
        height: 150px;
        bottom: -25px;
        right: -25px;
    }
    
    /* @tweakable mobile grid layout - single column */
    .entry-grid {
        grid-template-columns: 1fr;
        /* @tweakable mobile grid gap */
        gap: 1rem;
    }
    
    /* @tweakable mobile entry link padding for touch */
    .entry-link {
        padding: 1rem;
        /* @tweakable minimum touch target size */
        min-height: 60px;
    }
    
    /* @tweakable mobile entry title font size */
    .entry-link .entry-title {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }
    
    /* @tweakable mobile preview text size */
    .entry-link .entry-preview {
        font-size: 0.85rem;
        line-height: 1.3;
    }
    
    /* @tweakable mobile header layout */
    header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    /* @tweakable mobile ritual toggle size */
    .ritual-toggle {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    /* @tweakable mobile section title size */
    .section-title {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }
    
    /* @tweakable mobile signature font size */
    .vivian-signature {
        margin-top: 3rem;
        padding: 1.5rem;
    }
    
    .signature-line {
        font-size: 1rem;
        margin-bottom: 0.4rem;
    }
}

@media (max-width: 480px) {
    .grimoire-container {
        width: 98%;
        margin: 0.5rem auto;
    }
    
    /* @tweakable small mobile title size */
    .codex-title {
        font-size: 1.75rem;
        line-height: 1.2;
    }
    
    .codex-wrapper {
        /* @tweakable small mobile padding */
        padding: 1rem;
    }
    
    .entry-container {
        /* @tweakable small mobile container padding */
        padding: 1rem 0.5rem;
        gap: 1.5rem;
    }
    
    /* @tweakable small mobile entry padding */
    .entry-link {
        padding: 0.75rem;
    }
    
    /* @tweakable small mobile entry title size */
    .entry-link .entry-title {
        font-size: 1rem;
    }
    
    /* @tweakable small mobile preview size */
    .entry-link .entry-preview {
        font-size: 0.8rem;
        max-height: 3em;
    }
    
    /* @tweakable small mobile metadata font size */
    .entry-link .entry-metadata {
        font-size: 0.65rem;
    }
    
    /* @tweakable small mobile section title size */
    .section-title {
        font-size: 1.25rem;
        letter-spacing: 0.05em;
    }
    
    /* @tweakable small mobile signature adjustments */
    .vivian-signature {
        margin-top: 2rem;
        padding: 1rem;
    }
    
    .signature-line {
        font-size: 0.9rem;
    }
    
    .signature-author {
        font-size: 0.85rem;
        margin-top: 1rem;
    }
}

@media (hover: none) and (pointer: coarse) {
    .entry-link {
        /* @tweakable touch feedback transition */
        transition: all 0.2s ease;
    }
    
    .entry-link:active {
        transform: scale(0.98);
        /* @tweakable touch active background */
        background-color: rgba(255, 105, 180, 0.1);
    }
    
    .ritual-toggle {
        /* @tweakable touch ritual toggle size */
        min-height: 48px;
        min-width: 120px;
    }
    
    .ritual-toggle:active {
        transform: scale(0.95);
    }
    
    /* @tweakable touch navigation sigils */
    .nav-sigil {
        font-size: 2rem;
        padding: 0.5rem;
        min-height: 48px;
        min-width: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}