:root {
  --bg: #245DDA;
  --window-bg: #ECE9D8;
  --title-bg: linear-gradient(to bottom, #0058e6 0%, #3a93ff 8%, #288eff 40%, #127dff 88%, #036bba 100%);
  --title-color: white;
  --text-color: #000000;
  --border-color: #00138C;
  --link-color: #0000EE;
  --btn-bg: #ece9d8;
  --btn-border: #7a96df;
  --title-shadow: 1px 1px 2px rgba(0,0,0,0.5);
  font-family: Tahoma, "Trebuchet MS", sans-serif;
}

[data-theme="dark"] {
  --bg: #121212;
  --window-bg: #2C2C2C;
  --title-bg: linear-gradient(to bottom, #4a4a4a 0%, #2b2b2b 100%);
  --title-color: #E0E0E0;
  --text-color: #E0E0E0;
  --border-color: #000000;
  --link-color: #66B2FF;
  --btn-bg: #444444;
  --btn-border: #222222;
  --title-shadow: none;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text-color); line-height: 1.4; transition: background 0.3s; }
.container { max-width: 1100px; margin: 32px auto; padding: 24px; }

.window {
  background: var(--window-bg); border: 1px solid var(--border-color);
  border-top-left-radius: 8px; border-top-right-radius: 8px;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.5); margin-bottom: 24px; overflow: hidden;
}
.title-bar {
  background: var(--title-bg); color: var(--title-color); padding: 4px 8px;
  font-weight: bold; font-size: 14px; display: flex; justify-content: space-between;
  align-items: center; text-shadow: var(--title-shadow); border-bottom: 1px solid var(--border-color);
}

/* Standardized Window Buttons */
.title-bar-controls { display: flex; gap: 3px; }
.title-bar-btn {
  width: 18px; height: 18px;
  background: #ece9d8; border: 1px solid white; border-right-color: #888; border-bottom-color: #888;
  border-radius: 2px; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 11px; font-weight: bold; color: black; line-height: 1;
}
.min-btn { align-items: flex-end; padding-bottom: 3px; }
.max-btn { font-size: 13px; }
.close-btn { background: #e04343; color: white; }
.title-bar-btn:active { border-color: #888; border-right-color: white; border-bottom-color: white; }
[data-theme="dark"] .title-bar-btn { background: #555; border-color: #777; }
[data-theme="dark"] .close-btn { background: #8b2c2c; }

.window-content { padding: 16px; }

h1, h2, h3 { margin: 0 0 12px 0; font-weight: bold; }
a { color: var(--link-color); text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin: 0 0 10px 0; }

header { margin-bottom: 24px; }
.taskbar {
  background: var(--window-bg); border: 1px solid var(--border-color);
  padding: 8px 16px; display: flex; justify-content: space-between; align-items: center;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.5); border-radius: 4px;
}
nav { display: flex; gap: 16px; align-items: center; }
nav a { font-weight: bold; color: var(--text-color); }
.btn {
  background: var(--btn-bg); border: 1px solid white; border-right-color: #888; border-bottom-color: #888;
  padding: 4px 12px; color: var(--text-color); cursor: pointer; text-decoration: none; font-size: 13px;
}
.btn:active { border: 1px solid #888; border-right-color: white; border-bottom-color: white; }

.hero { display: grid; grid-template-columns: 1fr 300px; gap: 24px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.journal-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

@media (max-width: 880px){ .hero { grid-template-columns: 1fr; } .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px){ .grid, .journal-grid { grid-template-columns: 1fr; } nav { flex-wrap: wrap; } }

/* Journal Accordion Styles */
details.unit-folder {
  margin-bottom: 12px;
  background: var(--window-bg);
  border: 1px solid var(--border-color);
  box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
}

details.unit-folder summary {
  padding: 10px 12px;
  font-weight: bold;
  cursor: pointer;
  list-style: none;
  background: var(--btn-bg);
  display: flex;
  align-items: center;
  gap: 8px;
}

details.unit-folder summary::-webkit-details-marker {
  display: none;
}

details.unit-folder summary::before {
  content: "📁";
}

details.unit-folder[open] summary::before {
  content: "📂";
}

details.unit-folder[open] summary {
  background: var(--title-bg);
  color: var(--title-color);
  border-bottom: 1px solid var(--border-color);
}

.unit-content {
  padding: 16px;
}

/* Window States and Cursors */
.title-bar {
  cursor: grab;
}
.title-bar:active {
  cursor: grabbing;
}
.window {
  position: relative;
  transition: box-shadow 0.2s;
}
.window.maximized {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  margin: 0 !important;
  z-index: 9999 !important;
  transform: none !important;
  border-radius: 0;
}

/* Bottom Taskbar for Minimized Apps */
#bottom-taskbar {
  position: fixed; bottom: 0; left: 0; width: 100%;
  background: linear-gradient(to bottom, #245edb 0%, #003dbb 100%);
  border-top: 2px solid #00138c;
  display: flex; gap: 4px; padding: 4px 8px;
  z-index: 10000; min-height: 34px; box-sizing: border-box;
}
.taskbar-item {
  background: #3a93ff; color: white; border: 1px solid #00138c; border-radius: 2px;
  padding: 4px 12px; cursor: pointer; font-size: 12px; font-weight: bold;
  display: flex; align-items: center; box-shadow: inset 1px 1px 2px rgba(255,255,255,0.3);
}
.taskbar-item:active { box-shadow: inset 2px 2px 4px rgba(0,0,0,0.4); }