* {
  box-sizing: border-box;
}

body {
  font-family: "Comic Sans MS", "Chalkboard SE", "Comic Neue", sans-serif;
  background: #fdf6e3;
  color: #4a3728;
  margin: 0;
  padding: 0.5rem;
}

.screen {
  max-width: 60rem;
  margin: 0 auto;
}

.hidden {
  display: none;
}

.area-label {
  font-size: 0.9rem;
  font-weight: bold;
  color: #8a6d55;
}

/* Buttons: big and tap-friendly */
button {
  font-family: inherit;
  border: 3px solid #4a3728;
  border-radius: 1rem;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.big-button {
  font-size: 1.4rem;
  padding: 0.8rem 1.6rem;
  background: #ffd166;
}

.big-button:disabled {
  background: #e0e0e0;
  color: #999;
  border-color: #999;
  cursor: default;
}

.small-button {
  font-size: 1rem;
  padding: 0.5rem 1rem;
  background: #fff;
}

/* Intro screen */
#intro-screen {
  text-align: center;
  padding-top: 2rem;
}

#lulapen svg {
  width: 11rem;
  height: auto;
}

.speech-bubble {
  position: relative;
  display: inline-block;
  max-width: 28rem;
  background: #fff;
  border: 3px solid #4a3728;
  border-radius: 1.2rem;
  padding: 1rem 1.4rem;
  margin: 0.5rem auto 1.5rem;
  font-size: 1.3rem;
  line-height: 1.4;
}

/* Little tail pointing up toward Lulapen. */
.speech-bubble::before,
.speech-bubble::after {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  border: solid transparent;
}

.speech-bubble::before {
  margin-left: -14px;
  border-width: 14px;
  border-bottom-color: #4a3728;
}

.speech-bubble::after {
  margin-left: -10px;
  border-width: 10px;
  border-bottom-color: #fff;
}

#intro-screen .big-button {
  display: block;
  margin: 0 auto;
}

/* Title screen */
#title-screen {
  text-align: center;
  padding-top: 3rem;
}

#title-screen h1 {
  font-size: 2.6rem;
  margin-bottom: 0;
}

#title-screen h2 {
  font-size: 1.8rem;
  margin-top: 0.2rem;
  color: #e76f51;
}

#title-status {
  font-size: 1.2rem;
  margin: 1rem 0;
}

#title-screen .big-button {
  display: block;
  margin: 1rem auto;
}

/* HUD */
#hud {
  display: flex;
  justify-content: space-between;
  font-size: 1.3rem;
  background: #fff3d6;
  border: 3px solid #4a3728;
  border-radius: 1rem;
  padding: 0.4rem 1rem;
  margin-bottom: 0.5rem;
}

/* Waiting line */
#waiting-line {
  min-height: 2.5rem;
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
}

/* Dining room */
#dining-room {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.table {
  background: #e9d8a6;
  border: 3px solid #4a3728;
  border-radius: 1rem;
  min-height: 9rem;
  padding: 0.4rem;
  text-align: center;
  font-size: 1.1rem;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.table.empty {
  background: #f6eed7;
  border-style: dashed;
  color: #b9a98a;
}

.table.active {
  outline: 4px solid #e76f51;
}

.table.clickable {
  cursor: pointer;
}

/* Each table keeps the same child elements for its whole life; these
 * rules hide the ones that don't apply to its current state. Children
 * ignore pointer events so a tap always targets the table itself. */
.table > * {
  pointer-events: none;
}

.table.empty .face,
.table.empty .bubble,
.table.empty .hearts,
.table.eating .hearts,
.table:not(.empty) .empty-label {
  display: none;
}

.table .face {
  font-size: 2.4rem;
  display: block;
}

.table .bubble {
  background: #fff;
  border: 2px solid #4a3728;
  border-radius: 0.8rem;
  display: inline-block;
  padding: 0.1rem 0.5rem;
  margin-top: 0.2rem;
  font-size: 1.3rem;
}

.hearts {
  letter-spacing: 0.1rem;
}

/* Kitchen */
#kitchen {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 0.6rem;
}

#ticket,
#pantry {
  background: #fff3d6;
  border: 3px solid #4a3728;
  border-radius: 1rem;
  padding: 0.6rem;
}

#ticket-body {
  font-size: 1.2rem;
  min-height: 4.5rem;
  margin: 0.4rem 0;
}

#plate {
  background: #fff;
  border: 2px dashed #4a3728;
  border-radius: 0.8rem;
  min-height: 3rem;
  font-size: 1.8rem;
  padding: 0.3rem;
  margin-bottom: 0.5rem;
}

#kitchen-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

#pantry-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.ingredient {
  font-size: 1.1rem;
  padding: 0.4rem;
  background: #fff;
  text-align: center;
}

.ingredient .emoji {
  font-size: 1.8rem;
  display: block;
}

.ingredient:disabled {
  background: #e0e0e0;
  color: #999;
  border-color: #999;
  cursor: default;
}

/* Recap screen */
#recap-screen {
  text-align: center;
  padding-top: 2rem;
}

#recap-body {
  text-align: left;
  background: #fff3d6;
  border: 3px solid #4a3728;
  border-radius: 1rem;
  padding: 1rem;
  margin: 1rem auto;
  max-width: 32rem;
  font-size: 1.1rem;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.2rem 0;
}

.bar {
  background: #e76f51;
  height: 1.2rem;
  border-radius: 0.3rem;
}

.critic-review {
  background: #fff;
  border: 2px solid #4a3728;
  border-radius: 0.8rem;
  padding: 0.6rem;
  font-style: italic;
  margin-top: 0.8rem;
}

/* Phones: stack the kitchen and shrink the dining grid */
@media (max-width: 40rem) {
  #dining-room {
    grid-template-columns: repeat(2, 1fr);
  }

  #kitchen {
    grid-template-columns: 1fr;
  }
}
