@import url('https://fonts.googleapis.com/css2?family=Mochiy+Pop+One&family=Nunito:wght@400;500;600;700;800&family=Sniglet:wght@400;800&display=swap');

/* ===== GENERAL ===== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Nunito", Arial, Helvetica, sans-serif;
}

body {
    background: #c495e4;
    color: rgb(255, 254, 254);
    position: relative;
    isolation: isolate;
}

/* ===== BACKGROUND CHARACTERS ===== */

.background-image {
    position: fixed;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    pointer-events: none;
    z-index: 1;
    filter: drop-shadow(4px 6px 5px rgba(0, 0, 0, 0.25));
}

/* ----- Image 1: Jacinta ----- */

.bg-image-1 {
    width: 100px;
    height: 350px;
    right: 40px;
    bottom: 30px;
    background-image: url("images/jacinta.png");
    transform: rotate(-8deg);
}

/* ----- Image 2: Calico Squirrel ----- */

.bg-image-2 {
    width: 100px;
    height: 350px;
    left: 40px;
    bottom: 30px;
    background-image: url("images/calico squirrel.png");
    transform: rotate(8deg);
}

/* ----- Image 3: Rats ----- */

.bg-image-3 {
    width: 100px;
    height: 200px;
    left: 30px;
    top: 220px;
    background-image: url("images/rats.png");
    transform: rotate(-5deg);
}

/* ----- Image 4: Waddle ----- */

.bg-image-4 {
    width: 140px;
    height: 350px;
    right: 180px;
    top: 90px;
    background-image: url("images/waddle.png");
    transform: rotate(5deg);
}

/* ----- Ghostcat 1 ----- */

.ghostcat-1 {
    width: 80px;
    height: 340px;
    right: 75px;
    top: 255px;
    background-image: url("images/ghostcat1.png");
    transform: rotate(-6deg);
}

/* ----- Ghostcat 2 ----- */

.ghostcat-2 {
    width: 80px;
    height: 345px;
    right: 145px;
    top: 275px;
    background-image: url("images/ghostcat2.png");
    transform: rotate(7deg);
}

/* ----- Maple ----- */

.maple {
    width: 150px;
    height: 240px;
    left: 115px;
    bottom: 280px;
    background-image: url("images/maple.png");
    transform: rotate(-15deg);
}

header,
main,
footer {
    position: relative;
    z-index: 2;
}

a {
    color: #6f2da8;
    text-decoration: none;
}

button {
    cursor: pointer;
}

/* ===== CENTERED CHARACTERS ===== */

/* ----- Muchico ----- */

.muchico {
    position: fixed;
    width: 90px;
    height: 330px;
    left: 50%;
    top: 115px;
    margin-left: 45px;
    background-image: url("images/muchico.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    pointer-events: none;
    z-index: 1;
    filter: drop-shadow(4px 6px 5px rgba(0, 0, 0, 0.25));
    transform: rotate(-8deg);
}

/* ----- Pooshico ----- */

.pooshico {
    position: fixed;
    width: 75px;
    height: 260px;
    left: 50%;
    top: 130px;
    margin-left: -120px;
    background-image: url("images/pooshico.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    pointer-events: none;
    z-index: 1;
    filter: drop-shadow(4px 6px 5px rgba(0, 0, 0, 0.25));
    transform: rotate(7deg);
}

/* ----- Lobter ----- */

.lobter {
    position: fixed;
    width: 125px;
    height: 380px;
    left: 50%;
    bottom: -150px;
    background-image: url("images/lobter.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    pointer-events: none;
    z-index: 1;
    filter: drop-shadow(4px 6px 5px rgba(0, 0, 0, 0.25));
    transform: translateX(-50%) rotate(20deg);
}

/* ===== SCROLLBAR ===== */

html {
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: #9b6dcc #573b70;
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #573b70;
}

::-webkit-scrollbar-thumb {
    background: #9b6dcc;
    border-radius: 999px;
    border: 2px solid #573b70;
}

::-webkit-scrollbar-thumb:hover {
    background: #b184dc;
}

/* ===== BACKGROUND STARS ===== */

.background-star {
    position: fixed;
    background-image: url("images/star.webp");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    pointer-events: none;
    z-index: 0;
    opacity: 0.9;
}

/* ----- Upper area ----- */

.star-1 {
    top: 110px;
    left: 100px;
    width: 24px;
    height: 24px;
    transform: rotate(18deg);
}

.star-2 {
    top: 135px;
    left: 260px;
    width: 38px;
    height: 38px;
    transform: rotate(-22deg);
}

.star-3 {
    top: 105px;
    left: 445px;
    width: 20px;
    height: 20px;
    transform: rotate(35deg);
}

.star-4 {
    top: 145px;
    left: 635px;
    width: 32px;
    height: 32px;
    transform: rotate(-12deg);
}

.star-5 {
    top: 115px;
    right: 420px;
    width: 22px;
    height: 22px;
    transform: rotate(25deg);
}

.star-6 {
    top: 150px;
    right: 260px;
    width: 40px;
    height: 40px;
    transform: rotate(-18deg);
}

.star-7 {
    top: 105px;
    right: 100px;
    width: 28px;
    height: 28px;
    transform: rotate(32deg);
}

/* ----- Around search / upper cards ----- */

.star-8 {
    top: 225px;
    left: 60px;
    width: 34px;
    height: 34px;
    transform: rotate(-25deg);
}

.star-9 {
    top: 255px;
    left: 245px;
    width: 20px;
    height: 20px;
    transform: rotate(15deg);
}

.star-10 {
    top: 235px;
    right: 245px;
    width: 36px;
    height: 36px;
    transform: rotate(28deg);
}

.star-11 {
    top: 255px;
    right: 70px;
    width: 24px;
    height: 24px;
    transform: rotate(-15deg);
}

/* ----- Middle area ----- */

.star-12 {
    top: 460px;
    left: 45px;
    width: 40px;
    height: 40px;
    transform: rotate(20deg);
}

.star-13 {
    top: 365px;
    left: 200px;
    width: 50px;
    height: 50px;
    transform: rotate(-30deg);
}

.star-14 {
    top: 375px;
    right: 285px;
    width: 32px;
    height: 32px;
    transform: rotate(12deg);
}

.star-15 {
    top: 475px;
    right: 100px;
    width: 22px;
    height: 22px;
    transform: rotate(-24deg);
}

/* ----- Lower half ----- */

.star-16 {
    top: 570px;
    left: 60px;
    width: 28px;
    height: 28px;
    transform: rotate(35deg);
}

.star-17 {
    top: 620px;
    left: 200px;
    width: 40px;
    height: 40px;
    transform: rotate(-18deg);
}

.star-18 {
    top: 580px;
    right: 260px;
    width: 24px;
    height: 24px;
    transform: rotate(22deg);
}

.star-19 {
    top: 550px;
    right: 15px;
    width: 36px;
    height: 36px;
    transform: rotate(-32deg);
}

.star-20 {
    top: 720px;
    left: 70px;
    width: 22px;
    height: 22px;
    transform: rotate(14deg);
}

.star-21 {
    top: 760px;
    left: 260px;
    width: 34px;
    height: 34px;
    transform: rotate(-26deg);
}

.star-22 {
    top: 730px;
    right: 285px;
    width: 40px;
    height: 40px;
    transform: rotate(18deg);
}

.star-23 {
    top: 830px;
    right: 100px;
    width: 26px;
    height: 26px;
    transform: rotate(-15deg);
}

/* ----- Bottom edges ----- */

.star-24 {
    bottom: 120px;
    left: 115px;
    width: 38px;
    height: 38px;
    transform: rotate(28deg);
}

.star-25 {
    bottom: 30px;
    right: 490px;
    width: 30px;
    height: 30px;
    transform: rotate(-20deg);
}

/* ===== HEADER ===== */

header {
    width: 100%;
    height: 104px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;

    background-image:
        linear-gradient(
            to bottom,
            rgba(196, 149, 228, 0) 65%,
            #c495e4 100%
        ),
        url("images/header.png");

    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

header h1 {
    font-family: "Sniglet", cursive;
    font-size: 36px;
    letter-spacing: .4px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, .45);
    text-align: center;
}

.logo {
    grid-column: 2;
    text-align: center;
}

header nav {
    grid-column: 3;
    justify-self: end;
}

/* ===== LOGIN ===== */

.login-container{

    width:350px;

    margin:80px auto;

    background:#3b2454;

    padding:30px;

    border-radius:12px;

    box-shadow:0 0 20px rgba(243, 241, 241, 0.5);

}

.login-container h1{

    text-align:center;

    margin-bottom:25px;

}

.input-group{

    margin-bottom:20px;

}

.input-group label{

    display:block;

    margin-bottom:8px;

}

.input-group input{

    width:100%;

    padding: 12px 18px;;

    border:none;

    border-radius:6px;

    background:#573b70;

    color:white;

}

.login-container button{

    width:100%;

    padding: 12px 18px;

    background:#9b6dcc;

    color:white;

    border:none;

    border-radius:6px;

}

#loginError{

    color:red;

    margin-top:15px;

    text-align:center;

}

/* ===== READER ===== */

/* ----- Header ----- */

.reader-header {
    width: 100%;
    height: 104px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;

    padding: 20px;
    box-sizing: border-box;

    background-image:
        linear-gradient(
            to bottom,
            rgba(196, 149, 228, 0) 65%,
            #c495e4 100%
        ),
        url("images/header.png");

    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.reader-header h1 {
    grid-column: 2;
    margin: 0;
    text-align: center;
}

.reader-header .reader-controls {
    grid-column: 3;
    justify-self: end;
}

.reader-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.back-button,
#readerModeButton {
    white-space: nowrap;
}

.back-button {

    text-decoration: none;

    color: white;

    background: #9b6dcc;

    padding: 10px 18px;

    border-radius: 6px;

    font-weight: 600;

    transition: background .2s ease;

}

.back-button:hover {

    background: #7d4eaf;

}

.reader-controls button {

    background: #9b6dcc;

    color: white;

    border: none;

    border-radius: 6px;

    padding: 10px 16px;

    cursor: pointer;

    transition:
        background .18s ease,
        transform .18s ease;

}

.reader-controls button:hover {

    background: #b184dc;

    transform: translateY(-2px);

}

.logout-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: 2px solid #604875;
    border-radius: 8px;
    background: #9b6dcc;
    color: white;
    cursor: pointer;
    font-size: 16px;
}

.logout-image {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;

    background-image: url("images/loginrest.png");
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    transform: rotate(-15deg);
}

.logout-button:hover {
    background: #7d4eaf;
    transform: translateY(-2px);
}

.logout-button:hover .logout-image {
    background-image: url("images/loginhover.png");
    background-size: 50px 50px;
}

.logout-button:active {
    transform: scale(.96);
}

/* ----- Progress ----- */

.progress-bar {

    max-width: 900px;

    height: 10px;

    margin: 20px auto 10px;

    background: #573b70;

    border-radius: 999px;

    overflow: hidden;

}

#readingProgress {

    width: 0%;

    height: 100%;

    background: #9b6dcc;

    transition: width .25s ease;

}

/* ----- Navigation ----- */

.page-info {

    display: flex;

    justify-content: space-between;

    align-items: center;

    max-width: 900px;

    margin: 20px auto;

    font-weight: 600;

}

.page-info span {

    font-size: 1.1rem;

}

.page-info button {

    padding: 12px 20px;

    background: #9b6dcc;

    color: white;

    border: none;

    border-radius: 6px;

}

#prevPage:disabled,
#nextPage:disabled {

    visibility: hidden;

}

/* ----- Comic ----- */

.reader {

    display: flex;

    justify-content: center;

    align-items: center;

    width: 95%;

    margin: 40px auto;

}

.reader img {
    width: auto;
    max-width: 100%;
    max-height: 72vh;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0,0,0,.28);
    object-fit: contain;
    transition: transform .2s ease, opacity .2s ease;
}

#comicImage {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 72vh;
    height: auto;
    margin: 0 auto;
    border-radius: 8px;
    opacity: 1;
    object-fit: contain;
    transition: opacity .12s ease;
}

#comicImage.fade {

    opacity: 0;

}
/* ===== LIBRARY ===== */

/* ----- Hero ----- */

.hero {

    margin: 20px 0 40px;

    padding: 30px 0;

}

.hero h2 {

    font-size: 2rem;

    font-weight: 700;

    margin-bottom: 12px;

}

.hero p {

    max-width: 700px;

    color: #eadcf2;

    font-size: 1.05rem;

    line-height: 1.6;

}

/* ===== WELCOME MESSAGE ===== */

.cloud-bubble {
    display: inline-block;
    max-width: 700px;
    margin-top: 10px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.cloud-bubble p {
    margin: 0;
    color: #ffffff;
}

/* ----- Library Controls ----- */

.library-controls {

    display: flex;

    gap: 15px;

    align-items: center;

    margin: 30px 0 20px;

    flex-wrap: wrap;

}

.library-controls input {

    flex: 1;

    min-width: 220px;

    padding: 12px 16px;

    background: #4a3263;

    color: white;

    border: none;

    border-radius: 8px;

    font-size: 1rem;

}

.library-controls select {

    padding: 12px 16px;

    background: #4a3263;

    color: white;

    border: none;

    border-radius: 8px;

    font-size: 1rem;

}

/* ----- Library Grid ----- */

.library {

    display: grid;

    grid-template-columns: repeat(auto-fit, 200px);

    gap: 30px;

    margin-top: 40px;

}

/* ----- Comic Cards ----- */

.comic-card {

    background: #3b2454;

    border-radius: 12px;

    overflow: hidden;

    display: flex;

    flex-direction: column;

    position: relative;

    box-shadow: none;

    transition:

        transform .2s ease,

        box-shadow .2s ease;

}

.comic-card:hover {
    transform: scale(1.04);
    box-shadow: 0 7px 16px rgba(0,0,0,.25);
}

.comic-card img {

    width: 100%;

    aspect-ratio: 2 / 3;

    object-fit: cover;

    transition:

        filter .25s ease,

        transform .25s ease;

}

.comic-card h3 {
    font-family: "Mochiy Pop One", sans-serif;
    padding: 12px 14px 6px;
    font-size: .92rem;
    font-weight: 400;
    line-height: 1.25;
    letter-spacing: .1px;
}

.comic-card p {

    padding: 0 18px 18px;

    color: #d4c4dc;

    font-size: .9rem;

    line-height: 1.45;

}

.comic-card button {

    margin: auto 18px 18px;

    padding: 12px;

    border: none;

    border-radius: 6px;

    background: #9b6dcc;

    color: white;

    font-weight: 600;

    transition:

        background .2s ease,

        transform .2s ease;

}

.comic-card button:hover {

    background: #9b6dcc;

    transform: scale(1.03);

}

/* ----- Locked Comics ----- */

.comic-card.locked img {

    filter: grayscale(100%) blur(2px);

    opacity: .75;

}

.comic-card.locked:hover {

    opacity: .9;

}

.comic-card.locked:hover img {

    filter: grayscale(80%) blur(1px);

}

.comic-card.locked::before {

    content: "";

    position: absolute;

    inset: 0;

    background: rgba(0,0,0,.25);

    pointer-events: none;

}

.comic-card.locked::after {

    content: "";

    position: absolute;

    top: 40%;

    left: 50%;

    transform: translate(-50%, -50%);

    width: 56px;

    aspect-ratio: 1 / 1;

    background-image: url("images/lock.svg");

    background-repeat: no-repeat;

    background-position: center;

    background-size: contain;

    pointer-events: none;

}

/* ----- New Badge ----- */

.comic-card.new::before {

    content: "NEW";

    position: absolute;

    top: 12px;

    right: 12px;

    background: #e74c3c;

    color: white;

    padding: 6px 10px;

    border-radius: 20px;

    font-size: .75rem;

    font-weight: 600;

    letter-spacing: .5px;

    z-index: 10;

}

/* ===== ADMIN ===== */

main {

    width: 90%;

    max-width: 1200px;

    margin: 40px auto;

}

.upload {

    margin-bottom: 50px;

}

.upload form {

    display: flex;

    flex-direction: column;

    gap: 20px;

}

.upload input,
.upload select {

    width: 100%;

    padding: 10px;

    background: #573b70;

    color: white;

    border: none;
 
    border-radius: 6px;

}

.admin-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}

.admin-header h1 {
    grid-column: 2;
    margin: 0;
    text-align: center;
    white-space: nowrap;
}

.admin-header a {
    grid-column: 3;
    justify-self: end;
}

/* ----- Comic Table ----- */

table {

    width: 100%;

    border-collapse: collapse;

}

th,
td {

    padding: 15px;

    border: 1px solid #654d72;

}

th {

    background: #573b70;

}

td button {

    margin-right: 10px;

    padding: 8px 14px;

}

/* ----- File Path Inputs ----- */

.path-input {

    display: flex;

    align-items: center;

    gap: 10px;

}

.path-input span {

    color: #ded0e5;

    font-weight: 600;

    white-space: nowrap;

}

.path-input input {

    flex: 1;

}

/* ----- Page List ----- */

#pageList {

    display: grid;

    grid-template-columns: repeat(auto-fit, 420px);

    gap: 20px;

}

.page-row {

    display: flex;

    flex-direction: column;

    gap: 12px;

    background: #4a3263;

    border-radius: 10px;

    padding: 15px;

    width: 420px;

}

.page-header {

    display: flex;

    justify-content: space-between;

    align-items: center;

}

.page-label {

    font-weight: 600;

    font-size: 1rem;

    color: white;

    padding-bottom: 4px;

    border-bottom: 1px solid #604875;

}

/* ----- Page Buttons ----- */

.page-buttons {

    display: flex;

    gap: 8px;

}

.page-buttons button {

    width: 40px;

    height: 40px;

    padding: 0;

    border: none;

    border-radius: 6px;

    background: #9b6dcc;

    color: white;

    font-weight: 600;

}

.page-buttons button:hover {

    background: #7d4eaf;

}

.page-buttons .delete-page {

    background: #c0392b;

}

.page-buttons .delete-page:hover {

    background: #e74c3c;

}

/* ----- Main Action Buttons ----- */

#submitButton {

    width: 200px;

    padding: 12px 18px;

    background: #9b6dcc;

    color: white;

    border: none;

    border-radius: 6px;

}

.add-page {

    align-self: flex-start;

    padding: 10px 18px;

    background: #9b6dcc;

    color: white;

    border: none;

    border-radius: 6px;

    font-weight: 600;

}

.delete-page {

    background: #c0392b;

    color: white;

    border: none;

}

.delete-page:hover {

    background: #e74c3c;

}

/* ===== READER MODE ===== */

.reader-mode {
    overflow: hidden;
}

.reader-mode .reader-header,
.reader-mode .page-info,
.reader-mode .progress-bar {
    display: none;
}

.reader-mode .reader {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: auto;
}

.reader-mode .reader img,
.reader-mode #comicImage {
    width: auto;
    height: auto;
    max-width: 96vw;
    max-height: 96vh;
    object-fit: contain;
    margin: 0 auto;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

#exitReaderMode {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1100;
    padding: 12px 18px;
    border: none;
    border-radius: 999px;
    background: rgba(25, 25, 25, 0.85);
    color: white;
    font-weight: 600;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    opacity: 1;
    transition: opacity .25s ease, background .2s ease, transform .2s ease;
}

#exitReaderMode:hover {
    background: rgba(50, 50, 50, 0.95);
    transform: scale(1.05);
}

.reader-mode #exitReaderMode {
    display: block;
}

#exitReaderMode.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ===== COPYRIGHT ===== */

.copyright {
    text-align: left;
    font-size: 0.8rem;
    margin: 20px 15px 10px;
}

/* ===== RETURN TO TOP ===== */

#returnToTop {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    z-index: 1000;

    width: 44px;
    height: 44px;

    border: none;
    border-radius: 50%;

    background: rgba(59, 36, 84, 0.9);
    color: white;

    font-size: 1.4rem;
    font-weight: 700;

    cursor: pointer;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition:
        opacity .2s ease,
        transform .2s ease,
        background .2s ease;
}

#returnToTop.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#returnToTop:hover {
    background: #9b6dcc;
    transform: translateX(-50%) translateY(-2px);
}

/* ===== MOBILE ===== */

@media (max-width: 768px) {

    /* ----- Main Header ----- */

    .header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 16px 14px;
    text-align: left;
    }

    .header h1 {
        font-size: 30px;
    }

    .header nav {
        flex-shrink: 0;
    }

    .logout-button {
        padding: 7px 10px;
        gap: 5px;
        font-size: 13px;
        border-width: 1px;
    }

    .logout-image {
        width: 28px;
        height: 28px;
        flex-basis: 28px;
    }

    /* ----- Mobile Background Characters ----- */

.background-image {
    display: block;
}

/* ----- Jacinta ----- */

.bg-image-1 {
    width: 55px;
    height: 200px;
    right: 8px;
    bottom: -15px;
}

/* ----- Calico Squirrel ----- */

.bg-image-2 {
    width: 55px;
    height: 200px;
    left: 8px;
    bottom: -15px;
}

/* ----- Rats ----- */

.bg-image-3 {
    width: 55px;
    height: 130px;
    left: 4px;
    top: 210px;
}

/* ----- Waddle ----- */

.bg-image-4 {
    width: 55px;
    height: 200px;
    right: 15px;
    top: 130px;
}

/* ----- Mobile Ghostcats ----- */

.ghostcat-1 {
    width: 55px;
    height: 190px;
    right: 8px;
    top: 400px;
    transform: rotate(-6deg);
}

.ghostcat-2 {
    width: 55px;
    height: 190px;
    right: 62px;
    top: 415px;
    transform: rotate(7deg);
}

/* ----- Mobile Muchico ----- */

.muchico {
    width: 50px;
    height: 165px;
    left: 57%;
    top: 65px;
    transform: rotate(-8deg);
}

/* ----- Mobile Pooshico ----- */

.pooshico {
    width: 40px;
    height: 145px;
    left: 70%;
    top: 70px;
    transform: rotate(7deg);
}

/* ----- Mobile Maple ----- */

.maple {
    width: 70px;
    height: 190px;
    left: 15px;
    top: auto;
    bottom: 120px;
    transform: rotate(-12deg);
}

/* ----- Mobile Lobter ----- */

.lobter {
    width: 50px;
    height: 170px;
    left: 50%;
    bottom: -55px;
    transform: translateX(-50%) rotate(6deg);
}

    /* ----- Library Hero ----- */

    .hero {
        margin: 5px 0 10px;
        padding: 10px 0;
    }

    .hero h2 {
        margin-bottom: 5px;
        font-size: 1.7rem;
    }

    .hero p {
        font-size: .95rem;
        line-height: 1.4;
    }


    .cloud-bubble {
    width: 90%;
    max-width: 90%;
    margin: 8px auto 0;
    padding: 9px 12px;
    border-radius: 8px;
    }

    .cloud-bubble p {
        font-size: .9rem;
        line-height: 1.4;
    }

    /* ----- Library Controls ----- */

    .library-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    margin: 5px 0 15px;
    }

    .library-controls input {
        flex: 1;
        width: auto;
        min-width: 0;
    }

    .library-controls select {
        width: 100px;
        flex: 0 0 100px;
        font-size: 0.8rem;
    }


    /* ----- Library Grid ----- */

    .library {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 10px;
    }


    /* ----- Comic Cards ----- */

    .comic-card {
        width: 100%;
        border-radius: 10px;
        transition:
            transform .2s ease,
            box-shadow .2s ease;
    }

    .comic-card:hover {
        transform: scale(1.03);
        box-shadow: 0 6px 14px rgba(0,0,0,.25);
    }

    .comic-card:active {
        transform: scale(.98);
    }

    .comic-card h3 {
        font-size: .9rem;
        line-height: 1.25;
        padding: 11px 12px 5px;
    }

    .comic-card p {
        font-size: .78rem;
        padding: 0 12px 12px;
    }

    .comic-card button {
        margin: auto 12px 12px;
        padding: 10px;
        font-size: .85rem;
        transition:
            background .2s ease,
            transform .2s ease;
    }

    .comic-card button:hover {
        background: #b184dc;
        transform: translateY(-2px);
    }

    .comic-card button:active {
        transform: scale(.96);
    }


    /* ----- Reader Header ----- */

    .reader-header {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        margin: 10px 12px;
        text-align: center;
    }

    .reader-header h1 {
        font-size: 1.7rem;
        line-height: 1.15;
        width: 100%;
    }

    .reader-controls {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .back-button,
    #readerModeButton {
        padding: 9px 14px;
        font-size: 0.85rem;
    }

    .reader-controls button {
        padding: 9px 14px;
        font-size: 0.85rem;
    }

    #exitReaderMode {
    bottom: 15px;
    right: 15px;
    padding: 10px 14px;
    font-size: 0.85rem;
    }

    /* ----- Reader ----- */

    .reader {
    width: 100%;
    min-height: 65vh;
    margin: 20px auto 0;
    padding: 0 0 80px;
    box-sizing: border-box;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    }

    #comicImage {
        display: block;
        width: 94%;
        height: auto;
        margin: 0 auto;
        border-radius: 8px;
    }

    /* ----- Admin Header ----- */
    .admin-header {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 8px;
        height: auto;
        min-height: 110px;
        padding: 12px 14px;
        text-align: center;
    }

    .admin-header h1 {
        font-size: 1.7rem;
        line-height: 1.1;
        white-space: nowrap;
    }

    .admin-header a {
        white-space: nowrap;
        font-size: 0.85rem;
        padding: 8px 12px;
    }

    /* ----- Admin Page Editor ----- */
    #pageList {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .page-row {
        width: 100%;
        max-width: 100%;
        padding: 14px;
    }

    .page-row .path-input {
        width: 100%;
    }

    .page-row .path-input input {
        min-width: 0;
        width: 100%;
    }

    .page-header {
        width: 100%;
    }

    .page-buttons {
        flex-shrink: 0;
    }

    /* ----- Existing Comics ----- */
    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    thead {
        display: none;
    }

    table {
        width: 100%;
    }

    tbody tr {
        background: #4a3263;
        border: 1px solid #654d72;
        border-radius: 10px;
        margin-bottom: 15px;
        overflow: hidden;
    }

    tbody td {
        display: flex;
        align-items: center;
        width: 100%;
        min-height: 50px;
        padding: 10px 12px;
        border: none;
        border-bottom: 1px solid #654d72;
    }

    tbody td:last-child {
        border-bottom: none;
    }

    tbody td::before {
        width: 80px;
        flex-shrink: 0;
        font-weight: 700;
        color: #ded0e5;
    }

    tbody td:nth-child(1)::before {
        content: "Title";
    }

    tbody td:nth-child(2)::before {
        content: "Release";
    }

    tbody td:nth-child(3)::before {
        content: "Status";
    }

    tbody td:nth-child(4)::before {
        content: "Actions";
    }

    tbody td:last-child {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    tbody td button {
        margin: 0;
        padding: 8px 14px;
    }

    /* ----- Page Controls ----- */

    .page-info {
        margin: 20px;
        flex-wrap: wrap;
        gap: 12px;
    }

    .page-info span {
        width: 100%;
        text-align: center;
        order: -1;
    }

    .page-info button {
        flex: 1;
        min-width: 120px;
    }


    /* ----- Mobile Background Stars ----- */

        .background-star {
            display: block;
            position: fixed;
            opacity: 0.75;
        }

        /* ----- Upper area ----- */

        .star-1 {
            top: 105px;
            left: 3%;
            width: 16px;
            height: 16px;
        }

        .star-2 {
            top: 145px;
            left: 10%;
            width: 24px;
            height: 24px;
        }

        .star-3 {
            top: 110px;
            right: 18%;
            width: 14px;
            height: 14px;
        }

        .star-4 {
            top: 130px;
            right: 4%;
            width: 22px;
            height: 22px;
        }

        .star-5 {
            top: 210px;
            left: 2%;
            width: 18px;
            height: 18px;
        }

        /* ----- Around search area ----- */

        .star-6 {
            top: 270px;
            right: 3%;
            width: 22px;
            height: 22px;
        }

        .star-7 {
            top: 330px;
            left: 4%;
            width: 16px;
            height: 16px;
        }

        .star-8 {
            top: 380px;
            right: 6%;
            width: 26px;
            height: 26px;
        }

        /* ----- Below comic cards ----- */

        .star-9 {
            top: 620px;
            left: 4%;
            width: 20px;
            height: 20px;
        }

        .star-10 {
            top: 680px;
            right: 5%;
            width: 28px;
            height: 28px;
        }

        .star-11 {
            top: 750px;
            left: 8%;
            width: 16px;
            height: 16px;
        }

        .star-12 {
            top: 810px;
            right: 10%;
            width: 24px;
            height: 24px;
        }

        .star-13 {
            top: 875px;
            left: 3%;
            width: 30px;
            height: 30px;
        }

        .star-14 {
            top: 940px;
            right: 4%;
            width: 18px;
            height: 18px;
        }

        .star-15 {
            top: 1010px;
            left: 12%;
            width: 26px;
            height: 26px;
        }

        .star-16 {
            top: 1080px;
            right: 12%;
            width: 32px;
            height: 32px;
        }

        .star-17 {
            top: 1150px;
            left: 4%;
            width: 18px;
            height: 18px;
        }

        .star-18 {
            top: 1220px;
            right: 5%;
            width: 28px;
            height: 28px;
        }

        .star-19 {
            top: 1290px;
            left: 9%;
            width: 22px;
            height: 22px;
        }

        .star-20 {
            top: 1360px;
            right: 8%;
            width: 34px;
            height: 34px;
        }

        .star-21 {
            top: 1430px;
            left: 3%;
            width: 20px;
            height: 20px;
        }

        .star-22 {
            top: 1500px;
            right: 14%;
            width: 26px;
            height: 26px;
        }

        .star-23 {
            top: 1570px;
            left: 10%;
            width: 36px;
            height: 36px;
        }

        .star-24 {
            top: 1640px;
            right: 4%;
            width: 18px;
            height: 18px;
        }

        .star-25 {
            top: 1710px;
            left: 5%;
            width: 28px;
            height: 28px;
        }
}

#returnToTop {
    left: 50%;
    bottom: 15px;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
}

/* ===== TABLET / IPAD ===== */

/* ----- Portrait iPad ----- */

@media (min-width: 769px) and (max-width: 1100px) and (orientation: portrait) {

    .muchico {
        width: 65px;
        height: 240px;
        left: 50%;
        top: 35px;
        transform: rotate(-8deg);
    }

    .pooshico {
        width: 55px;
        height: 200px;
        left: 60%;
        top: 60px;
        transform: rotate(7deg);
    }

    .maple {
        width: 90px;
        height: 170px;
        left: 20px;
        bottom: 440px;
        transform: rotate(-12deg);
    }

}

/* ----- Landscape iPad ----- */

@media (min-width: 769px) and (max-width: 1200px) and (orientation: landscape) {

    .muchico {
        width: 65px;
        height: 235px;
        left: 50%;
        top: 35px;
        transform: rotate(-8deg);
    }

    .pooshico {
        width: 55px;
        height: 195px;
        left: 58%;
        top: 55px;
        transform: rotate(7deg);
    }

    .maple {
        width: 95px;
        height: 175px;
        left: 175px;
        bottom: 220px;
        transform: rotate(-12deg);
    }

}

/* ===== MOBILE READER MODE POSITION ===== */

@media (max-width: 768px) {

    .reader-mode .reader {
        height: 100dvh;
        min-height: 100dvh;
        padding: 0 10px;
        box-sizing: border-box;

        display: flex;
        justify-content: center;
        align-items: center;
    }

    .reader-mode .reader img,
    .reader-mode #comicImage {
        max-width: 96vw;
        max-height: 85dvh;

        transform: translateY(-5vh);
    }

}