:root {
  --maroon: #7a0000;
  --maroon-dark: #4a0000;
  --maroon-light: #a83232;
  --gold: #e9c94a;
  --link: #0000ee;
  --link-visited: #551a8b;
  --ink: #111;
  --muted: #4a4a4a;
  --hairline: #999;
  --paper: #ffffff;
  --page-bg: #d9d9d9;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page-bg);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 15px;
  line-height: 1.4;
  background: var(--page-bg);
}

a {
  color: var(--link);
}

a:visited {
  color: var(--link-visited);
}

button,
select,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

hr {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.28);
  margin: 14px 0;
}

.page-shell {
  max-width: 1040px;
  margin: 0 auto;
  background: var(--paper);
  border-left: 1px solid #b8b8b8;
  border-right: 1px solid #b8b8b8;
  box-shadow: 0 0 0 1px #fff inset;
}

/* ---------- Masthead ---------- */

.masthead {
  position: relative;
  overflow: hidden;
  background: linear-gradient(#b23b3b, #7a0000 55%, #5c0000);
  border-bottom: 3px solid var(--maroon-dark);
  padding: 0 0 14px;
}

.masthead-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 16px;
  background: linear-gradient(rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 60%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.3);
  font-family: Arial, Helvetica, sans-serif;
}

.masthead-bar a {
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
}

.masthead-bar a:visited {
  color: #fff;
}

.masthead-bar a:hover {
  text-decoration: underline;
}

.masthead-date {
  margin-left: auto;
  color: #ffe9b3;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1px;
}

.masthead-title {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 4px;
}

.brand-mark {
  width: 56px;
  height: 56px;
}

.brand-wordmark {
  height: 54px;
  width: auto;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.35));
}

.masthead-tagline {
  margin: 4px 20px 0;
  max-width: 40rem;
  color: #ffe3e3;
  font-size: 13px;
  line-height: 1.45;
}

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 188px 1fr;
  gap: 22px;
  padding: 18px 18px 4px;
}

/* ---------- Sidebar ---------- */

.sidebar {
  padding: 14px 12px;
  color: #fff2e6;
  background: linear-gradient(#6f2320, #451412);
  border: 1px solid #2c0c0b;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
}

.sidebar-box label {
  display: block;
  margin-bottom: 4px;
  color: #ffd9a0;
  font-weight: 700;
}

.sidebar-search-row {
  display: flex;
  gap: 4px;
}

.sidebar-search-row input,
.sidebar-search-row select {
  flex: 1;
  min-width: 0;
  height: 22px;
  padding: 0 4px;
  border: 2px inset #cbb;
  font-size: 12px;
  background: #fff;
  color: #111;
}

.sidebar-links {
  list-style: none;
  margin: 14px 0;
  padding: 0;
}

.sidebar-links li {
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.sidebar-links a {
  display: block;
  padding: 7px 2px;
  color: #ffe9d6;
  font-weight: 700;
  text-decoration: none;
}

.sidebar-links a:visited {
  color: #ffe9d6;
}

.sidebar-links a:hover {
  text-decoration: underline;
  color: #fff;
}

.sidebar-note {
  color: #e8c9c0;
  font-size: 11px;
  line-height: 1.5;
}

.sidebar-danger {
  width: 100%;
  margin-top: 6px;
}

/* ---------- Sidebar ad slots (placeholder) ---------- */

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

.ad-slot-tag {
  align-self: flex-start;
  color: #d8b9a8;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.ad-slot {
  display: flex;
  width: 100%;
  max-width: 160px;
  align-items: center;
  justify-content: center;
  border: 2px dashed rgba(255, 255, 255, 0.4);
  background: rgba(0, 0, 0, 0.2);
  color: rgba(255, 255, 255, 0.65);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  text-transform: uppercase;
}

.ad-slot-rect {
  aspect-ratio: 160 / 300;
}

.ad-slot-skyscraper {
  aspect-ratio: 160 / 600;
}

.ad-slot-filled {
  border-style: solid;
  border-color: #2c0c0b;
  background: #000;
}

.ad-slot-filled img {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------- Beveled buttons (classic OS bevel, no images) ---------- */

.go-button,
.beveled-button {
  padding: 4px 12px;
  border: 2px outset #d8d8d8;
  color: #111;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 12px;
  text-align: center;
  text-decoration: none;
  background: linear-gradient(#f7f7f7, #c7c7c7);
}

.go-button:active,
.beveled-button:active {
  border-style: inset;
  background: linear-gradient(#c7c7c7, #e6e6e6);
}

.beveled-primary,
.beveled-button.beveled-primary {
  border-color: #d68b8b;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
  background: linear-gradient(#c24b4b, var(--maroon));
}

/* ---------- Main content ---------- */

.content {
  min-width: 0;
}

.section-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 22px 0 10px;
  padding: 4px 10px;
  border: 1px solid #b89a2f;
  border-bottom: 3px solid var(--maroon);
  color: #4a3a08;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(#fffbe0, var(--gold));
}

.tab-arrow {
  font-size: 10px;
}

.compose-panel {
  border: 1px solid var(--hairline);
  padding: 14px 16px 16px;
  background: #fbfbfb;
}

.world-form {
  display: grid;
  gap: 10px;
}

.world-form label {
  display: grid;
  gap: 4px;
  color: #222;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 700;
}

textarea,
input,
select {
  width: 100%;
  padding: 5px 7px;
  border: 2px inset #b8b8b8;
  color: var(--ink);
  background: #fff;
}

textarea {
  min-height: 90px;
  resize: vertical;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.4;
}

.field-hint {
  margin: -2px 0 0;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.check-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border: 2px inset #b8b8b8;
  background: #fff;
}

.check-row input[type="checkbox"]:checked::after {
  content: "\2713";
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  color: #000;
}

.form-grid,
.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.modal-actions {
  grid-template-columns: 1fr 1fr;
}

/* ---------- Status strip ---------- */

.status-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  align-items: center;
  gap: 14px;
  margin: 14px 0;
  padding: 8px 12px;
  border: 1px solid var(--hairline);
  background: #f3f3f3;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
}

.status-strip strong {
  margin-right: 6px;
}

.status-strip span {
  color: var(--muted);
}

.progress-shell {
  height: 14px;
  overflow: hidden;
  border: 2px inset #aaa;
  background: #fff;
}

.progress-shell span {
  display: block;
  width: 0%;
  height: 100%;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.35) 0 6px, transparent 6px 12px),
    linear-gradient(90deg, #2c6e2f, var(--gold));
  transition: width 220ms ease;
}

/* ---------- Catalog (gallery) ---------- */

.gallery {
  column-count: 2;
  column-gap: 26px;
  column-rule: 1px solid var(--hairline);
  margin-bottom: 30px;
}

.catalog-entry {
  break-inside: avoid;
  margin: 0 0 16px;
  padding: 0 0 14px;
  border-bottom: 1px dashed #bbb;
}

.catalog-entry button {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 0;
  border: 0;
  text-align: left;
  color: inherit;
  background: transparent;
}

.catalog-viewer {
  display: block;
  flex: 0 0 auto;
  width: 108px;
  height: 108px;
  border: 0;
  background: transparent;
}

.missing-thumb {
  display: grid;
  flex: 0 0 auto;
  width: 108px;
  height: 108px;
  place-items: center;
  color: #999;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  font-weight: 700;
  background: #eee;
  border: 1px dashed #ccc;
}

.catalog-copy h3 {
  margin: 0;
  color: var(--link);
  font-size: 16px;
  line-height: 1.2;
  text-decoration: underline;
}

.catalog-meta {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.empty-state {
  column-span: all;
  padding: 20px;
  border: 1px solid var(--hairline);
  background: #f6f6f6;
}

.empty-state h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 16px 20px 22px;
  border-top: 1px solid var(--hairline);
  background: #f0f0f0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  text-align: center;
  color: #333;
}

.footer-mark {
  display: block;
  width: 40px;
  height: 40px;
  margin: 0 auto 10px;
}

.footer-links {
  margin: 0 0 8px;
}

.footer-copy {
  margin: 0;
  color: #555;
  line-height: 1.6;
}

/* ---------- World modal ---------- */

.world-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: #000;
  box-shadow: none;
}

.world-modal::backdrop {
  background: #000;
}

.world-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, #f4f1ea, #ded5bd);
}

.world-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
}

.stage-loading {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  display: flex;
}

.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  padding: 20px 26px;
  border: 2px outset #d8d8d8;
  background: linear-gradient(#f7f7f7, #d4d4d4);
  color: #111;
  font-family: Arial, Helvetica, sans-serif;
  text-align: center;
}

.loading-box p {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
}

.loading-hint {
  color: #555;
  font-weight: 400 !important;
  font-size: 11px !important;
}

.loading-bar {
  width: 220px;
  height: 14px;
  overflow: hidden;
  border: 2px inset #aaa;
  background: #fff;
}

.loading-bar span {
  display: block;
  width: 35%;
  height: 100%;
  background: repeating-linear-gradient(45deg, var(--gold) 0 6px, #b98f2a 6px 12px);
  animation: loading-slide 1.1s linear infinite;
}

@keyframes loading-slide {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(385%);
  }
}

.stage-loading.is-error .loading-box {
  border-color: var(--maroon);
}

.stage-loading.is-error .loading-bar {
  display: none;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 6;
}

.stage-overlay {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  width: fit-content;
  max-width: calc(100% - 36px);
  padding: 16px 20px;
  border: 2px outset #d8d8d8;
  background: linear-gradient(#f7f7f7, #d4d4d4);
}

.stage-overlay-text {
  max-width: 480px;
}

.stage-overlay-text h2 {
  margin: 0;
  color: var(--link);
  font-size: 24px;
  line-height: 1.1;
}

.modal-actions {
  flex: 0 0 auto;
  width: fit-content;
}

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 12px 12px 4px;
  }

  .sidebar {
    order: 2;
  }

  .content {
    order: 1;
  }

  .form-grid,
  .button-row,
  .status-strip {
    grid-template-columns: 1fr;
  }

  .gallery {
    column-count: 1;
  }

  .stage-overlay {
    align-items: stretch;
    width: auto;
    padding: 18px;
  }

  .modal-actions {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .stage-loading {
    right: 12px;
    bottom: auto;
    top: 64px;
  }
}
