:root {
  color-scheme: dark;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #f4f8ff;
  background: #0b1224;
  font-synthesis: none;
  --red: #ff6573;
  --yellow: #ffdc71;
  --muted: #99aac8;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100svh;
  background: radial-gradient(ellipse at 24% 0%, #1a2b50 0, transparent 65%);
}
button,
select {
  font: inherit;
}
button {
  touch-action: manipulation;
  cursor: pointer;
}
button:disabled {
  cursor: default;
}
button:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid #91e9d3;
  outline-offset: 3px;
}
.game {
  width: min(1040px, 100%);
  margin: auto;
  padding: clamp(12px, 2.7vh, 24px) clamp(12px, 3vw, 32px);
}
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 0.17em;
  color: #91e9d3;
  margin: 0 0 5px;
  font-weight: 750;
}
h1 {
  font-size: clamp(24px, 4vw, 36px);
  letter-spacing: -0.045em;
  margin: 0;
}
.board-mark {
  display: grid;
  grid-template-columns: repeat(2, 12px);
  gap: 4px;
  margin-right: 4px;
}
.board-mark i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--yellow);
}
.board-mark i:nth-child(odd) {
  background: var(--red);
}
.play-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 32px;
  align-items: center;
}
.board-area {
  width: min(100%, 600px);
  margin: auto;
}
.column-controls {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  padding: 0 16px 8px;
}
.column-button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  height: 34px;
  color: #8c9abc;
  font-size: 23px;
}
.column-button:hover:not(:disabled),
.column-button.selected:not(:disabled) {
  background: #243d66;
  border-color: #37578a;
  color: #fff;
}
.column-button:disabled {
  color: #50617d;
}
.board {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: clamp(5px, 1.1vw, 10px);
  padding: clamp(10px, 1.8vw, 16px);
  border-radius: 19px;
  background: linear-gradient(145deg, #326bc3, #1c4283);
  box-shadow:
    0 15px 35px #050b1970,
    inset 0 1px #6698e0;
  border: 1px solid #4779c5;
}
.cell {
  border: 0;
  border-radius: 50%;
  aspect-ratio: 1;
  min-width: 0;
  width: 100%;
  position: relative;
  background: #0d1a36;
  box-shadow: inset 0 3px 7px #020916b0;
  padding: 0;
}
.cell.red,
.turn-disc.red,
.player-key .red {
  background: var(--red);
}
.cell.yellow,
.turn-disc.yellow,
.player-key .yellow {
  background: var(--yellow);
}
.cell.red,
.cell.yellow {
  box-shadow:
    inset 0 -4px 1px #0003,
    inset 0 2px 1px #ffffff50;
}
.cell.last::after {
  content: "";
  position: absolute;
  inset: 35%;
  border: 2px solid #0b12246e;
  border-radius: 50%;
}
.cell.winning {
  box-shadow:
    inset 0 -4px 1px #0002,
    0 0 0 3px #fff,
    0 0 17px #fff7;
}
.board-caption {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  margin: 12px 0 0;
}
.panel {
  min-width: 0;
}
.turn-card {
  display: flex;
  align-items: center;
  gap: 13px;
  background: #15213a;
  border: 1px solid #2a3b5a;
  border-radius: 12px;
  padding: 14px;
}
.turn-disc {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset 0 -3px #0002;
}
.turn-label {
  font-size: 9px;
  letter-spacing: 0.13em;
  color: var(--muted);
  margin: 0 0 4px;
  font-weight: 700;
}
#status {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.02em;
  margin: 0;
}
.player-key {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 10px;
  color: var(--muted);
  margin: 15px 0 23px;
}
.player-key > span {
  display: flex;
  align-items: center;
  gap: 5px;
}
.player-key i {
  display: inline-block;
  height: 8px;
  width: 8px;
  border-radius: 50%;
}
.mode-label {
  display: block;
  color: #bdcce4;
  font-size: 11px;
  margin-bottom: 7px;
}
select {
  width: 100%;
  height: 43px;
  padding: 0 12px;
  background: #101a30;
  border: 1px solid #314263;
  border-radius: 8px;
  color: #eef5ff;
  font-size: 13px;
}
#restart {
  width: 100%;
  height: 43px;
  border: 0;
  border-radius: 8px;
  background: #91e9d3;
  color: #10253a;
  font-weight: 750;
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 13px;
}
#restart:hover {
  background: #adf5e2;
}
#restart span {
  font-size: 23px;
}
.rules {
  margin-top: 23px;
  color: #afbed6;
  font-size: 12px;
  line-height: 1.6;
}
.rules h2 {
  color: #eaf1fb;
  font-size: 12px;
  margin: 0 0 6px;
}
.rules p {
  margin: 0 0 7px;
}
.move-count {
  font-size: 10px;
  color: var(--muted);
  margin: 17px 0 0;
}
footer {
  font-size: 9px;
  color: #788aaa;
  text-align: center;
  margin-top: 19px;
}
footer a {
  color: #99b5dc;
}
@media (max-width: 660px) {
  .game {
    max-width: 460px;
    padding: 16px 14px;
  }
  .header {
    margin-bottom: 12px;
  }
  .play-area {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  .board-area {
    max-width: 410px;
  }
  .board {
    gap: 7px;
    padding: 12px;
    border-radius: 15px;
  }
  .column-controls {
    padding: 0 12px 6px;
    gap: 7px;
  }
  .column-button {
    height: 29px;
    font-size: 21px;
  }
  .board-caption {
    margin-top: 8px;
    font-size: 10px;
  }
  .panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
  }
  .turn-card {
    grid-column: 1/-1;
    padding: 11px 13px;
  }
  .player-key {
    grid-column: 1/-1;
    margin: 0 0 3px;
  }
  .mode-label {
    grid-column: 1/2;
    margin: 0;
    align-self: end;
  }
  .panel select {
    grid-column: 1/2;
    height: 40px;
    font-size: 11px;
  }
  .panel #restart {
    grid-column: 2/3;
    grid-row: 4/5;
    height: 40px;
    margin: 0;
  }
  .rules {
    grid-column: 1/-1;
    margin: 5px 0 0;
    font-size: 11px;
    line-height: 1.5;
  }
  .rules h2 {
    font-size: 11px;
    margin-bottom: 3px;
  }
  .rules p {
    margin-bottom: 3px;
  }
  .move-count {
    grid-column: 1/-1;
    margin: 0;
    font-size: 9px;
  }
  footer {
    margin-top: 12px;
  }
}
@media (min-width: 661px) and (max-height: 630px) {
  .game {
    padding: 12px 20px;
  }
  .header {
    margin-bottom: 10px;
  }
  h1 {
    font-size: 26px;
  }
  .eyebrow {
    font-size: 8px;
  }
  .play-area {
    grid-template-columns: minmax(0, 1fr) 235px;
    gap: 24px;
  }
  .board-area {
    max-width: min(100%, calc((100svh - 190px) * 7 / 6));
  }
  .board {
    gap: 7px;
    padding: 12px;
  }
  .column-controls {
    padding: 0 12px 5px;
    gap: 7px;
  }
  .column-button {
    height: 25px;
    font-size: 20px;
  }
  .board-caption {
    font-size: 9px;
    margin-top: 7px;
  }
  .turn-card {
    padding: 11px;
  }
  .player-key {
    margin: 10px 0 13px;
  }
  .rules {
    margin-top: 12px;
    font-size: 10px;
    line-height: 1.5;
  }
  .rules h2 {
    font-size: 11px;
  }
  .rules p {
    margin-bottom: 4px;
  }
  .mode-label {
    font-size: 10px;
  }
  select,
  #restart {
    height: 37px;
    font-size: 11px;
  }
  .move-count {
    margin-top: 10px;
  }
  footer {
    margin-top: 10px;
    font-size: 8px;
  }
}
@media (max-width: 380px) {
  .game {
    padding: 12px;
  }
  .eyebrow {
    font-size: 8px;
  }
  .board {
    gap: 6px;
    padding: 10px;
  }
  .column-controls {
    gap: 6px;
    padding-inline: 10px;
  }
  .panel {
    gap: 6px 10px;
  }
  .rules {
    font-size: 10px;
  }
  .turn-card {
    padding: 9px 12px;
  }
  .player-key {
    font-size: 9px;
  }
  .board-caption {
    font-size: 9px;
  }
}
@media (max-width: 660px) and (max-height: 720px) {
  .game {
    padding: 10px 12px;
  }
  .header {
    margin-bottom: 8px;
  }
  h1 {
    font-size: 23px;
  }
  .eyebrow {
    font-size: 8px;
  }
  .play-area {
    gap: 12px;
  }
  .panel {
    gap: 6px 10px;
  }
  .turn-card {
    padding: 8px 12px;
  }
  .turn-disc {
    width: 28px;
    height: 28px;
  }
  #status {
    font-size: 16px;
  }
  .player-key {
    font-size: 9px;
  }
  .mode-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .panel select {
    grid-row: 3/4;
  }
  .panel #restart {
    grid-row: 3/4;
  }
  .rules {
    font-size: 10px;
    line-height: 1.4;
    margin-top: 3px;
  }
  .rules h2 {
    font-size: 10px;
  }
  .move-count {
    font-size: 9px;
  }
  footer {
    font-size: 8px;
    margin-top: 9px;
  }
}
@media (min-width: 661px) and (max-height: 450px) {
  .panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px 9px;
  }
  .turn-card {
    grid-column: 1/-1;
    padding: 9px 11px;
  }
  .player-key {
    grid-column: 1/-1;
    margin: 0;
    font-size: 9px;
  }
  .mode-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .panel select {
    grid-column: 1/2;
    grid-row: 3/4;
    height: 34px;
    font-size: 10px;
    padding: 0 6px;
  }
  .panel #restart {
    grid-column: 2/3;
    grid-row: 3/4;
    height: 34px;
    font-size: 10px;
    margin: 0;
    padding: 0 8px;
  }
  .rules {
    grid-column: 1/-1;
    margin: 3px 0 0;
    font-size: 10px;
    line-height: 1.4;
  }
  .move-count {
    grid-column: 1/-1;
    margin: 0;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .cell.last {
    animation: drop 0.19s ease-out;
  }
  @keyframes drop {
    from {
      transform: translateY(-25%);
      opacity: 0.6;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
}
