:root {
  --cream: #fff7df;
  --paper: #f8e7bd;
  --ink: #32160d;
  --red: #de3b1f;
  --orange: #ff8a21;
  --gold: #ffc94f;
  --green: #72bd38;
  --shadow: 0 22px 70px rgb(36 8 0 / 35%);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--cream);
  font-family: "Leelawadee UI", Tahoma, Arial, sans-serif;
  background:
    radial-gradient(circle at 50% -20%, #713318 0, transparent 42%),
    linear-gradient(160deg, #180906, #3c140a 55%, #180906);
  overflow-x: hidden;
}

button {
  font: inherit;
}

.game-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  min-height: 104px;
  padding: 14px clamp(18px, 4vw, 70px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  background:
    linear-gradient(90deg, rgb(32 9 4 / 96%), rgb(91 31 12 / 93%), rgb(32 9 4 / 96%)),
    repeating-linear-gradient(90deg, transparent 0 38px, rgb(255 255 255 / 3%) 39px 40px);
  border-bottom: 2px solid rgb(255 183 58 / 30%);
  box-shadow: 0 8px 30px rgb(0 0 0 / 30%);
  position: relative;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-flame {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  color: #ffcf5e;
  font-size: 32px;
  border: 2px solid #ffb63d;
  border-radius: 50%;
  background: radial-gradient(circle, #c93114, #661407);
  box-shadow: inset 0 0 16px #ff7a1b, 0 0 22px rgb(255 102 22 / 30%);
}

.brand small,
.panel-title small {
  color: #e6b779;
  font-family: "Segoe UI", Tahoma, sans-serif;
  font-size: 10px;
  letter-spacing: 0.18em;
}

.brand h1 {
  margin: -1px 0 0;
  font-size: clamp(21px, 2vw, 31px);
  line-height: 1;
}

.brand em {
  color: #ffb33c;
  font-style: normal;
}

.hud {
  display: flex;
  gap: 10px;
}

.hud-card {
  min-width: 108px;
  padding: 8px 15px;
  text-align: center;
  border: 1px solid rgb(255 204 113 / 28%);
  border-radius: 12px;
  background: linear-gradient(180deg, rgb(255 248 224 / 9%), rgb(0 0 0 / 10%));
}

.hud-card span,
.hud-card small {
  display: block;
  color: #d6ae82;
  font-size: 10px;
}

.hud-card strong {
  display: block;
  color: #fff5c9;
  font-family: "Segoe UI", Tahoma, sans-serif;
  font-size: 27px;
  line-height: 1.05;
  text-shadow: 0 2px 12px rgb(255 103 23 / 40%);
}

.timer-card strong {
  color: #ffd65a;
}

.combo-card strong b {
  color: #ff7442;
}

.combo-card strong i {
  font-size: 16px;
  font-style: normal;
}

.play-layout {
  width: 100%;
  max-width: 1600px;
  margin: auto;
  padding: 24px clamp(14px, 3vw, 48px);
  display: grid;
  grid-template-columns: minmax(210px, 270px) minmax(480px, 820px) minmax(210px, 270px);
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2.2vw, 32px);
}

.side-panel {
  align-self: stretch;
  max-height: 690px;
  padding: 18px;
  border: 1px solid rgb(255 206 121 / 27%);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgb(83 29 12 / 94%), rgb(35 11 6 / 96%)),
    url("./assets/grill-table.png") center / cover;
  box-shadow: var(--shadow), inset 0 1px rgb(255 255 255 / 9%);
}

.panel-title {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgb(255 216 146 / 17%);
}

.panel-title > span {
  font-size: 28px;
}

.panel-title strong {
  display: block;
  font-size: 17px;
  line-height: 1.1;
}

.meat-option {
  width: 100%;
  min-height: 92px;
  margin: 10px 0;
  padding: 10px;
  display: grid;
  grid-template-columns: 70px 1fr auto;
  align-items: center;
  gap: 10px;
  color: var(--cream);
  text-align: left;
  border: 1px solid rgb(255 213 143 / 16%);
  border-radius: 14px;
  background: linear-gradient(130deg, rgb(255 249 226 / 8%), rgb(0 0 0 / 18%));
  box-shadow: inset 0 1px rgb(255 255 255 / 5%);
  cursor: pointer;
  transition: 0.2s ease;
}

.meat-option:hover {
  transform: translateX(5px);
  border-color: #ffac42;
  background: linear-gradient(130deg, rgb(255 141 45 / 18%), rgb(0 0 0 / 18%));
}

.meat-option:active {
  transform: translateX(5px) scale(0.97);
}

.meat-option b,
.meat-option small {
  display: block;
}

.meat-option b {
  font-size: 13px;
}

.meat-option small {
  color: #cfa57d;
  font-size: 10px;
}

.meat-option kbd {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: #3f190b;
  font-family: "Segoe UI", Tahoma, sans-serif;
  font-size: 11px;
  border: 0;
  border-radius: 6px;
  background: #f3c873;
  box-shadow: 0 3px 0 #9e5c20;
}

.meat-preview,
.order-icon {
  position: relative;
  display: block;
  overflow: hidden;
  filter: drop-shadow(0 7px 5px rgb(0 0 0 / 32%));
}

.meat-preview {
  width: 70px;
  height: 54px;
  transform: rotate(-7deg);
}

.meat-preview::after,
.order-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.7;
  background: repeating-linear-gradient(115deg, transparent 0 9px, rgb(255 244 214 / 65%) 10px 12px, transparent 13px 19px);
  mix-blend-mode: screen;
}

.beef {
  border: 2px solid #b92120;
  border-radius: 48% 52% 42% 58% / 58% 45% 55% 42%;
  background: radial-gradient(circle at 70% 20%, #ff8a68, transparent 22%), linear-gradient(145deg, #ff765f, #b92828 58%, #761615);
}

.pork {
  border: 2px solid #d96d5d;
  border-radius: 44% 56% 50% 50% / 60% 45% 55% 40%;
  background: repeating-linear-gradient(90deg, #ffbead 0 9px, #f07869 10px 24px, #ffe1c9 25px 30px);
}

.chicken {
  border: 2px solid #c84f21;
  border-radius: 58% 42% 50% 50% / 42% 58% 42% 58%;
  background:
    radial-gradient(circle, #fff1a3 0 2px, transparent 3px) 0 0 / 15px 15px,
    linear-gradient(145deg, #ff9c43, #d94520 65%, #9f2517);
}

.mini-guide {
  margin-top: 18px;
  padding: 12px;
  border-left: 3px solid #f5a332;
  border-radius: 5px 12px 12px 5px;
  background: rgb(255 188 71 / 8%);
}

.mini-guide > span {
  color: #ffca6d;
  font-size: 11px;
  font-weight: 600;
}

.mini-guide p {
  margin: 6px 0 0;
  color: #cfa985;
  font-size: 11px;
}

.mini-guide b {
  color: #fff0c6;
}

.table-stage {
  width: min(100%, 760px);
  aspect-ratio: 1;
  position: relative;
  align-self: center;
  justify-self: center;
  overflow: hidden;
  border: 3px solid #a55e22;
  border-radius: 34px;
  background: #31140b;
  box-shadow: 0 28px 80px rgb(0 0 0 / 48%), 0 0 0 8px rgb(255 177 61 / 7%);
}

.table-art {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
}

.grill-zone {
  position: absolute;
  left: 22%;
  top: 22%;
  width: 56%;
  height: 56%;
  border-radius: 50%;
  user-select: none;
}

#meatLayer,
#particleLayer {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

#particleLayer {
  overflow: hidden;
  pointer-events: none;
}

.heat {
  position: absolute;
  border-radius: 50%;
  background: #ff4d16;
  filter: blur(15px);
  opacity: 0.15;
  animation: ember 1.7s ease-in-out infinite alternate;
  pointer-events: none;
}

.heat-one {
  width: 32%;
  height: 30%;
  left: 42%;
  top: 38%;
}

.heat-two {
  width: 20%;
  height: 20%;
  left: 28%;
  top: 55%;
  animation-delay: -0.7s;
}

@keyframes ember {
  to { opacity: 0.35; transform: scale(1.2); }
}

.meat-piece {
  --rotation: 0deg;
  position: absolute;
  width: 25%;
  height: 16%;
  padding: 0;
  display: grid;
  place-items: center;
  appearance: none;
  border: 0;
  outline: 0;
  background: transparent;
  cursor: pointer;
  transform: translate(-50%, -50%) rotate(var(--rotation)) scale(0);
  filter: drop-shadow(0 8px 7px rgb(0 0 0 / 60%));
  animation: drop-meat 0.35s cubic-bezier(.2, 1.6, .55, 1) forwards;
  transition: filter 0.35s;
}

.meat-piece::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 48% 52% 43% 57% / 56% 43% 57% 44%;
  border: 2px solid rgb(100 7 7 / 55%);
  background:
    repeating-linear-gradient(115deg, transparent 0 12px, rgb(255 235 207 / 72%) 13px 15px, transparent 16px 24px),
    radial-gradient(circle at 70% 25%, #ffad8b, transparent 20%),
    linear-gradient(145deg, #fa7964, #bd2b29 58%, #761614);
  box-shadow: inset 0 2px 5px rgb(255 255 255 / 30%), inset 0 -5px 9px rgb(62 0 0 / 30%);
  transition: 1s linear;
}

.meat-piece.pork-piece::before {
  border-color: #a7473d;
  background: repeating-linear-gradient(90deg, #ffd4c5 0 12px, #ee7969 13px 31px, #ffe4cc 32px 38px);
}

.meat-piece.chicken-piece::before {
  border-color: #8d2f14;
  border-radius: 58% 42% 50% 50% / 42% 58% 42% 58%;
  background:
    radial-gradient(circle, #ffe38a 0 2px, transparent 3px) 0 0 / 18px 18px,
    linear-gradient(145deg, #f89841, #d84921 65%, #9b2417);
}

.meat-piece::after {
  content: "";
  width: 9px;
  height: 9px;
  position: absolute;
  right: 12%;
  top: 15%;
  border-radius: 50%;
  background: rgb(255 255 255 / 75%);
  filter: blur(2px);
  transition: 0.5s;
}

.meat-piece.cooking::before {
  filter: saturate(0.8) brightness(0.82);
  box-shadow: inset 0 0 0 2px rgb(92 30 8 / 35%), inset 0 -7px 12px rgb(65 15 0 / 35%);
}

.meat-piece.ready-flip {
  filter: drop-shadow(0 0 12px #ffc845) drop-shadow(0 8px 7px rgb(0 0 0 / 60%));
}

.meat-piece.ready-flip::before {
  background-blend-mode: multiply;
}

.meat-piece.flipping {
  animation: flip-meat 0.55s ease-in-out;
}

.meat-piece.perfect {
  filter: drop-shadow(0 0 14px #8eff50) drop-shadow(0 8px 7px rgb(0 0 0 / 60%));
}

.meat-piece.perfect::before {
  filter: brightness(0.72) saturate(1.05);
  box-shadow:
    inset 0 0 0 2px rgb(72 17 0 / 35%),
    inset 0 0 12px rgb(75 15 0 / 45%);
}

.meat-piece.burnt {
  filter: drop-shadow(0 0 10px #df3c22) grayscale(0.55) drop-shadow(0 8px 7px rgb(0 0 0 / 60%));
}

.meat-piece.burnt::before {
  filter: brightness(0.33) saturate(0.4);
}

.meat-status {
  position: absolute;
  top: -28px;
  padding: 3px 8px;
  color: #32140a;
  font-size: clamp(8px, 1vw, 11px);
  font-weight: 700;
  white-space: nowrap;
  border-radius: 12px;
  background: #ffe17a;
  box-shadow: 0 4px 10px rgb(0 0 0 / 30%);
  opacity: 0;
  transform: translateY(5px);
  transition: 0.25s;
  pointer-events: none;
}

.ready-flip .meat-status,
.perfect .meat-status,
.burnt .meat-status {
  opacity: 1;
  transform: translateY(0);
}

.perfect .meat-status {
  color: #163409;
  background: #aaf17b;
}

.burnt .meat-status {
  color: white;
  background: #bd301c;
}

@keyframes drop-meat {
  65% { transform: translate(-50%, -50%) rotate(var(--rotation)) scale(1.12); }
  100% { transform: translate(-50%, -50%) rotate(var(--rotation)) scale(1); }
}

@keyframes flip-meat {
  0%, 100% { transform: translate(-50%, -50%) rotate(var(--rotation)) scaleY(1); }
  50% { transform: translate(-50%, -70%) rotate(calc(var(--rotation) + 8deg)) scaleY(0.08) scaleX(1.08); }
}

.smoke {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgb(255 247 225 / 35%);
  filter: blur(4px);
  animation: smoke-up 1.7s ease-out forwards;
}

@keyframes smoke-up {
  to { transform: translate(var(--drift), -90px) scale(3.2); opacity: 0; }
}

.spark {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ffcf56;
  box-shadow: 0 0 8px #ff5c15;
  animation: spark-out 0.7s ease-out forwards;
}

@keyframes spark-out {
  to { transform: translate(var(--dx), var(--dy)); opacity: 0; }
}

.heat-label {
  position: absolute;
  left: 50%;
  bottom: 4.5%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  color: #ffe09a;
  font-size: 10px;
  letter-spacing: 0.08em;
  border: 1px solid rgb(255 212 127 / 35%);
  border-radius: 20px;
  background: rgb(34 11 4 / 70%);
  transform: translateX(-50%);
  backdrop-filter: blur(6px);
}

.heat-label i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ff8b26;
  box-shadow: 0 0 8px #ff4a15;
}

.toast {
  position: absolute;
  left: 50%;
  top: 17%;
  z-index: 20;
  padding: 8px 18px;
  color: #371407;
  font-size: clamp(11px, 1.5vw, 16px);
  font-weight: 700;
  border-radius: 30px;
  background: #ffe489;
  box-shadow: 0 8px 20px rgb(0 0 0 / 30%);
  opacity: 0;
  transform: translate(-50%, -10px) scale(0.8);
  transition: 0.25s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.order-card {
  padding: 14px;
  border: 1px solid rgb(255 207 128 / 22%);
  border-radius: 16px;
  background: linear-gradient(150deg, rgb(255 238 200 / 10%), rgb(0 0 0 / 16%));
}

.customer {
  display: flex;
  align-items: center;
  gap: 9px;
}

.customer > span {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 26px;
  border-radius: 50%;
  background: #f4c46e;
}

.customer b,
.customer small {
  display: block;
}

.customer b {
  font-size: 13px;
}

.customer small {
  color: #c9a47e;
  font-size: 10px;
}

.order-request {
  margin: 15px 0;
  padding: 12px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px dashed rgb(255 223 161 / 20%);
  border-bottom: 1px dashed rgb(255 223 161 / 20%);
}

.order-icon {
  width: 55px;
  height: 40px;
  flex: 0 0 auto;
}

.order-request strong,
.order-request small {
  display: block;
}

.order-request strong {
  color: #ffd576;
  font-size: 12px;
}

.order-request small {
  color: #c9a47e;
  font-size: 9px;
}

.order-progress {
  display: grid;
  gap: 6px;
  color: #d2ad87;
  font-size: 10px;
}

.order-progress > div {
  height: 7px;
  overflow: hidden;
  border-radius: 10px;
  background: rgb(0 0 0 / 40%);
}

.order-progress i {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, #6fc345, #ffe15b);
  transition: width 0.1s linear;
}

.legend {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.legend div {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #d1ab84;
  font-size: 10px;
}

.dot {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 50%;
  box-shadow: 0 0 9px currentColor;
}

.dot.raw { color: #e85a5a; background: currentColor; }
.dot.flip { color: #ffd35f; background: currentColor; }
.dot.perfect { color: #80d74d; background: currentColor; }
.dot.burnt { color: #7d6b64; background: currentColor; }

footer {
  min-height: 48px;
  padding: 8px clamp(18px, 4vw, 70px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #c99c72;
  font-size: 11px;
  border-top: 1px solid rgb(255 183 58 / 18%);
  background: rgb(24 7 3 / 80%);
}

.sound-button {
  padding: 6px 12px;
  color: #eac18e;
  border: 1px solid rgb(255 202 119 / 24%);
  border-radius: 20px;
  background: rgb(255 255 255 / 5%);
  cursor: pointer;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 45%, rgb(122 43 15 / 42%), transparent 40%),
    rgb(20 6 2 / 84%);
  backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: 0.35s;
}

.overlay.visible {
  opacity: 1;
  visibility: visible;
}

.modal {
  width: min(92vw, 460px);
  padding: 34px;
  color: var(--ink);
  text-align: center;
  border: 1px solid #fff3c9;
  border-radius: 30px;
  background:
    linear-gradient(rgb(255 249 225 / 94%), rgb(247 224 177 / 96%)),
    repeating-linear-gradient(0deg, transparent 0 23px, rgb(123 65 22 / 4%) 24px);
  box-shadow: 0 32px 100px rgb(0 0 0 / 55%), inset 0 0 0 7px rgb(130 67 20 / 6%);
  transform: translateY(18px) scale(0.94);
  transition: 0.4s cubic-bezier(.2, 1.4, .5, 1);
}

.visible .modal {
  transform: translateY(0) scale(1);
}

.modal-kicker {
  display: inline-block;
  padding: 5px 13px;
  color: #8e321c;
  font-family: "Segoe UI", Tahoma, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  border: 1px solid #c7804d;
  border-radius: 20px;
}

.modal h2 {
  margin: 8px 0;
  font-size: clamp(38px, 7vw, 61px);
  line-height: 0.9;
  letter-spacing: -0.04em;
}

.modal h2 em {
  color: var(--red);
  font-style: normal;
}

.modal p {
  color: #754a36;
  font-size: 14px;
  line-height: 1.7;
}

.modal > small {
  display: block;
  margin-top: 14px;
  color: #9b765c;
  font-size: 10px;
}

.hero-meat {
  width: 135px;
  height: 88px;
  margin: 18px auto 8px;
  position: relative;
  transform: rotate(-8deg);
}

.hero-meat span {
  position: absolute;
  inset: 0;
  border: 4px solid #a41f17;
  border-radius: 48% 52% 43% 57% / 56% 43% 57% 44%;
  background:
    repeating-linear-gradient(115deg, transparent 0 17px, rgb(255 237 206 / 90%) 18px 22px, transparent 23px 33px),
    linear-gradient(145deg, #ff806b, #bd2b29 58%, #761614);
  box-shadow: inset 0 3px 8px rgb(255 255 255 / 35%), 0 14px 20px rgb(84 20 7 / 25%);
}

.hero-meat i {
  position: absolute;
  right: -15px;
  top: -15px;
  color: #f5b423;
  font-size: 30px;
  font-style: normal;
}

.primary-button {
  min-width: 210px;
  margin-top: 8px;
  padding: 13px 20px;
  color: white;
  font-weight: 600;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #ee5d2c, #c92c19);
  box-shadow: 0 7px 0 #8d2116, 0 12px 25px rgb(137 29 12 / 28%);
  cursor: pointer;
  transition: 0.15s;
}

.primary-button:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.primary-button:active {
  transform: translateY(5px);
  box-shadow: 0 2px 0 #8d2116;
}

.primary-button span {
  margin-left: 18px;
}

.result-icon {
  margin: 17px 0 3px;
  font-size: 55px;
  filter: drop-shadow(0 8px 8px rgb(104 45 11 / 20%));
}

.result-modal h2 {
  font-size: 35px;
}

.result-score {
  margin: 18px 0;
  padding: 14px;
  border-top: 1px dashed #b98a60;
  border-bottom: 1px dashed #b98a60;
}

.result-score span,
.result-score strong {
  display: block;
}

.result-score span {
  color: #9b6a4f;
  font-size: 11px;
}

.result-score strong {
  color: var(--red);
  font-family: "Segoe UI", Tahoma, sans-serif;
  font-size: 45px;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.result-stats div {
  padding: 9px 4px;
  border-radius: 10px;
  background: rgb(137 67 20 / 8%);
}

.result-stats span,
.result-stats strong {
  display: block;
}

.result-stats span {
  color: #9b765c;
  font-size: 9px;
}

.result-stats strong {
  font-family: "Segoe UI", Tahoma, sans-serif;
  font-size: 20px;
}

@media (max-width: 1050px) {
  .play-layout {
    grid-template-columns: 190px minmax(450px, 680px);
  }

  .right-panel {
    display: none;
  }
}

@media (max-width: 760px) {
  .topbar {
    min-height: auto;
    padding: 10px 14px;
  }

  .brand small,
  .brand-flame,
  .hud-card small {
    display: none;
  }

  .brand h1 {
    font-size: 17px;
  }

  .hud-card {
    min-width: 61px;
    padding: 5px 7px;
  }

  .hud-card span {
    font-size: 8px;
  }

  .hud-card strong {
    font-size: 20px;
  }

  .play-layout {
    padding: 12px;
    display: flex;
    flex-direction: column-reverse;
  }

  .left-panel {
    width: 100%;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
  }

  .left-panel .panel-title,
  .mini-guide {
    display: none;
  }

  .meat-option {
    min-height: 80px;
    margin: 0;
    padding: 7px;
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .meat-option .meat-preview {
    width: 52px;
    height: 36px;
  }

  .meat-option span:nth-child(2) small,
  .meat-option kbd {
    display: none;
  }

  .meat-option b {
    font-size: 10px;
  }

  .table-stage {
    border-radius: 20px;
  }

  footer {
    display: none;
  }
}

@media (max-height: 750px) and (min-width: 761px) {
  .topbar {
    min-height: 82px;
  }

  .play-layout {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .table-stage {
    width: min(72vh, 680px);
  }
}
