/* Official contest long post and the official publish form. */
.contest-visual {
  margin: 24px 0 0;
  border-radius: var(--fc-radius-xl);
  overflow: hidden;
  background: var(--fc-color-surface-sunken);
}
.contest-visual img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: cover;
}
.contest-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 20px;
}
.contest-head .badge {
  margin: 0;
}
/* Overview card: the facts. The schedule is in the panel on the right (contestPanel). */
.contest-overview {
  margin: 24px 0 0;
  padding: 26px 28px;
  border: 1px solid var(--fc-color-border);
  border-radius: var(--fc-radius-xl);
  background: var(--fc-color-surface);
}
.contest-facts {
  display: grid;
  gap: 16px;
  margin: 0;
}
.contest-facts > div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 16px;
}
.contest-facts dt {
  padding-top: 4px;
  font-size: 13px;
  color: var(--fc-color-text-muted);
  font-weight: 650;
}
.contest-facts dd {
  margin: 0;
  color: var(--fc-color-text);
  line-height: 1.7;
}
.contest-facts dd .chip {
  margin-bottom: 0;
}
.contest-facts dd:has(.chip) {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-block;
  margin: 0 8px 8px 0;
  padding: 3px 12px;
  border-radius: var(--fc-radius-pill);
  background: var(--fc-color-surface-sunken);
  border: 1px solid transparent;
  font-size: 14px;
}
.contest-facts .chip {
  margin: 0;
}

.thread.contest-post > .body {
  margin: 30px 0 34px;
  font-size: 16px;
  color: var(--fc-color-text);
}
/* The card clips its children by default, which would stop the table of contents from sticking. */
.thread.contest-post {
  overflow: visible;
}
.contest-toc {
  position: sticky;
  top: var(--header-h);
  z-index: 5;
  display: flex;
  gap: 8px;
  margin: 0 -32px;
  padding: 12px 32px;
  overflow-x: auto;
  scrollbar-width: none;
  background: rgb(255 255 255 / 0.94);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.contest-toc a {
  flex: none;
  padding: 6px 14px;
  border-radius: var(--fc-radius-pill);
  background: var(--fc-color-accent-soft);
  color: var(--fc-color-text);
  font-size: 13px;
  font-weight: 650;
}
.contest-toc a:hover {
  background: var(--fc-color-accent-soft);
  color: var(--blue);
}
.contest-section {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 24px;
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 160px;
}
.contest-section h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.5;
}
.contest-section h2 span {
  margin-right: 10px;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--fc-color-text-muted);
}
.thread .contest-section .body {
  margin: 0;
  color: var(--fc-color-text-muted);
}
.contest-files {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.contest-section-body > .contest-files:first-child {
  margin-top: 0;
}
.contest-files li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--fc-radius-lg);
  background: var(--fc-color-accent-soft);
}
.contest-files li:hover {
  border-color: var(--fc-color-border-strong);
}
.contest-files a {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--fc-color-text);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 650;
}
.contest-files a::before {
  content: '↓ ';
}
.contest-files span {
  flex: none;
  color: var(--fc-color-text-muted);
  font-size: 13px;
}
.thread.contest-post .section-title {
  margin-top: 28px;
}
.tag {
  display: inline-block;
  vertical-align: 2px;
  margin-right: 8px;
  padding: 1px 7px;
  border-radius: var(--fc-radius-sm);
  font-size: 12px;
  font-weight: 650;
  color: var(--fc-color-text-muted);
  background: var(--fc-color-surface-sunken);
}
/* 「公式」はどこでも同じ中性のラベル（board-tag の「公式」も同じ見た目、board.css）。 */
.tag.official {
  color: var(--fc-color-text);
  background: var(--fc-color-surface-sunken);
}
.official-floor {
  margin-top: 12px;
  padding: 18px 20px;
  border: 1px solid var(--fc-color-border);
  border-radius: var(--fc-radius-lg);
  background: var(--fc-color-surface-sunken);
}
.official-floor .meta time {
  color: var(--fc-color-text-muted);
  font-size: 13px;
}
.locked-note {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: var(--fc-radius-md);
  background: var(--fc-color-bg);
  font-size: 14px;
}
.locked-note a {
  color: var(--fc-color-text);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 650;
}
.pin-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 14px;
  color: var(--fc-color-text-muted);
}
.pin-control select {
  padding: 8px 10px;
}
.pinned-list {
  margin-bottom: 20px;
}
.contest-form .field select {
  width: 100%;
}
.contest-times {
  border: 1px solid var(--line);
  border-radius: var(--fc-radius-lg);
  padding: 4px 20px;
  margin: 24px 0;
}
.contest-times legend {
  font-size: 14px;
  color: var(--fc-color-text-muted);
  padding: 0 6px;
}
.contest-times .field {
  margin: 16px 0;
}
/* 展示シーン：見本の画像に「使う」と「★ 既定」。 */
.contest-scenes {
  border: 1px solid var(--line);
  border-radius: var(--fc-radius-lg);
  padding: 4px 20px 20px;
  margin: 24px 0;
}
.contest-scenes legend {
  font-size: 14px;
  color: var(--fc-color-text-muted);
  padding: 0 6px;
}
.contest-scenes legend small {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}
.scene-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.scene-option {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}
.scene-option img {
  width: 100%;
  aspect-ratio: 8 / 5;
  object-fit: cover;
  border-radius: var(--fc-radius-md);
  border: 1px solid var(--line);
}
.scene-option:has(input[type='checkbox']:checked) img {
  outline: 2px solid var(--fc-color-accent);
  outline-offset: 1px;
}
.scene-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.scene-option label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  color: var(--fc-color-text);
}
.scene-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.scene-chip img {
  width: 28px;
  height: 18px;
  border-radius: var(--fc-radius-sm);
  object-fit: cover;
}
@media (max-width: 720px) {
  .contest-overview {
    padding: 18px;
  }
  .contest-facts > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .contest-toc {
    margin: 0 -24px;
    padding: 10px 24px;
  }
  .contest-section {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 26px 0;
    scroll-margin-top: 130px;
  }
}

/* Official tag colours (tag-colors.js), set on /admin/tags. The chip itself stays neutral; the colour is only the
 * small dot in front of the name (unslop review G1／L1, 2026-11-30). Untinted chips get a grey dot. --tag-bg and
 * --tag-line are still used by the swatches on /admin/tags. */
.chip[data-color='blue'],
.swatch [data-color='blue'] {
  --tag-bg: #e6edf9;
  --tag-fg: #2f5aa8;
  --tag-line: #c7d5ef;
}
.chip[data-color='teal'],
.swatch [data-color='teal'] {
  --tag-bg: #e0f5f1;
  --tag-fg: #13796b;
  --tag-line: #bfe8df;
}
.chip[data-color='green'],
.swatch [data-color='green'] {
  --tag-bg: #e8f5e0;
  --tag-fg: #3d7a1f;
  --tag-line: #cfe8bf;
}
.chip[data-color='amber'],
.swatch [data-color='amber'] {
  --tag-bg: #fff1d6;
  --tag-fg: #b07000;
  --tag-line: #f6dcaa;
}
.chip[data-color='coral'],
.swatch [data-color='coral'] {
  --tag-bg: #ffe8e0;
  --tag-fg: #d0532a;
  --tag-line: #f8cbbb;
}
.chip[data-color='rose'],
.swatch [data-color='rose'] {
  --tag-bg: #fde7ee;
  --tag-fg: #c43a68;
  --tag-line: #f6c6d5;
}
.chip[data-color='purple'],
.swatch [data-color='purple'] {
  --tag-bg: #f1e8fb;
  --tag-fg: #7a3fb8;
  --tag-line: #dfcdf3;
}
.contest-facts .chip:not(.scene-chip)::before,
.tag-row .chip::before,
.chip[data-color]::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  vertical-align: 2px;
  border-radius: 50%;
  background: var(--tag-fg, var(--fc-color-border-strong));
}

/* /admin/tags */
.tag-admin {
  margin-bottom: 20px;
  padding: 22px 26px;
}
.tag-admin h2 {
  margin: 0 0 8px;
  font-size: 17px;
}
.tag-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.tag-row:first-child {
  border-top: 0;
}
.tag-row .chip {
  margin: 0;
}
.tag-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.swatch {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}
.swatch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.swatch span {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--tag-line, var(--fc-color-border));
  background: var(--tag-bg, #fff);
  box-shadow: inset 0 0 0 6px var(--tag-bg, #fff);
  transition: box-shadow 0.15s;
}
.swatch span::after {
  content: '';
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--tag-fg, var(--fc-color-text-muted));
  transform: scale(0.42);
}
.swatch input:checked + span {
  border-color: var(--tag-fg, var(--fc-color-border-strong));
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 4px var(--tag-fg, var(--fc-color-border-strong));
}
.swatch input:focus-visible + span {
  outline: 3px solid var(--fc-color-focus-ring);
  outline-offset: 3px;
}
.swatch input:disabled + span {
  opacity: 0.6;
}

/* The コンテスト tab (pages/contests.js): title and stage filter, then one row per contest with its place on the schedule. */
.contests-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 24px;
  margin-bottom: 20px;
}
.contests-top h1 {
  margin: 0 0 4px;
  font-size: 28px;
}
.contests-top p {
  margin: 0;
  color: var(--fc-color-text-muted);
  font-size: 14px;
}
.contest-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.contest-chip {
  flex: none;
}
/* Filter chips: the コンテスト stage filter and the goods kinds on 作品 (pages/gallery.js) look the same and are selected the same way:
   a dark fill (2026-11-30, C3). The contest switch on 作品 is a segmented control instead, so the two differ by shape, not colour. */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--fc-color-border);
  border-radius: var(--fc-radius-pill);
  background: var(--fc-color-surface);
  color: var(--fc-color-text);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.filter-chip small {
  color: var(--fc-color-text-muted);
  font-size: 12px;
}
.filter-chip:hover {
  border-color: var(--fc-color-border-strong);
}
.filter-chip[aria-current] {
  border-color: var(--fc-color-nav-active);
  background: var(--fc-color-nav-active);
  color: var(--fc-color-nav-active-text);
}
.filter-chip[aria-current] small {
  color: var(--fc-color-border-strong);
}
.contest-rows {
  display: grid;
  gap: 12px;
}
/* A contest: its cover fills the left third at the card's full height; the copy, button and top five share the rest (user's request, 2026-10-22). On phones the cover is a banner on top (below). */
.contest-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--fc-radius-xl);
  background: #fff;
}
.contest-row-cover {
  position: relative;
  min-height: 180px;
  overflow: hidden;
  background: var(--fc-color-surface-sunken);
}
.contest-row-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}
.contest-row:has(.contest-row-link:hover) .contest-row-cover img,
.contest-row-cover:hover img {
  transform: scale(1.03);
}
.contest-row-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 24px;
  padding: 20px 24px;
  min-width: 0;
}
.contest-row-link {
  display: block;
  min-width: 0;
}
.contest-row-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}
.contest-row-copy .badge {
  margin: 0;
}
.contest-row-copy strong {
  font-size: 19px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.contest-row-link:hover strong {
  text-decoration: underline;
}
.contest-row-theme {
  color: var(--fc-color-text-muted);
  font-size: 13px;
}
/* Schedule: the same journey as the home page and the long post (journey.js, home.css), with only the current step's date. */
.contest-row .journey {
  width: min(100%, 460px);
  margin-top: 8px;
}
.contest-row-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  text-align: right;
}
.contest-row-side .button {
  flex: none;
  padding: 9px 20px;
  border-radius: var(--fc-radius-pill);
  white-space: nowrap;
}
@media (max-width: 720px) {
  .contests-top h1 {
    font-size: 24px;
  }
  .contest-filter {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 -18px;
    padding: 0 18px 2px;
  }
  .filter-chip {
    height: 32px;
    padding: 0 12px;
  }
  /* Phones: the cover becomes a 3:1 banner on top and the copy, schedule and button take the full width (2026-11-30, C2). */
  .contest-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .contest-row-cover {
    min-height: 0;
    aspect-ratio: 3 / 1;
  }
  .contest-row-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
  }
  .contest-row-copy strong {
    font-size: 16px;
  }
  .contest-row-side {
    flex-direction: row;
    justify-content: flex-end;
  }
}
/* Current top five of a contest in voting: a row of squares under the contest, the first a little larger. */
.contest-top {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.contest-top-title {
  align-self: center;
  color: var(--fc-color-text-muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.contest-top-grid {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.contest-top-entry {
  position: relative;
  display: block;
  flex: none;
  width: 64px;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--fc-radius-md);
  background: var(--fc-color-surface-sunken);
}
.contest-top-entry[data-rank='1'] {
  width: 88px;
  border-radius: var(--fc-radius-lg);
}
.contest-top-entry img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 15%;
  transition: transform 0.2s;
}
.contest-top-entry:hover img {
  transform: scale(1.05);
}
.contest-top-rank {
  position: absolute;
  top: 4px;
  left: 4px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  border-radius: var(--fc-radius-pill);
  background: #fff;
  color: var(--fc-color-text);
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 1px 4px #20243733;
}
.contest-top-entry[data-rank='1'] .contest-top-rank {
  min-width: 24px;
  height: 24px;
  background: var(--fc-color-text);
  color: var(--fc-color-surface);
  font-size: 13px;
}
@media (max-width: 720px) {
  /* Phones: the title above, the five squares across the card. */
  .contest-top {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px 0 0;
  }
  .contest-top-title {
    align-self: flex-start;
  }
  .contest-top-grid {
    display: grid;
    grid-template-columns: 1.4fr repeat(4, minmax(0, 1fr));
    align-items: end;
    gap: 6px;
  }
  .contest-top-entry,
  .contest-top-entry[data-rank='1'] {
    width: auto;
  }
}
