.mj-shell {
  font-family: Arial, Helvetica, sans-serif;
}

.mj-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.mj-month-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mj-month-nav h1 {
  font-size: 1.15rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 0;
  min-width: 220px;
  text-align: center;
}

.mj-month-nav button {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1rem;
  background: #ffffff;
  border: 1px solid #000000;
  padding: 2px 10px;
  cursor: pointer;
}

.mj-month-nav button:hover:not(:disabled) {
  background: #0000ff;
  color: #ffffff;
}

.mj-month-nav button:disabled {
  opacity: 0.3;
  cursor: default;
}

#searchBox {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  border: 1px solid #000000;
  padding: 4px 8px;
  width: 300px;
  max-width: 100%;
}

.mj-stats {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.75rem;
  color: #555555;
}

.mj-view-tabs button {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8rem;
  background: #ffffff;
  border: 1px solid #000000;
  padding: 3px 12px;
  cursor: pointer;
}

.mj-view-tabs button + button {
  border-left: none;
}

.mj-view-tabs button.active {
  background: #0000ff;
  color: #ffffff;
  font-weight: bold;
}

.mj-view-tabs button:hover:not(.active) {
  text-decoration: underline;
}

.mj-body {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.mj-gallery {
  flex: 1;
  min-width: 0;
}

.mj-loading {
  font-family: 'Courier New', Courier, monospace;
}

.mj-error {
  font-family: 'Courier New', Courier, monospace;
  color: #cc0000;
  white-space: pre-wrap;
}

.mj-day {
  margin-bottom: 26px;
}

.mj-day-header {
  position: sticky;
  top: 46px;
  background: #ffffff;
  border-bottom: 1px solid #000000;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  font-weight: bold;
  padding: 6px 0 4px;
  margin-bottom: 10px;
  z-index: 5;
}

.mj-day-header small {
  font-weight: normal;
  color: #555555;
  margin-left: 8px;
}

.mj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.mj-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #eeeeee;
  border: 1px solid #cccccc;
  cursor: pointer;
  padding: 0;
}

.mj-cell:hover {
  border-color: #0000ff;
}

.mj-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mj-cell .mj-video-badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #ffffff;
  background: #222222;
  font-family: Arial, Helvetica, sans-serif;
}

.mj-cell .mj-ref-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: #0000ff;
  color: #ffffff;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.6rem;
  padding: 1px 4px;
}

/* prompt view: text cards take the images' places, same order/grouping */

.mj-gallery[data-view="prompts"] .mj-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.mj-cell-text {
  aspect-ratio: auto;
  min-height: 90px;
  background: #ffffff;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  font-family: Arial, Helvetica, sans-serif;
}

.mj-cell-text .mj-cell-time {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.65rem;
  color: #888888;
}

.mj-cell-text .mj-cell-prompt-text {
  font-size: 0.8rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 7;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-wrap: break-word;
}

.mj-cell-text .mj-cell-prompt-text em {
  color: #888888;
}

.mj-cell-text .mj-params {
  color: #0000ff;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.68rem;
  word-wrap: break-word;
}

.mj-cell-text .mj-ref-badge {
  position: static;
  align-self: flex-start;
}

.mj-ref-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.mj-ref-strip img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border: 1px solid #cccccc;
}

.mj-ref-missing {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.65rem;
  color: #888888;
}

.mj-timeline {
  position: sticky;
  top: 60px;
  width: 130px;
  flex-shrink: 0;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.75rem;
  border-left: 1px solid #000000;
  padding-left: 10px;
}

.mj-timeline .mj-tl-year {
  font-weight: bold;
  margin: 8px 0 2px;
}

.mj-timeline a {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  color: #000000;
  padding: 1px 2px;
}

.mj-timeline a small {
  color: #888888;
}

.mj-timeline a.current {
  background: #0000ff;
  color: #ffffff;
}

.mj-timeline a.current small {
  color: #ccccff;
}

.mj-toolbar-links {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.mj-help-link {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.75rem;
  color: #0000ff;
}

/* import panel */

.mj-import-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 150;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 16px 16px;
  overflow-y: auto;
}

.mj-import-overlay[hidden] {
  display: none;
}

.mj-import-panel {
  background: #ffffff;
  border: 1px solid #000000;
  max-width: 640px;
  width: 100%;
  padding: 18px;
  font-family: Arial, Helvetica, sans-serif;
}

.mj-import-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid #000000;
  padding-bottom: 6px;
  margin-bottom: 10px;
}

.mj-import-head h2 {
  font-size: 1rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 0;
}

.mj-import-hint {
  font-size: 0.85rem;
  line-height: 1.5;
}

.mj-import-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.78rem;
}

.mj-import-label {
  color: #888888;
}

.mj-import-row code {
  background: #f2f2f2;
  padding: 2px 6px;
  word-break: break-all;
}

.mj-import-run {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  font-weight: bold;
  background: #ffffff;
  border: 1px solid #000000;
  padding: 6px 14px;
  cursor: pointer;
}

.mj-import-run:hover:not(:disabled) {
  background: #0000ff;
  color: #ffffff;
}

.mj-import-run:disabled {
  opacity: 0.4;
  cursor: default;
}

.mj-import-log {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.7rem;
  background: #111111;
  color: #dddddd;
  padding: 10px;
  max-height: 260px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* lightbox */

.mj-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 200;
  display: flex;
}

.mj-lightbox[hidden] {
  display: none;
}

.mj-lb-media {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 30px 60px;
}

.mj-lb-media img,
.mj-lb-media video {
  max-width: 100%;
  max-height: calc(100vh - 60px);
  object-fit: contain;
}

.mj-lb-panel {
  width: 330px;
  flex-shrink: 0;
  background: #ffffff;
  border-left: 1px solid #000000;
  padding: 18px;
  overflow-y: auto;
  font-family: Arial, Helvetica, sans-serif;
}

.mj-lb-date {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8rem;
  font-weight: bold;
  border-bottom: 1px solid #000000;
  padding-bottom: 6px;
  margin-bottom: 10px;
}

.mj-lb-prompt {
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0 0 8px;
  word-wrap: break-word;
}

.mj-lb-prompt .mj-params {
  color: #0000ff;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8rem;
}

.mj-lb-prompt .mj-no-prompt {
  color: #888888;
  font-style: italic;
}

.mj-copy {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.75rem;
  background: #ffffff;
  border: 1px solid #000000;
  padding: 2px 8px;
  cursor: pointer;
}

.mj-copy:hover {
  background: #0000ff;
  color: #ffffff;
}

.mj-lb-meta {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.72rem;
  margin: 14px 0;
}

.mj-lb-meta dt {
  color: #888888;
  float: left;
  clear: left;
  width: 70px;
}

.mj-lb-meta dd {
  margin: 0 0 3px 78px;
  word-wrap: break-word;
}

.mj-lb-refs h3 {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.78rem;
  margin: 12px 0 6px;
  border-bottom: 1px solid #cccccc;
}

.mj-lb-refs .mj-ref-row {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.72rem;
  margin-bottom: 8px;
  word-wrap: break-word;
}

.mj-lb-refs img {
  display: block;
  max-width: 120px;
  max-height: 120px;
  border: 1px solid #cccccc;
  margin-top: 4px;
}

.mj-lb-close,
.mj-lb-arrow {
  position: absolute;
  background: transparent;
  color: #ffffff;
  border: 1px solid #ffffff;
  font-size: 1.2rem;
  font-family: 'Courier New', Courier, monospace;
  cursor: pointer;
  padding: 4px 12px;
  z-index: 210;
}

.mj-lb-close:hover,
.mj-lb-arrow:hover {
  background: #0000ff;
  border-color: #0000ff;
}

.mj-lb-close {
  top: 14px;
  left: 14px;
}

.mj-lb-arrow {
  top: 50%;
  transform: translateY(-50%);
}

.mj-lb-prev {
  left: 14px;
}

.mj-lb-next {
  right: 348px;
}

@media (max-width: 900px) {
  .mj-timeline {
    display: none;
  }

  .mj-lightbox {
    flex-direction: column;
    overflow-y: auto;
  }

  .mj-lb-panel {
    width: auto;
    border-left: none;
    border-top: 1px solid #000000;
  }

  .mj-lb-media {
    padding: 40px 10px 10px;
  }

  .mj-lb-next {
    right: 14px;
  }
}
