* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation; /*タブレット連打時の拡大防止 */
}

html {
  margin: 0;
  height: 100%;
}

body {
  margin: 0;
  height: 100vh;

  font-family:
    -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Meiryo",
    sans-serif;
  background: #f2f2f2;

  display: flex;
  justify-content: center;
  align-items: center;
}

.container {
  margin: 0 auto;
  border: 2px solid #333;

  width: 100%;
  max-width: 1196px;
  height: 540px;

  display: flex;
  flex-direction: column;
}

.game-header {
  height: 50px;
  flex: 0 0 50px;
  align-items: center;
}

.info {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: bold;
  flex-wrap: wrap;
}

.game-main {
  position: relative;

  flex: 1;

  overflow: hidden;

  display: grid;
  place-items: center;
}

#game {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.container {
  color: #5a3a1e;
  background:
    linear-gradient(
      160deg,
      rgba(255, 255, 255, 0.45) 0,
      rgba(255, 255, 255, 0) 40%
    ),
    linear-gradient(#fff 4px, transparent 4px) 0 0/64px 64px,
    linear-gradient(90deg, #fff 4px, transparent 4px) 0 0/64px 64px,
    #bfe8f2;
}
#game::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 70px;
  pointer-events: none;
  border-top: 10px solid #f0b56e;
  box-shadow: 0 -6px 0 rgba(0, 0, 0, 0.08);
  background:
    repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.07) 0 3px,
      transparent 3px 90px
    ),
    repeating-linear-gradient(0deg, #c98a4b 0 14px, #bf7f40 14px 28px);
}
#game::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 14px;
  pointer-events: none;
  background: repeating-linear-gradient(90deg, #ff6b6b 0 40px, #fff 40px 80px);
}
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.screen.on {
  display: flex;
}
button {
  font-family: inherit;
  color: inherit;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}
.big {
  font-size: 44px;
  font-weight: 900;
  padding: 18px 70px;
  min-height: 90px;
  border-radius: 60px;
  color: #fff;
  background: #ff6b3d;
  box-shadow: 0 8px 0 #c43f15;
  transition: transform 0.08s;
}
.big:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0 #c43f15;
}
.big.blue {
  background: #3da9ff;
  box-shadow: 0 8px 0 #1c6cb8;
}
.big.blue:active {
  box-shadow: 0 2px 0 #1c6cb8;
}
h1 {
  margin: 0;
  line-height: 1.1;
  text-align: center;
  color: #ff5a1f;
  -webkit-text-stroke: 2px #fff;
  paint-order: stroke fill;
  text-shadow:
    0 6px 0 #ffc36b,
    0 10px 0 rgba(0, 0, 0, 0.12);
}
#quit {
  font-weight: 900;
  background: #fff;
  border: 4px solid #ff8a3d;
  border-radius: 40px;
}
#quit:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #c9621a;
}
#theme {
  min-width: 0;
  display: flex;
  align-items: center;
  background: #fff;
  border: 5px solid #ffb84d;
  border-radius: 36px;
  box-shadow: 0 8px 0 #d99a2b;
}
#dishName {
  font-weight: 900;
  color: #ff5a1f;
}
#hint:empty {
  display: none;
}
#theme small {
  display: block;
  margin-top: 10px;
  font-weight: 900;
}
.pic {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pic .em {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.pic img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
#stage {
  position: absolute;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
#bowl {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(#f6f9fb, #cfd9e0);
  border: 6px solid #8d9aa4;
  border-radius: 26px;
  box-shadow:
    0 16px 0 #6f7c86,
    0 22px 0 rgba(0, 0, 0, 0.15);
}
.slot {
  border: 4px dashed #7f8f9b;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.slot.f {
  border-style: solid;
  border-color: #4cc35a;
  background: #fff;
}
#bowl.done .slot {
  visibility: hidden;
}
.item.pop {
  animation: pop 0.35s;
}
.item.vanish {
  animation: vanish 0.5s forwards;
}
@keyframes vanish {
  to {
    transform: scale(0) rotate(200deg);
    opacity: 0;
  }
}
@keyframes hop {
  50% {
    transform: translateY(-14px);
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.s-chop .item {
  animation: hop 0.35s 4;
}
.s-mix .item {
  animation: spin 1.1s ease-in-out;
}
.s-fire {
  animation: cook 0.25s infinite;
}
#tool {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 90px;
  height: 90px;
  margin: -45px 0 0 -45px;
  font-size: 78px;
  line-height: 90px;
  text-align: center;
  z-index: 4;
  pointer-events: none;
}
.t-chop {
  animation: chop 0.35s 4;
}
.t-mix {
  animation: circ 1.1s linear;
}
.t-fire {
  top: auto !important;
  bottom: -8px;
  margin-top: 0 !important;
  animation: flick 0.3s infinite alternate;
}
@keyframes chop {
  0%,
  100% {
    transform: translateY(-60px) rotate(-35deg);
  }
  50% {
    transform: translateY(8px) rotate(15deg);
  }
}
@keyframes circ {
  from {
    transform: rotate(0) translateX(60px) rotate(0);
  }
  to {
    transform: rotate(360deg) translateX(60px) rotate(-360deg);
  }
}
@keyframes flick {
  from {
    transform: scale(0.9);
  }
  to {
    transform: scale(1.15);
  }
}
#right {
  position: absolute;
  left: 14px;
  right: 14px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  z-index: 2;
}
.card {
  position: relative;
  background: #fff;
  border: 5px solid #8fd0ff;
  border-radius: 24px;
  box-shadow: 0 7px 0 #5aa7e0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 2px;
  font-weight: 900;
  font-size: 21px;
  transition: transform 0.08s;
}
.card:active {
  transform: translateY(5px);
  box-shadow: 0 2px 0 #5aa7e0;
}
.card .pic {
  width: 88px;
  height: 88px;
  font-size: 66px;
  margin-bottom: 6px;
}
.card.sel {
  border-color: #ff8a3d;
  background: #ffe9c2;
  box-shadow: 0 7px 0 #d9691a;
  opacity: 0.55;
}
.card.sel::after {
  content: "✔";
  position: absolute;
  top: -8px;
  right: -6px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #4cc35a;
  color: #fff;
  font-size: 26px;
  line-height: 40px;
  text-align: center;
}
.card.lock {
  pointer-events: none;
}
.card > span,
.slot > .item {
  unicode-bidi: isolate;
}
#ov {
  position: absolute;
  inset: 0;
  background: rgba(255, 248, 220, 0.94);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 6;
}
#ov.on {
  display: flex;
}
#ovT {
  font-weight: 900;
  color: #ff5a1f;
  -webkit-text-stroke: 2px #fff;
  paint-order: stroke fill;
  text-shadow: 0 5px 0 #ffc36b;
  animation: pop 0.5s;
}
#ovD {
  font-weight: 900;
}
#ovS {
  font-size: 44px;
  margin-top: 4px;
}
.fly {
  position: absolute;
  z-index: 8;
  pointer-events: none;
}
.puff {
  position: absolute;
  z-index: 8;
  pointer-events: none;
  font-size: 34px;
}
.steam {
  animation: rise 1s ease-out infinite;
}
@keyframes rise {
  0% {
    transform: translateY(0) scale(0.6);
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  100% {
    transform: translateY(-70px) scale(1.2);
    opacity: 0;
  }
}
@keyframes cook {
  25% {
    transform: translateX(-5px) rotate(-3deg);
  }
  75% {
    transform: translateX(5px) rotate(3deg);
  }
}
@keyframes pop {
  0% {
    transform: scale(0);
  }
  70% {
    transform: scale(1.25);
  }
  100% {
    transform: scale(1);
  }
}
#result .score {
  margin: 10px 0;
}
#result .comment {
  margin-bottom: 18px;
}
.btns {
  display: flex;
  gap: 24px;
}
.fall {
  position: absolute;
  top: -30px;
  pointer-events: none;
  animation: fall 2.2s linear forwards;
}
@keyframes fall {
  to {
    transform: translate(var(--fall-drift, 0px), var(--fall-distance, 640px))
      rotate(720deg);
  }
}
.container {
  position: relative;
  overflow: hidden;
}
.game-main {
  min-height: 0;
  background: transparent;
  width: 100%;
}
.game-header {
  position: relative;
  z-index: 20;
  background: transparent;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  padding: 3px 12px;
  gap: 8px;
}
.game-header[hidden] {
  display: none;
}
.info {
  width: auto;
}
.info-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-radius: 40px;
  padding: 6px 16px;
  font-size: 18px;
  font-weight: bold;
  color: #444;
  box-shadow: 0 2px 0 #e8a000;
}
.info-box .val {
  font-size: 22px;
  color: #ff6f3c;
  min-width: 28px;
  text-align: center;
}
.header-center {
  text-align: center;
  align-self: center;
}
.header-center h2 {
  margin: 0;
  font-size: 21px;
  line-height: 24px;
  white-space: nowrap;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
}
#progress-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 3px;
}
.progress-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ddd;
  transition: background 0.3s;
}
.progress-dot.done {
  background: #6ecb63;
}
.progress-dot.current {
  background: #f9a825;
  border: 2px solid #c77c00;
}
#quit {
  min-width: 0;
  height: 38px;
  font-size: 18px;
  border-width: 3px;
  padding: 0 16px;
  box-shadow: 0 3px 0 #c9621a;
}
.sound-btn {
  background: #fff0ad;
  border: 3px solid #f2b321;
  border-radius: 50px;
  padding: 6px 15px;
  font-size: 18px;
  font-weight: 700;
  color: #694100;
  box-shadow: 0 3px 0 #d89500;
  min-width: 100px;
  height: 38px;
}
.sound-btn:hover {
  background: #ffe680;
  border-color: #dc9700;
  color: #5a3500;
}
.sound-btn.sound-off {
  background: #e9edf1;
  border-color: #aeb7c0;
  color: #66717b;
  box-shadow: 0 3px 0 #929ba4;
}
.floating-sound {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 20;
}
[hidden] {
  display: none !important;
}
#stage {
  top: 28px;
  height: 258px;
  gap: 24px;
}
#theme {
  flex: 0 0 34%;
  height: 220px;
  padding: 10px 12px;
  gap: 10px;
}
#dishImg {
  flex: none;
  width: 90px;
  height: 90px;
  font-size: 72px;
}
#dishName {
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: 1.35;
  white-space: pre-line;
}
#theme small {
  font-size: 18px;
}
#bowl {
  flex: 1;
  min-width: 0;
  height: 220px;
  padding: 30px 14px 34px;
  gap: 8px;
}
.slot {
  flex: 1;
  min-width: 0;
  max-width: 120px;
  width: 0;
  height: 124px;
  padding: 2px;
}
.item {
  width: 100%;
  height: 112px;
  font-size: 76px;
}
#right {
  height: 166px;
  bottom: 14px;
}
.fall {
  z-index: 1;
}
#result {
  z-index: 2;
}
#result .btns {
  z-index: 2;
}
#result .score {
  font-size: 64px;
}
#result .comment {
  font-size: 40px;
}
#ovT {
  font-size: 56px;
}
#ovPic {
  height: 170px;
  width: 170px;
  font-size: 130px;
}
#ovD {
  font-size: 38px;
}
#result h1 {
  font-size: 64px;
}
@media (max-width: 900px) {
  .header-center h2 {
    font-size: 18px;
  }
  .info-box {
    padding: 5px 10px;
    font-size: 16px;
  }
  #quit,
  .sound-btn {
    padding: 4px 10px;
    font-size: 16px;
  }
  .sound-btn {
    min-width: 86px;
  }
  #stage {
    gap: 14px;
  }
  #theme {
    flex-direction: column;
    justify-content: center;
    padding: 8px;
    gap: 6px;
    text-align: center;
  }
  #dishImg {
    width: 64px;
    height: 64px;
    font-size: 54px;
  }
  #bowl {
    padding: 24px 10px;
    gap: 6px;
  }
  .slot {
    width: 0;
    height: 112px;
  }
  .item {
    width: 100%;
    height: 100px;
    font-size: 60px;
  }
  .card {
    font-size: 17px;
    border-width: 4px;
  }
  .card .pic {
    width: 66px;
    height: 76px;
    font-size: 54px;
  }
  .big {
    font-size: 34px;
    padding: 16px 32px;
    min-height: 76px;
  }
}
@media (max-width: 650px) {
  .game-header {
    padding: 3px 5px;
    gap: 3px;
  }
  .header-center h2 {
    white-space: normal;
  }
  .header-actions {
    gap: 4px;
  }
  .info-box {
    font-size: 12px;
    gap: 3px;
  }
  .info-box .val {
    font-size: 18px;
    min-width: 20px;
  }
  #quit,
  .sound-btn {
    font-size: 13px;
    padding: 4px 8px;
  }
  .sound-btn {
    min-width: 64px;
  }
  .progress-dot {
    width: 10px;
    height: 10px;
  }
  #stage {
    top: 8px;
    flex-direction: column;
  }
  #theme {
    flex: none;
    flex-direction: row;
    width: 100%;
    border-radius: 22px;
    text-align: left;
  }
  #dishImg {
    width: 64px;
    height: 64px;
    font-size: 54px;
  }
  #dishName {
    font-size: 21px;
  }
  #theme small {
    font-size: 16px;
    margin-top: 4px;
  }
  #bowl {
    flex: none;
    width: 100%;
    padding: 10px;
    gap: 5px;
  }
  .slot {
    width: 0;
    max-width: 96px;
    height: 94px;
  }
  .item {
    width: 100%;
    height: 82px;
    font-size: 44px;
  }
  #right {
    grid-template-columns: repeat(4, 1fr);
    height: 202px;
    gap: 8px;
    left: 8px;
    right: 8px;
    bottom: 12px;
  }
  .card {
    border-radius: 16px;
    font-size: 14px;
  }
  .card .pic {
    height: 52px;
    width: 52px;
    font-size: 42px;
    margin-bottom: 2px;
  }
  .card.sel::after {
    width: 28px;
    height: 28px;
    font-size: 20px;
    line-height: 28px;
  }
  #result h1 {
    font-size: 40px;
  }
  #result .comment {
    font-size: 30px;
  }
  .btns {
    flex-direction: column;
    gap: 18px;
  }
  .big {
    font-size: 26px;
    min-height: 64px;
    padding: 12px 28px;
  }
  #ovT {
    font-size: 44px;
  }
  #ovD {
    font-size: 28px;
  }
}

.slot:focus-visible {
  outline: 3px solid #2259ba;
  outline-offset: 3px;
}
.card.returning .pic {
  visibility: hidden;
}
.info-box {
  line-height: 1.2;
}
.info-box #stars {
  display: flex;
  align-items: center;
  min-height: 26px;
  height: auto;
  min-width: 0;
  line-height: 1;
  white-space: nowrap;
  font-size: 22px;
}
#result .score {
  min-height: 1.2em;
  line-height: 1.2;
}
#result .comment {
  font-weight: 900;
  color: #e65b24;
}
@media (max-width: 650px) {
  .game-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .header-center {
    grid-column: 1;
    grid-row: 1;
    text-align: left;
    min-width: 0;
  }
  .header-actions {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
  .info {
    grid-column: 1;
    grid-row: 2;
  }
  .game-header {
    height: 72px;
    flex-basis: 72px;
  }
  .header-center h2 {
    font-size: 15px;
  }
  #progress-dots {
    justify-content: flex-start;
    margin-top: 2px;
    gap: 5px;
  }
  .info-box {
    padding: 2px 7px;
    min-height: 26px;
  }
  .info-box #stars {
    font-size: 18px;
    min-height: 22px;
  }
  #result .score {
    font-size: clamp(30px, 10vw, 52px);
  }
  #stage {
    height: 226px;
    gap: 8px;
  }
  #theme {
    height: 92px;
  }
  #bowl {
    height: 118px;
  }
}

#start {
  padding: 72px 20px 26px;
  justify-content: space-between;
  gap: 12px;
}
#start h1 {
  font-size: clamp(28px, 5vw, 52px);
  z-index: 1;
  flex: none;
}
#startBtn {
  font-size: 30px;
  min-height: 60px;
  padding: 10px 46px;
  z-index: 1;
  flex: none;
}
#demo {
  width: min(720px, 100%);
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 30% minmax(0, 1fr);
  align-items: center;
  align-content: center;
  gap: 10px 18px;
  pointer-events: none;
}
#demoHeading {
  font-weight: 900;
}
#demoTray {
  justify-content: center;
  border: 4px solid #8d9aa4;
  border-radius: 22px;
  background: linear-gradient(#f6f9fb, #cfd9e0);
  box-shadow: 0 6px 0 #6f7c86;
}
.demo-slot {
  height: 70px;
  border: 3px dashed #8d9aa4;
  border-radius: 12px;
  background: #ffffffa6;
  font-size: 44px;
}
.demo-slot.filled {
  border: 3px solid #4cc35a;
  background: #fff;
  animation: pop 0.4s;
}
#demoFoods {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}
.demo-card {
  min-width: 0;
  padding: 5px 3px;
  background: #fff;
  border: 3px solid #8fd0ff;
  border-radius: 16px;
  text-align: center;
  font-size: 13px;
  font-weight: 900;
  overflow-wrap: anywhere;
  transition:
    opacity 0.3s,
    transform 0.3s;
}
.demo-card .pic {
  height: 52px;
  width: 100%;
  font-size: 40px;
}
.demo-card.picked {
  opacity: 0.35;
  transform: translateY(-5px);
  border-color: #4cc35a;
}
#demoDish {
  width: 160px;
  height: 100px;
  font-size: 80px;
  animation: pop 0.6s;
}
#demoMessage {
  grid-column: 1 / -1;
  font-size: 20px;
  font-weight: 900;
  color: #d85720;
  min-height: 28px;
  text-align: center;
}
#demoTray.cooking {
  animation: cook 0.25s infinite;
}
#demoStage {
  display: contents;
}
#demoTheme {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: #fff;
  border: 4px solid #ffb84d;
  border-radius: 22px;
}
#demoThemePic {
  flex: none;
  width: 70px;
  height: 70px;
  font-size: 52px;
}
#demoHeading {
  font-size: 20px;
  line-height: 1.5;
}
#demoWork {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  min-height: 104px;
  display: flex;
  justify-content: center;
  align-items: center;
}
#demoTray {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: 100%;
  gap: 6px;
  padding: 12px 10px;
}
.demo-slot {
  min-width: 0;
  width: 100%;
  max-width: none;
}
#demoChoices {
  grid-column: 1 / -1;
  position: relative;
  width: 100%;
  padding-bottom: 26px;
}
#demoPointer {
  position: absolute;
  z-index: 3;
  font-size: 42px;
  line-height: 1;
  transform: translateX(-35%);
  transition:
    left 0.35s ease,
    top 0.35s ease;
  filter: drop-shadow(0 2px 2px #0003);
}
#demoPointer.tapping {
  animation: demoTap 0.4s ease;
}
@keyframes demoTap {
  50% {
    transform: translate(-35%, -9px) scale(0.85);
  }
}
@media (max-width: 650px) {
  #start {
    padding: 82px 12px 22px;
    gap: 10px;
  }
  #startBtn {
    font-size: 26px;
    min-height: 54px;
    padding: 8px 36px;
  }
  #demo {
    grid-template-columns: 25% minmax(0, 1fr);
    gap: 12px 8px;
  }
  #demoTheme {
    flex-direction: column;
    padding: 8px 4px;
    gap: 3px;
    border-width: 3px;
    text-align: center;
  }
  #demoThemePic {
    width: 48px;
    height: 48px;
    font-size: 36px;
  }
  #demoHeading {
    font-size: 13px;
  }
  #demoTray {
    gap: 4px;
    padding: 10px 4px;
    width: 100%;
  }
  .demo-slot {
    height: 64px;
    font-size: 38px;
  }
  #demoFoods {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }
  .demo-card {
    font-size: 11px;
    overflow-wrap: anywhere;
    border-width: 2px;
    border-radius: 12px;
  }
  .demo-card .pic {
    height: 38px;
    font-size: 30px;
  }
  #demoMessage {
    font-size: 17px;
  }
  #demoPointer {
    font-size: 36px;
  }
}
