:root{
    --bg: #f6f8fb;
    --card: #ffffff;
    --muted: #69707a;
    --accent: #2563eb;
    --accent-2: #0ea5a4;
    --border: #e6e9ef;
    --success: #16a34a;
    --danger: #ef4444;
    --radius: 12px;
    --shadow: 0 6px 18px rgba(22,24,31,0.06);
}


/* ===========================
     Knowlet Unit Top Bar (Pinned + Fixed)
     =========================== */

.unit-top-bar {
    position: fixed;                /* Always fixed to viewport */
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.97);
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    z-index: 9999;
    font-family: system-ui, sans-serif;
    backdrop-filter: blur(6px); /* smooth blur for better look */
    opacity: 1;                                /* fully visible */
    transform: translateY(0);    /* no animation offset */
}

/* --- Base style for all buttons and links --- */
.unit-top-bar button,
.unit-top-bar a {
    all: unset;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #f5f5f5;
    color: #333;
    cursor: pointer;
    font-size: 20px;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}
.unit-top-bar #btnLike {
    width: auto;
}

.unit-top-bar button:hover,
.unit-top-bar a:hover {
    filter: brightness(1.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.unit-top-bar button:active,
.unit-top-bar a:active {
    transform: scale(0.95);
}

/* --- Disabled navigation (frozen state) --- */
.unit-top-bar a.disabled {
    pointer-events: none;
    opacity: 0.5;
    background: #ccc;
    color: #666;
    cursor: not-allowed;
}

/* --- Icons --- */
#back-btn::before { content: "←"; }
.unit-prev::before { content: "«"; }
.unit-next::before { content: "»"; }
#fav-btn::before { content: "☆"; }
#fav-btn.favourited::before { content: "★"; }
#keep-screen-on-btn::before { content: "☀️"; }
#keep-screen-on-btn.active::before { content: "🌙"; }

/* --- Colors --- */
#back-btn { background: #b0bec5; color: #fff; }
.unit-prev { background: #42a5f5; color: #fff; }
.unit-next { background: #66bb6a; color: #fff; }
#fav-btn { background: #f0ad4e; color: #fff; }
#fav-btn.favourited { background: #d9534f; color: #fff; }
#keep-screen-on-btn { background: #0078ff; color: #fff; }
#keep-screen-on-btn.active {
    background: #00b359;
    animation: pulseGlow 2s infinite ease-in-out;
}

/* --- Glow animation --- */
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 6px rgba(0, 180, 90, 0.5); }
    50% { box-shadow: 0 0 14px rgba(0, 180, 90, 0.8); }
}

/* --- Responsive (mobile-friendly) --- */
/* Mobile */
@media (max-width: 600px) {
    .unit-top-bar {
        gap: 6px;
        padding: 8px;
    }

    .unit-top-bar button,
    .unit-top-bar a {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }

    #btnLike {
        font-size: 14px;
        padding: 0 6px;
    }
}

/* Very Small Screens */
@media (max-width: 400px) {
    .unit-top-bar {
        gap: 4px;
        padding: 6px;
    }

    .unit-top-bar button,
    .unit-top-bar a {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }

    #btnLike {
        font-size: 12px;
        padding: 0 4px;
    }

    #profile-btn-img {
        width: 28px;
        height: 28px;
    }
}

/* --- Page content offset --- */
.container {
    max-width: 1000px;
    margin: 0 auto;
    background-color: #ffffff;
    border: 1px solid #dcdcdc;
    border-radius: 8px;
    padding: 25px;
    margin-top: 70px; /* prevents content from hiding behind toolbar */
    overflow: hidden;
}

pre, .add-horizontal-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

#app {
    margin-top: 25px;
}


/* -------------------------
     Layout / Card / Typography
     ------------------------- */
     

html,body{height:100%; margin:0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial; background:var(--bg); color:#111827}
.supcontainer{max-width:920px; margin:0px auto; padding:0px;}
.supcard{background:var(--card); border-radius:var(--radius); box-shadow:var(--shadow); border:1px solid var(--border); padding:20px; margin-bottom:18px;}
#h1{font-size:20px; margin:0 0 8px;}
#h2{font-size:16px; margin:0 0 14px; color:var(--muted)}
small{color:var(--muted)}

/* -------------------------
     Comment input
     ------------------------- */
.comment-area textarea{width:95%; min-height:84px; padding:2.5%; border-radius:8px; border:1px solid var(--border); resize:vertical; font-size:14px}
.btn{display:inline-block; padding:8px 12px; background:var(--accent); color:white; border-radius:8px; border:none; cursor:pointer; font-weight:600}
.btn.ghost{background:transparent; color:var(--accent); border:1px solid var(--border)}
.row{display:flex; gap:12px; align-items:center}
.muted{color:var(--muted); font-size:13px}

/* -------------------------
     Ratings area / stars
     ------------------------- */
.rating-widget{display:flex; gap:12px; align-items:center}
.stars {display:inline-flex; gap:5px; cursor:pointer; user-select:none}
.star {width:32px; height:32px; display:inline-block; position:relative; font-size:0; transition: transform .12s ease;}
.star svg{width:100%; height:100%; display:block}
.star:hover{transform:scale(1.06)}
.star.filled svg path{fill: #f59e0b}
.star.half svg path{fill: url(#halfGrad)}
.star.empty svg path{fill: #e6e9ef}

/* Average display: fractional star filling using overlay */
.avg-stars {position:relative; display:inline-block; font-size:0; line-height:0}
.avg-stars .back, .avg-stars .front {display:inline-flex; gap:6px;}
.avg-stars .back svg path{fill:#e6e9ef}
.avg-stars .front{position:absolute; top:0; left:0; overflow:hidden; white-space:nowrap}
.avg-stars .front svg path{fill:#f59e0b}

/* stars for all others*/
.star-f {width:16px; height:16px; display:inline-block; position:relative; font-size:0;}
.star-f svg{width:100%; height:100%; display:block}
.star-f.filled svg path{fill: #f59e0b}
.star-f.half svg path{fill: url(#halfGrad)}
.star-f.empty svg path{fill: #e6e9ef}

/* rating summary */
.rating-summary {display:flex; gap:12px; align-items:center; flex-wrap:wrap}

/* list items */
.comment-item, .rating-item {
    border:1px solid var(--border); padding:12px; border-radius:8px; margin-bottom:10px;
    background:#fff;
}
.meta {color:var(--muted); font-size:13px}

@media (max-width:640px){
    .row{flex-direction:column; align-items:stretch}
    .rating-widget{justify-content:space-between}
}

#ratings-box {
    display: ;
}

#comments-box {
    display: ;
}
/* -------------------------
     Rating item layout
     ------------------------- */
.rating-row{
    display:flex;
    justify-content:space-between;
    gap:14px;
    align-items:flex-start;
}

/* User info (avatar + name) */
.user-info{
    display:flex;
    gap:12px;
    align-items:center;
    min-width:180px;
}

.avatar{
    width:42px;
    height:42px;
    border-radius:50%;
    object-fit:cover;
    border:1px solid var(--border);
    background:#e5e7eb;
}

.user-name{
    font-weight:600;
    font-size:14px;
    color:#111827;
}

/* Rating content */
.rating-content{
    text-align:right;
    flex:1;
}

.rating-score{
    display:block;
    font-size:14px;
    margin-bottom:4px;
}

.rating-message{
    font-size:14px;
    color:#111827;
    line-height:1.4;
}

/* Mobile handling */
@media (max-width:640px){
    .rating-row{
        flex-direction:column;
        align-items:stretch;
    }

    .rating-content{
        text-align:left;
    }
}

/* -------------------------
     Comment layout
     ------------------------- */
.comment-row{
    display:flex;
    gap:14px;
    align-items:flex-start;
}

/* Comment content */
.comment-content{
    flex:1;
}

.comment-text{
    font-size:14px;
    line-height:1.5;
    color:#111827;
    margin-bottom:8px;
}

.comment-actions{
    display:flex;
    gap:10px;
    align-items:center;
}

/* Mobile */
@media (max-width:640px){
    .comment-row{
        flex-direction:column;
    }
}

.vertical-scroll {
    max-height: 400px;
    overflow-y: auto;
}

#profile-btn {
    border-radius: 50%;
}

#profile-btn-img {
    border-radius: 50%;
    width: 35px;
    height: 35px;
    background: linear-gradient(#ddd, #ccc);
    object-fit: cover
}