:root {
  --black: #050505;
  --ink: #111;
  --paper: #fff;
  --soft: #f4f4f4;
  --gray: #b9b9b9;
  --yellow: #ffe24a;
  --green: #d9ffe2;
  --danger: #ffeded;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: #111;
  color: var(--black);
  font-family: "Courier New", Courier, "Osaka-Mono", "MS Gothic", monospace;
  font-weight: 700;
  line-height: 1.25;
  image-rendering: pixelated;
}

a {
  color: inherit;
  text-underline-offset: 3px;
}

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

button {
  cursor: pointer;
}

.site-shell {
  width: min(1360px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 34px 26px 44px;
  background:
    linear-gradient(90deg, #000 0 18px, transparent 18px calc(100% - 18px), #000 calc(100% - 18px)),
    repeating-conic-gradient(#111 0% 25%, #f4f4f4 0% 50%) 0 0 / 48px 48px;
  border-left: 3px solid #dcdcdc;
  border-right: 3px solid #dcdcdc;
  box-shadow: 0 0 0 3px #000 inset;
}

.top-title {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: center;
  margin-bottom: 14px;
  padding: 16px 24px;
  background: var(--black);
  color: #fff;
  border: 4px solid #000;
  text-align: center;
  font-size: clamp(22px, 3vw, 34px);
  letter-spacing: .04em;
  line-height: 1;
}

.top-title span {
  white-space: nowrap;
}

.admin-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -2px 0 14px;
  padding: 9px 12px;
  background: var(--yellow);
  border: 4px solid #000;
  box-shadow: 4px 4px 0 #000;
  font-size: clamp(16px, 2.4vw, 24px);
  line-height: 1;
}

.admin-mode-bar a {
  padding: 7px 10px;
  background: #fff;
  border: 3px solid #000;
  text-decoration: none;
  box-shadow: 3px 3px 0 #000;
  white-space: nowrap;
}

.theme-switcher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: -2px 0 14px;
  padding: 7px 10px;
  background: #fff;
  border: 4px solid #000;
  outline: 3px solid #fff;
  box-shadow: 0 0 0 2px #000 inset;
  font-size: 13px;
  line-height: 1;
}

.theme-switcher span {
  margin-right: 2px;
}

.theme-switcher button {
  min-height: 28px;
  padding: 4px 8px;
  background: #fff;
  color: #000;
  border: 3px solid #000;
  box-shadow: 3px 3px 0 #000;
}

.theme-switcher button.active {
  background: var(--yellow);
}

.ticker {
  position: relative;
  overflow: hidden;
  margin-bottom: 26px;
  padding: 8px 0;
  background: #fff;
  color: #000;
  border: 4px solid #000;
  outline: 3px solid #fff;
  box-shadow: 0 0 0 2px #000 inset;
  white-space: nowrap;
}

.ticker-track {
  display: inline-flex;
  width: max-content;
  min-width: max-content;
  padding-left: 0;
  will-change: transform;
  animation: ticker-scroll var(--ticker-duration, 18s) linear infinite;
  font-size: 18px;
}

.ticker-segment {
  flex: 0 0 auto;
  padding-right: 42px;
}

.ticker-link {
  display: inline-block;
  margin-right: 42px;
  color: inherit;
  text-decoration: none;
}

.ticker-link:hover {
  text-decoration: underline;
}

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(calc(var(--ticker-loop-distance, 720px) * -1)); }
}

.nav-bar {
  display: none;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
  margin-bottom: 24px;
  padding: 8px 10px;
  background: #fff;
  border: 4px solid #000;
  outline: 3px solid #fff;
  box-shadow: 0 0 0 2px #000 inset;
  font-size: 17px;
}

.nav-bar a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 4px;
}

.page-grid {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 20px;
}

.sidebar {
  min-height: 840px;
  padding: 0 8px 18px;
  background: #fff;
  border: 4px solid #000;
  outline: 3px solid #fff;
  box-shadow: 0 0 0 2px #000 inset;
}

.side-head {
  height: 32px;
  margin: 0 -8px 10px;
  background: #000;
  border-bottom: 4px solid #000;
}

.side-link {
  display: block;
  margin: 18px 0 26px;
  text-align: center;
  font-size: 17px;
}

.side-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin: 0 auto 8px;
  background: #fff;
  border: 4px solid #000;
  box-shadow: 6px 6px 0 #000;
  font-size: 29px;
  line-height: 1;
}

.nav-svg {
  display: block;
  width: 48px;
  height: 48px;
  fill: #fff;
  stroke: #000;
  stroke-width: 5;
  stroke-linecap: square;
  stroke-linejoin: miter;
  shape-rendering: crispEdges;
}

.nav-svg circle {
  fill: #000;
  stroke: #000;
}

.content {
  min-width: 0;
  background: #fff;
  border: 4px solid #000;
  outline: 3px solid #fff;
  box-shadow: 0 0 0 2px #000 inset;
}

.content-head {
  height: 30px;
  background: #000;
  border-bottom: 4px solid #000;
}

.content-inner {
  padding: 20px 28px 30px;
}

.page-title {
  margin: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 4px solid #000;
  font-size: clamp(28px, 5vw, 48px);
  line-height: .95;
  letter-spacing: 0;
}

.panel {
  margin: 0 0 22px;
  background: #fff;
  border: 4px solid #000;
}

.panel-title {
  padding: 8px 12px;
  background: #000;
  color: #fff;
  font-size: 20px;
  letter-spacing: .03em;
}

.panel-body {
  padding: 16px;
}

.panel-body.tight {
  padding: 10px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 20px;
  align-items: center;
}

.hero-copy {
  font-size: 20px;
}

.hero-copy p {
  margin: 0 0 12px;
}

.hero-image {
  border: 4px double #000;
  padding: 6px;
  background: repeating-linear-gradient(90deg, #000 0 4px, #fff 4px 8px);
}

.hero-image img {
  display: block;
  width: 100%;
  height: auto;
  border: 4px solid #fff;
  filter: grayscale(1) contrast(2.05);
}

.iframe-board {
  margin: 0 auto 26px;
  background: #fff;
  border: 4px solid #000;
  outline: 3px solid #fff;
}

.iframe-title {
  padding: 9px 8px;
  background: #000;
  color: #fff;
  text-align: center;
  font-size: 26px;
  letter-spacing: .04em;
}

.iframe-body {
  min-height: 250px;
  padding: 16px 18px;
}

.portrait-card {
  position: relative;
  margin: 0 auto 26px;
  padding: 10px;
  background: #fff;
  border: 4px solid #000;
}

.portrait-card::before,
.portrait-card::after,
.portrait-bottom {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 4px solid #000;
}

.portrait-card::before { left: -8px; top: -8px; }
.portrait-card::after { right: -8px; top: -8px; }
.portrait-bottom { left: -8px; bottom: -8px; }
.portrait-bottom.r { left: auto; right: -8px; }

.portrait-frame {
  padding: 6px;
  background: repeating-linear-gradient(90deg, #000 0 4px, #fff 4px 8px);
  border: 4px double #000;
}

.portrait-frame img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  background: #fff;
  border: 4px solid #fff;
  filter: grayscale(1) contrast(2.15);
}

.sns-panel {
  margin: 0 0 26px;
  padding: 18px 0 20px;
  border-top: 4px solid #000;
  border-bottom: 4px solid #000;
}

.sns-title {
  margin-bottom: 14px;
  text-align: center;
  font-size: 28px;
}

.sns-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.sns-links a {
  display: block;
  padding: 11px 6px;
  background: #000;
  color: #fff;
  border: 3px solid #000;
  outline: 2px solid #fff;
  text-align: center;
  text-decoration: none;
  font-size: 17px;
}

.sns-links a:hover {
  background: var(--yellow);
  color: #000;
}

.counter {
  width: min(510px, 100%);
  margin: 0 auto 24px;
  padding: 10px 12px 9px;
  background: #040404;
  color: var(--yellow);
  border: 5px solid #000;
  outline: 3px solid #fff;
  box-shadow: 0 0 0 3px #000 inset;
  text-align: center;
  font-size: 34px;
  letter-spacing: .05em;
  white-space: nowrap;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.mini-card {
  min-height: 160px;
  padding: 14px;
  background: #fff;
  border: 4px solid #000;
  text-decoration: none;
}

.mini-card strong {
  display: block;
  margin-bottom: 10px;
  font-size: 22px;
}

.news-list,
.thread-list,
.admin-list {
  display: grid;
  gap: 12px;
}

.news-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  background: #fff;
  border: 3px solid #000;
}

.news-item.pinned {
  background: var(--yellow);
}

.news-item.express-news {
  padding: 16px;
  background: var(--yellow);
  border-width: 5px;
  box-shadow: 5px 5px 0 #000;
}

.news-item.express-news strong {
  font-size: clamp(20px, 3vw, 34px);
  line-height: 1.15;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: #333;
  font-size: 13px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 1px 6px;
  background: #000;
  color: #fff;
  border: 2px solid #000;
  font-size: 12px;
}

.tag.light {
  background: #fff;
  color: #000;
}

.tag.live {
  color: #000;
  background: var(--yellow);
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
  50% { opacity: .2; }
}

.bbs-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.bbs-toolbar-bottom {
  margin: 14px 0 0;
}

.district-tabs,
.slot-tabs,
.icon-picker,
.character-picker,
.sticker-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pixel-button,
.district-tabs a,
.slot-tabs button,
.icon-picker button,
.character-option,
.sticker-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 11px;
  background: #fff;
  color: #000;
  border: 3px solid #000;
  box-shadow: 4px 4px 0 #000;
  text-decoration: none;
}

.pixel-button:hover,
.district-tabs a:hover,
.slot-tabs button:hover,
.icon-picker button:hover,
.character-option:hover,
.sticker-option:hover,
.pixel-button.active,
.district-tabs a.active,
.slot-tabs button.active,
.icon-picker button.active,
.character-option.active,
.sticker-option.active {
  background: var(--yellow);
}

.district-tabs a {
  min-width: 86px;
  min-height: 48px;
  font-size: 20px;
}

.bbs-new-thread-button {
  min-height: 48px;
  font-size: 18px;
}

.bbs-admin-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.edit-help {
  padding: 6px 8px;
  background: #fff;
  border: 3px solid #000;
  font-size: 13px;
}

.new-thread-panel.is-collapsed {
  display: none;
}

.pixel-button.danger {
  background: var(--danger);
}

.bbs-map {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 1619 / 971;
  container-type: inline-size;
  --map-marker-width: 19cqw;
  --map-bubble-gap: .74cqw;
  --map-bubble-min-height: 7.8cqw;
  --map-bubble-padding-y: 1.8cqw;
  --map-bubble-padding-x: 1.42cqw;
  --map-bubble-border: .36cqw;
  --map-bubble-radius: 2.18cqw;
  --map-bubble-shadow: .72cqw;
  --map-title-size: 2.22cqw;
  --map-avatar-width: 6.2cqw;
  --map-avatar-shadow: .44cqw;
  --map-tail-size: 2.36cqw;
  --map-activity-size: 1.52cqw;
  --map-activity-border: .28cqw;
  background: #ddd;
  border: 4px solid #000;
}

.bbs-map.is-editing {
  outline: 5px solid var(--yellow);
  outline-offset: -9px;
}

.bbs-map > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thread-marker {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 2;
  width: var(--map-marker-width);
  transform: translate(-50%, -100%);
  padding: 0;
  background: transparent;
  border: 0;
  color: #000;
  text-align: center;
  text-decoration: none;
}

.thread-marker.is-bubble-pulse {
  z-index: 50;
}

.thread-marker.is-bubble-pulse .thread-bubble {
  transform-origin: 50% 100%;
  animation: bubble-soft-pop 520ms cubic-bezier(.16, 1.22, .32, 1) both;
}

.thread-marker.is-bubble-pulse .thread-title,
.thread-marker.is-bubble-pulse .activity-mark {
  animation: bubble-text-pop 520ms cubic-bezier(.16, 1.22, .32, 1) both;
}

.thread-marker.spawning {
  animation: character-spawn 1.55s steps(6, end) both;
}

.thread-marker.spawning::before,
.thread-marker.spawning::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(100% - 3.8cqw);
  z-index: 5;
  width: 8.3cqw;
  height: 8.3cqw;
  border: .38cqw solid #000;
  background:
    linear-gradient(90deg, transparent 46%, #fff 46% 54%, transparent 54%),
    linear-gradient(0deg, transparent 46%, #fff 46% 54%, transparent 54%);
  transform: translate(-50%, -50%) rotate(45deg);
  animation: sparkle-burst 1.55s steps(5, end) both;
  pointer-events: none;
}

.thread-marker.spawning::after {
  width: 4.2cqw;
  height: 4.2cqw;
  animation-delay: .15s;
}

@keyframes character-spawn {
  0% { opacity: 0; transform: translate(-50%, -84%) scale(.25); filter: brightness(2.2); }
  18% { opacity: 1; transform: translate(-50%, -124%) scale(1.15); }
  42% { transform: translate(-50%, -100%) scale(.94); }
  62% { transform: translate(-50%, -106%) scale(1.04); }
  100% { opacity: 1; transform: translate(-50%, -100%) scale(1); filter: none; }
}

@keyframes sparkle-burst {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(45deg) scale(.2); }
  18% { opacity: 1; transform: translate(-50%, -50%) rotate(45deg) scale(1); }
  58% { opacity: .85; transform: translate(-50%, -50%) rotate(45deg) scale(1.28); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(45deg) scale(1.6); }
}

@keyframes bubble-soft-pop {
  0% { transform: scale(1); }
  36% { transform: scale(1.52); }
  68% { transform: scale(1.42); }
  100% { transform: scale(1); }
}

@keyframes bubble-text-pop {
  0% { transform: translateY(0) scale(1); }
  36% { transform: translateY(-.12cqw) scale(1.08); }
  68% { transform: translateY(-.06cqw) scale(1.04); }
  100% { transform: translateY(0) scale(1); }
}

.thread-marker.empty {
  transform: translate(-50%, -50%);
}

.thread-marker.edit-marker {
  cursor: grab;
  touch-action: none;
  z-index: 6;
}

.thread-marker.edit-marker.is-dragging {
  cursor: grabbing;
  z-index: 20;
  filter: drop-shadow(0 0 8px var(--yellow));
}

.edit-bubble {
  background: var(--yellow);
}

.thread-bubble {
  position: relative;
  display: grid;
  box-sizing: border-box;
  gap: .2cqw;
  min-height: var(--map-bubble-min-height);
  margin-bottom: var(--map-bubble-gap);
  padding: var(--map-bubble-padding-y) var(--map-bubble-padding-x) calc(var(--map-bubble-padding-y) * .78);
  background: #fff;
  border: var(--map-bubble-border) solid #000;
  border-radius: var(--map-bubble-radius);
  box-shadow: var(--map-bubble-shadow) var(--map-bubble-shadow) 0 #000;
  font-size: var(--map-title-size);
  line-height: 1.1;
}

.thread-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(var(--map-tail-size) * -.72);
  width: var(--map-tail-size);
  height: var(--map-tail-size);
  background: #fff;
  border-right: var(--map-bubble-border) solid #000;
  border-bottom: var(--map-bubble-border) solid #000;
  transform: translateX(-50%) rotate(45deg);
}

.thread-title {
  position: relative;
  z-index: 1;
  display: block;
  overflow: hidden;
  min-height: 2.2em;
  font-size: var(--map-title-size);
  line-height: 1.1;
}

.thread-title-line {
  display: block;
  white-space: nowrap;
}

.activity-mark {
  position: absolute;
  right: -1.18cqw;
  top: -1.32cqw;
  z-index: 2;
  min-width: 4.85cqw;
  padding: .34cqw .7cqw;
  background: var(--yellow);
  color: #000;
  border: var(--map-activity-border) solid #000;
  font-size: var(--map-activity-size);
  line-height: 1;
  text-align: center;
}

.activity-mark.now {
  animation: bob 900ms steps(2, end) infinite;
}

.activity-mark.hot {
  background: #fff;
}

.activity-mark.lock {
  background: #000;
  color: #fff;
}

@keyframes bob {
  50% { transform: translateY(-4px); }
}

.thread-avatar {
  display: block;
  width: var(--map-avatar-width);
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(var(--map-avatar-shadow) var(--map-avatar-shadow) 0 #000);
}

.empty-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  min-height: 32px;
  padding: 4px;
  background: #fff;
  border: 3px dashed #000;
  box-shadow: 4px 4px 0 #000;
  font-size: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.character-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.character-option {
  min-height: 126px;
  padding: 7px;
}

.character-option img {
  display: block;
  width: min(72px, 100%);
  height: auto;
  filter: drop-shadow(3px 3px 0 #000);
}

.sticker-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.sticker-picker.is-collapsed {
  display: none;
}

.sticker-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.selected-sticker {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}

.selected-sticker img {
  width: 70px;
  height: auto;
  background: #fff;
  border: 2px solid #000;
}

.sticker-option {
  min-height: 78px;
  padding: 6px;
}

.sticker-option img {
  display: block;
  width: 100%;
  max-width: 92px;
  height: auto;
  background: #fff;
  border: 2px solid #000;
}

.field {
  display: grid;
  gap: 6px;
  align-content: start;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 14px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 40px;
  padding: 8px;
  background: #fff;
  border: 3px solid #000;
  border-radius: 0;
}

.field input,
.field select {
  height: 40px;
}

.field textarea {
  min-height: 94px;
  resize: vertical;
}

.char-count {
  text-align: right;
  color: #444;
  font-size: 12px;
}

.rules {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 1.2em;
}

.thread-head {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) minmax(180px, auto);
  gap: 16px;
  align-items: center;
}

.thread-head img {
  width: 104px;
  height: auto;
  filter: drop-shadow(5px 5px 0 #000);
}

.thread-exit-button {
  justify-self: end;
  min-width: 180px;
  min-height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(18px, 2.4vw, 28px);
  text-align: center;
}

.message-list {
  display: grid;
  gap: 12px;
}

.message {
  display: grid;
  gap: 6px;
  max-width: 82%;
  padding: 12px;
  background: #fff;
  border: 3px solid #000;
  border-radius: 16px;
}

.message.admin {
  margin-left: auto;
  background: #000;
  color: #fff;
}

.message .meta-row {
  color: inherit;
  opacity: .75;
}

.sticker {
  display: inline-flex;
  align-items: center;
  width: max-content;
  padding: 5px 8px;
  background: var(--yellow);
  color: #000;
  border: 2px solid #000;
  border-radius: 14px;
  font-size: 13px;
}

.sticker-image {
  display: block;
  width: 118px;
  max-width: 45vw;
  height: auto;
  margin-top: 4px;
  border: 3px solid #000;
  background: #fff;
  image-rendering: pixelated;
}

.sticker-preview {
  min-height: 74px;
  padding: 8px;
  border: 3px solid #000;
  background: #fff;
}

.sticker-preview .sticker-image {
  width: 92px;
  margin: 0;
}

.arcade-scene {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 2;
  background: #ddd;
  border: 4px solid #000;
}

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

.cabinet-hotspot {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  min-height: 15%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  padding: 7px;
  background: #fff;
  color: #000;
  border: 3px solid #000;
  box-shadow: 3px 3px 0 #000;
  appearance: none;
  text-align: center;
  text-decoration: none;
  font-size: clamp(10px, 1.45vw, 17px);
  line-height: 1.05;
}

.cabinet-hotspot:hover {
  background: var(--yellow);
}

.cabinet-hotspot span {
  display: block;
}

.arcade-player {
  background: #111;
  border: 5px solid #000;
  box-shadow: 6px 6px 0 #000;
}

.arcade-player[hidden] {
  display: none;
}

.arcade-player-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: repeating-linear-gradient(90deg, #000 0 12px, #fff 12px 24px);
  border-bottom: 5px solid #000;
}

.arcade-player-head span {
  padding: 6px 10px;
  background: #fff;
  border: 3px solid #000;
  line-height: 1;
}

.mini-button {
  padding: 6px 10px;
  background: var(--yellow);
  color: #000;
  border: 3px solid #000;
  box-shadow: 3px 3px 0 #000;
  line-height: 1;
}

.arcade-cabinet {
  padding: clamp(14px, 3vw, 28px);
  background:
    linear-gradient(90deg, #000 0 5%, transparent 5% 95%, #000 95%),
    repeating-linear-gradient(0deg, #1a1a1a 0 10px, #050505 10px 20px);
}

.arcade-screen-shell {
  position: relative;
  overflow: hidden;
  width: min(980px, 100%);
  margin: 0 auto;
  aspect-ratio: 16 / 10;
  background: #000;
  border: 8px solid #000;
  outline: 5px solid #fff;
  box-shadow: inset 0 0 0 4px #333, 0 8px 0 #000;
}

.arcade-screen-shell iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.arcade-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 22px auto 0;
  padding: 14px;
  width: min(360px, 100%);
  background: #fff;
  border: 4px solid #000;
}

.stick {
  width: 20px;
  height: 34px;
  background: #000;
  border: 3px solid #000;
  border-radius: 999px 999px 4px 4px;
  box-shadow: 0 22px 0 6px #fff, 0 22px 0 10px #000;
}

.push {
  width: 30px;
  height: 30px;
  background: var(--yellow);
  border: 4px solid #000;
  border-radius: 50%;
  box-shadow: inset -4px -4px 0 rgba(0, 0, 0, .2);
}

.game-modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, .72);
}

.game-modal.open {
  display: grid;
}

.game-window {
  width: min(760px, 100%);
  background: #fff;
  border: 5px solid #000;
  box-shadow: 10px 10px 0 #000;
}

.game-screen {
  display: grid;
  place-items: center;
  min-height: 330px;
  padding: 20px;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.08) 0 2px, transparent 2px 6px),
    #fff;
  border-bottom: 4px solid #000;
  text-align: center;
}

.game-screen h2 {
  margin: 0;
  max-width: 12em;
  font-size: clamp(30px, 6vw, 58px);
  line-height: 1;
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px;
}

.admin-lock {
  max-width: 520px;
}

.admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 3px solid #000;
}

.footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 4px solid #000;
  text-align: center;
  font-size: 14px;
}

.is-hidden {
  display: none !important;
}

html[data-theme="homepage"] {
  --black: #201900;
  --ink: #221d15;
  --paper: #fffde8;
  --soft: #fff7c7;
  --gray: #9eb0c9;
  --yellow: #fff36a;
  --green: #d5ffd0;
  --danger: #ffe4ef;
}

html[data-theme="homepage"] body {
  background-color: #6ecbf2;
  background-image:
    radial-gradient(circle at 7px 7px, rgba(255, 255, 255, .55) 0 2px, transparent 2px),
    linear-gradient(45deg, rgba(255, 246, 121, .45) 25%, transparent 25% 75%, rgba(255, 246, 121, .45) 75%),
    linear-gradient(45deg, transparent 25%, rgba(255, 255, 255, .32) 25% 75%, transparent 75%);
  background-position: 0 0, 0 0, 10px 10px;
  background-size: 16px 16px, 20px 20px, 20px 20px;
  color: #1f2608;
  font-family: Verdana, "MS PGothic", "Osaka", sans-serif;
  font-weight: 700;
  image-rendering: auto;
}

html[data-theme="homepage"] a {
  color: #0645ad;
}

html[data-theme="homepage"] .site-shell {
  width: min(1180px, 100%);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .62) 0 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, .62) 0 1px, transparent 1px),
    #fffbd7;
  background-size: 22px 22px;
  border-left: 5px ridge #f5c04b;
  border-right: 5px ridge #f5c04b;
  box-shadow: 0 0 0 2px #1576c7 inset;
}

html[data-theme="homepage"] .top-title {
  grid-template-columns: 1fr;
  gap: 5px;
  background: linear-gradient(90deg, #ff6fb2, #fff36a 38%, #72d6ff 70%, #9aff81);
  color: #13216f;
  border: 4px double #1546bc;
  box-shadow: 0 0 0 4px rgba(255,255,255,.65) inset, 5px 5px 0 rgba(8, 40, 115, .22);
  text-shadow: 1px 1px 0 #fff;
  font-family: "Arial Black", Verdana, sans-serif;
}

html[data-theme="homepage"] .admin-mode-bar,
html[data-theme="homepage"] .theme-switcher,
html[data-theme="homepage"] .ticker,
html[data-theme="homepage"] .sidebar,
html[data-theme="homepage"] .content,
html[data-theme="homepage"] .iframe-board,
html[data-theme="homepage"] .panel,
html[data-theme="homepage"] .portrait-card,
html[data-theme="homepage"] .news-item,
html[data-theme="homepage"] .mini-card,
html[data-theme="homepage"] .bbs-map,
html[data-theme="homepage"] .arcade-scene,
html[data-theme="homepage"] .game-window {
  border-color: #274f9e;
  outline-color: #fff;
  box-shadow: 3px 3px 0 rgba(39, 79, 158, .28);
}

html[data-theme="homepage"] .theme-switcher {
  background: #fff8d6;
  border-style: ridge;
  color: #21386f;
}

html[data-theme="homepage"] .theme-switcher button,
html[data-theme="homepage"] .pixel-button,
html[data-theme="homepage"] .district-tabs a,
html[data-theme="homepage"] .slot-tabs button,
html[data-theme="homepage"] .icon-picker button,
html[data-theme="homepage"] .character-option,
html[data-theme="homepage"] .sticker-option,
html[data-theme="homepage"] .mini-button {
  background: linear-gradient(#fff, #ffe7a3);
  color: #063d94;
  border-color: #274f9e;
  border-style: outset;
  box-shadow: 2px 2px 0 rgba(39, 79, 158, .35);
}

html[data-theme="homepage"] .theme-switcher button.active,
html[data-theme="homepage"] .pixel-button:hover,
html[data-theme="homepage"] .district-tabs a:hover,
html[data-theme="homepage"] .slot-tabs button:hover,
html[data-theme="homepage"] .icon-picker button:hover,
html[data-theme="homepage"] .character-option:hover,
html[data-theme="homepage"] .sticker-option:hover,
html[data-theme="homepage"] .pixel-button.active,
html[data-theme="homepage"] .district-tabs a.active,
html[data-theme="homepage"] .slot-tabs button.active,
html[data-theme="homepage"] .icon-picker button.active,
html[data-theme="homepage"] .character-option.active,
html[data-theme="homepage"] .sticker-option.active {
  background: linear-gradient(#fffca8, #ff9fd2);
  color: #46105e;
}

html[data-theme="homepage"] .ticker {
  background: #fff36a;
  color: #c00000;
  border: 3px ridge #e34886;
  box-shadow: 0 0 0 2px #fff inset;
}

html[data-theme="homepage"] .ticker-track {
  font-size: 16px;
}

html[data-theme="homepage"] .sidebar,
html[data-theme="homepage"] .content,
html[data-theme="homepage"] .iframe-board,
html[data-theme="homepage"] .panel,
html[data-theme="homepage"] .portrait-card,
html[data-theme="homepage"] .mini-card,
html[data-theme="homepage"] .news-item {
  background: #fffef0;
}

html[data-theme="homepage"] .side-head,
html[data-theme="homepage"] .content-head,
html[data-theme="homepage"] .panel-title,
html[data-theme="homepage"] .iframe-title {
  background: linear-gradient(90deg, #2467d8, #87e7ff);
  color: #fff;
  border-color: #274f9e;
  text-shadow: 1px 1px 0 #152c7a;
}

html[data-theme="homepage"] .side-link {
  color: #0645ad;
  text-decoration: underline;
}

html[data-theme="homepage"] .side-icon {
  background: radial-gradient(circle at 30% 30%, #fff 0 24%, #ffec8a 25% 58%, #78d9ff 59%);
  border-color: #274f9e;
  box-shadow: 3px 3px 0 rgba(39, 79, 158, .35);
}

html[data-theme="homepage"] .nav-svg {
  fill: #fffbe9;
  stroke: #1744a7;
}

html[data-theme="homepage"] .nav-svg circle {
  fill: #ff66ad;
  stroke: #1744a7;
}

html[data-theme="homepage"] .content-inner {
  background:
    linear-gradient(rgba(255,255,255,.58), rgba(255,255,255,.58)),
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(106, 166, 228, .15) 23px 24px);
}

html[data-theme="homepage"] .page-title {
  color: #1243a6;
  border-bottom-color: #ff78b4;
  text-shadow: 1px 1px 0 #fff;
}

html[data-theme="homepage"] .hero-image,
html[data-theme="homepage"] .portrait-frame {
  background: #fff;
  border: 5px ridge #f3bf4e;
}

html[data-theme="homepage"] .hero-image img,
html[data-theme="homepage"] .portrait-frame img {
  border-color: #fff;
  filter: sepia(.24) saturate(1.65) hue-rotate(-10deg) contrast(1.05);
}

html[data-theme="homepage"] .portrait-card::before,
html[data-theme="homepage"] .portrait-card::after,
html[data-theme="homepage"] .portrait-bottom {
  display: none;
}

html[data-theme="homepage"] .sns-panel {
  border-top-color: #ff78b4;
  border-bottom-color: #ff78b4;
}

html[data-theme="homepage"] .sns-title {
  color: #b00072;
  text-shadow: 1px 1px 0 #fff;
}

html[data-theme="homepage"] .sns-links a {
  background: linear-gradient(#8ee8ff, #2d62cf);
  color: #fff;
  border-color: #274f9e;
  outline-color: #fff;
  text-shadow: 1px 1px 0 #001b59;
}

html[data-theme="homepage"] .counter {
  background: #101010;
  color: #7cff55;
  border: 4px ridge #f3bf4e;
  outline-color: #fff;
  box-shadow: inset 0 0 12px rgba(124,255,85,.22);
}

html[data-theme="homepage"] .news-item.pinned,
html[data-theme="homepage"] .news-item.express-news {
  background: #fff36a;
  border-color: #e34886;
}

html[data-theme="homepage"] .tag {
  background: #2366d8;
  color: #fff;
  border-color: #163b9b;
}

html[data-theme="homepage"] .tag.light {
  background: #fff;
  color: #1546bc;
}

html[data-theme="homepage"] .tag.live,
html[data-theme="homepage"] .activity-mark {
  background: #ff78b4;
  color: #fff;
  border-color: #8f0a62;
}

html[data-theme="homepage"] .bbs-map,
html[data-theme="homepage"] .arcade-scene {
  background: #a6e3ff;
  border-style: ridge;
}

html[data-theme="homepage"] .bbs-map::before,
html[data-theme="homepage"] .arcade-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(140deg, rgba(80, 198, 255, .34), rgba(255, 230, 96, .25) 44%, rgba(255, 109, 171, .28)),
    radial-gradient(circle at 75% 18%, rgba(255, 255, 255, .42), transparent 28%);
  mix-blend-mode: color;
  pointer-events: none;
}

html[data-theme="homepage"] .bbs-map > img,
html[data-theme="homepage"] .arcade-scene img {
  filter: sepia(.2) saturate(1.95) hue-rotate(168deg) brightness(1.06) contrast(.98);
  image-rendering: auto;
}

html[data-theme="homepage"] .thread-marker,
html[data-theme="homepage"] .cabinet-hotspot {
  z-index: 2;
}

html[data-theme="homepage"] .thread-marker.is-bubble-pulse {
  z-index: 50;
}

html[data-theme="homepage"] .thread-bubble {
  background: #fffef8;
  border-color: #274f9e;
  box-shadow: var(--map-bubble-shadow) var(--map-bubble-shadow) 0 rgba(39, 79, 158, .35);
}

html[data-theme="homepage"] .thread-bubble::after {
  background: #fffef8;
  border-color: #274f9e;
}

html[data-theme="homepage"] .thread-avatar,
html[data-theme="homepage"] .character-option img,
html[data-theme="homepage"] .thread-head img {
  filter: sepia(.2) saturate(1.4) hue-rotate(165deg) drop-shadow(3px 3px 0 rgba(39, 79, 158, .35));
}

html[data-theme="homepage"] .field input,
html[data-theme="homepage"] .field textarea,
html[data-theme="homepage"] .field select,
html[data-theme="homepage"] .admin-row,
html[data-theme="homepage"] .message,
html[data-theme="homepage"] .sticker-preview,
html[data-theme="homepage"] .selected-sticker img,
html[data-theme="homepage"] .sticker-option img,
html[data-theme="homepage"] .sticker-image {
  border-color: #274f9e;
}

html[data-theme="homepage"] .message {
  background: #fffef8;
}

html[data-theme="homepage"] .message.admin {
  background: #1546bc;
  color: #fff;
}

html[data-theme="homepage"] .arcade-player {
  background: #2a2461;
  border-color: #274f9e;
  box-shadow: 4px 4px 0 rgba(39, 79, 158, .35);
}

html[data-theme="homepage"] .arcade-player-head {
  background: linear-gradient(90deg, #ff78b4, #fff36a, #72d6ff);
  border-bottom-color: #274f9e;
}

html[data-theme="homepage"] .arcade-cabinet {
  background:
    linear-gradient(90deg, #31388e 0 6%, transparent 6% 94%, #31388e 94%),
    repeating-linear-gradient(0deg, #2d62cf 0 12px, #1744a7 12px 24px);
}

html[data-theme="homepage"] .arcade-screen-shell {
  border-color: #151515;
  outline-color: #fff36a;
  box-shadow: inset 0 0 0 4px #333, 0 8px 0 rgba(0,0,0,.35);
}

html[data-theme="homepage"] .footer {
  border-top-color: #ff78b4;
  color: #1546bc;
}

@media (max-width: 860px) {
  .site-shell {
    padding: 22px 14px 34px;
  }

  .top-title {
    grid-template-columns: 1fr;
    gap: 8px;
  }

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

  .sidebar {
    min-height: auto;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    padding: 8px;
  }

  .side-head {
    display: none;
  }

  .side-link {
    margin: 0;
    font-size: 12px;
  }

  .side-icon {
    width: 44px;
    height: 44px;
    margin-bottom: 4px;
    box-shadow: 3px 3px 0 #000;
    font-size: 20px;
  }

  .content-inner {
    padding: 16px 14px 22px;
  }

  .home-hero,
  .mini-grid,
  .form-grid,
  .thread-head {
    grid-template-columns: 1fr;
  }

  .thread-exit-button {
    justify-self: stretch;
    width: 100%;
  }

  .hero-image {
    max-width: 260px;
    margin: 0 auto;
  }

  .sns-links {
    grid-template-columns: 1fr;
  }

  .counter {
    font-size: 25px;
  }

  .message {
    max-width: 100%;
  }
}

@media (max-width: 520px) {
  .admin-mode-bar {
    align-items: stretch;
    flex-direction: column;
    text-align: center;
  }

  .admin-mode-bar a {
    width: 100%;
  }

  .empty-slot {
    width: 58px;
    font-size: 10px;
  }

  .cabinet-hotspot {
    min-height: 18%;
    padding: 4px;
    border-width: 2px;
    box-shadow: 2px 2px 0 #000;
    font-size: 9px;
  }

  .arcade-player-head {
    align-items: stretch;
    flex-direction: column;
  }

  .arcade-player-head span,
  .mini-button {
    width: 100%;
    text-align: center;
  }

  .arcade-screen-shell {
    aspect-ratio: 9 / 13;
    border-width: 5px;
    outline-width: 3px;
  }

  .arcade-controls {
    gap: 14px;
    margin-top: 16px;
  }
}

@media (max-width: 640px) {
  body {
    line-height: 1.18;
  }

  .site-shell {
    padding: 12px 8px 22px;
  }

  .top-title {
    gap: 4px;
    margin-bottom: 8px;
    padding: 9px 8px;
    border-width: 3px;
    font-size: clamp(17px, 5.4vw, 22px);
  }

  .admin-mode-bar,
  .theme-switcher {
    gap: 6px;
    margin: -2px 0 8px;
    padding: 5px 6px;
    border-width: 3px;
    outline-width: 2px;
    font-size: 11px;
  }

  .theme-switcher {
    justify-content: center;
  }

  .admin-mode-bar a,
  .theme-switcher button {
    min-height: 27px;
    padding: 3px 6px;
    border-width: 2px;
    box-shadow: 2px 2px 0 #000;
  }

  .ticker {
    margin-bottom: 10px;
    padding: 5px 0;
    border-width: 3px;
    outline-width: 2px;
  }

  .ticker-track {
    font-size: 12px;
  }

  .page-grid {
    gap: 9px;
  }

  .sidebar {
    gap: 4px;
    padding: 5px;
    border-width: 3px;
    outline-width: 2px;
  }

  .side-link {
    font-size: 9px;
    line-height: 1.05;
  }

  .side-icon {
    width: 31px;
    height: 31px;
    margin-bottom: 3px;
    border-width: 2px;
    box-shadow: 2px 2px 0 #000;
  }

  .nav-svg {
    width: 22px;
    height: 22px;
    stroke-width: 6;
  }

  .content {
    border-width: 3px;
    outline-width: 2px;
  }

  .content-head {
    height: 16px;
    border-bottom-width: 3px;
  }

  .content-inner {
    padding: 9px 7px 14px;
  }

  .page-title {
    margin-bottom: 9px;
    padding-bottom: 6px;
    border-bottom-width: 3px;
    font-size: clamp(20px, 6.4vw, 28px);
    line-height: 1;
  }

  .panel,
  .iframe-board,
  .portrait-card,
  .sns-panel {
    margin-bottom: 11px;
  }

  .panel,
  .iframe-board,
  .portrait-card {
    border-width: 3px;
  }

  .panel-title,
  .iframe-title {
    padding: 5px 7px;
    font-size: 14px;
  }

  .panel-body,
  .iframe-body {
    padding: 8px;
  }

  .panel-body.tight {
    padding: 5px;
  }

  .iframe-body {
    min-height: 120px;
  }

  .hero-copy {
    font-size: 13px;
  }

  .hero-copy p {
    margin-bottom: 8px;
  }

  .hero-image,
  .portrait-frame {
    padding: 4px;
    border-width: 3px;
  }

  .sns-panel {
    padding: 9px 0 10px;
    border-top-width: 3px;
    border-bottom-width: 3px;
  }

  .sns-title {
    margin-bottom: 8px;
    font-size: 18px;
  }

  .sns-links {
    gap: 7px;
  }

  .sns-links a {
    padding: 7px 5px;
    font-size: 12px;
  }

  .counter {
    margin-bottom: 12px;
    padding: 7px 8px;
    border-width: 3px;
    outline-width: 2px;
    font-size: clamp(15px, 5vw, 21px);
  }

  .footer {
    margin-top: 12px;
    padding-top: 10px;
    border-top-width: 3px;
    font-size: 11px;
  }

  .news-list,
  .thread-list,
  .admin-list,
  .message-list {
    gap: 8px;
  }

  .news-item,
  .mini-card,
  .message,
  .admin-row {
    padding: 8px;
    border-width: 2px;
    font-size: 12px;
  }

  .news-item.express-news {
    padding: 10px;
    border-width: 3px;
    box-shadow: 3px 3px 0 #000;
  }

  .news-item.express-news strong {
    font-size: 18px;
  }

  .meta-row {
    gap: 5px;
    font-size: 10px;
  }

  .tag {
    min-height: 17px;
    padding: 1px 4px;
    border-width: 1px;
    font-size: 9px;
  }

  .bbs-toolbar {
    gap: 6px;
    margin-bottom: 7px;
  }

  .bbs-toolbar-bottom {
    margin-top: 7px;
  }

  .district-tabs {
    width: 100%;
    gap: 4px;
  }

  .district-tabs a {
    flex: 1 1 calc(20% - 4px);
    min-width: 0;
    min-height: 32px;
    padding: 4px 3px;
    font-size: 12px;
  }

  .pixel-button,
  .slot-tabs button,
  .icon-picker button,
  .character-option,
  .sticker-option,
  .mini-button {
    min-height: 30px;
    padding: 4px 7px;
    border-width: 2px;
    box-shadow: 2px 2px 0 #000;
    font-size: 11px;
  }

  .bbs-new-thread-button {
    width: 100%;
    min-height: 34px;
    font-size: 13px;
  }

  .bbs-admin-tools {
    width: 100%;
    gap: 6px;
  }

  .edit-help {
    padding: 4px 5px;
    border-width: 2px;
    font-size: 10px;
  }

  .bbs-map {
    border-width: 3px;
  }

  .form-grid {
    gap: 8px;
  }

  .field {
    gap: 4px;
  }

  .field label,
  .char-count {
    font-size: 10px;
  }

  .field input,
  .field textarea,
  .field select {
    min-height: 32px;
    padding: 6px;
    border-width: 2px;
    font-size: 12px;
  }

  .field input,
  .field select {
    height: 32px;
  }

  .field textarea {
    min-height: 68px;
  }

  .rules {
    gap: 5px;
    padding-left: 1.05em;
    font-size: 12px;
  }

  .character-picker,
  .sticker-picker {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
  }

  .character-option {
    min-height: 64px;
    padding: 3px;
  }

  .character-option img {
    width: min(44px, 100%);
  }

  .sticker-toggle-row {
    gap: 6px;
  }

  .selected-sticker {
    min-height: 30px;
    font-size: 11px;
  }

  .selected-sticker img {
    width: 46px;
    border-width: 1px;
  }

  .sticker-option {
    min-height: 52px;
    padding: 3px;
  }

  .sticker-option img {
    max-width: 48px;
    border-width: 1px;
  }

  .thread-head {
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 8px;
  }

  .thread-head img {
    width: 54px;
    filter: drop-shadow(3px 3px 0 #000);
  }

  .thread-head .page-title {
    margin-bottom: 5px;
    font-size: clamp(19px, 6.2vw, 25px);
  }

  .thread-exit-button {
    grid-column: 1 / -1;
    min-width: 0;
    min-height: 34px;
    font-size: 13px;
  }

  .message {
    gap: 5px;
    max-width: 100%;
    border-radius: 10px;
    font-size: 12px;
  }

  .sticker-image {
    width: 82px;
    max-width: 38vw;
    border-width: 2px;
  }

  .sticker-preview {
    min-height: 56px;
    padding: 5px;
    border-width: 2px;
  }

  .sticker-preview .sticker-image {
    width: 62px;
  }

  .arcade-scene {
    border-width: 3px;
  }

  .arcade-player {
    border-width: 3px;
    box-shadow: 3px 3px 0 #000;
  }

  .arcade-player-head {
    gap: 7px;
    padding: 7px;
    border-bottom-width: 3px;
  }

  .arcade-player-head span {
    padding: 5px 7px;
    border-width: 2px;
    font-size: 11px;
  }

  .arcade-cabinet {
    padding: 10px;
  }

  .arcade-controls {
    margin-top: 12px;
    padding: 9px;
    border-width: 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .thread-marker.is-bubble-pulse .thread-bubble,
  .thread-marker.is-bubble-pulse .thread-title,
  .thread-marker.is-bubble-pulse .activity-mark {
    animation: none;
  }
}
