/* Official contest long post and the official publish form. */
.contest-visual {
  margin: 24px 0 0;
  border-radius: 16px;
  overflow: hidden;
  background: #eef0f7;
}
.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;
}
.contest-phase[data-phase='open'],
.contest-phase[data-phase='voting'] {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}
/* Overview card: facts, then the schedule as a timeline (done steps muted, the next one highlighted). */
.contest-overview {
  margin: 24px 0 0;
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fafbfe;
}
.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: #646e85;
  font-weight: 650;
}
.contest-facts dd {
  margin: 0;
  color: #303957;
  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: 999px;
  background: #fff;
  border: 1px solid #e0e4ed;
  font-size: 14px;
}
.contest-facts .chip {
  margin: 0;
}
.contest-overview-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 24px 0 16px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  font-weight: 650;
  color: #646e85;
}
.contest-overview-title small {
  font-size: 12px;
  font-weight: 500;
}
.contest-schedule {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.contest-schedule li {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 22px 8px 0 0;
  font-size: 13px;
}
/* The line runs through every dot; done steps colour their part of it. */
.contest-schedule li::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 0;
  right: 0;
  height: 2px;
  background: #dfe3ee;
}
.contest-schedule li::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 0;
  width: 8px;
  height: 8px;
  border: 2px solid #c3c9d8;
  border-radius: 50%;
  background: #fff;
}
.contest-schedule li[data-step='done']::before,
.contest-schedule li[data-step='done']::after {
  background: var(--blue);
  border-color: var(--blue);
}
.contest-schedule li[data-step='next']::after {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px #e3e7ff;
}
.contest-schedule span {
  color: #646e85;
  font-weight: 650;
}
.contest-schedule time {
  color: #303957;
  font-variant-numeric: tabular-nums;
}
.contest-schedule li[data-step='done'] time {
  color: #8a93a8;
}
.contest-schedule li[data-step='next'] span {
  color: var(--blue);
}
.contest-schedule li[data-step='next'] time {
  font-weight: 650;
}
.thread.contest-post > .body {
  margin: 30px 0 34px;
  font-size: 16px;
  color: #303957;
}
/* 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: 999px;
  background: #f1f3fa;
  color: #3a4466;
  font-size: 13px;
  font-weight: 650;
}
.contest-toc a:hover {
  background: #e3e7ff;
  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(--blue);
}
.thread .contest-section .body {
  margin: 0;
  color: #47516d;
}
.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: 12px;
  background: #fafbfe;
}
.contest-files li:hover {
  border-color: #c5ccf6;
}
.contest-files a {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--blue);
  font-weight: 650;
}
.contest-files a::before {
  content: '↓ ';
}
.contest-files span {
  flex: none;
  color: #646e85;
  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: 6px;
  font-size: 12px;
  font-weight: 650;
  color: #646e85;
  background: #f0f2f8;
}
.tag.official {
  color: #fff;
  background: #252b43;
}
.official-floor {
  margin-top: 12px;
  padding: 18px 20px;
  border: 1px solid #e3e7f5;
  border-left: 3px solid var(--blue);
  border-radius: 12px;
  background: #fafbff;
}
.official-floor .meta time {
  color: #646e85;
  font-size: 13px;
}
.locked-note {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #f4f5f9;
  font-size: 14px;
}
.locked-note a {
  color: var(--blue);
  font-weight: 650;
}
.pin-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 14px;
  color: #646e85;
}
.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: 14px;
  padding: 4px 20px;
  margin: 24px 0;
}
.contest-times legend {
  font-size: 14px;
  color: #646e85;
  padding: 0 6px;
}
.contest-times .field {
  margin: 16px 0;
}
/* 展示シーン：見本の画像に「使う」と「★ 既定」。 */
.contest-scenes {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 4px 20px 20px;
  margin: 24px 0;
}
.contest-scenes legend {
  font-size: 14px;
  color: #646e85;
  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: 10px;
  border: 1px solid var(--line);
}
.scene-option:has(input[type='checkbox']:checked) img {
  outline: 2px solid #5261ee;
  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: #3d4659;
}
.scene-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.scene-chip img {
  width: 28px;
  height: 18px;
  border-radius: 4px;
  object-fit: cover;
}
@media (max-width: 720px) {
  .contest-overview {
    padding: 18px;
  }
  .contest-facts > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  /* A vertical timeline on phones. */
  .contest-schedule {
    grid-template-columns: minmax(0, 1fr);
  }
  .contest-schedule li {
    grid-template-columns: 5.5em minmax(0, 1fr);
    padding: 0 0 14px 24px;
  }
  .contest-schedule li:last-child {
    padding-bottom: 0;
  }
  .contest-schedule li::before {
    top: 6px;
    bottom: -6px;
    left: 5px;
    right: auto;
    width: 2px;
    height: auto;
  }
  .contest-schedule li:last-child::before {
    display: none;
  }
  .contest-schedule li::after {
    top: 3px;
  }
  .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;
  }
}
/* 参加の入口：募集中は工房へ、投票中は投票と作品一覧へ */
.contest-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  margin: 16px 0 0;
  padding: 22px 28px;
  border-radius: 16px;
  background: linear-gradient(120deg, #202437, #3a3f8f);
  color: #fff;
}
.contest-cta h2 {
  margin: 0 0 6px;
  font-size: 18px;
}
.contest-cta p {
  margin: 0;
  color: #d5d9f3;
  font-size: 14px;
}
.contest-cta .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
}
/* Scoped under .actions so the site-wide a.button / a.button.primary hover rules (loaded later) cannot repaint them: on the dark card the outline button stays white text, the filled one stays dark text. */
.contest-cta .actions a.button {
  border-color: #ffffff66;
  background: transparent;
  color: #fff;
  transition:
    background 0.18s,
    border-color 0.18s;
}
.contest-cta .actions a.button:hover {
  border-color: #fff;
  background: #ffffff1f;
  color: #fff;
}
.contest-cta .actions a.button.primary {
  border-color: #fff;
  background: #fff;
  color: #202437;
}
.contest-cta .actions a.button.primary:hover {
  border-color: #e3e6ff;
  background: #e3e6ff;
  color: #202437;
}
.contest-cta .actions a.button:focus-visible {
  outline: 3px solid #c9cfff;
  outline-offset: 3px;
}
@media (max-width: 720px) {
  .contest-cta {
    padding: 20px;
  }
  .contest-cta .actions,
  .contest-cta .actions a {
    width: 100%;
    justify-content: center;
  }
}

/* Official tag colours (tag-colors.js), set on /admin/tags. Untinted chips stay grey. */
.chip[data-color='blue'],
.swatch [data-color='blue'] {
  --tag-bg: #e8ebfc;
  --tag-fg: #3f4fd0;
  --tag-line: #cfd5f8;
}
.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: #9a5a00;
  --tag-line: #f6dcaa;
}
.chip[data-color='coral'],
.swatch [data-color='coral'] {
  --tag-bg: #ffe8e0;
  --tag-fg: #b8461f;
  --tag-line: #f8cbbb;
}
.chip[data-color='rose'],
.swatch [data-color='rose'] {
  --tag-bg: #fde7ee;
  --tag-fg: #b8325d;
  --tag-line: #f6c6d5;
}
.chip[data-color='purple'],
.swatch [data-color='purple'] {
  --tag-bg: #f1e8fb;
  --tag-fg: #7a3fb8;
  --tag-line: #dfcdf3;
}
.chip[data-color] {
  border-color: var(--tag-line);
  background: var(--tag-bg);
  color: var(--tag-fg);
}

/* /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, #e0e4ed);
  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, #8a93a8);
  transform: scale(0.42);
}
.swatch input:checked + span {
  border-color: var(--tag-fg, #646e85);
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 4px var(--tag-fg, #646e85);
}
.swatch input:focus-visible + span {
  outline: 3px solid #a5afff;
  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: #5b6479;
  font-size: 14px;
}
.contest-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.contest-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid #e0e3ec;
  border-radius: 999px;
  background: #fff;
  color: #303957;
  font-size: 13px;
}
.contest-chip small {
  color: #7a8399;
  font-size: 12px;
}
.contest-chip:hover {
  border-color: #bac1ed;
}
.contest-chip[aria-current] {
  border-color: #252b43;
  background: #252b43;
  color: #fff;
}
.contest-chip[aria-current] small {
  color: #c9cde0;
}
.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). */
.contest-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}
.contest-row-cover {
  position: relative;
  min-height: 180px;
  overflow: hidden;
  background: #eef0f7;
}
.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 {
  color: var(--blue);
}
.contest-row-theme {
  color: #5b6479;
  font-size: 13px;
}
/* Schedule progress: past steps pale, the current one solid, later ones grey. */
.contest-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  width: min(100%, 420px);
  margin-top: 6px;
}
.contest-step {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: #7a8399;
  font-size: 11px;
}
.contest-step i {
  height: 5px;
  border-radius: 3px;
  background: #dfe2ee;
}
.contest-step[data-step='done'] i {
  background: #9aa3f5;
}
.contest-step[data-step='now'] {
  color: #303957;
  font-weight: 700;
}
.contest-step[data-step='now'] i {
  background: var(--blue);
}
.contest-step small {
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.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: 999px;
  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;
  }
  .contest-chip {
    flex: none;
  }
  .contest-row-cover {
    min-height: 0;
  }
  .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: #5b6479;
  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: 10px;
  background: #eef0f7;
}
.contest-top-entry[data-rank='1'] {
  width: 88px;
  border-radius: 12px;
}
.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: 999px;
  background: #fff;
  color: #303957;
  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(--blue);
  color: #fff;
  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;
  }
}
