@font-face {
  font-family: "VT323";
  src: url("./assets/VT323-Regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: "Press Start 2P";
  src: url("./assets/PressStart2P-Regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

:root {
  --bg: #008080;
  --win-bg: #c0c0c0;
  --win-dark: #808080;
  --win-darker: #404040;
  --win-light: #dfdfdf;
  --win-lighter: #ffffff;
  --title-active: #000080;
  --title-inactive: #808080;
  --text: #000000;
  --highlight: #000080;
  --highlight-text: #ffffff;
  --font-ui: "VT323", "MS Sans Serif", Tahoma, sans-serif;
  --font-heading: "Press Start 2P", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font: 18px/1.2 var(--font-ui);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.monitor {
  position: relative;
  width: min(96vw, 1200px);
  height: min(93vh, 800px);
  background: #1a1a1a;
  border-radius: 20px;
  padding: 30px 40px 50px;
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.8),
    0 0 0 8px #2a2a2a,
    0 0 0 12px #111,
    0 0 0 16px #0a0a0a,
    0 0 30px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.monitor::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 65%,
    rgba(0, 0, 0, 0.5) 100%
  );
  pointer-events: none;
  z-index: 100;
  border-radius: 20px;
}

.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.1) 0px,
    rgba(0, 0, 0, 0.1) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 101;
  border-radius: 20px;
}

.screen {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--bg);
  border-radius: 8px;
  overflow: hidden;
  border: 3px inset #333;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.4);
  animation: flicker 3s infinite;
}

.screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(255, 255, 255, 0.03) 0%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 35;
}

@keyframes flicker {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.98;
  }
  51% {
    opacity: 1;
  }
  52% {
    opacity: 0.99;
  }
  53% {
    opacity: 1;
  }
  100% {
    opacity: 1;
  }
}

.window {
  background: var(--win-bg);
  border-top: 2px solid var(--win-light);
  border-left: 2px solid var(--win-light);
  border-right: 2px solid var(--win-dark);
  border-bottom: 2px solid var(--win-dark);
  position: absolute;
  display: flex;
  flex-direction: column;
}

.window.gallery-window {
  top: 20px;
  left: 20px;
  right: 20px;
  bottom: 80px;
  z-index: 20;
}

.title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--title-active);
  color: var(--highlight-text);
  padding: 4px 6px;
  font-family: var(--font-heading);
  font-size: 10px;
}

.title-btn {
  min-width: 20px;
  height: 18px;
  background: var(--win-bg);
  border-top: 2px solid var(--win-light);
  border-left: 2px solid var(--win-light);
  border-right: 2px solid var(--win-dark);
  border-bottom: 2px solid var(--win-dark);
  font-family: var(--font-ui);
}
.title-btn:active {
  border-top-color: var(--win-dark);
  border-left-color: var(--win-dark);
  border-right-color: var(--win-light);
  border-bottom-color: var(--win-light);
}

.menu-bar {
  display: flex;
  gap: 14px;
  padding: 3px 8px;
  border-top: 1px solid var(--win-light);
  border-bottom: 1px solid var(--win-dark);
}

.menu-item {
  padding: 2px 6px;
  cursor: pointer;
  user-select: none;
  border: 2px solid transparent;
}
.menu-item:hover {
  border-top-color: var(--win-lighter);
  border-left-color: var(--win-lighter);
  border-right-color: var(--win-dark);
  border-bottom-color: var(--win-dark);
  background: var(--win-bg);
}
.menu-item:active {
  border-top-color: var(--win-dark);
  border-left-color: var(--win-dark);
  border-right-color: var(--win-lighter);
  border-bottom-color: var(--win-lighter);
}

.gallery-content {
  padding: 8px;
  border-top: 2px solid var(--win-dark);
  border-left: 2px solid var(--win-dark);
  border-right: 2px solid var(--win-light);
  border-bottom: 2px solid var(--win-light);
  background: var(--win-lighter);
  flex: 1;
  overflow-y: auto;
}

.thumb {
  background: var(--win-bg);
  border: 2px outset #fff;
  padding: 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  position: relative;
}
.thumb:active {
  border-style: inset;
}
.thumb-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px inset #808080;
  background: #000;
  display: block;
}
.thumb-label {
  font-size: 12px;
  color: #000;
  text-align: center;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thumb-delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  color: red;
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  background: var(--win-bg);
  border: 1px outset #ccc;
  cursor: pointer;
  z-index: 10;
  padding: 2px 3px;
  line-height: 1;
}
.thumb-delete-btn:active {
  border-style: inset;
}

/* --- Thumbnail Comments --- */

.thumb-comments {
  margin-top: 6px;
  padding: 4px;
  background: var(--win-lighter);
  border: 1px inset var(--win-dark);
  display: flex;
  flex-direction: column;
  gap: 3px;
  /* Pushes the 'more' button to the bottom if thumbs height is different */
  flex-grow: 1;
}

.thumb-comment-loading,
.thumb-comment-empty {
  font-size: 12px;
  color: var(--win-darker);
  font-style: italic;
  text-align: center;
  padding: 4px 0;
}

.thumb-comment-item {
  font-size: 12px;
  color: var(--text);
  background: var(--win-light);
  border: 1px solid var(--win-bg);
  padding: 2px 4px;
  /* Truncate long comments so they don't break the grid */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.comment-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  color: red;
  font-family: var(--font-heading);
  font-size: 10px;
  background: var(--win-bg);
  border: 1px outset #ccc;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
}
.comment-delete-btn:active {
  border-style: inset;
}

.thumb-more-btn {
  /* push to bottom */
  margin-top: auto;
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 2px;
  background: var(--win-bg);
  border: 2px outset #fff;
  cursor: pointer;
  text-align: center;
  width: 100%;
}

.thumb-more-btn:active {
  border-style: inset;
  padding: 3px 1px 1px 3px;
}

.viewerbox {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s;
}
.viewerbox.open {
  opacity: 1;
  pointer-events: all;
}

.viewerbox-window {
  width: 85%;
  max-height: 85%;
}

.viewerbox-layout {
  display: flex;
  flex-direction: row;
  flex: 1;
  overflow: hidden;
  height: 400px;
}

.viewerbox-img-wrap {
  flex: 2;
  display: flex;
  flex-direction: column;
  background: #000;
  border-right: 2px inset var(--win-dark);
  padding: 4px;
  justify-content: center;
  align-items: center;
}
.viewerbox-img-wrap img {
  max-width: 100%;
  max-height: calc(100% - 30px);
  object-fit: contain;
}
.viewerbox-info {
  color: #00ff00;
  font-size: 14px;
  margin-top: 8px;
  text-align: center;
}

.viewerbox-sidebar {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--win-light);
  padding: 4px;
}

.comment-panel-title {
  font-weight: bold;
  text-align: center;
  margin: 4px 0;
}

.comment-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  border: 2px inset var(--win-dark);
  background: #f7f7f7;
}

.comment-item {
  border-bottom: 1px solid #ddd;
  padding: 6px 4px;
}
.comment-item-header {
  font-size: 12px;
  color: #333;
  margin-bottom: 4px;
}
.comment-item-body {
  font-size: 14px;
  color: #000;
}

.comment-form {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.comment-textarea {
  min-height: 60px;
  resize: vertical;
}

.comment-empty {
  color: #666;
  text-align: center;
  padding: 10px 0;
}
.taskbar {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  height: 32px;
  background: var(--win-bg);
  box-shadow:
    inset 1px 1px 0 var(--win-lighter),
    inset -1px 0 0 var(--win-dark);
  display: flex;
  align-items: center;
  padding: 2px;
  gap: 3px;
  z-index: 40;
}
.start-btn {
  height: 26px;
  padding: 1px 8px;
  background: var(--win-bg);
  border: 2px outset #fff;
  font-family: var(--font-heading); /* 8-bit start button */
  font-size: 10px;
}
.start-btn:active {
  border-style: inset;
  padding: 2px 7px 0 9px;
}

.taskbar-divider {
  width: 1px;
  height: 24px;
  background: var(--win-dark);
  margin: 0 1px;
  box-shadow: 1px 0 0 var(--win-lighter);
}
.taskbar-clock {
  margin-left: auto;
  padding: 1px 8px;
  border: 1px inset var(--win-dark);
  min-width: 70px;
  text-align: center;
}

.status-bar {
  position: absolute;
  bottom: 56px;
  left: 20px;
  right: 20px;
  height: 18px;
  background: var(--win-bg);
  box-shadow:
    inset 1px 1px 0 var(--win-lighter),
    inset -1px -1px 0 var(--win-dark);
  display: flex;
  align-items: center;
  padding: 0 4px;
  font-size: 13px;
  z-index: 40;
}
.status-bar-item {
  padding: 0 6px;
  border: 1px inset var(--win-dark);
  height: 15px;
  display: flex;
  align-items: center;
  font-size: 12px;
}

*,
::after,
::before {
  /* https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing */
  box-sizing: border-box;
}

.row {
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
}

.form-window {
  width: 320px;
  min-width: auto;
}

.form-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--win-lighter);
  border: 2px inset var(--win-dark);
}

.retro-input {
  border: 2px inset #fff;
  padding: 4px;
  font-family: "VT323", monospace;
  font-size: 16px;
  width: 100%;
}

.retro-btn {
  flex: 1;
  padding: 4px;
  font-family: "VT323", monospace;
  font-size: 16px;
  cursor: pointer;
  border: 2px outset #fff;
  background: var(--win-bg);
}

.retro-btn:active {
  border-style: inset;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.form-error {
  color: red;
  font-size: 12px;
  text-align: center;
  height: 14px;
}

.status-ready {
  margin-left: 8px;
}

.status-count {
  margin-left: auto;
  font-size: 12px;
}

.start-logo {
  font-size: 16px;
  line-height: 1;
}

.taskbar-folder {
  border: 1px inset #808080;
  padding: 1px 8px;
  font-size: 12px;
  font-family: "VT323", var(--font-ui);
  min-width: 100px;
}

.site-footer {
  position: absolute;
  bottom: 10px;
  font-family: "VT323", var(--font-ui);
  color: #008080;
}

/* 12 grid bootstrap layout */
.col-1 {
  flex-basis: calc(1 / 12 * 100%);
}
.col-2 {
  flex-basis: calc(2 / 12 * 100%);
}
.col-3 {
  flex-basis: calc(3 / 12 * 100%);
}
.col-4 {
  flex-basis: calc(4 / 12 * 100%);
}
.col-5 {
  flex-basis: calc(5 / 12 * 100%);
}
.col-6 {
  flex-basis: calc(6 / 12 * 100%);
}
.col-7 {
  flex-basis: calc(7 / 12 * 100%);
}
.col-8 {
  flex-basis: calc(8 / 12 * 100%);
}
.col-9 {
  flex-basis: calc(9 / 12 * 100%);
}
.col-10 {
  flex-basis: calc(10 / 12 * 100%);
}
.col-11 {
  flex-basis: calc(11 / 12 * 100%);
}
.col-12 {
  flex-basis: calc(12 / 12 * 100%);
}
.col-auto {
  flex: 1;
}

/* for mobile */
@media (max-width: 576px) {
  .col-sm-1 {
    flex-basis: calc(1 / 12 * 100%);
  }
  .col-sm-2 {
    flex-basis: calc(2 / 12 * 100%);
  }
  .col-sm-3 {
    flex-basis: calc(3 / 12 * 100%);
  }
  .col-sm-4 {
    flex-basis: calc(4 / 12 * 100%);
  }
  .col-sm-5 {
    flex-basis: calc(5 / 12 * 100%);
  }
  .col-sm-6 {
    flex-basis: calc(6 / 12 * 100%);
  }
  .col-sm-7 {
    flex-basis: calc(7 / 12 * 100%);
  }
  .col-sm-8 {
    flex-basis: calc(8 / 12 * 100%);
  }
  .col-sm-9 {
    flex-basis: calc(9 / 12 * 100%);
  }
  .col-sm-10 {
    flex-basis: calc(10 / 12 * 100%);
  }
  .col-sm-11 {
    flex-basis: calc(11 / 12 * 100%);
  }
  .col-sm-12 {
    flex-basis: calc(12 / 12 * 100%);
  }
  .col-sm-auto {
    flex: 1;
  }
}

.align-items-center {
  align-items: center;
}

.update-indicator {
  width: 100%;
  padding: 8px 16px;
  margin-bottom: 8px;
  background: var(--highlight);
  color: var(--highlight-text);
  font-family: var(--font-ui);
  font-size: 16px;
  text-align: center;
  cursor: pointer;
  border: 2px outset #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.update-indicator:hover {
  background: #0000c0;
}
.update-indicator:active {
  border-style: inset;
}
