:root {
  --bg: #101114;
  --panel: #17191d;
  --panel-2: #1d2025;
  --panel-3: #22262b;
  --line: #30343b;
  --line-strong: #434850;
  --text: #f2f3f5;
  --muted: #9ca3ad;
  --dim: #717782;
  --orange: #ff7a1a;
  --green: #45d48a;
  --yellow: #f2bd4d;
  --blue: #8fa2bd;
  --red: #ef6673;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
}

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

button,
select {
  cursor: pointer;
}

img {
  max-width: 100%;
}

.wrap {
  width: min(1460px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 17, 20, 0.97);
}

.header-row {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.wordmark {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
}

.wordmark strong {
  color: var(--orange);
}

.wordmark span {
  margin-left: 8px;
  color: var(--muted);
  font-weight: 500;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.top-nav a,
.nav-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
}

.top-nav a:hover,
.top-nav a.active,
.nav-button:hover {
  color: var(--text);
  background: var(--panel-2);
}

.page-intro {
  padding: 30px 0 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.page-intro h1,
.admin-title-row h1 {
  margin: 0 0 6px;
  font-size: 31px;
  letter-spacing: -0.03em;
}

.page-intro p,
.admin-title-row p {
  margin: 0;
  color: var(--muted);
}

.updated-label {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

.progress-summary {
  margin-bottom: 20px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
}

.progress-summary.compact {
  margin-top: 18px;
}

.progress-summary-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.progress-summary-head > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.progress-summary-head strong {
  font-size: 26px;
}

.bar,
.mini-bar {
  overflow: hidden;
  background: #0b0c0e;
  border-radius: 999px;
}

.bar.large {
  height: 8px;
  margin-top: 12px;
}

.bar span,
.mini-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--orange);
}

.controls {
  margin: 18px 0 12px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  background: #0d0f11;
  color: var(--text);
  padding: 9px 10px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #59616c;
}

.controls > input {
  min-height: 40px;
}

.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.segmented button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 7px 10px;
}

.segmented button.active {
  background: var(--panel-3);
  color: var(--text);
}

.sort-control {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.sort-control select {
  width: 160px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
}

.dot.ns {
  background: #727782;
}

.dot.wip {
  background: var(--yellow);
}

.dot.done {
  background: var(--green);
}

.dot.na {
  background: var(--blue);
}

.roadmap-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding-bottom: 50px;
  align-items: start;
}

.roadmap-card {
  min-width: 0;
  border: 2px solid var(--card-accent, var(--line));
  border-radius: 9px;
  background: var(--panel);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.roadmap-card .mini-bar span {
  background: var(--card-accent, var(--orange));
}

.roadmap-card.card-state-finished {
  border: 2px solid transparent;
  background:
    linear-gradient(var(--panel), var(--panel)) padding-box,
    linear-gradient(
      120deg,
      #ff5a5f,
      #ff9f43,
      #f7e35f,
      #53d769,
      #4fd6ff,
      #6f7cff,
      #b56cff,
      #ff5fa2,
      #ff5a5f
    ) border-box;
  background-size: 100% 100%, 320% 320%;
  animation: finished-rainbow-border 4s linear infinite;
  box-shadow: 0 0 12px rgba(90, 210, 255, 0.10);
}

.roadmap-card.card-state-finished .mini-bar span {
  background: linear-gradient(
    90deg,
    #ff5a5f,
    #ff9f43,
    #f7e35f,
    #53d769,
    #4fd6ff,
    #6f7cff,
    #b56cff,
    #ff5fa2
  );
  background-size: 260% 100%;
  animation: finished-rainbow-bar 4s linear infinite;
}

@keyframes finished-rainbow-border {
  from { background-position: 0 0, 0% 50%; }
  to { background-position: 0 0, 320% 50%; }
}

@keyframes finished-rainbow-bar {
  from { background-position: 0% 50%; }
  to { background-position: 260% 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .roadmap-card.card-state-finished,
  .roadmap-card.card-state-finished .mini-bar span {
    animation: none;
  }
}

.character-card {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 410px;
}

.character-art-wrap {
  position: relative;
  min-height: 410px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: #131518;
}

.character-art {
  position: absolute;
  display: block;
  max-width: none;
  user-select: none;
  pointer-events: none;
  transform-origin: center;
}

.character-art.fit-height {
  width: auto;
  height: 100%;
}

.character-art.fit-contain {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.character-art.fit-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.character-body {
  min-width: 0;
  padding: 15px;
}

.character-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.character-head h2,
.standalone-head h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.02em;
}

.character-head > strong {
  color: var(--muted);
  font-size: 12px;
}

.character-note {
  margin: 10px 0;
  padding: 8px 10px;
  border-left: 3px solid #4b5159;
  background: #121417;
  color: #c8ccd1;
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.45;
}

.part-list {
  margin-top: 7px;
}

.part-row {
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.part-row:last-child {
  border-bottom: 0;
}

.part-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.part-name {
  min-width: 0;
  color: #d5d8dd;
  font-size: 13px;
  line-height: 1.25;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 700;
}

.status-not-started {
  color: #aeb3bc;
  background: #24272c;
}

.status-wip {
  color: var(--yellow);
  background: #2c271b;
}

.status-finished {
  color: var(--green);
  background: #17281f;
}

.status-na {
  color: var(--blue);
  background: #1a2028;
}

.part-note {
  margin: 6px 0 0;
  color: var(--muted);
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.42;
}

.mini-bar {
  height: 3px;
  margin-top: 12px;
}

.gallery-shell {
  position: relative;
  margin-top: 8px;
}

.gallery-track {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  padding-bottom: 4px;
}

.media-button {
  position: relative;
  flex: 0 0 auto;
  width: 118px;
  height: 76px;
  overflow: hidden;
  scroll-snap-align: start;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0d0e10;
  padding: 0;
}

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

.media-button.is-nsfw img {
  filter: blur(11px) brightness(0.5);
  transform: scale(1.15);
}

.media-button.is-nsfw.revealed img {
  filter: none;
  transform: none;
}

.nsfw-cover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  background: rgba(10, 11, 13, 0.45);
}

.nsfw-cover strong {
  font-size: 12px;
}

.nsfw-cover small {
  margin-top: 2px;
  font-size: 9px;
}

.media-button.revealed .nsfw-cover {
  display: none;
}

.gallery-arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 27px;
  height: 36px;
  transform: translateY(-50%);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: rgba(20, 22, 25, 0.92);
  color: white;
  font-size: 22px;
  line-height: 1;
}

.gallery-arrow.prev {
  left: 3px;
}

.gallery-arrow.next {
  right: 3px;
}

.gallery-arrow:hover {
  background: #2b2f34;
}

.standalone-card {
  padding: 16px;
}

.standalone-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
}

.standalone-type {
  margin-bottom: 4px;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 10px;
  font-weight: 800;
}

.standalone-notes {
  margin: 11px 0 0;
  color: #c9cdd2;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.5;
}

.standalone-card .gallery-shell {
  margin-top: 12px;
}

.standalone-card .media-button {
  width: 210px;
  height: 130px;
}

.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 48px;
  background: rgba(0, 0, 0, 0.9);
}

.viewer[hidden] {
  display: none;
}

.viewer img {
  max-width: 96vw;
  max-height: 90vh;
  object-fit: contain;
}

.viewer-close {
  position: fixed;
  top: 14px;
  right: 18px;
  width: 38px;
  height: 38px;
  border: 1px solid #444a52;
  border-radius: 7px;
  background: #22262b;
  color: white;
  font-size: 24px;
}

.empty {
  grid-column: 1 / -1;
  padding: 38px 20px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

/* Recent changes */
.changes-list {
  padding-bottom: 54px;
}

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

.change-day h2 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.change-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: var(--panel);
}

.change-row:nth-of-type(2) {
  border-radius: 8px 8px 0 0;
}

.change-row:last-child {
  border-bottom: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
}

.change-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--panel-3);
  color: var(--muted);
  font-weight: 800;
}

.change-icon.kind-status {
  color: var(--yellow);
}

.change-icon.kind-add {
  color: var(--green);
}

.change-icon.kind-remove {
  color: var(--red);
}

.change-title {
  font-size: 13px;
  font-weight: 700;
}

.change-detail {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.change-row time {
  color: var(--dim);
  font-size: 11px;
  white-space: nowrap;
}

/* Admin */
.admin-title-row {
  padding-top: 27px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.save-state {
  color: var(--green);
  font-size: 12px;
}

.save-state.saving {
  color: var(--yellow);
}

.save-state.error {
  color: var(--red);
}

.login-box {
  width: min(420px, 100%);
  margin: 90px auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
}

.login-box h1 {
  margin: 0 0 6px;
}

.login-box p {
  margin: 0 0 18px;
  color: var(--muted);
}

.login-box form {
  display: grid;
  gap: 9px;
}

.form-error {
  min-height: 18px;
  color: #ff9da6;
  font-size: 12px;
}

.primary,
.secondary,
.danger,
.icon-btn,
.edit-btn,
.small-button {
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 8px 11px;
}

.primary {
  background: var(--orange);
  color: #17100b;
  font-weight: 750;
}

.secondary,
.edit-btn {
  border-color: var(--line);
  background: var(--panel-3);
  color: var(--text);
}

.danger {
  border-color: #62323a;
  background: #2b191d;
  color: #ff9da6;
}

.icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 20px;
}

.small-button {
  min-height: 32px;
  padding: 6px 9px;
}

.admin-section {
  margin: 28px 0;
}

.section-heading {
  margin-bottom: 11px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.section-heading h2 {
  margin: 0 0 3px;
  font-size: 19px;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.button-row {
  display: flex;
  gap: 7px;
}

.full-input {
  margin-bottom: 9px;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-table {
  width: 100%;
  min-width: 1060px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 8px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 12px;
}

.admin-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #15171a;
  color: var(--muted);
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.admin-char {
  min-width: 165px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-char img {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 5px;
  background: #111;
  object-fit: cover;
}

.status-select {
  min-width: 112px;
  padding: 7px;
}

.standalone-admin-list {
  display: grid;
  gap: 7px;
}

.standalone-admin-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.standalone-admin-row img,
.standalone-admin-placeholder {
  width: 76px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 5px;
  background: #111;
  object-fit: cover;
}

.standalone-admin-row .grow {
  min-width: 0;
  flex: 1;
}

.standalone-admin-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 3px;
}

.type-badge {
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--muted);
  padding: 3px 6px;
  font-size: 10px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.74);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(620px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--panel);
}

.modal.wide {
  width: min(780px, 100%);
}

.modal.extra-wide {
  width: min(1040px, 100%);
}

.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  flex: 1;
  font-size: 18px;
}

.modal-actions {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.modal-body {
  padding: 14px;
}

.modal-body > label,
.art-controls label,
.part-editor label {
  display: grid;
  gap: 5px;
  margin-bottom: 11px;
  color: var(--muted);
  font-size: 12px;
}

.modal-body textarea,
.part-editor textarea {
  min-height: 88px;
  resize: vertical;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.spacer {
  flex: 1;
}

.editor-subsection {
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.editor-subsection.flush {
  margin-top: 10px;
}

.subsection-head {
  margin-bottom: 11px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.subsection-head h3 {
  margin: 0 0 3px;
  font-size: 15px;
}

.subsection-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.art-editor-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.25fr) minmax(220px, 0.75fr);
  gap: 14px;
}

.art-preview {
  position: relative;
  height: 360px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #131518;
  touch-action: none;
  cursor: grab;
}

.art-preview:active {
  cursor: grabbing;
}

.art-preview img {
  position: absolute;
  display: block;
  max-width: none;
  pointer-events: none;
  user-select: none;
}

.art-preview img.fit-height {
  width: auto;
  height: 100%;
}

.art-preview img.fit-contain {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

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

.art-preview-hint {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 2;
  border-radius: 5px;
  background: rgba(10, 11, 13, 0.78);
  color: var(--muted);
  padding: 4px 6px;
  font-size: 10px;
  pointer-events: none;
}

.art-controls {
  display: grid;
  align-content: start;
}

.art-controls output {
  justify-self: end;
  color: var(--text);
  font-size: 11px;
}

.art-controls input[type="range"] {
  padding: 0;
  accent-color: var(--orange);
}

.part-editors {
  display: grid;
  gap: 10px;
}

.part-editor {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #141619;
}

.part-editor-head {
  margin-bottom: 9px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 10px;
  align-items: center;
}

.part-editor-head h4 {
  margin: 0;
  font-size: 14px;
}

.file-label {
  margin-top: 9px;
}

.gallery-editor {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.gallery-editor-empty {
  width: 100%;
  padding: 8px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--dim);
  font-size: 11px;
}

.gallery-admin-item {
  width: 122px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101215;
}

.gallery-admin-item img {
  width: 100%;
  height: 68px;
  display: block;
  margin-bottom: 6px;
  border-radius: 4px;
  object-fit: cover;
}

.check-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 6px !important;
  margin: 0 !important;
}

.check-row input {
  width: auto !important;
}

.danger-link {
  margin-top: 5px;
  border: 0;
  background: transparent;
  color: #ff9da6;
  padding: 0;
  font-size: 11px;
}

.queued-files {
  display: grid;
  gap: 5px;
  margin-top: 8px;
}

.queued-file {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #101215;
  font-size: 11px;
}

.queued-file > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

hr {
  margin: 16px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 120;
  max-width: min(390px, calc(100% - 32px));
  padding: 10px 12px;
  transform: translateY(12px);
  opacity: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #24272c;
  color: var(--text);
  transition: 0.18s ease;
  pointer-events: none;
  font-size: 13px;
}

.toast.show {
  transform: none;
  opacity: 1;
}

.toast.error {
  border-color: #6d343e;
  color: #ffadb5;
}

@media (max-width: 1160px) {
  .roadmap-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .wrap {
    width: min(100% - 20px, 1460px);
  }

  .header-row {
    align-items: flex-start;
    flex-direction: column;
    padding: 10px 0;
    gap: 7px;
  }

  .top-nav {
    width: 100%;
    overflow-x: auto;
  }

  .page-intro,
  .admin-title-row,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .updated-label {
    text-align: left;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .segmented {
    overflow-x: auto;
  }

  .sort-control {
    justify-content: space-between;
  }

  .roadmap-grid {
    grid-template-columns: 1fr;
  }

  .character-card {
    grid-template-columns: 170px minmax(0, 1fr);
  }

  .character-art-wrap {
    min-height: 440px;
  }

  .two-col,
  .art-editor-grid {
    grid-template-columns: 1fr;
  }

  .art-preview {
    height: 420px;
  }

  .change-row {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .change-row time {
    grid-column: 2;
    white-space: normal;
  }
}

@media (max-width: 520px) {
  .wordmark span {
    display: none;
  }

  .top-nav a,
  .nav-button {
    padding-left: 7px;
    padding-right: 7px;
  }

  .progress-summary-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .roadmap-card.character-card {
    display: block;
  }

  .character-art-wrap {
    min-height: 380px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .part-editor-head {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    padding: 8px;
  }

  .queued-file {
    grid-template-columns: 1fr;
  }
}

.changes-admin-list {
  display: grid;
  gap: 7px;
}

.change-admin-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}

.change-admin-row .grow {
  min-width: 0;
  flex: 1;
}

.change-admin-row strong {
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
}

.change-admin-time {
  margin-top: 3px;
  color: var(--dim);
  font-size: 10px;
}

/* Compact subsection attachments */
.attachment-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.attachment-icon {
  position: relative;
  width: 28px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #202329;
  color: #cbd0d7;
  font-size: 16px;
  line-height: 1;
}

.attachment-icon:hover {
  border-color: #5b636e;
  background: #292d33;
  color: #fff;
}

.attachment-icon small {
  position: absolute;
  right: -4px;
  bottom: -4px;
  padding: 1px 3px;
  border-radius: 4px;
  background: #7d2832;
  color: #fff;
  font-size: 7px;
  font-weight: 800;
}

.viewer-nsfw img {
  filter: blur(26px) brightness(.45);
  transform: scale(1.05);
}

.viewer-nsfw-cover {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  color: #fff;
  cursor: pointer;
  background: rgba(5,6,8,.28);
}

.viewer-nsfw .viewer-nsfw-cover {
  display: flex;
}

.viewer-nsfw-cover strong {
  font-size: 22px;
}

.viewer-nsfw-cover span {
  font-size: 12px;
  color: #d7d9de;
}

.viewer-close {
  z-index: 4;
}

.standalone-component-head {
  grid-template-columns: minmax(150px,1fr) 150px auto;
}

.empty-art::after {
  content: 'No image';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--dim);
  font-size: 12px;
}

@media (max-width: 650px) {
  .standalone-component-head {
    grid-template-columns: 1fr;
  }
}

.hero-nsfw .character-art {
  filter: blur(20px) brightness(.45);
  transform-origin: center;
}

.hero-nsfw-cover {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  border: 0;
  background: rgba(8, 9, 11, .30);
  color: #fff;
}

.hero-nsfw-cover strong {
  font-size: 18px;
}

.hero-nsfw-cover span {
  font-size: 11px;
  color: #d3d7dd;
}

/* Editor preview uses the exact desktop roadmap art-pane framing: 220 x 410. */
#artPreview,
#standaloneArtPreview {
  width: 220px;
  height: 410px;
  min-width: 220px;
  min-height: 410px;
  max-width: 220px;
  max-height: 410px;
  justify-self: start;
}

.art-editor-grid {
  grid-template-columns: 220px minmax(220px, 1fr);
  align-items: start;
}

#artPreview::before,
#standaloneArtPreview::before {
  content: 'ROADMAP FRAME';
  position: absolute;
  top: 7px;
  left: 7px;
  z-index: 4;
  padding: 3px 5px;
  border-radius: 4px;
  background: rgba(10, 11, 13, .72);
  color: rgba(255,255,255,.62);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  pointer-events: none;
}

@media (max-width: 820px) {
  #artPreview,
  #standaloneArtPreview {
    width: 170px;
    height: 440px;
    min-width: 170px;
    min-height: 440px;
    max-width: 170px;
    max-height: 440px;
  }

  .art-editor-grid {
    grid-template-columns: 170px minmax(0, 1fr);
  }
}

/* Robust horizontal scaling: never squeeze cards below a usable content width. */
.roadmap-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr));
}

/* Give text/status columns permission to wrap cleanly instead of colliding. */
.character-head > *:first-child,
.character-head h2,
.part-top,
.part-name {
  min-width: 0;
}

.character-head h2 {
  overflow-wrap: anywhere;
}

.part-top {
  grid-template-columns: minmax(90px, 1fr) max-content;
}

.part-name {
  overflow-wrap: normal;
  word-break: normal;
}

.status-pill {
  flex: 0 0 auto;
}

/* If a card ever gets genuinely narrow, reduce the art pane before text gets crushed. */
@media (max-width: 980px) {
  .character-card {
    grid-template-columns: 190px minmax(0, 1fr);
  }
}

@media (max-width: 540px) {
  .character-card {
    display: block;
  }

  .character-art-wrap {
    min-height: 360px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

/* Keep subsection attachment icons inline with the subsection title. */
.part-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.part-main .attachment-icons {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 0;
}
