/* ===== FONTS ===== */
@font-face {
  font-family: regular;
  src: url('../fnt/regular.ttf');
  font-smooth: never;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  image-rendering: pixelated;
}

@font-face {
  font-family: heading;
  src: url('../fnt/heading.ttf');
  font-smooth: never;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  image-rendering: pixelated;
}

/* ===== CSS VARS ===== */
:root {
  --width: 640px;
  --height: 480px;
  --footer-height: 26px;
  --navbar-width: 96px;
  --scrollbar-width: 13px;
  --scrollbar-height: calc(var(--height) - var(--footer-height));
  --content-width: calc(var(--width) - var(--navbar-width) - var(--scrollbar-width));

  /* Font sizes */
  --font-body: 9px;
  --font-heading: 7px;
}

/* ===== RESET ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Strip all text formatting — uniform font everywhere */
b, strong, em, i, th, label {
  font-weight: normal;
  font-style: normal;
  font-size: inherit;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: normal;
  font-style: normal;
  font-family: heading;
  font-size: var(--font-heading);
}

img {
  display: block;
  border: 0;
}

/* Text input cursor */
input[type="text"], input[type="search"], textarea {
  cursor: url('/img/cur/local/text.png'), text;
  outline: none;
}

/* All underlines use border-bottom for exact 1px rendering with bitmap fonts */
a, * {
  text-decoration: none !important;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: regular;
  font-size: var(--font-body);
  color: #000;
  image-rendering: pixelated;
  cursor: default;
  /* Bitmap font kerning fixes */
  font-kerning: none;
  font-feature-settings: "kern" 0;
  text-rendering: optimizeSpeed;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  /* Prevent mobile text inflation */
  -webkit-text-size-adjust: none;
  -moz-text-size-adjust: none;
  text-size-adjust: none;
}

a { cursor: url('/img/cur/local/hyperlink.png'), pointer; }

/* ===== CURSOR LAYER =====
   Wraps #viewport to provide crisp pre-scaled cursors without zoom blurring.
   This div is NOT zoomed — it matches the viewport's on-screen size via its own scaling. */
#cursor-layer {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--width);
  height: var(--height);
  margin-left: calc(var(--width) / -2);
  margin-top: calc(var(--height) / -2);
  cursor: url('/img/cur/local/cursor.png'), default;
}

/* ===== VIEWPORT ===== */
#viewport {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-image: url('/img/background.png');
  background-repeat: repeat;
  animation: backgroundScroll 51.2s steps(512) infinite;
  image-rendering: pixelated;
  display: flex;
  flex-direction: column;
  cursor: inherit;
}

@keyframes backgroundScroll {
  0% { background-position: 0 0; }
  100% { background-position: 0 -512px; }
}

#viewport-inner {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
  max-height: var(--scrollbar-height);
}

/* ===== SIDEBAR / NAVBAR ===== */
#sidebar {
  width: var(--navbar-width);
  min-width: var(--navbar-width);
  height: var(--scrollbar-height);
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 36px 4px 20px 4px;
  gap: 0;
  z-index: 100;
}

.sidebar-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-bottom: 4px;
}

.sidebar-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 3px 2px;
  width: 80px;
  border: 1px solid transparent;
  background: none;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
  font-family: regular;
  font-size: var(--font-body);
  color: #000;
  text-decoration: none;
  user-select: none;
  -webkit-user-select: none;
}

.sidebar-btn:hover {
  background: rgba(255,255,255,0.3);
  border-color: #808080;
}

.sidebar-btn.active {
  border: 1px dotted #000;
  background: rgba(255,255,255,0.3);
}

.sidebar-btn img {
  width: 24px;
  height: 24px;
  image-rendering: pixelated;
  user-select: none;
  -webkit-user-drag: none;
}

.sidebar-btn span {
  text-align: center;
  line-height: 1.1;
  user-select: none;
}

/* Text links in sidebar */
.sidebar-link {
  display: block;
  text-align: center;
  padding: 2px 4px;
  font-family: regular;
  font-size: var(--font-body);
  color: #000080;
  text-decoration: none;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
  user-select: none;
  white-space: nowrap;
  border-bottom: 1px solid transparent;
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.3);
  border-bottom-color: currentColor;
}

/* ===== MAIN CONTENT ===== */
#main-content {
  width: var(--content-width);
  height: var(--scrollbar-height);
  overflow: hidden;
  position: relative;
  background: transparent;
}

/* The actual scrolling container — hides native scrollbar */
#content-scroll {
  width: 100%;
  height: 100%;
  overflow-y: scroll;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 8px;
}

#content-scroll::-webkit-scrollbar {
  display: none;
}

/* ===== CUSTOM SCROLLBAR (HTML element, sprite-based) ===== */
#scrollbar {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--scrollbar-width);
  height: var(--scrollbar-height);
  display: flex;
  flex-direction: column;
  z-index: 50;
}

.scrollbar-arrow,
.scrollbar-thumb-top,
.scrollbar-thumb-bottom {
  background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAfCAYAAAA89UfsAAAAeklEQVQ4je2SQQ7AIAgE14Z/ydf8mb6sPTQmDaCBmHqSI2EC7G4CcCNYVGsNAcwMAoCcswsopbybeqO15t52hW77BWLmGNSBEaggOWiBJBse3/apR/g47a10ArsAqURYsZFiqU1ywFLXPK8PjuwY/jTz7wR2ObBbfnoARVwxYErhog8AAAAASUVORK5CYII=');
  image-rendering: pixelated;
}

.scrollbar-arrow {
  width: 13px;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
  display: block;
  background-repeat: no-repeat;
}

.scrollbar-arrow.up {
  height: 14px;
  background-position: 0 0;
}

.scrollbar-arrow.down {
  height: 13px;
  background-position: 0 -14px;
}

.scrollbar-track {
  flex: 1;
  position: relative;
  background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAACCAYAAACDvVapAAAAHElEQVQImWM4cODA//////8nhWYgVcP/////AwBe9V4AtxHVIQAAAABJRU5ErkJggg==');
  background-repeat: repeat-y;
  background-position: 0 -27px;
}

.scrollbar-thumb {
  position: absolute;
  width: 13px;
  left: 0;
  min-height: 30px;
  display: flex;
  flex-direction: column;
  cursor: grab;
}

.scrollbar-thumb:active {
  cursor: grabbing;
}

.scrollbar-thumb-top {
  width: 13px;
  height: 2px;
  background-repeat: no-repeat;
  background-position: 0 -27px;
}

.scrollbar-thumb-middle {
  flex: 1;
  width: 13px;
  background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAABCAYAAAAFKSQHAAAAIElEQVQImWM8cODAf3t7e4aDBw8yEAIHDhxgaGhoYAAAPDwKAXApyN4AAAAASUVORK5CYII=');
  background-repeat: repeat-y;
  min-height: 1px;
}

.scrollbar-thumb-bottom {
  width: 13px;
  height: 2px;
  background-repeat: no-repeat;
  background-position: 0 -29px;
}

/* ===== WIN9X WINDOW COMPONENT (projects only) ===== */
.win-window {
  background: #c0c0c0;
  border: 2px solid;
  border-color: #dfdfdf #404040 #404040 #dfdfdf;
  margin-bottom: 8px;
  box-shadow: 1px 1px 0 #000;
}

.win-titlebar {
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #fff;
  
  font-size: var(--font-body);
  padding: 2px 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  height: 18px;
}

.win-titlebar-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-left: 2px;
}

.win-titlebar-buttons {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.win-btn {
  width: 16px;
  height: 14px;
  background: #c0c0c0;
  border: 1px solid;
  border-color: #dfdfdf #404040 #404040 #dfdfdf;
  font-size: var(--font-body);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: url('/img/cur/local/cursor.png'), default;
  font-family: regular;
  padding: 0;
  
}

.win-btn:active {
  border-color: #404040 #dfdfdf #dfdfdf #404040;
}

.win-body { padding: 6px; }

/* ===== RAISED / SUNKEN BORDERS ===== */
.raised {
  border: 2px solid;
  border-color: #dfdfdf #404040 #404040 #dfdfdf;
}

.sunken {
  border: 2px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
}

.field {
  border: 2px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  background: #fff;
  padding: 4px;
}

/* ===== PROGRESS BAR ===== */
.progress-bar {
  height: 16px;
  background: #fff;
  border: 2px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  position: relative;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #000080;
  transition: width 0.3s;
}

.progress-text {
  position: absolute;
  top: 0; left: 0; right: 0;
  text-align: center;
  font-size: var(--font-body);
  line-height: 14px;
  color: #000;
  mix-blend-mode: difference;
  filter: invert(1);
}

/* ===== HOMEPAGE ===== */
.site-banner {
  text-align: center;
  margin-bottom: 8px;
  padding: 6px;
}

.site-banner .site-title-img {
  width: 215px;
  height: 37px;
  margin: 8px auto;
  image-rendering: pixelated;
}

.site-banner .tagline {
  font-size: var(--font-body);
  color: #808080;
  margin-top: 2px;
}

/* Status box — terminal-style with clock above */
.status-box {
  margin: 0 auto 8px auto;
  position: relative;
  width: calc(var(--content-width) - 128px);
}

.status-clock-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  padding: 0 4px 2px 0;
}

.status-clock-row .clock-icon {
  width: 12px;
  height: 12px;
  image-rendering: pixelated;
  transform: translateY(2px);
}

.status-clock-row .clock-label {
  color: #ff6699;
  font-family: regular;
  font-size: var(--font-body);
  transform: translateY(4px) translateX(2px);
}

.status-clock {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  height: 17px;
}

.status-clock .clock-glyph {
  width: 10px;
  height: 17px;
  background-image: url('/fnt/clock.png');
  background-repeat: no-repeat;
  image-rendering: pixelated;
  display: inline-block;
  flex-shrink: 0;
}

.status-box-inner {
  background: #1a1a2e;
  position: relative;
  border-top: 2px solid #FF8C9D;
  border-bottom: 2px solid #49093D;
  border-left: none;
  border-right: none;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: row;
}

/* Side bars — 8-segment stepped gradient (top to bottom: light pink to dark purple) */
/* Palette bottom-to-top: #49093D → #5B0B46 → #6D073E → #a31a4d → #cc3366 → #E56782 → #ff6b9d → #FF8C9D */
.status-bar-left,
.status-bar-right {
  width: 8px;
  min-width: 8px;
  flex-shrink: 0;
  background:
    linear-gradient(180deg,
      #FF8C9D 0%,    #FF8C9D 12.5%,
      #ff6b9d 12.5%, #ff6b9d 25%,
      #E56782 25%,   #E56782 37.5%,
      #cc3366 37.5%, #cc3366 50%,
      #a31a4d 50%,   #a31a4d 62.5%,
      #6D073E 62.5%, #6D073E 75%,
      #5B0B46 75%,   #5B0B46 87.5%,
      #49093D 87.5%, #49093D 100%
    );
}

.status-box-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
  min-width: 0;
}

.status-header {
  padding: 3px 6px;
  color: #888;
  flex-shrink: 0;
  font-family: regular;
  font-size: var(--font-body);
}

.status-hr {
  height: 1px;
  background: #555;
  margin: 0 6px;
  flex-shrink: 0;
}

.status-lines {
  font-family: heading;
  font-size: var(--font-heading);
  padding: 4px 8px;
  color: #fff;
  overflow: hidden;
  height: calc(var(--font-heading) * 12.5);
}

.status-line {
  line-height: 1.6;
  white-space: nowrap;
  overflow: hidden;
  font-family: heading;
  font-size: var(--font-heading);
}

.status-line .prompt {
  color: #aaa;
  margin-right: 4px;
}

.status-footer {
  color: #666;
  padding: 2px 0 0 0;
  text-align: left;
  font-family: regular;
  font-size: var(--font-body);
}

/* About + Now Playing row */
.about-nowplaying-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.about-section {
  flex: 1;
  padding: 6px;
  min-width: 0;
}

.about-section h2 {
  font-family: heading;
  font-size: var(--font-heading);
  margin-bottom: 4px;
  color: #000080;
}

.about-section p {
  line-height: 1.3;
  font-size: var(--font-body);
}

/* Music player — vertical stack with album art */
.music-player {
  width: 144px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 6px;
  background: none;
  border: none;
}

.music-player-label {
  font-family: heading;
  font-size: var(--font-heading);
  color: #000080;
  margin-bottom: 2px;
}

.music-album-art {
  width: 64px;
  height: 64px;
  background: #000;
  border: 2px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  image-rendering: pixelated;
}

.music-album-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.music-album-art .no-art {
  color: #00ff00;
  font-size: 32px;
}

.music-info {
  width: 100%;
  text-align: left;
  overflow: hidden;
}

.music-title,
.music-artist,
.music-album {
  font-size: var(--font-body);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  -webkit-mask-image: linear-gradient(90deg, #000 80%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 80%, transparent 100%);
}

.music-title {
  color: #000;
}

.music-artist {
  color: #808080;
}

.music-hr {
  width: 100%;
  height: 1px;
  background: #808080;
  margin: 2px 0;
}

.music-album {
  color: #808080;
}

/* Recent projects */
.recent-projects { margin-bottom: 8px; }

.recent-projects h2 {
  font-family: heading;
  font-size: var(--font-heading);
  margin-bottom: 4px;
  color: #000080;
}

.recent-projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  min-height: 60px;
}

.recent-projects-grid .win-window {
  min-width: 0;
}

/* Changelog */
.changelog-container { margin-bottom: 8px; }

.changelog-label {
  font-family: heading;
  font-size: var(--font-heading);
  
  color: #000080;
  margin-bottom: 4px;
}

.changelog-body {
  max-height: 100px;
  min-height: 50px;
  overflow-y: auto;
  padding: 4px;
  background: #fff;
  border: 2px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
}

.changelog-body::-webkit-scrollbar { display: none; }
.changelog-body { scrollbar-width: none; }

.changelog-entry {
  padding: 2px 0;
  border-bottom: 1px dotted #c0c0c0;
  font-size: var(--font-body);
  display: flex;
}

.changelog-date {
  color: #000080;
  margin-right: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}

.changelog-text {
  flex: 1;
  min-width: 0;
}

.changelog-link {
  color: #000080;
  text-decoration: underline;
  text-decoration-color: transparent;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
}

.changelog-link:hover {
  text-decoration-color: currentColor;
}

/* Hit counter */
.hit-counter {
  text-align: center;
  padding: 8px;
  margin-top: 4px;
  font-size: var(--font-body);
  color: #808080;
}

.hit-counter .count {
  font-family: regular;
  font-size: var(--font-body);
  background: #000;
  color: #00ff00;
  padding: 2px 8px;
  border: 1px inset #808080;
}

/* ===== FOOTER (sticky taskbar) ===== */
#footer {
  height: var(--footer-height);
  min-height: var(--footer-height);
  background: rgba(73, 9, 61, 0.7);
  display: flex;
  align-items: center;
  padding: 0 4px;
  gap: 4px;
  font-size: var(--font-body);
  color: #fff;
  flex-shrink: 0;
  position: relative;
  z-index: 501;
}

#footer .footer-section {
  padding: 1px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}

#footer .footer-section.footer-page { min-width: 70px; }
#footer .footer-spacer { flex: 1; }

#footer .footer-name {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
}

#footer .footer-name label {
  font-size: var(--font-body);
  color: #fff;
}

#footer #name-input {
  width: 72px;
  height: 18px;
  border: none;
  background: rgba(26, 26, 46, 0.6);
  font-family: regular;
  font-size: var(--font-body);
  padding: 0 3px;
  color: #fff;
  outline: none;
  cursor: url('/img/cur/local/text.png'), text;
}

#footer #name-input:focus {
  outline: none;
  box-shadow: none;
}

#footer #name-input::selection {
  background: rgba(255, 140, 157, 0.4);
  color: #fff;
}

#footer #pen-toggle {
  padding: 1px 6px;
  margin-left: 6px;
  background: rgba(26, 26, 46, 0.6);
  border: none;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
  font-family: regular;
  font-size: var(--font-body);
  white-space: nowrap;
  color: #fff;
}

#footer #pen-toggle:active {
  background: rgba(255, 140, 157, 0.2);
}

#footer #pen-toggle.active {
  background: #ff6666;
  color: #000;
}

/* Hide pen toggle on canvas page */
body.page-canvas #footer #pen-toggle,
body.page-canvas #pen-overlay,
body.page-canvas #pen-canvas {
  display: none !important;
}

#footer .footer-section.footer-users { min-width: 55px; }
#footer .footer-section.footer-clock {
  min-width: 60px;
  text-align: center;
  background: rgba(26, 26, 46, 0.6);
  padding: 2px 6px;
}

/* ===== PROJECTS PAGE ===== */
.page-title {
  font-family: heading;
  font-size: var(--font-heading);
  color: #000080;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 2px solid #808080;
}

.category-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.cat-tab {
  padding: 3px 8px;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #dfdfdf #404040 #404040 #dfdfdf;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
  font-family: regular;
  font-size: var(--font-body);
}

.cat-tab:active, .cat-tab.active {
  border-color: #404040 #dfdfdf #dfdfdf #404040;
  background: #a0a0a0;
}

.projects-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.projects-control {
  display: flex;
  align-items: center;
  gap: 4px;
}

.projects-control label {
  font-size: var(--font-body);
  color: #808080;
  white-space: nowrap;
}

.win-select-wrapper {
  position: relative;
  display: inline-block;
}

.win-select-display {
  font-family: regular;
  font-size: var(--font-body);
  background: #fff;
  border: 2px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  padding: 2px 14px 2px 4px;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
  color: #000;
  white-space: nowrap;
  user-select: none;
  position: relative;
}

.win-select-display::after {
  content: '▼';
  position: absolute;
  right: 3px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 6px;
  color: #000;
  pointer-events: none;
}

.win-select-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 100%;
  background: #fff;
  border: 1px solid #000;
  z-index: 800;
  max-height: 150px;
  overflow-y: auto;
}

.win-select-dropdown.open {
  display: block;
}

.win-select-option {
  font-family: regular;
  font-size: var(--font-body);
  padding: 2px 6px;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
  white-space: nowrap;
  color: #000;
}

.win-select-option:hover {
  background: #000080;
  color: #fff;
}

.win-select-option.selected {
  background: #e0e0ff;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  min-height: 100px;
}

.projects-grid .project-tile {
  min-width: 0;
  overflow: hidden;
}

.project-tile {
  cursor: url('/img/cur/local/cursor.png'), default;
}

.project-tile .win-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.project-tile .project-tags {
  color: #808080;
  white-space: nowrap;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 85%, transparent 100%);
}

.project-tile .project-tags .tag {
  border-bottom: 1px solid currentColor;
}

.project-tile .project-date {
  font-size: var(--font-body);
  color: #808080;
}

.project-tile .project-desc {
  font-size: var(--font-body);
  color: #404040;
  line-height: 1.3;
  min-height: calc(var(--font-body) * 1.3 * 2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.project-tile .project-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.project-tile .project-status {
  color: #808080;
  text-transform: uppercase;
}

.project-tile .project-details-link {
  color: #000080;
  border-bottom: 1px solid currentColor;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
}

.project-tile .project-details-link:hover {
  color: #4040c0;
}

/* Segmented progress bar with percentage to the right */
.progress-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.progress-bar-segmented {
  height: 12px;
  flex: 1;
  background: #fff;
  border: 2px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  overflow: hidden;
  display: flex;
  gap: 1px;
  padding: 0px 1px;
}

.progress-segment {
  width: 6px;
  flex-shrink: 0;
  height: calc(100% + 2px);
  margin-top: -1px;
  background: #000080;
}

.progress-percent {
  color: #808080;
  white-space: nowrap;
}

/* Project detail */
.project-detail { max-width: 100%; }

.project-detail .back-link {
  display: inline-block;
  color: #000080;
  border-bottom: 1px solid currentColor;
  margin-bottom: 8px;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
  font-size: var(--font-body);
}

.project-detail h1 {
  font-family: heading;
  font-size: var(--font-heading);
  color: #000080;
  margin-bottom: 4px;
}

.project-infobox {
  float: right;
  width: 180px;
  margin: 0 0 8px 12px;
  background: #e8e8e8;
  border: 2px solid;
  border-color: #dfdfdf #404040 #404040 #dfdfdf;
  padding: 8px;
  font-size: var(--font-body);
}

.project-infobox h3 {
  font-family: heading;
  font-size: var(--font-heading);
  color: #000080;
  margin-bottom: 4px;
  border-bottom: 1px solid #808080;
  padding-bottom: 2px;
}

.project-infobox .info-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  border-bottom: 1px dotted #c0c0c0;
}

.project-infobox .info-label {  }

.project-content {
  line-height: 1.3;
  font-size: var(--font-body);
}

.project-content h2 {
  font-family: heading;
  font-size: var(--font-heading);
  color: #000080;
  margin: 12px 0 4px;
  border-bottom: 1px solid #808080;
  padding-bottom: 2px;
}

.project-content p { margin-bottom: 8px; }

/* Project detail (from proj/ JSON) */
.proj-header { margin-bottom: 8px; }
.proj-header h1 { font-family: heading; font-size: var(--font-heading); color: #000080; margin-bottom: 2px; }
.proj-tagline { font-size: var(--font-body); color: #808080; margin-bottom: 6px; }
.proj-meta { font-size: var(--font-body); color: #404040; margin-bottom: 6px; display: flex; gap: 12px; flex-wrap: wrap; }
.proj-meta .label { color: #000080; }
.proj-categories { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.proj-cat-tag { font-size: var(--font-body); padding: 1px 6px; background: #e0e0e0; border: 1px solid #808080; }
.proj-status-badge { display: inline-block; font-size: var(--font-body); padding: 1px 6px; border: 1px solid; margin-left: 6px; }
.proj-status-badge.active { color: #006600; border-color: #006600; background: #e0ffe0; }
.proj-status-badge.completed { color: #000080; border-color: #000080; background: #e0e0ff; }
.proj-status-badge.paused { color: #806000; border-color: #806000; background: #fff8e0; }
.proj-status-badge.archived { color: #808080; border-color: #808080; background: #f0f0f0; }
.proj-body { line-height: 1.3; font-size: var(--font-body); margin-bottom: 8px; }
.proj-body p { margin-bottom: 8px; }
.proj-embed-img { width: 128px; margin-bottom: 6px; border: 2px solid; border-color: #808080 #dfdfdf #dfdfdf #808080; cursor: pointer; }
.proj-embed-img.left { float: left; margin-right: 8px; }
.proj-embed-img.right { float: right; margin-left: 8px; }
.proj-embed-img img { width: 100%; display: block; }
.proj-embed-img .caption { font-size: var(--font-body); color: #808080; padding: 2px 4px; background: #e8e8e8; text-align: center; }
.proj-segment { margin-bottom: 10px; clear: both; }
.proj-segment h2 { font-family: heading; font-size: var(--font-heading); color: #000080; margin-bottom: 4px; border-bottom: 1px solid #808080; padding-bottom: 2px; }
.proj-segment-content { line-height: 1.3; font-size: var(--font-body); }
.proj-segment-content p { margin-bottom: 8px; }
.proj-gallery { clear: both; margin-top: 10px; }
.proj-gallery h2 { font-family: heading; font-size: var(--font-heading); color: #000080; margin-bottom: 6px; border-bottom: 1px solid #808080; padding-bottom: 2px; }
.proj-gallery-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.proj-gallery-item { aspect-ratio: 1; overflow: hidden; border: 2px solid; border-color: #808080 #dfdfdf #dfdfdf #808080; cursor: pointer; position: relative; }
.proj-gallery-item:hover { border-color: #000080 #4040c0 #4040c0 #000080; }
.proj-gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.proj-locked-notice { background: #fff8e0; border: 2px solid #806000; padding: 6px 10px; font-size: var(--font-body); color: #806000; margin-bottom: 8px; }

/* Exit page */
body.page-exit #sidebar,
body.page-exit #main-content,
body.page-exit #scrollbar,
body.page-exit #footer { pointer-events: none; opacity: 0.5; }
body.page-exit #viewport { animation: none; }

.project-images {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.project-images .img-thumb {
  width: 100%;
  aspect-ratio: 1;
  background: #808080;
  border: 2px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
}

/* ===== GALLERY ===== */
.gallery-tags {
  display: flex;
  gap: 2px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  min-height: 100px;
}

.gallery-item {
  aspect-ratio: 1;
  background: #808080;
  border: 2px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.gallery-item:hover {
  border-color: #000080 #4040c0 #4040c0 #000080;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Lightbox */
.lightbox {
  display: none;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.9);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.lightbox.active { display: flex; }

.lightbox-content {
  max-width: 85%;
  max-height: 60%;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 100%;
  display: block;
  image-rendering: pixelated;
}

.lightbox-info {
  color: #fff;
  margin-top: 6px;
  text-align: center;
  font-family: regular;
  font-size: var(--font-body);
}

.lightbox-close {
  position: absolute;
  top: 8px; right: 8px;
  background: none;
  border: none;
  color: #fff;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
  font-family: regular;
  font-size: var(--font-body);
  z-index: 10;
  padding: 2px;
}

.lightbox-close:hover { color: #ff8c9d; }

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #fff;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
  font-family: regular;
  font-size: 14px;
  z-index: 10;
  padding: 4px;
  display: none;
}

.lightbox-nav:hover { color: #ff8c9d; }

.lightbox.has-nav .lightbox-nav {
  display: block;
}

.lightbox-prev { left: 8px; }
.lightbox-next { right: 8px; }

.lightbox-thumbs {
  display: flex;
  gap: 3px;
  margin-top: 8px;
  justify-content: center;
  max-width: 90%;
  overflow-x: auto;
  display: none;
}

.lightbox.has-nav .lightbox-thumbs {
  display: flex;
}

.lightbox-thumb {
  width: 24px;
  height: 24px;
  border: 1px solid transparent;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
  overflow: hidden;
  flex-shrink: 0;
  opacity: 0.5;
}

.lightbox-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.lightbox-thumb.active {
  border-color: #fff;
  opacity: 1;
}

.lightbox-thumb:hover {
  opacity: 0.8;
}

/* ===== PRINTER PAGE ===== */
.printer-sprites {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  justify-content: center;
}

.printer-sprite-btn {
  padding: 4px;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #dfdfdf #404040 #404040 #dfdfdf;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
  text-align: center;
  font-family: regular;
  font-size: var(--font-body);
  min-width: 64px;
}

.printer-sprite-btn:active, .printer-sprite-btn.active {
  border-color: #404040 #dfdfdf #dfdfdf #404040;
  background: #a0a0a0;
}

.printer-sprite-btn .sprite-icon {
  width: 32px; height: 32px;
  margin: 0 auto 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-body);
}

.stream-container {
  width: 100%;
  aspect-ratio: 16/9;
  max-height: 250px;
  background: #000;
  border: 2px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #808080;
  font-size: var(--font-body);
  margin-bottom: 8px;
  overflow: hidden;
}

.printer-status {
  padding: 6px;
  background: #fff;
  border: 2px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  font-size: var(--font-body);
  line-height: 1.3;
}

.printer-status .label {  color: #000080; }

/* ===== PUBLIC CANVAS ===== */
.canvas-container { position: relative; }

#public-canvas {
  display: block;
  background: #fff;
  border: 2px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  cursor: crosshair;
  image-rendering: auto;
}

.canvas-toolbar {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.canvas-toolbar label { font-size: var(--font-body); margin-right: 2px; }

.color-btn {
  width: 18px; height: 18px;
  border: 2px solid;
  border-color: #dfdfdf #404040 #404040 #dfdfdf;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
  padding: 0;
}

.color-btn.active { border-color: #404040 #dfdfdf #dfdfdf #404040; }

.size-btn {
  padding: 2px 6px;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #dfdfdf #404040 #404040 #dfdfdf;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
  font-family: regular;
  font-size: var(--font-body);
}

.size-btn.active {
  border-color: #404040 #dfdfdf #dfdfdf #404040;
  background: #a0a0a0;
}

/* ===== PEN MODE OVERLAY ===== */
#pen-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 500;
  pointer-events: none;
  display: none;
}

#pen-overlay.active {
  display: block;
  pointer-events: none;
  cursor: crosshair;
}

#pen-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 499;
}

/* ===== REMOTE CURSORS ===== */
.remote-cursor {
  position: absolute;
  pointer-events: none;
  z-index: 600;
}

.remote-cursor .cursor-img {
  width: 11px; height: 19px;
  image-rendering: pixelated;
}

.remote-cursor .cursor-name {
  font-size: var(--font-body);
  background: #ffff00;
  color: #000;
  padding: 1px 3px;
  border: 1px solid #000;
  margin-left: 10px;
  margin-top: -2px;
  white-space: nowrap;
  font-family: regular;
}

/* ===== CONTEXT MENU ===== */
#context-menu {
  display: none;
  position: absolute;
  z-index: 10000;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #dfdfdf #404040 #404040 #dfdfdf;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.3);
  padding: 2px;
  min-width: 160px;
  font-family: regular;
  font-size: var(--font-body);
}

#context-menu.visible { display: block; }

.ctx-item {
  padding: 2px 12px;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
  white-space: nowrap;
}

.ctx-dynamic { display: none; }

.ctx-item:hover { background: #000080; color: #fff; }

.ctx-item.disabled { color: #808080; cursor: url('/img/cur/local/cursor.png'), default; }
.ctx-item.disabled:hover { background: none; color: #808080; }

.ctx-separator {
  height: 2px;
  background: #808080;
  border-bottom: 1px solid #dfdfdf;
  margin: 2px;
}

/* ===== TOOLTIP ===== */
.win-tooltip {
  display: none;
  position: absolute;
  z-index: 10001;
  background: #ffffe1;
  border: 1px solid #000;
  padding: 2px 6px;
  font-family: regular;
  font-size: var(--font-body);
  color: #000;
  white-space: nowrap;
  pointer-events: none;
}

.win-tooltip.visible { display: block; }

/* ===== DIVIDER ===== */
.divider {
  height: 2px;
  background: #808080;
  border-bottom: 1px solid #dfdfdf;
  margin: 8px 0;
}

/* ===== SECTION LABEL ===== */
.section-label {
  font-family: heading;
  font-size: var(--font-heading);
  
  color: #000080;
  margin-bottom: 4px;
}

/* ===== BUTTONS ===== */
.btn-98 {
  padding: 4px 12px;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #dfdfdf #404040 #404040 #dfdfdf;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
  font-family: regular;
  font-size: var(--font-body);
}

.btn-98:active { border-color: #404040 #dfdfdf #dfdfdf #404040; }

/* ===== INTEGER SCALING ===== */
@media (min-width: 1280px) and (min-height: 960px) {
  #cursor-layer {
    width: calc(var(--width) * 2);
    height: calc(var(--height) * 2);
    margin-left: calc(var(--width) * -1);
    margin-top: calc(var(--height) * -1);
  }
  #viewport {
    zoom: 2;
  }
}

@media (min-width: 1920px) and (min-height: 1440px) {
  #cursor-layer {
    width: calc(var(--width) * 3);
    height: calc(var(--height) * 3);
    margin-left: calc(var(--width) * -1.5);
    margin-top: calc(var(--height) * -1.5);
  }
  #viewport {
    zoom: 3;
  }
}
/* ===== CANVAS PAGE LAYOUT ===== */
.canvas-page-layout {
  padding: 6px;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.canvas-page-layout .page-title {
  flex-shrink: 0;
  margin-bottom: 4px;
}

.canvas-page-layout .canvas-toolbar {
  flex-shrink: 0;
}

.canvas-page-layout .canvas-container {
  flex: 1;
}

.canvas-toolbar-spacer {
  width: 8px;
  display: inline-block;
}

/* ===== STREAM IMAGE ===== */
.stream-img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.stream-img.visible {
  display: block;
}

/* ===== PRINTER SPRITE ICON ===== */
.sprite-icon-emoji {
  font-size: 20px;
}

.printer-status-text {
  color: #808080;
}

.printer-status-text.printing {
  color: #00aa00;
}

/* ===== PROJECT DETAIL INLINE STYLES ===== */
.back-link {
  display: inline-block;
  color: #000080;
  border-bottom: 1px solid currentColor;
  margin-bottom: 8px;
}

.loading-text {
  padding: 20px;
  text-align: center;
  color: #808080;
}

.not-found-text {
  color: #808080;
  padding: 20px;
  text-align: center;
}

.proj-progress-bar {
  margin-bottom: 8px;
}

.clearfix {
  clear: both;
}

/* ===== PLACEHOLDER TEXT ===== */
.coming-soon {
  color: #808080;
}

.no-results {
  color: #808080;
  padding: 12px;
}

/* ===== CLOCK ICON ===== */
.clock-icon {
  width: 12px;
  height: 12px;
}

/* ===== PROGRESS SEGMENT EMPTY ===== */
.progress-segment.empty {
  background: transparent;
}

/* ===== NOTIFICATIONS (minecraft-style) ===== */
#notification-container {
  position: absolute;
  bottom: 36px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 900;
  pointer-events: none;
}

.notification-toast {
  background: rgba(26, 26, 46, 0.8);
  color: #fff;
  font-family: regular;
  font-size: var(--font-body);
  padding: 3px 8px;
  opacity: 0;
  transition: opacity 0.3s;
  white-space: nowrap;
}

.notification-toast.visible {
  opacity: 1;
}

.notification-toast.fading {
  opacity: 0;
  transition: opacity 0.5s;
}
/* ===== CANVAS CONTROLS ===== */
.canvas-controls {
  display: flex;
  gap: 6px;
  align-items: stretch;
  padding: 6px 0 0 0;
  flex-shrink: 0;
}

.canvas-control-group {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
}

/* Color column */
.canvas-color-col {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.color-picker-row {
  display: flex;
  gap: 3px;
}

.color-picker-row canvas {
  border: 1px solid #808080;
  cursor: url('/img/cur/local/cursor.png'), default;
  image-rendering: pixelated;
  display: block;
}

.color-bottom-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

/* Swatches */
.swatch-pair {
  position: relative;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.swatch {
  position: absolute;
  width: 17px;
  height: 17px;
  border: 1px solid #000;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
}

.swatch-primary { top: 0; left: 0; background: #000; z-index: 2; }
.swatch-secondary { bottom: 0; right: 0; background: #fff; z-index: 1; }

.swatch-swap {
  background: #c0c0c0;
  border: 2px solid;
  border-color: #dfdfdf #404040 #404040 #dfdfdf;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
  font-size: 10px;
  line-height: 1;
  padding: 2px 4px;
  color: #000;
  flex-shrink: 0;
}

.swatch-swap:active { border-color: #404040 #dfdfdf #dfdfdf #404040; }

/* Hex */
.hex-row {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
}

.hex-row label {
  font-size: var(--font-body);
  color: #808080;
}

.hex-input {
  font-family: regular;
  font-size: var(--font-body);
  width: 100%;
  min-width: 48px;
  background: #fff;
  border: 2px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  padding: 2px 3px;
  color: #000;
  text-transform: uppercase;
  outline: none;
}

/* Tools */
.canvas-tools {
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

.tool-row {
  display: flex;
  gap: 2px;
}

.tool-btn, .brush-btn {
  width: 24px;
  height: 24px;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #dfdfdf #404040 #404040 #dfdfdf;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
  font-size: 11px;
  line-height: 1;
  text-align: center;
  padding: 0;
  color: #000;
}

.tool-btn.active, .brush-btn.active {
  border-color: #404040 #dfdfdf #dfdfdf #404040;
  background: #a0a0a0;
}

/* Sliders */
.canvas-sliders {
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.slider-row label {
  font-size: var(--font-body);
  min-width: 24px;
}

.brush-preview {
  border: 1px solid #808080;
  background: #fff;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.size-value {
  font-size: var(--font-body);
  color: #808080;
  width: 16px;
  text-align: right;
  flex-shrink: 0;
}

.size-slider {
  flex: 1;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: #fff;
  border: 1px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  outline: none;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
}

.size-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 8px;
  height: 14px;
  background: #c0c0c0;
  border: 1px solid;
  border-color: #dfdfdf #404040 #404040 #dfdfdf;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
}

.size-slider::-moz-range-thumb {
  width: 8px;
  height: 14px;
  background: #c0c0c0;
  border: 1px solid;
  border-color: #dfdfdf #404040 #404040 #dfdfdf;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
}

/* Actions */
.canvas-actions {
  justify-content: center;
}

.canvas-action-btn {
  font-family: regular;
  font-size: var(--font-body);
  background: #c0c0c0;
  border: 2px solid;
  border-color: #dfdfdf #404040 #404040 #dfdfdf;
  padding: 6px 10px;
  cursor: url('/img/cur/local/hyperlink.png'), pointer;
  color: #000;
  white-space: nowrap;
}

.canvas-action-btn:active {
  border-color: #404040 #dfdfdf #dfdfdf #404040;
}

/* pen cursor handled by injected style sheet in shared.js */
/* pen cursor handled by injected style sheet in shared.js */