:root {
  --pink: #ff6fa5;
  --sky: #5ec8ff;
  --green: #7ee787;
  --wood: #a9764f;
}
* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
html {
  height: 100%;
}
body {
  margin: 0;
  height: 100vh;
  font-family:
    -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Meiryo",
    sans-serif;
  background: #f2f2f2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.container {
  width: 100%;
  max-width: 1196px;
  height: 540px;
  border: 2px solid #333;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: linear-gradient(150deg, #1f3a2c, #3c684f);
  position: relative;
}
.game-header {
  position: absolute;
  inset: 0 0 auto;
  height: 50px;
  padding: 6px 14px;
  display: none;
  color: #fff;
  background: transparent;
  z-index: 5;
}
.playing .game-header {
  display: flex;
}
.info {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  font-size: 19px;
  font-weight: 800;
}
.info > b {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
}
.info > span:last-child {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  display: flex;
  gap: 8px;
  white-space: nowrap;
}
.game-header button,
.sound {
  border: 0;
  border-radius: 14px;
  padding: 8px 14px;
  color: #fff;
  background: linear-gradient(#8fd8ff, #399bd0);
  font: inherit;
  font-weight: 800;
  box-shadow: 0 4px #246f98;
  cursor: pointer;
}
.game-header #quit {
  background: linear-gradient(#ffd08a, #ffb347);
  box-shadow: 0 4px #c57b17;
}
.sound.off {
  background: linear-gradient(#aaa, #777);
  box-shadow: 0 4px #555;
}
.game-main {
  position: relative;
  flex: 1;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 14px solid var(--wood);
  background:
    radial-gradient(circle at 20% 20%, #ffffff12, transparent 35%),
    linear-gradient(150deg, #1f3a2c, #3c684f);
}
.decor {
  position: absolute;
  inset: 0;
  color: #fff;
  opacity: 0.17;
  pointer-events: none;
}
.decor i,
.decor i:before,
.decor i:after {
  position: absolute;
  display: block;
  content: "";
  border: 4px solid currentColor;
}
.flower {
  left: 7%;
  top: 14%;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  box-shadow:
    0 -27px 0 -4px currentColor,
    27px 0 0 -4px currentColor,
    0 27px 0 -4px currentColor,
    -27px 0 0 -4px currentColor;
}
.flower:before {
  left: 13px;
  top: 31px;
  width: 4px;
  height: 70px;
  border-width: 0 0 0 4px;
  transform: rotate(7deg);
}
.flower:after {
  left: 17px;
  top: 68px;
  width: 27px;
  height: 16px;
  border-radius: 70% 10% 70% 10%;
  transform: rotate(-15deg);
}
.car {
  right: 7%;
  bottom: 16%;
  width: 112px;
  height: 47px;
  border-radius: 18px 25px 9px 9px;
  transform: rotate(5deg);
}
.car:before {
  left: 20px;
  top: -32px;
  width: 62px;
  height: 31px;
  border-radius: 30px 30px 0 0;
  transform: skew(-12deg);
}
.car:after {
  left: 13px;
  top: 34px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #315541;
  box-shadow:
    62px 0 0 -4px #315541,
    62px 0 0 0 currentColor;
}
.rocket {
  right: 16%;
  top: 9%;
  width: 42px;
  height: 91px;
  border-radius: 50% 50% 18% 18%;
  transform: rotate(38deg);
}
.rocket:before {
  left: 8px;
  top: 18px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
}
.rocket:after {
  left: 6px;
  top: 84px;
  width: 22px;
  height: 43px;
  border-width: 4px 0 0 4px;
  transform: rotate(45deg);
}
.cloud {
  left: 19%;
  bottom: 13%;
  width: 100px;
  height: 35px;
  border-radius: 50%;
}
.cloud:before {
  left: 18px;
  top: -28px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: #315541;
}
.cloud:after {
  left: 52px;
  top: -17px;
  width: 37px;
  height: 37px;
  border-radius: 50%;
  background: #315541;
}
.screen {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: #fff;
}
.screen.active {
  display: flex;
}
.top-sound {
  position: absolute;
  right: 10px;
  top: 10px;
}
h1 {
  font-size: 45px;
  margin: 0 0 8px;
  text-shadow: 2px 2px #0005;
}
h1 i,
h1 em {
  font-style: normal;
  font-size: 68px;
}
h1 i {
  color: var(--pink);
}
h1 em {
  color: var(--sky);
}
#home p {
  font-size: 21px;
  font-weight: 800;
  margin: 8px;
}
.choice,
.big,
.card button {
  border: 0;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 6px #0003;
}
.choice {
  font-size: 23px;
  min-width: 145px;
  padding: 15px;
  border-radius: 22px;
  background: linear-gradient(#ff9ac1, var(--pink));
  margin: 5px;
}
.choice.blue {
  background: linear-gradient(#8fd8ff, var(--sky));
}
.choice.selected {
  outline: 5px solid #fff;
  outline-offset: -8px;
}
.big {
  font-size: 30px;
  min-width: 245px;
  padding: 16px;
  border-radius: 40px;
  margin-top: 15px;
  background: linear-gradient(#ffe27a, #ffb52e);
  box-shadow: 0 6px #b97812;
}
.play {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 24px;
}
aside {
  display: contents;
}
#you {
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
}
#cpu {
  grid-column: 3;
  grid-row: 1;
  justify-self: center;
}
.play > .board-wrap {
  grid-column: 2;
  grid-row: 1;
}
aside div {
  background: #fff;
  color: #756895;
  border-radius: 24px;
  min-width: 144px;
  padding: 20px 28px;
  text-align: center;
  font-weight: 800;
}
aside span {
  display: block;
  font-size: 22px;
}
aside b {
  display: block;
  margin-top: 8px;
  font-size: 82px;
  line-height: 1;
  font-weight: 900;
  color: var(--pink);
}
aside b.x {
  color: var(--sky);
  -webkit-text-stroke: 3px currentColor;
}
.board-wrap {
  position: relative;
}
#board {
  display: grid;
  grid-template: repeat(3, 126px) / repeat(3, 126px);
  gap: 0;
  padding: 0;
  background: transparent;
}
.cell {
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 62px;
  font-weight: 900;
  color: var(--pink);
  cursor: pointer;
}
.cell:not(:nth-child(3n)) {
  border-right: 4px solid #eee9d8;
}
.cell:nth-child(-n + 6) {
  border-bottom: 4px solid #eee9d8;
}
.cell:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: -9px;
}
.cell.x {
  color: var(--sky);
}
#touchHint {
  display: none;
  position: absolute;
  z-index: 2;
  left: 50%;
  top: calc(100% + 12px);
  transform: translateX(-50%);
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  color: #675887;
  background: #fff;
  padding: 7px 15px;
  border-radius: 20px;
  font-size: 17px;
  font-weight: 900;
  box-shadow: 0 4px 10px #0003;
  pointer-events: none;
}
#touchHint.show {
  display: flex;
}
.cell.win {
  background: #ffe066;
  animation: pop 0.4s;
}
@keyframes pop {
  50% {
    transform: scale(1.1);
  }
}
#result {
  display: none;
  position: absolute;
  inset: 0;
  background: #3a4a8f99;
  align-items: center;
  justify-content: center;
}
.card {
  text-align: center;
  background: #fff;
  color: #3a4a8f;
  padding: 28px 40px;
  border-radius: 30px;
}
.card strong {
  font-size: 55px;
}
.card h2 {
  font-size: 38px;
  margin: 5px 0 18px;
}
.card button {
  font-size: 20px;
  padding: 14px 22px;
  border-radius: 18px;
  background: linear-gradient(#9be89f, var(--green));
  margin: 4px;
}
.card #homeBtn {
  background: linear-gradient(#ffd08a, #ffb347);
}
@media (max-width: 700px) {
  .info {
    font-size: 14px;
  }
  .info b {
    font-size: 15px;
  }
  .game-header button {
    padding: 6px;
  }
  h1 {
    font-size: 28px;
  }
  h1 i,
  h1 em {
    font-size: 42px;
  }
  #board {
    grid-template: repeat(3, 96px) / repeat(3, 96px);
  }
  .cell {
    font-size: 45px;
  }
  aside {
    display: none;
  }
}
@media (max-width: 480px) {
  .game-header {
    height: 80px;
  }
  .info {
    grid-template-columns: 1fr;
    row-gap: 4px;
  }
  .info > b {
    grid-column: 1;
    grid-row: 1;
  }
  .info > span:last-child {
    grid-column: 1;
    grid-row: 2;
  }
}
