:root {
  color-scheme: dark;
  --ink: #241d27;
  --paper: #fff4d6;
  --tile: #d6b784;
  --tile-dark: #aa7c54;
  --counter: #33455c;
  --steel: #9eb6bf;
  --red: #d84632;
  --green: #4ea56a;
  --gold: #f2b33d;
  --cyan: #46b6c8;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(36, 29, 39, 0.8), rgba(23, 24, 31, 0.96)),
    repeating-linear-gradient(0deg, #20212c 0 2px, #191a22 2px 4px);
  color: var(--paper);
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100vw - 28px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 768px) minmax(260px, 330px);
  gap: 16px;
  align-items: center;
  padding: 18px 0 88px;
}

.playfield {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 4px solid #4e3440;
  background: #11141e;
  box-shadow:
    0 24px 0 rgba(0, 0, 0, 0.28),
    0 0 0 4px #171821,
    inset 0 0 0 4px #f2b33d;
}

.playfield::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.035) 0 1px,
      rgba(0, 0, 0, 0.09) 1px 3px
    );
  mix-blend-mode: soft-light;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.start-card {
  position: absolute;
  inset: auto 24px 24px 24px;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  min-height: 76px;
  padding: 16px;
  border: 4px solid #241d27;
  background: #fff4d6;
  color: #241d27;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.35);
}

.start-card.is-hidden {
  display: none;
}

.start-card h1 {
  margin: 0;
  font-size: clamp(1.15rem, 3vw, 2rem);
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
}

.start-card button {
  min-height: 48px;
  padding: 0 18px;
  border: 4px solid #241d27;
  background: var(--red);
  color: #fff4d6;
  box-shadow: 4px 4px 0 #241d27;
  cursor: pointer;
  text-transform: uppercase;
}

.hud {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px 0;
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  background:
    linear-gradient(90deg, transparent 0 16%, #f2b33d 16% 84%, transparent 84%),
    linear-gradient(#d84632 0 28%, #fff4d6 28% 43%, #46b6c8 43% 72%, #241d27 72%);
  image-rendering: pixelated;
  box-shadow:
    0 0 0 4px #241d27,
    4px 4px 0 rgba(0, 0, 0, 0.35);
}

.brand p,
.brand h2,
.panel-heading h3,
.ticket p {
  margin: 0;
}

.eyebrow {
  color: #9eb6bf;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.brand h2 {
  font-size: 1.35rem;
  line-height: 1.05;
  text-transform: uppercase;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-grid div,
.orders-section,
.ticket {
  border: 3px solid #493241;
  background: rgba(255, 244, 214, 0.08);
}

.stat-grid div {
  min-width: 0;
  padding: 11px 10px;
}

.stat-grid span,
.panel-heading span {
  display: block;
  color: #9eb6bf;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.stat-grid strong {
  display: block;
  min-height: 26px;
  overflow: hidden;
  color: #fff4d6;
  font-size: 1.15rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.orders-section {
  min-height: 286px;
  padding: 12px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 10px;
}

.panel-heading h3 {
  font-size: 1.05rem;
  text-transform: uppercase;
}

.orders {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.order-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 9px;
  border: 3px solid #241d27;
  background: #fff4d6;
  color: #241d27;
}

.dish-icon,
.swatch {
  display: inline-block;
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
  box-shadow: 0 0 0 3px #241d27;
}

.dish-icon.ramen,
.swatch.noodle {
  background:
    linear-gradient(#f2b33d 0 28%, #fff4d6 28% 44%, #4ea56a 44% 64%, #d84632 64%);
}

.dish-icon.bento,
.swatch.rice {
  background:
    linear-gradient(90deg, #fff4d6 0 48%, #d84632 48% 52%, #4ea56a 52%),
    linear-gradient(#fff4d6, #fff4d6);
}

.dish-icon.burger,
.swatch.patty {
  background:
    linear-gradient(#f2b33d 0 25%, #8e503c 25% 48%, #4ea56a 48% 62%, #f2b33d 62%);
}

.order-card h4 {
  margin: 0 0 6px;
  font-size: 0.88rem;
  line-height: 1.1;
  text-transform: uppercase;
}

.patience {
  height: 8px;
  border: 2px solid #241d27;
  background: #c7b68b;
}

.patience span {
  display: block;
  height: 100%;
  background: #4ea56a;
}

.ticket {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 9px;
  color: #fff4d6;
}

.tickets {
  display: grid;
  gap: 8px;
}

.touch-controls {
  position: fixed;
  left: 50%;
  bottom: 12px;
  z-index: 4;
  display: none;
  grid-template-columns: repeat(5, 48px);
  gap: 7px;
  transform: translateX(-50%);
}

.touch-btn {
  width: 48px;
  height: 48px;
  border: 3px solid #fff4d6;
  background: #241d27;
  color: #fff4d6;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.42);
}

.touch-btn.action {
  background: #d84632;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    align-items: start;
    padding-top: 12px;
  }

  .hud {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .brand,
  .orders-section {
    grid-column: 1 / -1;
  }

  .orders-section {
    min-height: 0;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100vw - 16px, 768px);
    gap: 10px;
    padding-bottom: 82px;
  }

  .playfield {
    border-width: 3px;
  }

  .start-card {
    inset: auto 12px 12px 12px;
    grid-template-columns: 1fr;
  }

  .start-card button {
    width: 100%;
  }

  .hud {
    grid-template-columns: 1fr;
  }

  .stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stat-grid div {
    padding: 8px 6px;
  }

  .stat-grid strong {
    font-size: 0.82rem;
  }

  .tickets {
    display: none;
  }

  .touch-controls {
    display: grid;
  }
}
