:root {
    --text-color: #ffffff;
    --bg-color: #000000;
    --border-color: #3b3b3b;
    --secondary-text-color: #bbbbbb;
    --footer-text-color: #555555;
    --grid-item-bg: transparent;
}

@media (prefers-color-scheme: light) {
    :root {
        --text-color: #000000;
        --bg-color: #ffffff;
        --border-color: #d3d3d3;
        --secondary-text-color: #555555;
        --footer-text-color: #bbbbbb;
        --grid-item-bg: #f5f5f5;
    }
}

[data-theme="light"] {
    --text-color: #000000;
    --bg-color: #ffffff;
    --border-color: #2e2e2e;
    --secondary-text-color: #555555;
    --footer-text-color: #bbbbbb;
    --grid-item-bg: #f5f5f5;
}

[data-theme="dark"] {
    --text-color: #ffffff;
    --bg-color: #000000;
    --border-color: #3b3b3b;
    --secondary-text-color: #bbbbbb;
    --footer-text-color: #555555;
    --grid-item-bg: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Monospace', monospace;
    margin: 0;
    padding: 15px;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
}

.no-select {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.ascii-banner {
    border: 1px solid var(--border-color);
    border-radius: 3px;
    padding: 10px;
    margin: 15px auto;
    max-width: 1200px;
    overflow-x: auto;
    text-decoration: bold;
}

.ascii-art {
    font-size: 12px;
    line-height: 1.2;
    white-space: pre;
    text-align: center;
    margin: 0;
}

.description-box {
    border: 1px solid var(--border-color);
    border-radius: 3px;
    padding: 15px;
    margin: 15px auto;
    max-width: 1200px;
    text-align: left;
    text-align: justify;
    cursor: pointer;
    height: 60px;
    overflow: hidden;
}

#description-text {
    font-size: 13px;
    display: inline-block;
    font-family: 'Monospace', monospace;
    margin: 0;
}

.typing::after {
    content: '▋';
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    from, to { color: transparent; }
    50% { color: var(--text-color); }
}

.secondary-description-box {
    border: 1px solid var(--border-color);
    border-radius: 5px;
    margin: 15px auto;
    max-width: 1200px;
    text-align: center;
    font-size: 13px;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
    margin: 20px auto;
    max-width: 1200px;
    align-items: start;
}

.grid-item {
    border: 1px solid var(--border-color);
    border-radius: 25px;
    padding: 15px;
    text-align: left;
    display: flex;
    flex-direction: column;
    background-color: var(--grid-item-bg);
    transition: border-color 0.1s ease-out, height 0.1s ease-out;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.item-header a {
    color: var(--text-color);
    text-decoration: underline;
    font-weight: normal;
    font-size: 1.05em;
}
.item-header a:hover {
    text-decoration: underline;
}

.toggle-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.1em;
    cursor: pointer;
    padding: 0 5px;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.item-description {
    height: 0;
    opacity: 0;
    overflow: hidden;
    margin-top: 10px;
    color: var(--secondary-text-color);
    font-size: 0.9em;
    transform: translateY(-20px);
    transition: height 0.15s ease-out, opacity 0.15s ease-out, transform 0.15s ease-out;
} 

.item-description.expanded {
    height: 110px;
    opacity: 1;
    transform: translateY(0);
}

.footer {
    margin-top: 30px;
}

.footer a {
    color: var(--footer-text-color);
    text-decoration: none;
    font-size: 0.9em;
}
.footer a:hover {
    color: var(--secondary-text-color);
}

.theme-toggle-container {
    position: fixed;
    bottom: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    pointer-events: none;
}

.theme-toggle-container.right-pos {
    right: 20px;
    left: auto;
}

.theme-toggle-container.left-pos {
    left: 20px;
    right: auto;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5em;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    z-index: 101;
    -webkit-tap-highlight-color: transparent;
    opacity: 0.7;
    position: relative;
    pointer-events: auto;
    transition: opacity 0.3s ease;
    padding: 0;
}

.theme-toggle:hover {
    opacity: 1;
}

.theme-toggle-outline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 1px solid var(--text-color);
    border-radius: 50%;
    opacity: 0.5;
    box-sizing: border-box;
    pointer-events: none;
}

.theme-toggle .sun-symbol {
    display: inline-block;
    transform: translateY(-2px);
}

.theme-toggle-container.animate-out-right {
    animation: moveOutRight 0.5s forwards;
}

.theme-toggle-container.animate-out-left {
    animation: moveOutLeft 0.5s forwards;
}

.theme-toggle-container.animate-in-left {
    animation: moveInLeft 0.5s forwards;
}

.theme-toggle-container.animate-in-right {
    animation: moveInRight 0.5s forwards;
}

.theme-toggle.animate-spin-out-right {
    animation: spinShrinkDisappearRight 0.5s forwards;
}

.theme-toggle.animate-spin-out-left {
    animation: spinShrinkDisappearLeft 0.5s forwards;
}

.theme-toggle.animate-spin-in-left {
    animation: spinGrowAppearLeft 0.5s forwards;
}

.theme-toggle.animate-spin-in-right {
    animation: spinGrowAppearRight 0.5s forwards;
}

@keyframes moveOutRight {
    0% { right: 20px; left: auto; opacity: 1;}
    100% { right: 20px; left: auto; opacity: 0; }
}

@keyframes moveOutLeft {
    0% { left: 20px; right: auto; opacity: 1;}
    100% { left: 20px; right: auto; opacity: 0; }
}

@keyframes moveInLeft {
    0% { left: 20px; right: auto; opacity: 0;}
    100% { left: 20px; right: auto; opacity: 1;}
}

@keyframes moveInRight {
    0% { right: 20px; left: auto; opacity: 0;}
    100% { right: 20px; left: auto; opacity: 1;}
}

@keyframes spinShrinkDisappearRight {
    0% { transform: rotate(0deg) scale(1); opacity: 1; }
    100% { transform: rotate(720deg) scale(0); opacity: 0; }
}

@keyframes spinShrinkDisappearLeft {
    0% { transform: rotate(0deg) scale(1); opacity: 1; }
    100% { transform: rotate(-720deg) scale(0); opacity: 0; }
}

@keyframes spinGrowAppearLeft {
    0% { transform: rotate(0deg) scale(0); opacity: 0; }
    100% { transform: rotate(720deg) scale(1); opacity: 0.7; }
}

@keyframes spinGrowAppearRight {
    0% { transform: rotate(0deg) scale(0); opacity: 0; }
    100% { transform: rotate(-720deg) scale(1); opacity: 0.7; }
}

.corner-button {
    position: fixed;
    bottom: 0;
    width: 20vw;
    height: 20vh;
    z-index: 99;
    cursor: pointer;
}

#leftCornerBtn {
    left: 0;
}

#rightCornerBtn {
    right: 0;
}

.cat-frame {
    font-size: 12px;
    line-height: 1.2;
    white-space: pre;
    text-align: center;
    margin: 0;
}

.colorful-text {
    animation: textColorChange 0.8s infinite;
}

@keyframes textColorChange {
    0% { color: #ff9999; }
    16% { color: #99ff99; }
    32% { color: #9999ff; }
    48% { color: #ffff99; }
    64% { color: #ff99ff; }
    80% { color: #99ffff; }
    100% { color: #ffcc99; }
}
