body {
    background-color: #DCE8D5;
    background-image: url("./DSC06160.JPG");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;

    font-family: "Nunito", Arial, sans-serif;
    font-size: 18px;
    line-height: 1.6;
    padding: 24px;
    color: #20342A;
    margin: 0;
    min-height: 100vh;
}

h1 {
    font-family: "Space Grotesk", Arial, sans-serif;
    font-size: 48px;
    font-weight: 700;
    color: #FFFFFF;
    background-color: #24573E;
    margin: 4px 0 14px;
    padding: 12px 18px;
    border-radius: 16px;
    box-shadow: 5px 5px 0 #8EBD97;
    font-weight: 700;
}

h2 {
    font-family: "Space Grotesk", Arial, sans-serif;
    font-size: 30px;
    color: #2D6A4F;
    margin: 30px 0 8px;
    padding-bottom: 4px;
    border-bottom: 2px solid #95BFA5;
    margin-top: 34px;
    margin-bottom: 10px;
}

h3 {
    font-family: "Fira Code", monospace;
    font-size: 20px;
    color: #3A5A40;
    margin: 18px 0 2px;
    margin-bottom: 2px;
}

p {
    margin: 8px 0 14px;
    margin-top: 8px;
    margin-bottom: 14px;
    font-size: 18px;
    color: #263B2E;
}

ul {
    margin: 10px 0 18px;
    padding-left: 28px;
    background-color: #F3F8F0;
    padding: 14px 14px 14px 38px;
    border-radius: 12px;
}

li {
    font-size: 18px;
    color: #263B2E;
    margin: 4px 0;
    margin-bottom: 4px;
}

a {
    color: #FFFFFF;
    font-weight: 800;
    display: inline-block;
    background-color: #3B7357;
    margin: 4px 0;
    padding: 8px 14px;
    border-radius: 999px;
    text-decoration: none;
}

a:hover {
    background-color: #173D2A;
    transform: translateY(-2px);
}

img {
    border-radius: 20px;
    display: block;
    width: 300px;
    max-width: 100%;
    margin: 12px 0 8px;
    margin-top: 14px;
    margin-bottom: 8px;
    border: 4px solid #FFFFFF;
    box-shadow: 5px 5px 0 #8EBD97;
}

details {
    background-color: #EEF5E9;
    margin-top: 18px;
    padding: 12px 16px;
    border-radius: 12px;
}

summary {
    font-weight: 800;
    cursor: pointer;
    color: #24573E
}

strong {
    color: #1E6846;
}

dfn {
    color: #24573E;
    font-weight: 800;
}

abbr {
    text-decoration-color: #3B7357;
    cursor: help;
}

.window {
    position: absolute;
    top: 110px;
    left: 10%;
    transform: none;

    width: 80%;
    max-width: 850px;
    box-sizing: border-box;
    padding: 28px;

    background-color: rgba(248, 252, 246, 0.92);
    border: 8px ridge #3B7357;
    outline: 3px dotted #FFFFFF;
    outline-offset: 6px;
    border-radius: 20px;
    box-shadow: 8px 8px 0 #8EBD97;
}

.top-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    z-index: 10;

    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    padding: 10px 18px;

    color: #EFFFF3;
    background: radial-gradient(circle at 20% 0%, rgba(111, 255, 170, 0.22), transparent 35%),
        linear-gradient(90deg, rgba(4, 30, 22, 0.93), rgba(18, 87, 55, 0.78), rgba(4, 30, 22, 0.93));
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(190, 255, 213, 0.4);
    box-shadow: 0 6px 22px rgba(0, 20, 10, 0.45);
}

.top-bar p {
    margin: 12px 0;
    color: white;
}

.os-name {
    font-family: "Fira Code", monospace;
    font-weight: 800;
    letter-spacing: 1px;
    text-shadow: 0 0 12px rgba(135, 255, 186, 0.85);
    cursor: pointer;
}

.system-status {
    padding: 5px 12px;
    border: 1px solid rgba(190, 255, 213, 0.5);
    border-radius: 999px;
    background-color: rgba(220, 255, 230, 0.12);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.8px;
}

#timeElement {
    justify-self: end;
    font-family: "Fira Code", monospace;
    font-size: 14px;
    color: #B9FFD0;
}

.top-bar .system-status {
    color: #123D29;
    background-color: rgba(190, 255, 210, 0.9);
    border: 1px solid #58E889;
    box-shadow: 0 0 16px rgba(88, 232, 137, 0.45);
    text-shadow: none;
}

#welcomeWindowheader {
    cursor: grab;
    user-select: none;
}

#welcomeWindowheader:active {
    cursor: grabbing;
}

.window-close {
    position: absolute;
    top: 14px;
    right: 14px;

    cursor: pointer;
    border: 2px solid #FFE1E7;
    border-radius: 50%;
    width: 34px;
    height: 34px;

    background-color: #8E2944;
    color: #FFFFFF;
    font-size: 23px;
    font-weight: 800;
    line-height: 1;

    box-shadow: 3px 3px 0 #4B1423;
}

.window-close:hover {
    background-color: #C23A5B;
    transform: translateY(-2px);
}

.window-close:active {
    transform: translateY(1px);
    box-shadow: 1px 1px 0 #4B1423;
}

#desktopApps {
    padding-top: 90px;
    padding-left: 24px;
}

.desktop-app {
    width: 104px;
    padding: 10px 6px;
    text-align: center;
    border-radius: 18px;
    cursor: pointer;
    user-select: none;
    filter: drop-shadow(0 6px 7px rgba(0, 25, 12, 0.55));
}

.desktop-app:hover {
    background: rgba(225, 255, 234, 0.18);
}

.desktop-app-icon {
    display: block;
    width: 76px;
    height: 76px;
    margin: 0 auto 8px;
    object-fit: cover;
    border: 2px solid rgba(220, 255, 230, 0.9);
    border-radius: 22px;
    box-shadow: 4px 5px 0 rgba(2, 46, 25, 0.7);
}

#desktopApps .desktop-app-label {
    margin: 0;
    color: #FFFFFF;
    font-family: "Fira Code", monospace;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.25;
    text-shadow: 0 2px 4px rgba(0, 25, 12, 0.9);
}

.desktop-app.selected {
    background: rgba(187, 255, 207, 0.3);
    outline: 2px solid #B9FFD0;
    outline-offset: 2px;
    box-shadow: inset 0 0 18px rgba(128, 255, 172, 0.22);
}

.desktop-app.selected .desktop-app-icon {
    transform: translateY(-3px) scale(1.04);
    border-color: #B9FFD0;
    box-shadow: 0 0 18px rgba(128, 255, 172, 0.75);
}

.threadbook-window {
    top: 150px;
    left: 18%;
    width: min(760px, calc(100% - 48px));
}

.threadbook-content {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 16px;
    min-height: 380px;
    padding: 8px 4px;
}

.threadbook-library {
    padding: 14px;
    background: rgba(218, 242, 220, 0.72);
    border: 1px solid #95BFA5;
    border-radius: 16px;
}

.threadbook-library-title {
    margin: 0 0 10px;
    color: #24573E;
    font-family: "Fira Code", monospace;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1px;
}

.threadbook-entry {
    display: block;
    width: 100%;
    margin: 0 0 8px;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: #20342A;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.threadbook-entry span,
.threadbook-entry small {
    display: block;
}

.threadbook-entry span {
    font-weight: 800;
}

.threadbook-entry small {
    margin-top: 2px;
    color: #547360;
    font-size: 12px;
}

.threadbook-entry:hover,
.threadbook-entry.current {
    background: #24573E;
    border-color: #8EBD97;
    color: #FFFFFF;
}

.threadbook-entry:hover small,
.threadbook-entry.current small {
    color: #D7FFE4;
}

.threadbook-page {
    padding: 8px 8px 8px 16px;
}

.threadbook-page h2 {
    margin-top: 4px;
}

.threadbook-kicker {
    margin: 0;
    color: #3B7357;
    font-family: "Fira Code", monospace;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1px;
}

.threadbook-page blockquote {
    margin: 18px 0;
    padding: 12px 16px;
    border-left: 5px solid #58E889;
    border-radius: 0 12px 12px 0;
    background: #EEF5E9;
    color: #24573E;
    font-weight: 800;
}

.threadbook-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.threadbook-tags span {
    padding: 5px 10px;
    border-radius: 999px;
    background: #D6EFDA;
    color: #24573E;
    font-size: 13px;
    font-weight: 800;
}

@media (max-width: 640px) {
    .threadbook-content {
        grid-template-columns: 1fr;
    }
}

#threadbookWindowheader {
    cursor: grab;
    user-select: none;
}

#threadbookWindowheader:active {
    cursor: grabbing;
}

.top-bar[data-thread="build-log"] {
    background: linear-gradient(90deg, #10291D, #276640, #10291D);
}

.top-bar[data-thread="bookshelf"] {
    background: linear-gradient(90deg, #293316, #6A6B2E, #293316);
}

.top-bar[data-thread="soundtrack"] {
    background: linear-gradient(90deg, #1B2445, #53427A, #1B2445);
}

.threads-app-icon {
    display: grid;
    place-items: center;
    background: radial-gradient(circle, #DFF9E2, #557E8C 48%, #263E4A 75%);
    font-size: 38px;
}

.threads-window {
    top: 126px;
    left:14%;
    width: min(900px, calc(100% - 48px));
}

.threads-story {
    margin-top: 18px;
}

.threads-progress {
    display: flex;
    gap: 10px;
    margin: 14px 0 18px;
}

.thread-marker {
    width: 15px;
    height: 15px;
    border: 2px solid #72957A;
    border-radius: 50%;
    background: #B8CAB9;
    box-shadow: inset 0 0 0 2px #F6FFF6;
}

.thread-marker.complete {
    background: #86D3A1;
    border-color: #378050;
    box-shadow: 0 0 12px rgba(77, 192, 116, 0.8);
}

.thread-marker.current {
    background: #DFFBC6;
    border-color: #478F68;
    animation: threadPulse 1.7s ease-in-out infinite;
}

@keyframes threadPulse {
    50% {
        transform: scale(1.17);
        box-shadow: 0 0 15px #9CF5B5;
    }
}

.threads-layout {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(0, 1fr);
    gap: 22px;
}

.garden-stage {
    display: grid;
    align-content: center;
    min-height: 410px;
    padding: 12px;
    color: #EAFEEA;
    background:
        radial-gradient(circle at 50% 40%, rgba(216, 254, 213, 0.46), transparent 42%),
        linear-gradient(145deg, #102F25, #1C5140);
    border: 1px solid #79A786;
    border-radius: 19px;
    box-shadow: inset 0 0 35px rgba(3, 31, 18, 0.65);
}

.threads-web {
    width: 100%;
    max-width: 390px;
    margin: auto;
    overflow: visible;
}

.garden-glow {
    fill: #CFFFD8;
    opacity: 0.16;
}

.garden-leaf {
    fill: #285B38;
    opacity: 0.7;
}

.thread-base,
.thread-strand {
    fill: none;
    stroke: #D8FFE3;
    stroke-linecap: round;
    stroke-width: 2.5;
}

.thread-base {
    opacity: 0.55;
    stroke-dasharray: 9 7;
}

.thread-strand {
    opacity: 0;
    stroke-dasharray: 220;
    stroke-dashoffset: 220;
    transition: opacity 0.7s ease, stroke-dashoffset 0.7s ease;
}

.thread-strand.active {
    opacity: 1;
    stroke-dashoffset: 0;
}

.thread-strand.warm { stroke: #FFF0A9; }
.thread-strand.blue { stroke: #B6ECFF; }
.thread-strand.green { stroke: #C6FFD3; }
.thread-strand.pink { stroke: #FFD1E5; }
.thread-strand.gold { stroke: #FFE7A0; }

.thread-dew {
    opacity: 0;
    fill: #DDFFFF;
    stroke: #9BD9E8;
    stroke-width: 2;
    transition: opacity 0.7s ease;
}

.thread-dew.active {
    opacity: 1;
}

.little-spider {
    fill: #27392C;
    stroke: #D2F8DA;
    stroke-linecap: round;
    stroke-width: 3;
}

.garden-caption {
    min-height: 28px;
    color: #E7FFE9;
    font-size: 14px;
    font-style: italic;
    text-align: center;
}

.threads-panel {
    display: flex;
    min-height: 410px;
    flex-direction: column;
    justify-content: center;
    padding: 25px;
    background: #F1F8ED;
    border: 1px solid #AAC9B1;
    border-radius: 18px;
}

.threads-panel h2 {
    margin: 0 0 9px;
    color: #24573E;
}

.thread-number {
    margin: 0 0 8px;
    color: #537A60;
    font-family: "Fira Code", monospace;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1px;
}

.thread-choices {
    display: grid;
    gap: 10px;
    margin-top: 24px;
}

.thread-choice,
.restart-thread-button {
    padding: 13px 15px;
    color: #153F28;
    cursor: pointer;
    background: #DFF1DF;
    border: 2px solid #8CBD99;
    border-radius: 13px;
    font: inherit;
    font-weight: 800;
    text-align: left;
}

.thread-choice:hover {
    background: #C8E8D0;
    transform: translateY(-2px);
}

.restart-thread-button {
    margin-top: 20px;
    color: #FFFFFF;
    background: #24573E;
    border-color: #24573E;
    text-align: center;
}

.ending-quality {
    display: inline-block;
    margin: 4px 4px 0 0;
    padding: 5px 9px;
    color: #24573E;
    background: #D6EFDA;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
}

@media (max-width: 640px) {
    .threads-layout {
        grid-template-columns: 1fr;
    }

    .garden-stage,
    .threads-panel {
        min-height: auto;
    }
}

#threadsWindowheader {
    cursor: grab;
    user-select: none;
}

#threadsWindowheader:active {
    cursor: grabbing;
}

#welcomeWindow {
    top: 105px;
    left: 190px;
    width: min(780px, calc(100% - 230px));
}

@media (max-width: 640px) {
    #welcomeWindow {
        top: 100px;
        left: 24px;
        width: calc(100% - 48px);
    }
}

.theme-toggle {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 999;

    padding: 12px 16px;
    cursor: pointer;
    color: #FFFFFF;
    background: #24573E;
    border: 2px solid #B9FFD0;
    border-radius: 999px;
    box-shadow: 4px 4px 0 #123D29;

    font-family: "Fira Code", monospace;
    font-weight: 800;
}

.theme-toggle:hover {
    background: #173D2A;
    transform: translateY(-2px);
}

body.night-mode {
    background-color: #0C1D33;
    background-image: 
        linear-gradient(
            rgba(6, 21, 42, 0.36),
            rgba(6, 21, 42, 0.52)
        ),
        url("./DSC06160.JPG");
}

body.night-mode .top-bar {
    background:
        radial-gradient(circle at 20% 0%, rgba(112, 156, 255, 0.25), transparent 35%),
        linear-gradient(90deg, #071124, #233866, #071124);
}

body.night-mode .window {
    background-color: rgba(12, 28, 45, 0.94);
    border-color: #5B78B9;
    box-shadow: 8px 8px 0 #263E70;
}

body.night-mode .window p,
body.night-mode .window li {
    color: #E3F1FF;
}

body.night-mode .window h2,
body.night-mode .window h3,
body.night-mode .threadbook-kicker {
    color: #B8D7FF;
}

body.night-mode .threadbook-library,
body.night-mode .threads-panel {
    background: rgba(26, 49, 74, 0.88);
    border-color: #587BB4;
}

body.night-mode .threadbook-entry {
    color: #E3F1FF;
}

body.night-mode .threadbook-entry small {
    color: #BDD6ED;
}

body.night-mode .thread-choice {
    color: #E3F1FF;
    background: #294D70;
    border-color: #6C9ED0;
}

body.night-mode .theme-toggle {
    color: #102540;
    background: #D7E8FF;
    border-color: #FFFFFF;
    box-shadow: 4px 4px 0 #6B90C7;
}

@media (max-width: 640px) {
    .theme-toggle {
        right: 16px;
        bottom: 16px;
    }
}

body.night-mode .top-bar[data-thread="build-log"] {
    background:
        radial-gradient(circle at 20% 0%, rgba(93, 255, 170, 0.18), transparent 35%),
        linear-gradient(90deg, #071D19, #1D5A47, #071D19);
}

body.night-mode .top-bar[data-thread="bookshelf"] {
    background:
        radial-gradient(circle at 20% 0%, rgba(255, 225, 132, 0.16), transparent 35%),
        linear-gradient(90deg, #282312, #66581F, #282312);
}

body.night-mode .top-bar[data-thread="soundtrack"] {
    background:
        radial-gradient(circle at 20% 0%, rgba(193, 155, 255, 0.2), transparent 35%),
        linear-gradient(90deg, #151A3E, #473669, #151A3E);
}

body.night-mode .window details {
    background: #193450;
    border: 1px solid #587BB4;
}

body.night-mode .window summary {
    color: #D7E8FF;
}

body.night-mode .window details p {
    color: #E3F1FF;
}

body.night-mode .window ul {
    background: #193450;
    border: 1px solid #587BB4;
}

body.night-mode .window li {
    color: #E3F1FF;
}

@media (max-width: 640px) {
    .threadbook-window,
    .threads-window {
        top: 100px;
        left: 24px;
        width: calc(100% - 48px);
    }

    h1 {
        font-size: 36px;
    }
}