@import url('https://fonts.googleapis.com/css2?family=VT323&family=Zen+Dots&family=DotGothic16&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Comic+Relief:wght@400;700&display=swap');

body {
    margin: 0;
    padding: 20px;
    font-family: "Comic Sans MS","Comic Relief",  "DotGothic16", cursive, sans-serif;
    color: #1a3a5c;
    background-color: #d6f0ff;
    background-image:
    radial-gradient(circle at 10px 10px, #7fcfff 2px, transparent 2px),
    radial-gradient(circle at 30px 30px, #ffb3d9 2px, transparent 2px);
    background-size: 40px 40px;
    image-rendering: pixelated;
}

/* === MAIN FRAME === */
.frame {
    max-width: 880px;
    margin: 0 auto;
    background: #fffdf5;
    border: 4px double #1a3a5c;
    box-shadow: 8px 8px 0 #1a3a5c;
    padding: 0;
}

/* === TITLE BAR === */
.titlebar {
    background: repeating-linear-gradient(
    90deg,
    #00b3ff 0 12px,
    #4fc3f7 12px 24px
    );
    color: white;
    padding: 6px 12px;
    font-family: "VT323", monospace;
    font-size: 18px;
    border-bottom: 3px solid #1a3a5c;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.titlebar .dots { letter-spacing: 2px; }

.titlebar .close-btn {
    background: #fffdf5;
    color: #1a3a5c;
    border: 2px solid #1a3a5c;
    padding: 0 8px;
    font-weight: bold;
}

/* === HEADER === */
header {
    text-align: center;
    padding: 20px;
    background:
    linear-gradient(180deg, #e1f5fe 0%, #fffdf5 100%);
    border-bottom: 2px dashed #00b3ff;
    position: relative;
}

.bayes-loop {
    width: 80px; height: 60px;
    margin: 0 auto 10px;
}

.bayes-loop svg {
    display: block;
    overflow: visible;
}

.bayes-loop .prior,
.bayes-loop .posterior {
    fill: #00b3ff;
    filter: drop-shadow(0 0 4px #00b3ff);
}

.bayes-loop .likelihood {
    fill: #ff6b9d;
    filter: drop-shadow(0 0 4px #ff6b9d);
}

.bayes-loop .prior      { animation: prior-cycle      4s ease-in-out infinite; }
.bayes-loop .posterior  { animation: posterior-cycle  4s ease-in-out infinite; }
.bayes-loop .likelihood { animation: likelihood-cycle 4s ease-in-out infinite; }

/* P at x=0 fades while P' at x=+7 takes over, then back again */
@keyframes prior-cycle {
    0%, 25%    { opacity: 1; transform: translateX(0); }
    40%, 70%   { opacity: 0; transform: translateX(0); }
    85%, 100%  { opacity: 1; transform: translateX(0); }
}

@keyframes posterior-cycle {
    0%, 25%    { opacity: 0; transform: translateX(7px); }
    40%, 70%   { opacity: 1; transform: translateX(7px); }
    85%, 100%  { opacity: 0; transform: translateX(7px); }
}

/* L1 pulses at x=+14 (pulls prior right), then L2 pulses at x=0
   (pulls posterior back left to the original prior) */
@keyframes likelihood-cycle {
    0%, 10%    { opacity: 0; transform: translateX(14px); }
    20%, 30%   { opacity: 1; transform: translateX(14px); }
    40%       { opacity: 0; transform: translateX(14px); }
    47%       { opacity: 0; transform: translateX(0); }   /* jump while invisible */
    55%       { opacity: 0; transform: translateX(0); }
    65%, 75%   { opacity: 1; transform: translateX(0); }
    85%       { opacity: 0; transform: translateX(0); }
    93%, 100%  { opacity: 0; transform: translateX(14px); } /* reset while invisible */
}

h1 {
    font-family: "Zen Dots", sans-serif;
    font-size: 32px;
    margin: 6px 0;
    color: #00b3ff;
    text-shadow:
    2px 2px 0 #fff,
    4px 4px 0 #1a3a5c;
    letter-spacing: 2px;
}

.tagline {
    font-size: 14px;
    color: #ff6b9d;
    margin-top: 4px;
}

.tagline::before { content: "˚⊹ "; }
.tagline::after { content: " ⊹˚"; }

/* === MARQUEE BAR === */
.marquee-bar {
    background: #fff3b0;
    border-top: 2px solid #1a3a5c;
    border-bottom: 2px solid #1a3a5c;
    padding: 6px;
    font-family: "VT323", monospace;
    font-size: 18px;
    color: #1a3a5c;
}

.blink { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* === LAYOUT TABLE === */
.layout {
    width: 100%;
    border-collapse: collapse;
}

.layout td {
    vertical-align: top;
    padding: 16px;
}

.sidebar {
    width: 220px;
    background: #f0f9ff;
    border-right: 2px dashed #00b3ff;
}

/* === SIDEBAR BOXES === */
.box {
    background: white;
    border: 2px solid #1a3a5c;
    margin-bottom: 16px;
    box-shadow: 3px 3px 0 #00b3ff;
}

.box-title {
    background: #1a3a5c;
    color: #00b3ff;
    font-family: "VT323", monospace;
    font-size: 16px;
    padding: 4px 8px;
    letter-spacing: 2px;
}

.box-title::before { content: "▼ "; }

.box-body {
    padding: 8px 10px;
    font-size: 13px;
}

/* === CHAPTER NAV === */
.chapter-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.chapter-list li {
    padding: 5px 0;
    border-bottom: 1px dotted #99ccdd;
}

.chapter-list li:last-child { border-bottom: none; }

.chapter-list a {
    color: #1a3a5c;
    text-decoration: none;
    display: block;
}

.chapter-list a::before {
    content: "♡ ";
    color: #ff6b9d;
}

.chapter-list a:hover {
    color: #00b3ff;
    background: #fff3b0;
}

.chapter-list a:hover::before { content: "★ "; }

.chapter-list .done a::before {
    content: "✓ ";
    color: #4caf50;
}

.chapter-list .current a {
    background: #fff3b0;
    color: #ff6b9d;
    font-weight: bold;
}
.chapter-list .current a::before { content: "▶ "; }

/* === STATUS BOX === */
.status-line {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    border-bottom: 1px dotted #ccc;
    font-family: "VT323", monospace;
    font-size: 14px;
}

.online { color: #4caf50; font-weight: bold; }

/* === MAIN CONTENT === */
.content h2 {
    font-family: "Zen Dots", sans-serif;
    color: #00b3ff;
    border-bottom: 3px double #00b3ff;
    padding-bottom: 6px;
    font-size: 22px;
}

.content h2::before { content: "✦ "; color: #ff6b9d; }

.content p {
    font-size: 14px;
    line-height: 1.7;
}

.greeting-box {
    background: #fff;
    border: 2px dashed #ff6b9d;
    padding: 14px;
    margin: 16px 0;
    position: relative;
    font-size: 14px;
}

.greeting-box::before {
    content: "(„• ֊ •„) Welcome back, Sensei!";
    position: absolute;
    top: -12px; left: 12px;
    background: #fffdf5;
    padding: 0 8px;
    color: #ff6b9d;
    font-size: 12px;
}

.resource-box {
    background: #fff;
    border: 2px dashed #ff6b9d;
    padding: 14px;
    margin: 16px 0;
    position: relative;
    font-size: 14px;
    font-family: "VT323", monospace;
}

.resource-box::before {
    content: "Resources";
    position: absolute;
    top: -12px; left: 12px;
    background: #fffdf5;
    padding: 0 8px;
    color: #ff6b9d;
    font-size: 12px;
}

/* === MODULE GRID (course chapters as cards) === */
.modules {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 16px 0;
}

.module {
    background: white;
    border: 2px solid #1a3a5c;
    padding: 10px;
    text-decoration: none;
    color: #1a3a5c;
    box-shadow: 3px 3px 0 #00b3ff;
    transition: none;
    position: relative;
}

.module:hover {
    background: #fff3b0;
    box-shadow: 1px 1px 0 #00b3ff;
    transform: translate(2px, 2px);
}

.module-num {
    font-family: "VT323", monospace;
    color: #ff6b9d;
    font-size: 14px;
    letter-spacing: 2px;
}

.module-name {
    font-weight: bold;
    font-size: 15px;
    margin: 4px 0;
    color: #00b3ff;
}

.module-meta {
    font-size: 11px;
    color: #888;
    font-family: "VT323", monospace;
}

.module .stamp {
    position: absolute;
    top: 6px; right: 6px;
    background: #ff6b9d;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    transform: rotate(8deg);
    font-family: "VT323", monospace;
}

.module.locked {
    opacity: 0.5;
    background: #eee;
    cursor: not-allowed;
}

.module.locked .stamp { background: #999; }

/* === RETRO BUTTONS === */
.btn-row {
    text-align: center;
    margin: 18px 0;
}

.ba-btn {
    display: inline-block;
    background: #00b3ff;
    color: white;
    padding: 8px 22px;
    font-family: "Zen Dots", sans-serif;
    font-size: 12px;
    text-decoration: none;
    border: 2px solid #1a3a5c;
    box-shadow: 3px 3px 0 #1a3a5c;
    transform: skewX(-12deg);
    margin: 0 6px;
    letter-spacing: 1px;
}

.ba-btn span { display: inline-block; transform: skewX(12deg); }

.ba-btn:hover {
    background: #ff6b9d;
    box-shadow: 1px 1px 0 #1a3a5c;
    transform: skewX(-12deg) translate(2px, 2px);
}

/* === FOOTER === */
footer {
    background: #1a3a5c;
    color: #aaccdd;
    padding: 14px;
    font-family: "VT323", monospace;
    font-size: 14px;
    text-align: center;
    border-top: 4px solid #00b3ff;
}

footer a { color: #00b3ff; }

.counter {
    display: inline-block;
    background: black;
    color: #00ff66;
    font-family: "VT323", monospace;
    padding: 2px 8px;
    border: 1px solid #00b3ff;
    letter-spacing: 4px;
}

.webring {
    margin-top: 8px;
    font-size: 12px;
}

/* === ASCII corner === */
.ascii-art {
    font-family: monospace;
    font-size: 11px;
    color: #ff6b9d;
    white-space: pre;
    text-align: center;
    line-height: 1.2;
    margin: 8px 0;
}

/* === RESPONSIVE === */
@media (max-width: 720px) {
    .layout, .layout tbody, .layout tr, .layout td { display: block; width: 100%; }
    .sidebar { border-right: none; border-bottom: 2px dashed #00b3ff; }
    .modules { grid-template-columns: 1fr; }
    h1 { font-size: 22px; }
}