* {
    outline: none !important;
}

*:focus {
    outline: none !important;
    box-shadow: none !important;
}

html {
    --s: 70px;
    --c1: #323554;
    --c2: #c9bcb3;
    --color-primary: #c9bcb3;
    --color-secondary: #323554;
    --color-primary-light: #d4c4ba;
    --color-primary-muted: #b5a89a;
    --color-secondary-dark: #1f2a36;
    --color-secondary-light: #454f5a;
    --font-main: 'Noto Serif', serif;
    --font-mono: 'Courier New', monospace;
    --font-description: 'Noto Serif', serif;

    background-color: var(--c1);
    background-image: url('images/bg4.avif');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    transition: all 0.6s ease;
}

html.character-theme {
    --c1: var(--theme-secondary, #323554);
    --c2: var(--theme-primary, #c9bcb3);
    --color-primary: var(--theme-primary, #c9bcb3);
    --color-secondary: var(--theme-secondary, #323554);
    --color-primary-light: var(--theme-primary-light, #d4c4ba);
    --color-primary-muted: var(--theme-primary-muted, #b5a89a);
    --color-secondary-dark: var(--theme-secondary-dark, #1f2a36);
    --color-secondary-light: var(--theme-secondary-light, #454f5a);
    background-color: var(--c1);
}

body {
    background-color: transparent;
    color: var(--color-secondary);
    font-family: var(--font-main);
    margin: 0;
    padding: 0;
    line-height: 1.4;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.header {
    background-color: rgba(25, 33, 41, 0.7);
    color: var(--color-primary);
    border-bottom: 4px solid var(--color-primary);
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
    min-height: 180px;
    padding: 0;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    transition: all 0.6s ease;
}

.character-theme .header {
    background-color: var(--header-bg-rgba, rgba(25, 33, 41, 0.7));
}

.title {
    font-size: 4rem;
    font-weight: bold;
    font-family: var(--font-mono);
    letter-spacing: 0.2em;
    text-align: center;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(var(--color-secondary-dark), 0.5);
    background: linear-gradient(45deg, var(--color-primary), var(--color-primary-muted), var(--color-primary));
    background-size: 200% 200%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-shift 4s ease-in-out infinite;
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.subtitle {
    text-align: center;
    margin: 16px 0 0 0;
    font-family: var(--font-mono);
    color: var(--color-primary-muted);
    font-size: 1.2rem;
    letter-spacing: 0.1em;
    text-shadow: 1px 1px 2px rgba(var(--color-secondary), 0.7);
    opacity: 0.9;
}

.main {
    min-height: calc(100vh - 200px);
}

.character-card {
    background-color: rgba(25, 33, 41, 0.7);
    border: 4px solid var(--color-primary);
    margin-bottom: 32px;
    padding: 24px;
    box-shadow: 0 4px 8px rgba(var(--color-primary), 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.6s ease, border-color 0.6s ease;
    border-radius: 16px;
    backdrop-filter: blur(6px);
}

.character-theme .character-card {
    background-color: var(--card-bg-rgba, rgba(25, 33, 41, 0.7));
}

.card-header {
    margin-bottom: 16px;
}

.character-name {
    font-size: 1.5rem;
    font-weight: bold;
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
    color: var(--color-primary);
    margin: 0;
    text-shadow: 1px 1px 0px rgba(var(--color-secondary), 0.3);
    transition: color 0.6s ease;
}

.variant-active {
    color: var(--color-primary);
    text-decoration: underline;
}

.variant-inactive {
    color: var(--color-primary-muted);
    cursor: pointer;
    transition: color 0.2s ease;
}

.variant-inactive:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.card-content {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
    align-items: flex-start;
}

.image-section {
    flex: 0 0 auto;
    width: 400px;
}

.image-frame {
    border: 2px solid var(--color-primary);
    background-color: var(--color-secondary);
    display: block;
    width: 100%;
    height: 504px;
    overflow: hidden;
    line-height: 0;
    font-size: 0;
    box-sizing: border-box;
    transition: border-color 0.6s ease, background-color 0.6s ease;
    border-radius: 16px;
}

.character-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    vertical-align: top;
    border: none;
    outline: none;
}

.description-section {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-self: flex-start;
}

.description-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: baseline;
    height: 48px;
    flex-shrink: 0;
    margin-top: -56px;
    position: relative;
    z-index: 2;
}

.tab-button {
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    position: relative;
}

.tab-button.bookmark {
    width: 50px;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.1);
    border: 2px solid var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px 4px 0 0;
}

.tab-button.bookmark::after {
    display: none;
}

.tab-button.bookmark:hover {
    background-color: rgba(0, 0, 0, 0.15);
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(var(--color-primary), 0.2);
}

.tab-button.bookmark.active {
    background-color: rgba(0, 0, 0, 0.12);
    border-color: var(--color-primary);
    border-bottom: none;
    transform: translateY(0);
    box-shadow: none;
    margin-bottom: -2px;
    z-index: 3;
}

.bookmark-letter {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    color: var(--color-primary);
    transition: all 0.3s ease;
    text-shadow: 1px 1px 0px rgba(var(--color-secondary), 0.5);
}

.tab-button.bookmark:hover .bookmark-letter,
.tab-button.bookmark.active .bookmark-letter {
    color: var(--color-primary);
    transform: scale(1.1);
}

.description-frame {
    border: 2px solid var(--color-primary);
    background-color: transparent;
    padding: 16px;
    height: calc(504px - 48px);
    overflow-y: auto;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    transition: border-color 0.6s ease, background-color 0.6s ease;
    border-radius: 16px;
    backdrop-filter: blur(6px);
}

.description-text {
    color: var(--color-primary);
    font-family: var(--font-description);
    font-size: 1.02rem;
    line-height: 1.6;
    margin: 0;
    font-weight: 400;
    transition: color 0.6s ease;
    white-space: pre-wrap;
    max-height: 100%;
    overflow-y: auto;
    padding-right: 8px;
}

.description-frame::-webkit-scrollbar {
    width: 12px;
}

.description-frame::-webkit-scrollbar-track {
    background: var(--color-secondary);
    border: 2px solid var(--color-primary);
    border-radius: 0;
}

.description-frame::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border: 2px solid var(--color-secondary);
    border-radius: 0;
    transition: all 0.3s ease;
}

.description-frame::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-muted);
    box-shadow: 0 0 4px rgba(var(--color-primary), 0.3);
}

.description-frame::-webkit-scrollbar-thumb:active {
    background: var(--color-primary-muted);
}

.description-text::-webkit-scrollbar {
    width: 4px;
}

.description-text::-webkit-scrollbar-track {
    background: linear-gradient(to right, var(--color-secondary), var(--color-secondary-dark));
    border-radius: 8px;
    margin: 4px;
}

.description-text::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, var(--color-primary), var(--color-primary-muted), var(--color-primary));
    border-radius: 8px;
    border: 1px solid var(--color-primary-muted);
    transition: all 0.3s ease;
}

.description-text::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, var(--color-primary-light), var(--color-primary-muted), var(--color-primary-light));
    border-color: var(--color-primary-muted);
}

.description-text::-webkit-scrollbar-thumb:active {
    background: linear-gradient(to bottom, var(--color-primary-muted), var(--color-primary-muted), var(--color-primary-muted));
}

.card-footer {
    display: flex;
    justify-content: flex-end;
}

.download-btn {
    background-color: var(--color-primary);
    color: var(--color-secondary);
    border: 2px solid var(--color-primary);
    padding: 8px 24px;
    font-family: var(--font-mono);
    font-weight: bold;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.download-btn:hover {
    background-color: var(--color-primary-muted);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(var(--color-primary), 0.3);
}

.download-btn:active {
    transform: translateY(0);
}

.thumbnail-gallery {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    height: 180px;
    width: 100vw;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

.thumbnail-gallery::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.thumbnail-item {
    background-color: var(--color-secondary-dark);
    height: 180px;
    width: auto;
    aspect-ratio: 4/5;
    flex-shrink: 0;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    scroll-snap-align: start;
}

.thumbnail-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(var(--color-primary), 0.4);
}

.thumbnail-item.selected {
    box-shadow: 0 0 15px rgba(var(--color-primary), 0.8);
    transform: scale(1.08);
}

.thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    line-height: 0;
    font-size: 0;
    vertical-align: top;
}

.placeholder-text {
    color: var(--color-primary-muted);
    font-family: var(--font-description);
    text-align: center;
    padding: 40% 20px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.greetings-navigation {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: none;
    gap: 6px;
    z-index: 100;
}

.greetings-navigation.active {
    display: flex;
}

.greeting-chevron {
    width: 32px;
    height: 32px;
    background: rgba(var(--color-secondary), 0.7);
    border: 1px solid rgba(var(--color-primary), 0.3);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
}

.greeting-chevron:hover {
    background: rgba(var(--color-secondary), 0.9);
    border-color: rgba(var(--color-primary), 0.6);
    transform: scale(1.1);
}

.greeting-chevron:active {
    transform: scale(0.95);
}

.greeting-chevron svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--color-primary);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.greeting-indicator {
    position: absolute;
    bottom: 50px;
    left: 10px;
    font-size: 11px;
    color: rgba(var(--color-primary), 0.6);
    background: rgba(var(--color-secondary), 0.7);
    padding: 2px 6px;
    border-radius: 10px;
    display: none;
    font-family: var(--font-description);
}

.greeting-indicator.active {
    display: block;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--color-primary) !important;
    font-family: var(--font-description);
}

.footer-container {
    background-color: rgba(25, 33, 41, 0.7);
    border: 4px solid var(--color-primary);
    border-left: none;
    border-right: none;
    margin-top: 32px;
    margin-bottom: 60px;
    padding: 24px;
    box-shadow: 0 4px 8px rgba(var(--color-primary), 0.2);
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    transition: all 0.6s ease;
}

.character-theme .footer-container {
    background-color: var(--footer-bg-rgba, rgba(25, 33, 41, 0.7));
}

.footer-container:hover {
    box-shadow: 0 8px 16px rgba(var(--color-primary), 0.3);
}

.footer-content {
    text-align: center;
    width: 100%;
}

.updates-section {
    margin-bottom: 16px;
}

.update-entry {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--color-primary);
}

.update-date {
    font-weight: bold;
    color: var(--color-primary-muted);
}

.update-text {
    color: var(--color-primary);
}

.update-divider {
    text-align: center;
    color: var(--color-primary-muted);
    font-size: 0.75rem;
    margin: 6px 0;
    opacity: 0.7;
}

.footer-divider {
    text-align: center;
    color: var(--color-primary-muted);
    font-size: 1rem;
    margin: 12px 0;
    opacity: 0.6;
}

.footer-thanks {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-primary);
    font-style: italic;
    letter-spacing: 0.05em;
}

.email-signature,
.footer-text {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-primary);
    font-style: italic;
    letter-spacing: 0.05em;
    display: inline;
}

.email-signature.clickable {
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
}

.email-signature.clickable:hover {
    color: var(--color-primary-muted);
    transform: scale(1.05);
    display: inline-block;
}

.lorebook-divider {
    height: 2px;
    background: linear-gradient(to right, transparent 0%, var(--color-primary) 20%, var(--color-primary) 80%, transparent 100%);
    margin: 8px 0;
    opacity: 0.5;
}

.lorebook-entry {
    margin-bottom: 0;
}

.entry-header {
    font-weight: bold;
    color: var(--color-primary);
    margin-bottom: 0;
}

.entry-content {
    color: var(--color-primary);
    line-height: 1.6;
    white-space: pre-wrap;
}

@media (max-width: 1024px) {
    .image-section {
        width: 350px;
    }
    .image-frame {
        height: 440px;
    }
    .description-frame {
        height: calc(440px - 48px);
    }
}

@media (max-width: 768px) {
    .title {
        font-size: 2.5rem;
    }
    .subtitle {
        font-size: 1rem;
    }
    .header {
        min-height: 140px;
    }
    .thumbnail-gallery {
        height: 140px;
        gap: 3px;
    }
    .thumbnail-item {
        height: 140px;
    }
    .card-content {
        flex-direction: column;
        gap: 16px;
    }
    .description-tabs {
        margin-top: 0;
        margin-bottom: 8px;
    }
    .image-section {
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
    }
    .image-frame {
        height: 400px;
    }
    .description-frame {
        height: calc(300px - 48px);
    }
    .container {
        padding: 0 16px;
    }
    .character-card {
        padding: 16px;
    }
    .footer-content {
        text-align: center;
        padding-right: 0;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 2rem;
    }
    .subtitle {
        font-size: 0.9rem;
    }
    .character-name {
        font-size: 1.2rem;
    }
    .card-content {
        gap: 12px;
    }
    .image-frame {
        height: 350px;
    }
    .description-frame {
        height: calc(300px - 48px);
    }
    .header {
        min-height: 120px;
    }
    .thumbnail-gallery {
        height: 120px;
        gap: 2px;
    }
    .thumbnail-item {
        height: 120px;
    }
    .footer-container {
        padding: 16px;
        margin-top: 24px;
        margin-bottom: 40px;
    }
    .email-signature {
        font-size: 0.7rem;
    }
}

@media (max-width: 900px) {
    .image-section {
        width: 320px;
    }
    .image-frame {
        height: 400px;
    }
    .description-frame {
        height: calc(400px - 48px);
    }
}

@media (max-width: 820px) {
    .container {
        padding: 0 16px;
    }
    .character-card {
        padding: 20px;
    }
}

.description-text a {
    color: var(--color-primary);
    font-family: var(--font-description);
    font-size: inherit;
    text-decoration: underline;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.description-text a:hover {
    opacity: 1;
    color: var(--color-primary-light);
}