:root {
  color-scheme: light;
  font-family: "MS PGothic", "Osaka", "Arial", sans-serif;
  color: #111;
  background: #fff;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #fff;
  font-size: 16px;
}

.site-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  background-color: #fffdf3;
  background-image:
    url("./background-chain-sim.svg?v=4"),
    radial-gradient(circle at 3px 3px, rgba(0, 170, 180, 0.14) 1px, transparent 1.6px),
    radial-gradient(circle at 13px 13px, rgba(255, 75, 160, 0.11) 1px, transparent 1.6px);
  background-position: 180px 0, 0 0, 0 0;
  background-size: 420px 96px, 16px 16px, 16px 16px;
}

.side-menu {
  min-height: 100vh;
  padding: 28px 18px;
  border-right: 1px solid #777;
  background-color: #ddffff;
  background-image:
    radial-gradient(circle at 2px 2px, #ffb6d9 1px, transparent 1.5px),
    radial-gradient(circle at 9px 9px, #9be5ff 1px, transparent 1.5px);
  background-size: 12px 12px;
}

.side-title {
  margin: 0 0 22px;
  padding: 4px;
  border: 3px outset #eee;
  background: #000080;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.side-menu nav {
  display: grid;
  gap: 17px;
}

.side-menu a {
  color: #0000cc;
  font-size: 15px;
  text-decoration: underline;
}

.menu-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: -1px;
}

.menu-dot--pink {
  background: #ffb4c7;
}

.menu-dot--green {
  background: #00dd55;
}

.menu-dot--cyan {
  background: #25dbe1;
}

.menu-dot--blue {
  background: #168de2;
}

.menu-dot--purple {
  background: #b325c7;
}

.side-note {
  margin: 42px 0 0;
  padding-top: 14px;
  border-top: 1px solid #aaa;
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}

.side-note p {
  margin: 0 0 6px;
}

.side-note .counter-message {
  margin-top: 6px;
  font-weight: 700;
}

.digital-counter {
  display: flex;
  justify-content: center;
  gap: 2px;
  margin: 0 auto;
}

.digital-counter span {
  display: inline-grid;
  width: 19px;
  height: 27px;
  place-items: center;
  border: 2px inset #aaa;
  background: #050505;
  color: #39ff14;
  font-family: "Courier New", monospace;
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 0 3px #39ff14;
}

.side-note .kiriban {
  margin-top: 7px;
  color: #ff0066;
  font-weight: 700;
}

.shell {
  width: min(100%, 1050px);
  min-width: 0;
  padding: 26px 34px 42px;
}

.site-header {
  padding: 0 0 12px;
  text-align: center;
}

h1 {
  margin: 0 0 12px;
  font-family: "MS Mincho", "Times New Roman", serif;
  font-size: clamp(32px, 5vw, 44px);
  line-height: 1.2;
}

.rainbow-title span {
  display: inline-block;
  text-shadow: 2px 2px 0 #bbb;
}

.rainbow-title span:nth-child(1) {
  color: #ff0033;
}

.rainbow-title span:nth-child(2) {
  color: #ff7900;
}

.rainbow-title span:nth-child(3) {
  color: #c6a600;
}

.rainbow-title span:nth-child(4) {
  color: #00a050;
}

.rainbow-title span:nth-child(5) {
  color: #0066dd;
}

.rainbow-title span:nth-child(6) {
  color: #8a20c8;
}

.rainbow-title span:nth-child(7) {
  color: #ff0033;
}

.rainbow-title span:nth-child(8) {
  color: #ff7900;
}

.rainbow-title span:nth-child(9) {
  color: #c6a600;
}

.rainbow-rule {
  height: 7px;
  margin: 0 0 8px;
  border: 2px outset #eee;
  background: linear-gradient(
    90deg,
    #f00 0 16.6%,
    #ff0 16.6% 33.2%,
    #0c0 33.2% 49.8%,
    #0ff 49.8% 66.4%,
    #00f 66.4% 83%,
    #f0f 83% 100%
  );
}

.marquee {
  overflow: hidden;
  border: 1px solid #000080;
  background: #000080;
  color: #ffff00;
  white-space: nowrap;
}

.marquee p {
  width: max-content;
  margin: 0;
  padding: 3px 0;
  font-size: 15px;
  font-weight: 700;
  animation: marquee 14s linear infinite;
}

.site-header .updated {
  margin: 7px 0 0;
  color: #000080;
  font-size: 13px;
  font-weight: 700;
}

.new-blink {
  color: #ff0000;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  animation: blink 900ms steps(1, end) infinite;
}

.panel {
  width: 100%;
  padding: 23px 0 0;
}

.intro {
  margin: 0 0 8px;
  font-weight: 700;
  text-align: center;
}

.tsumo-search-note {
  margin: 0 0 22px;
  font-size: 14px;
  text-align: center;
}

.tsumo-search-note a {
  color: #0000cc;
  font-weight: 700;
  text-decoration: underline;
}

.controls {
  width: min(820px, 100%);
  margin: 0 auto;
}

.controls > label {
  display: block;
  margin-bottom: 5px;
  font-size: 15px;
  font-weight: 700;
}

.run-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

input,
button {
  border-radius: 0;
  font: inherit;
}

input[type="number"] {
  width: 100%;
  height: 34px;
  padding: 4px 7px;
  border: 2px inset #ddd;
  background: #fff;
  font-size: 16px;
}

button {
  min-width: 86px;
  border: 2px outset #eee;
  padding: 4px 18px;
  background: linear-gradient(#fff, #bcbcbc);
  color: #000080;
  font-weight: 700;
  cursor: pointer;
  text-shadow: 1px 1px #fff;
}

button:active {
  border-style: inset;
}

button:disabled {
  color: #777;
  cursor: wait;
}

.preset-group {
  margin: 19px 0 0;
  padding: 7px 10px 9px;
  border: 3px ridge #ff99cc;
  background: #ffffcc;
}

.preset-group legend {
  padding: 0 5px;
  color: #000;
  font-size: 15px;
  font-weight: 700;
}

.preset-group label {
  display: flex;
  align-items: flex-start;
  padding: 5px 2px;
  border-bottom: 1px dotted #aaa;
  cursor: pointer;
}

.preset-group label:last-of-type {
  border-bottom: 0;
}

.preset-group input {
  position: static;
  width: auto;
  height: auto;
  margin: 3px 8px 0 0;
  opacity: 1;
}

.preset-card {
  display: flex;
  flex: 1;
  gap: 12px;
  min-width: 0;
  padding: 2px 4px;
}

.preset-card strong {
  min-width: 24px;
  color: #000080;
  font-size: 16px;
  text-decoration: underline;
}

.preset-card small {
  color: #222;
  font-size: 14px;
  line-height: 1.45;
}

.preset-group input:checked + .preset-card {
  background: #ffff99;
}

.status {
  width: min(820px, 100%);
  min-height: 0;
  margin: 15px auto 0;
  padding: 6px 8px;
  border: 2px inset #ddd;
  background: #ccffff;
  color: #000080;
  font-size: 14px;
}

.result {
  width: min(900px, 100%);
  margin: 26px auto 0;
  padding-top: 17px;
  border-top: 2px groove #ddd;
}

.result[hidden] {
  display: none;
}

.result:not([hidden]) {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr);
  gap: 20px 32px;
  align-items: start;
}

.stats {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding-bottom: 9px;
  border-bottom: 1px dotted #888;
}

.stats span {
  font-size: 18px;
  font-weight: 700;
}

.stats span + span {
  margin-left: 14px;
  padding-left: 14px;
  border-left: 1px solid #888;
}

.board-wrap {
  width: fit-content;
  margin: 0;
}

.board-title {
  margin: 0 0 7px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

.field-board {
  --cell-size: clamp(28px, 5vw, 38px);
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, var(--cell-size));
  grid-template-rows: repeat(13, var(--cell-size));
  gap: 2px;
  padding: 7px 7px 9px;
  border-right: 5px solid #999;
  border-bottom: 6px solid #888;
  border-left: 5px solid #999;
  background: #f7f7f2;
}

.field-board::after {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: calc(var(--cell-size) + 9px);
  background: rgba(35, 40, 38, 0.22);
  content: "";
  pointer-events: none;
}

.field-cell {
  display: block;
  width: var(--cell-size);
  height: var(--cell-size);
  border-radius: 50%;
}

.field-cell--empty {
  border: 1px solid #e2e2dd;
  background: #fff;
}

.field-cell--red {
  border: 2px solid #c33d35;
  background: #e9574d;
}

.field-cell--green {
  border: 2px solid #338e43;
  background: #4db45d;
}

.field-cell--blue {
  border: 2px solid #2d73ad;
  background: #4997d1;
}

.field-cell--yellow {
  border: 2px solid #c99b28;
  background: #f0c94d;
}

.field-cell--purple {
  border: 2px solid #824a96;
  background: #a768ba;
}

.simulator-links {
  padding: 7px 0 7px 22px;
  border-left: 1px solid #aaa;
}

.simulator-title {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 700;
}

.simulator-actions {
  display: grid;
  justify-items: start;
  gap: 12px;
}

.simulator-link {
  color: #0000cc;
  font-size: 16px;
  font-weight: 700;
  text-decoration: underline;
}

.simulator-link::before {
  content: "■ ";
  color: #168de2;
  font-size: 11px;
  text-decoration: none;
}

.simulator-link:visited {
  color: #551a8b;
}

.simulator-note {
  margin: 18px 0 0;
  color: #333;
  font-size: 13px;
  line-height: 1.5;
}

.site-footer {
  margin-top: 36px;
  color: #333;
  font-size: 13px;
  text-align: center;
}

.site-footer hr {
  border: 0;
  border-top: 1px solid #aaa;
}

.site-footer p {
  margin: 10px 0 0;
}

.site-footer p + p {
  color: #000080;
  font-family: "Courier New", monospace;
}

@keyframes marquee {
  from {
    transform: translateX(100%);
  }

  to {
    transform: translateX(-100%);
  }
}

@keyframes blink {
  0%,
  49% {
    visibility: visible;
  }

  50%,
  100% {
    visibility: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  .marquee p,
  .new-blink {
    animation: none;
  }
}

@media (max-width: 700px) {
  .site-layout {
    grid-template-columns: minmax(0, 1fr);
    background-position: 0 0, 0 0, 0 0;
  }

  .side-menu {
    min-height: 0;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid #777;
  }

  .side-title {
    margin: 0 0 8px;
    width: 80px;
  }

  .side-menu nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
  }

  .side-note {
    display: none;
  }

  .shell {
    padding: 20px 14px 30px;
  }

  h1 {
    margin-bottom: 16px;
  }

  .site-header p {
    font-size: 12px;
    line-height: 1.6;
  }

  .run-row {
    grid-template-columns: 1fr;
  }

  button {
    min-height: 36px;
  }

  .preset-card {
    display: block;
  }

  .preset-card strong {
    display: block;
    margin-bottom: 3px;
  }

  .result:not([hidden]) {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-column: auto;
  }

  .board-wrap {
    margin: 0 auto;
  }

  .simulator-links {
    padding: 16px 0 0;
    border-top: 1px dotted #888;
    border-left: 0;
  }
}
