* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #3d8a3a;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
}
#stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #3d8a3a;
}
#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  pointer-events: none;
  user-select: none;
}
#hud {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}
.res {
  min-width: 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(18, 92, 42, 0.9);
  color: #fff8e8;
  font-size: 16px;
  font-weight: 700;
}
#plot {
  position: absolute;
  left: 7%;
  right: 7%;
  top: 22%;
  height: 48%;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
}
.cell {
  border: 0;
  border-radius: 12px;
  background: rgba(92, 54, 22, 0.62);
  color: #fff8e8;
  font-size: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  padding: 4px;
}
.cell.ready {
  background: rgba(255, 196, 64, 0.86);
  color: #3a2408;
  box-shadow: inset 0 0 0 3px #fff3c4;
}
.cell .tag {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}
#seeds {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(10px, env(safe-area-inset-bottom));
  height: 18%;
  z-index: 2;
  display: flex;
  gap: 8px;
  padding: 0 12px;
  align-items: stretch;
}
.seed {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  background: rgba(28, 22, 16, 0.82);
  color: #fff8e8;
  font-size: 15px;
  font-weight: 700;
}
.seed.sel {
  outline: 3px solid #FF8A3D;
  background: #FF8A3D;
  color: #3a220c;
}
.seed:disabled { opacity: 0.45; }
#hint {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(18% + 16px);
  z-index: 2;
  margin: 0;
  text-align: center;
  color: #fff8e8;
  font-size: 13px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
#toast {
  position: absolute;
  left: 50%;
  top: 16%;
  z-index: 3;
  transform: translateX(-50%);
  width: max-content;
  max-width: 84%;
  padding: 0;
  border-radius: 12px;
  color: #fff;
  background: transparent;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}
#toast.show {
  background: rgba(20, 20, 20, 0.78);
  padding: 10px 16px;
}
#stage button { touch-action: manipulation; }
#stage button:focus-visible { outline: 3px solid #184d77; outline-offset: 2px; }
